From d4db6c0f5c6a2014e50c819fcddbae5aede4ceb7 Mon Sep 17 00:00:00 2001 From: Yaxian Date: Mon, 22 Nov 2021 19:35:30 +0800 Subject: [PATCH] docs: integrate swagger to show api doc (#61) * docs: integrate swagger to show api doc * feat: optmise to get etcd connection --- README.md | 10 + app.yaml | 3 + cmd/open_im_api/main.go | 16 +- docs/docs.go | 3480 +++++++++++++++++ docs/swagger.json | 3407 ++++++++++++++++ docs/swagger.yaml | 2208 +++++++++++ go.mod | 12 +- go.sum | 80 + internal/api/auth/user_register.go | 25 +- internal/api/auth/user_token.go | 18 +- internal/api/chat/get_max_min_seq.go | 33 +- internal/api/chat/pull_msg.go | 38 +- internal/api/chat/send_msg.go | 26 +- internal/api/friend/add_blacklist.go | 27 +- internal/api/friend/add_friend.go | 43 +- internal/api/friend/add_friend_response.go | 22 +- internal/api/friend/delete_friend.go | 22 +- internal/api/friend/get_blcaklist.go | 23 +- internal/api/friend/get_friend_apply_list.go | 38 +- internal/api/friend/get_friend_list.go | 23 +- internal/api/friend/get_friends_info.go | 34 +- internal/api/friend/is_friend.go | 22 +- internal/api/friend/remove_blacklist.go | 22 +- internal/api/friend/set_friend_comment.go | 22 +- internal/api/group/create_group.go | 34 +- .../api/group/get_group_applicationList.go | 27 +- internal/api/group/get_groups_info.go | 21 +- internal/api/group/group.go | 121 +- .../api/group/group_application_response.go | 20 +- internal/api/group/join_group.go | 22 +- internal/api/group/quit_group.go | 22 +- internal/api/group/set_group_info.go | 22 +- internal/api/group/transfer_group_owner.go | 20 +- internal/api/manage/management_chat.go | 28 +- internal/api/manage/management_user.go | 52 +- .../third/tencent_cloud_storage_credential.go | 27 +- internal/api/user/get_user_info.go | 39 +- internal/api/user/get_user_info_test.go | 31 + internal/api/user/update_user_info.go | 44 +- internal/msg_gateway/gate/logic.go | 13 +- .../msg_transfer/logic/history_msg_handler.go | 5 +- internal/push/logic/push_to_client.go | 5 +- internal/rpc/chat/send_msg.go | 3 +- .../get_user_info_to_client.go | 6 +- internal/rpc/user/update_user_info.go | 3 +- pkg/grpc-etcdv3/getcdv3/resolver.go | 38 +- pkg/proto/group/group.pb.go | 2 + 47 files changed, 10066 insertions(+), 193 deletions(-) create mode 100644 docs/docs.go create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml create mode 100644 internal/api/user/get_user_info_test.go diff --git a/README.md b/README.md index b6bf34c92..6d3bbf89f 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,16 @@ or try with `docker-compose` docker-compose -f docker-compose.dev.yaml logs -f ``` +### Api Swagger +run service by `pm2` firstly, then run visit `[ip]:10000/swagger/index.html` + +run following command to generate swagger docs +``` +go get -u github.com/swaggo/swag/cmd/swag +export PATH=$(go env GOPATH)/bin:$PATH +swag init --generalInfo cmd/open_im_api/main.go +``` + ### CONFIGURATION INSTRUCTIONS > Open-IM configuration is divided into basic component configuration and business internal service configuration. Developers need to fill in the address of each component as the address of their server component when using the product, and ensure that the internal service port of the business is not occupied diff --git a/app.yaml b/app.yaml index 52b14d2d7..5f2458f74 100644 --- a/app.yaml +++ b/app.yaml @@ -3,6 +3,9 @@ apps: - name: open_im_api script: "go run main.go" cwd: "cmd/open_im_api" + env: + OPEN_IM_SWAGGER_API: true + watch: ["docs", "cmd", "internal", "pkg"] - name: open_im_auth script: "go run main.go" diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index 14c8e1e38..7bd6efba0 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -1,6 +1,7 @@ package main import ( + docs "Open_IM/docs" apiAuth "Open_IM/internal/api/auth" apiChat "Open_IM/internal/api/chat" "Open_IM/internal/api/friend" @@ -11,9 +12,15 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/utils" "flag" - "github.com/gin-gonic/gin" + "os" "strconv" + + "github.com/gin-gonic/gin" + //"syscall" + + swaggerfiles "github.com/swaggo/files" + ginSwagger "github.com/swaggo/gin-swagger" ) func main() { @@ -28,6 +35,12 @@ func main() { //log.Info("", "", "api server running...") r := gin.Default() r.Use(utils.CorsHandler()) + + if os.Getenv("OPEN_IM_SWAGGER_API") == "true" { + docs.SwaggerInfo.BasePath = "/" + r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler)) + } + // user routing group, which handles user registration and login services userRouterGroup := r.Group("/user") { @@ -98,5 +111,6 @@ func main() { log.NewPrivateLog("api") ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port") flag.Parse() + r.Run(utils.ServerIP + ":" + strconv.Itoa(*ginPort)) } diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 000000000..9de23d1c1 --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,3480 @@ +// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT +// This file was generated by swaggo/swag +package docs + +import ( + "bytes" + "encoding/json" + "strings" + "text/template" + + "github.com/swaggo/swag" +) + +var doc = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "contact": {}, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/auth/user_register": { + "post": { + "description": "register a new user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "parameters": [ + { + "description": "new user params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiAuth.paramsUserRegister" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/apiAuth.resultUserRegister" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/auth/user_token": { + "post": { + "description": "get token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "parameters": [ + { + "description": "get token params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiAuth.paramsUserToken" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/apiAuth.resultUserRegister" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/chat/newest_seq": { + "post": { + "description": "get latest message seq", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "chat" + ], + "parameters": [ + { + "description": "user get latest seq params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiChat.paramsUserNewestSeq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/apiChat.resultUserNewestSeq" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/chat/pull_msg": { + "post": { + "description": "user pull messages", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "chat" + ], + "parameters": [ + { + "description": "user pull messages", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiChat.paramsUserPullMsg" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "reqIdentifier": { + "type": "integer" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/chat/pull_msg_by_seq": { + "post": { + "description": "user pull msg by seq", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "chat" + ], + "parameters": [ + { + "description": "pull msg by seq", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiChat.paramsUserPullMsgBySeqList" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "reqIdentifier": { + "type": "integer" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/chat/send_msg": { + "post": { + "description": "user send messages", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "chat" + ], + "parameters": [ + { + "description": "user send messages", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiChat.paramsUserSendMsg" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/apiChat.resultSendMsg" + }, + "reqIdentifier": { + "type": "integer" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/add_blacklist": { + "post": { + "description": "add a user into black list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "add black list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/add_friend": { + "post": { + "description": "add a new friend by uid", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "add friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsAddFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/add_friend_response": { + "post": { + "description": "the response of adding friend", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "response of adding friend", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsAddFriendResponse" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/delete_friend": { + "post": { + "description": "delete friend", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "delete friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_blacklist": { + "post": { + "description": "get black list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "get black list", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/friend.blackListUserInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_friend_apply_list": { + "post": { + "description": "get friend apply list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "get friend apply list", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsGetApplyList" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/friend.UserInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_friend_list": { + "post": { + "description": "get friend apply list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "get friend apply list", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsGetFriendLIst" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/friend.friendInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_friends_info": { + "post": { + "description": "get friend info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "search friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_self_apply_list": { + "post": { + "description": "get friend apply list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "get friend apply list", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsGetApplyList" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/friend.UserInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/import_friend": { + "post": { + "description": "import friend", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "import friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsImportFriendReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/friend.resultImportFriend" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/is_friend": { + "post": { + "description": "check is friend", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "is friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/remove_blacklist": { + "post": { + "description": "remove black list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "remove black list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/set_friend_comment": { + "post": { + "description": "set friend comment", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "set friend comment", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSetFriendComment" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/create_group": { + "post": { + "description": "create group", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "create group params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsCreateGroup" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_group_all_member_list": { + "post": { + "description": "get group all members", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get group all members params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.getGroupAllMemberReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.GetGroupMemberListResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_group_applicationList": { + "post": { + "description": "get group application list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get group application list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsGroupApplicationList" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/group.resultGroupApplication" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_group_member_list": { + "post": { + "description": "get group member list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get group member list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.GetGroupMemberListReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.GetGroupMemberListResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_group_members_info": { + "post": { + "description": "get group members info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get group members info params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.GetGroupMembersInfoReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.GetGroupMembersInfoResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_groups_info": { + "post": { + "description": "get groups info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get groups info params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsGetGroupInfo" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/group.GroupInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_joined_group_list": { + "post": { + "description": "get joined group list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get joined group list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.GetJoinedGroupListReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.GetJoinedGroupListResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/group_application_response": { + "post": { + "description": "response of application group", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "application group param", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsGroupApplicationResponse" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/invite_user_to_group": { + "post": { + "description": "invite user to group", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "invite user to group params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.InviteUserToGroupReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.InviteUserToGroupResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/kick_group": { + "post": { + "description": "kick member from group", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "kick member from group params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsKickGroupMember" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.KickGroupMemberResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/set_group_info": { + "post": { + "description": "set group info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "set group info params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsSetGroupInfo" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/transfer_group": { + "post": { + "description": "transfer group owner", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "transfer group owner param", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsTransferGroupOwner" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/manager/delete_user": { + "post": { + "description": "delete user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "manage" + ], + "parameters": [ + { + "description": "user to be deleted", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/manage.paramsDeleteUsers" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/manage.deleteUserResult" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/manager/get_all_users_uid": { + "post": { + "description": "get all user ids", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "manage" + ], + "parameters": [ + { + "description": "all user ids", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/manage.paramsGetAllUsersUid" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/manage.uidListResult" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/manage.uidListResult" + } + } + } + } + }, + "/manager/send_msg": { + "post": { + "description": "manage send message", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "manage" + ], + "parameters": [ + { + "description": "manage send message", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/manage.paramsManagementSendMsg" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/manage.sendMsgResult" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/third/user_register": { + "post": { + "description": "get Tencent cloud storage credential", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "third" + ], + "parameters": [ + { + "description": "get Tencent cloud storage credential params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiThird.paramsTencentCloudStorageCredential" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/apiThird.resultTencentCredential" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/user/get_user_info": { + "post": { + "description": "get user info by uid list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "parameters": [ + { + "description": "get userInfo by uidList", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/user.queryUserInfoParam" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/user.userInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/user/update_user_info": { + "post": { + "description": "update user info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "parameters": [ + { + "description": "new user info", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/user.updateUserInfoParam" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + } + }, + "definitions": { + "apiAuth.paramsUserRegister": { + "type": "object", + "required": [ + "name", + "platform", + "secret", + "uid" + ], + "properties": { + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "platform": { + "type": "integer" + }, + "secret": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "apiAuth.paramsUserToken": { + "type": "object", + "required": [ + "platform", + "secret", + "uid" + ], + "properties": { + "platform": { + "type": "integer" + }, + "secret": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "apiAuth.resultUserRegister": { + "type": "object", + "properties": { + "expiredTime": { + "type": "integer" + }, + "token": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "apiChat.paramsUserNewestSeq": { + "type": "object", + "required": [ + "msgIncr", + "operationID", + "reqIdentifier", + "sendID" + ], + "properties": { + "msgIncr": { + "type": "integer" + }, + "operationID": { + "type": "string" + }, + "reqIdentifier": { + "type": "integer" + }, + "sendID": { + "type": "string" + } + } + }, + "apiChat.paramsUserPullMsg": { + "type": "object", + "required": [ + "operationID", + "reqIdentifier", + "sendID" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "seqBegin", + "seqEnd" + ], + "properties": { + "seqBegin": { + "type": "integer" + }, + "seqEnd": { + "type": "integer" + } + } + }, + "operationID": { + "type": "string" + }, + "reqIdentifier": { + "type": "integer" + }, + "sendID": { + "type": "string" + } + } + }, + "apiChat.paramsUserPullMsgBySeqList": { + "type": "object", + "required": [ + "operationID", + "reqIdentifier", + "sendID" + ], + "properties": { + "operationID": { + "type": "string" + }, + "reqIdentifier": { + "type": "integer" + }, + "sendID": { + "type": "string" + }, + "seqList": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "apiChat.paramsUserSendMsg": { + "type": "object", + "required": [ + "operationID", + "platformID", + "reqIdentifier", + "sendID" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "clientMsgID", + "content", + "contentType", + "msgFrom", + "recvID", + "sessionType" + ], + "properties": { + "clientMsgID": { + "type": "string" + }, + "content": { + "type": "string" + }, + "contentType": { + "type": "integer" + }, + "ext": { + "type": "object", + "additionalProperties": true + }, + "forceList": { + "type": "array", + "items": { + "type": "string" + } + }, + "msgFrom": { + "type": "integer" + }, + "offlineInfo": { + "type": "object", + "additionalProperties": true + }, + "options": { + "type": "object", + "additionalProperties": true + }, + "recvID": { + "type": "string" + }, + "sessionType": { + "type": "integer" + } + } + }, + "operationID": { + "type": "string" + }, + "platformID": { + "type": "integer" + }, + "reqIdentifier": { + "type": "integer" + }, + "sendID": { + "type": "string" + }, + "senderFaceUrl": { + "type": "string" + }, + "senderNickName": { + "type": "string" + } + } + }, + "apiChat.resultSendMsg": { + "type": "object", + "properties": { + "clientMsgID": { + "type": "string" + }, + "sendTime": { + "type": "integer" + }, + "serverMsgID": { + "type": "string" + } + } + }, + "apiChat.resultUserNewestSeq": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "maxSeq": { + "type": "integer" + }, + "minSeq": { + "type": "integer" + } + } + }, + "errCode": { + "type": "integer" + }, + "errMsg": { + "type": "string" + }, + "msgIncr": { + "type": "integer" + }, + "reqIdentifier": { + "type": "integer" + } + } + }, + "apiThird.paramsTencentCloudStorageCredential": { + "type": "object", + "properties": { + "operationID": { + "type": "string" + }, + "token": { + "type": "string" + } + } + }, + "apiThird.resultTencentCredential": { + "type": "object", + "properties": { + "bucket": { + "type": "string" + }, + "data": {}, + "errCode": { + "type": "integer" + }, + "errMsg": { + "type": "string" + }, + "region": { + "type": "string" + } + } + }, + "friend.UserInfo": { + "type": "object", + "properties": { + "applyTime": { + "type": "string" + }, + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "flag": { + "type": "integer" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "reqMessage": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.blackListUserInfo": { + "type": "object", + "properties": { + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.friendInfo": { + "type": "object", + "properties": { + "birth": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "isInBlackList": { + "type": "integer" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.paramsAddFriend": { + "type": "object", + "required": [ + "operationID", + "uid" + ], + "properties": { + "operationID": { + "type": "string" + }, + "reqMessage": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.paramsAddFriendResponse": { + "type": "object", + "required": [ + "flag", + "operationID", + "uid" + ], + "properties": { + "flag": { + "type": "integer" + }, + "operationID": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.paramsGetApplyList": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "friend.paramsGetFriendLIst": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "friend.paramsImportFriendReq": { + "type": "object", + "required": [ + "operationID", + "ownerUid", + "uidList" + ], + "properties": { + "operationID": { + "type": "string" + }, + "ownerUid": { + "type": "string" + }, + "uidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "friend.paramsSearchFriend": { + "type": "object", + "required": [ + "operationID", + "uid" + ], + "properties": { + "operationID": { + "type": "string" + }, + "ownerUid": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.paramsSetFriendComment": { + "type": "object", + "required": [ + "operationID", + "uid" + ], + "properties": { + "comment": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.resultFriendInfo": { + "type": "object", + "properties": { + "birth": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.resultImportFriend": { + "type": "object", + "properties": { + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + }, + "failedUidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "group.GetGroupMemberListReq": { + "type": "object", + "properties": { + "filter": { + "type": "integer" + }, + "groupID": { + "type": "string" + }, + "nextSeq": { + "type": "integer" + }, + "operationID": { + "type": "string" + } + } + }, + "group.GetGroupMemberListResp": { + "type": "object", + "properties": { + "errorCode": { + "type": "integer" + }, + "errorMsg": { + "type": "string" + }, + "memberList": { + "type": "array", + "items": { + "$ref": "#/definitions/group.GroupMemberFullInfo" + } + }, + "nextSeq": { + "type": "integer" + } + } + }, + "group.GetGroupMembersInfoReq": { + "type": "object", + "properties": { + "groupID": { + "type": "string" + }, + "memberList": { + "type": "array", + "items": { + "type": "string" + } + }, + "operationID": { + "type": "string" + } + } + }, + "group.GetGroupMembersInfoResp": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/group.MemberResult" + } + }, + "errCode": { + "type": "integer" + }, + "errMsg": { + "type": "string" + } + } + }, + "group.GetJoinedGroupListReq": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "group.GetJoinedGroupListResp": { + "type": "object", + "properties": { + "errorCode": { + "type": "integer" + }, + "errorMsg": { + "type": "string" + }, + "groupList": { + "type": "array", + "items": { + "$ref": "#/definitions/group.GroupInfo" + } + } + } + }, + "group.GroupInfo": { + "type": "object", + "properties": { + "createTime": { + "type": "integer" + }, + "faceUrl": { + "type": "string" + }, + "groupId": { + "type": "string" + }, + "groupName": { + "type": "string" + }, + "introduction": { + "type": "string" + }, + "memberCount": { + "type": "integer" + }, + "notification": { + "type": "string" + }, + "ownerId": { + "type": "string" + } + } + }, + "group.GroupMemberFullInfo": { + "type": "object", + "properties": { + "faceUrl": { + "type": "string" + }, + "joinTime": { + "type": "integer" + }, + "nickName": { + "type": "string" + }, + "role": { + "type": "integer" + }, + "userId": { + "type": "string" + } + } + }, + "group.Id2Result": { + "type": "object", + "properties": { + "result": { + "type": "integer" + }, + "uId": { + "type": "string" + } + } + }, + "group.InviteUserToGroupReq": { + "type": "object", + "required": [ + "groupID", + "operationID", + "uidList" + ], + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "uidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "group.InviteUserToGroupResp": { + "type": "object", + "properties": { + "errorCode": { + "type": "integer" + }, + "errorMsg": { + "type": "string" + }, + "id2result": { + "type": "array", + "items": { + "$ref": "#/definitions/group.Id2Result" + } + } + } + }, + "group.KickGroupMemberResp": { + "type": "object", + "properties": { + "errorCode": { + "type": "integer" + }, + "errorMsg": { + "type": "string" + }, + "id2result": { + "type": "array", + "items": { + "$ref": "#/definitions/group.Id2Result" + } + } + } + }, + "group.MemberResult": { + "type": "object", + "properties": { + "faceUrl": { + "type": "string" + }, + "groupID": { + "type": "string" + }, + "joinTime": { + "type": "integer" + }, + "nickName": { + "type": "string" + }, + "role": { + "type": "integer" + }, + "userId": { + "type": "string" + } + } + }, + "group.getGroupAllMemberReq": { + "type": "object", + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsCreateGroup": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "ex": { + "type": "string" + }, + "faceUrl": { + "type": "string" + }, + "groupName": { + "type": "string" + }, + "introduction": { + "type": "string" + }, + "memberList": { + "type": "object", + "properties": { + "setRole": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "notification": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsGetGroupInfo": { + "type": "object", + "required": [ + "groupIDList", + "operationID" + ], + "properties": { + "groupIDList": { + "type": "array", + "items": { + "type": "string" + } + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsGroupApplicationList": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "group.paramsGroupApplicationListRet": { + "type": "object", + "properties": { + "createTime": { + "type": "integer" + }, + "flag": { + "type": "integer" + }, + "fromUserFaceURL": { + "type": "string" + }, + "fromUserID": { + "type": "string" + }, + "fromUserNickName": { + "type": "string" + }, + "groupID": { + "type": "string" + }, + "handleResult": { + "type": "integer" + }, + "handleStatus": { + "type": "integer" + }, + "handledMsg": { + "type": "string" + }, + "handledUser": { + "type": "string" + }, + "id": { + "type": "string" + }, + "reqMsg": { + "type": "string" + }, + "toUserFaceURL": { + "type": "string" + }, + "toUserID": { + "type": "string" + }, + "toUserNickName": { + "type": "string" + }, + "type": { + "type": "integer" + } + } + }, + "group.paramsGroupApplicationResponse": { + "type": "object", + "required": [ + "fromUserID", + "groupID", + "operationID", + "toUserID" + ], + "properties": { + "addTime": { + "type": "integer" + }, + "fromUserFaceUrl": { + "type": "string" + }, + "fromUserID": { + "type": "string" + }, + "fromUserNickName": { + "type": "string" + }, + "groupID": { + "type": "string" + }, + "handleResult": { + "type": "integer" + }, + "handleStatus": { + "type": "integer" + }, + "handledMsg": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "requestMsg": { + "type": "string" + }, + "toUserFaceUrl": { + "type": "string" + }, + "toUserID": { + "type": "string" + }, + "toUserNickName": { + "type": "string" + }, + "type": { + "type": "integer" + } + } + }, + "group.paramsJoinGroup": { + "type": "object", + "required": [ + "groupID", + "operationID" + ], + "properties": { + "groupID": { + "type": "string" + }, + "message": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsKickGroupMember": { + "type": "object", + "required": [ + "operationID", + "uidListInfo" + ], + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "uidListInfo": { + "type": "array", + "items": { + "type": "object", + "properties": { + "faceUrl": { + "type": "string" + }, + "joinTime": { + "type": "integer" + }, + "nickName": { + "type": "string" + }, + "role": { + "type": "integer" + }, + "userId": { + "type": "string" + } + } + } + } + } + }, + "group.paramsQuitGroup": { + "type": "object", + "required": [ + "groupID", + "operationID" + ], + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsSetGroupInfo": { + "type": "object", + "required": [ + "groupId", + "operationID" + ], + "properties": { + "faceUrl": { + "type": "string" + }, + "groupId": { + "type": "string" + }, + "groupName": { + "type": "string" + }, + "introduction": { + "type": "string" + }, + "notification": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsTransferGroupOwner": { + "type": "object", + "required": [ + "groupID", + "operationID", + "uid" + ], + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "group.resultGroupApplication": { + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "user": { + "type": "array", + "items": { + "$ref": "#/definitions/group.paramsGroupApplicationListRet" + } + } + } + }, + "manage.deleteUserResult": { + "type": "object", + "properties": { + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + }, + "failedUidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "manage.paramsDeleteUsers": { + "type": "object", + "required": [ + "deleteUidList", + "operationID" + ], + "properties": { + "deleteUidList": { + "type": "array", + "items": { + "type": "string" + } + }, + "operationID": { + "type": "string" + } + } + }, + "manage.paramsGetAllUsersUid": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "manage.paramsManagementSendMsg": { + "type": "object", + "required": [ + "content", + "contentType", + "operationID", + "recvID", + "sendID", + "sessionType" + ], + "properties": { + "content": { + "type": "object", + "additionalProperties": true + }, + "contentType": { + "type": "integer" + }, + "forceList": { + "type": "array", + "items": { + "type": "string" + } + }, + "operationID": { + "type": "string" + }, + "recvID": { + "type": "string" + }, + "sendID": { + "type": "string" + }, + "senderFaceURL": { + "type": "string" + }, + "senderNickName": { + "type": "string" + }, + "sessionType": { + "type": "integer" + } + } + }, + "manage.sendMsgResult": { + "type": "object", + "properties": { + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + }, + "msgID": { + "type": "string" + }, + "sendTime": { + "type": "integer" + } + } + }, + "manage.uidListResult": { + "type": "object", + "properties": { + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + }, + "uidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "user.queryUserInfoParam": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + }, + "uidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "user.result": { + "type": "object", + "properties": { + "data": {}, + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + } + } + }, + "user.updateUserInfoParam": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "user.userInfo": { + "type": "object", + "properties": { + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + } + } +}` + +type swaggerInfo struct { + Version string + Host string + BasePath string + Schemes []string + Title string + Description string +} + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = swaggerInfo{ + Version: "", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "", + Description: "", +} + +type s struct{} + +func (s *s) ReadDoc() string { + sInfo := SwaggerInfo + sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) + + t, err := template.New("swagger_info").Funcs(template.FuncMap{ + "marshal": func(v interface{}) string { + a, _ := json.Marshal(v) + return string(a) + }, + "escape": func(v interface{}) string { + // escape tabs + str := strings.Replace(v.(string), "\t", "\\t", -1) + // replace " with \", and if that results in \\", replace that with \\\" + str = strings.Replace(str, "\"", "\\\"", -1) + return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1) + }, + }).Parse(doc) + if err != nil { + return doc + } + + var tpl bytes.Buffer + if err := t.Execute(&tpl, sInfo); err != nil { + return doc + } + + return tpl.String() +} + +func init() { + swag.Register("swagger", &s{}) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 000000000..2c1131d0f --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,3407 @@ +{ + "swagger": "2.0", + "info": { + "contact": {} + }, + "paths": { + "/auth/user_register": { + "post": { + "description": "register a new user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "parameters": [ + { + "description": "new user params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiAuth.paramsUserRegister" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/apiAuth.resultUserRegister" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/auth/user_token": { + "post": { + "description": "get token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "parameters": [ + { + "description": "get token params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiAuth.paramsUserToken" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/apiAuth.resultUserRegister" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/chat/newest_seq": { + "post": { + "description": "get latest message seq", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "chat" + ], + "parameters": [ + { + "description": "user get latest seq params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiChat.paramsUserNewestSeq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/apiChat.resultUserNewestSeq" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/chat/pull_msg": { + "post": { + "description": "user pull messages", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "chat" + ], + "parameters": [ + { + "description": "user pull messages", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiChat.paramsUserPullMsg" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "reqIdentifier": { + "type": "integer" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/chat/pull_msg_by_seq": { + "post": { + "description": "user pull msg by seq", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "chat" + ], + "parameters": [ + { + "description": "pull msg by seq", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiChat.paramsUserPullMsgBySeqList" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "reqIdentifier": { + "type": "integer" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/chat/send_msg": { + "post": { + "description": "user send messages", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "chat" + ], + "parameters": [ + { + "description": "user send messages", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiChat.paramsUserSendMsg" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/apiChat.resultSendMsg" + }, + "reqIdentifier": { + "type": "integer" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/add_blacklist": { + "post": { + "description": "add a user into black list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "add black list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/add_friend": { + "post": { + "description": "add a new friend by uid", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "add friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsAddFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/add_friend_response": { + "post": { + "description": "the response of adding friend", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "response of adding friend", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsAddFriendResponse" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/delete_friend": { + "post": { + "description": "delete friend", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "delete friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_blacklist": { + "post": { + "description": "get black list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "get black list", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/friend.blackListUserInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_friend_apply_list": { + "post": { + "description": "get friend apply list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "get friend apply list", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsGetApplyList" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/friend.UserInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_friend_list": { + "post": { + "description": "get friend apply list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "get friend apply list", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsGetFriendLIst" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/friend.friendInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_friends_info": { + "post": { + "description": "get friend info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "search friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/get_self_apply_list": { + "post": { + "description": "get friend apply list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "get friend apply list", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsGetApplyList" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/friend.UserInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/import_friend": { + "post": { + "description": "import friend", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "import friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsImportFriendReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/friend.resultImportFriend" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/is_friend": { + "post": { + "description": "check is friend", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "is friend params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/remove_blacklist": { + "post": { + "description": "remove black list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "remove black list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSearchFriend" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/friend/set_friend_comment": { + "post": { + "description": "set friend comment", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "friend" + ], + "parameters": [ + { + "description": "set friend comment", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/friend.paramsSetFriendComment" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/create_group": { + "post": { + "description": "create group", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "create group params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsCreateGroup" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_group_all_member_list": { + "post": { + "description": "get group all members", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get group all members params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.getGroupAllMemberReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.GetGroupMemberListResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_group_applicationList": { + "post": { + "description": "get group application list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get group application list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsGroupApplicationList" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/group.resultGroupApplication" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_group_member_list": { + "post": { + "description": "get group member list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get group member list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.GetGroupMemberListReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.GetGroupMemberListResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_group_members_info": { + "post": { + "description": "get group members info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get group members info params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.GetGroupMembersInfoReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.GetGroupMembersInfoResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_groups_info": { + "post": { + "description": "get groups info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get groups info params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsGetGroupInfo" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/group.GroupInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/get_joined_group_list": { + "post": { + "description": "get joined group list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "get joined group list params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.GetJoinedGroupListReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.GetJoinedGroupListResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/group_application_response": { + "post": { + "description": "response of application group", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "application group param", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsGroupApplicationResponse" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/invite_user_to_group": { + "post": { + "description": "invite user to group", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "invite user to group params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.InviteUserToGroupReq" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.InviteUserToGroupResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/kick_group": { + "post": { + "description": "kick member from group", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "kick member from group params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsKickGroupMember" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/group.KickGroupMemberResp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/set_group_info": { + "post": { + "description": "set group info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "set group info params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsSetGroupInfo" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/group/transfer_group": { + "post": { + "description": "transfer group owner", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "group" + ], + "parameters": [ + { + "description": "transfer group owner param", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/group.paramsTransferGroupOwner" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/manager/delete_user": { + "post": { + "description": "delete user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "manage" + ], + "parameters": [ + { + "description": "user to be deleted", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/manage.paramsDeleteUsers" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/manage.deleteUserResult" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/manager/get_all_users_uid": { + "post": { + "description": "get all user ids", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "manage" + ], + "parameters": [ + { + "description": "all user ids", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/manage.paramsGetAllUsersUid" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/manage.uidListResult" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/manage.uidListResult" + } + } + } + } + }, + "/manager/send_msg": { + "post": { + "description": "manage send message", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "manage" + ], + "parameters": [ + { + "description": "manage send message", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/manage.paramsManagementSendMsg" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/manage.sendMsgResult" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/third/user_register": { + "post": { + "description": "get Tencent cloud storage credential", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "third" + ], + "parameters": [ + { + "description": "get Tencent cloud storage credential params", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/apiThird.paramsTencentCloudStorageCredential" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/apiThird.resultTencentCredential" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/user/get_user_info": { + "post": { + "description": "get user info by uid list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "parameters": [ + { + "description": "get userInfo by uidList", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/user.queryUserInfoParam" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/user.result" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/user.userInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + }, + "/user/update_user_info": { + "post": { + "description": "update user info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "parameters": [ + { + "description": "new user info", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/user.updateUserInfoParam" + } + }, + { + "type": "string", + "description": "token", + "name": "token", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.result" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/user.result" + } + } + } + } + } + }, + "definitions": { + "apiAuth.paramsUserRegister": { + "type": "object", + "required": [ + "name", + "platform", + "secret", + "uid" + ], + "properties": { + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "platform": { + "type": "integer" + }, + "secret": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "apiAuth.paramsUserToken": { + "type": "object", + "required": [ + "platform", + "secret", + "uid" + ], + "properties": { + "platform": { + "type": "integer" + }, + "secret": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "apiAuth.resultUserRegister": { + "type": "object", + "properties": { + "expiredTime": { + "type": "integer" + }, + "token": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "apiChat.paramsUserNewestSeq": { + "type": "object", + "required": [ + "msgIncr", + "operationID", + "reqIdentifier", + "sendID" + ], + "properties": { + "msgIncr": { + "type": "integer" + }, + "operationID": { + "type": "string" + }, + "reqIdentifier": { + "type": "integer" + }, + "sendID": { + "type": "string" + } + } + }, + "apiChat.paramsUserPullMsg": { + "type": "object", + "required": [ + "operationID", + "reqIdentifier", + "sendID" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "seqBegin", + "seqEnd" + ], + "properties": { + "seqBegin": { + "type": "integer" + }, + "seqEnd": { + "type": "integer" + } + } + }, + "operationID": { + "type": "string" + }, + "reqIdentifier": { + "type": "integer" + }, + "sendID": { + "type": "string" + } + } + }, + "apiChat.paramsUserPullMsgBySeqList": { + "type": "object", + "required": [ + "operationID", + "reqIdentifier", + "sendID" + ], + "properties": { + "operationID": { + "type": "string" + }, + "reqIdentifier": { + "type": "integer" + }, + "sendID": { + "type": "string" + }, + "seqList": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "apiChat.paramsUserSendMsg": { + "type": "object", + "required": [ + "operationID", + "platformID", + "reqIdentifier", + "sendID" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "clientMsgID", + "content", + "contentType", + "msgFrom", + "recvID", + "sessionType" + ], + "properties": { + "clientMsgID": { + "type": "string" + }, + "content": { + "type": "string" + }, + "contentType": { + "type": "integer" + }, + "ext": { + "type": "object", + "additionalProperties": true + }, + "forceList": { + "type": "array", + "items": { + "type": "string" + } + }, + "msgFrom": { + "type": "integer" + }, + "offlineInfo": { + "type": "object", + "additionalProperties": true + }, + "options": { + "type": "object", + "additionalProperties": true + }, + "recvID": { + "type": "string" + }, + "sessionType": { + "type": "integer" + } + } + }, + "operationID": { + "type": "string" + }, + "platformID": { + "type": "integer" + }, + "reqIdentifier": { + "type": "integer" + }, + "sendID": { + "type": "string" + }, + "senderFaceUrl": { + "type": "string" + }, + "senderNickName": { + "type": "string" + } + } + }, + "apiChat.resultSendMsg": { + "type": "object", + "properties": { + "clientMsgID": { + "type": "string" + }, + "sendTime": { + "type": "integer" + }, + "serverMsgID": { + "type": "string" + } + } + }, + "apiChat.resultUserNewestSeq": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "maxSeq": { + "type": "integer" + }, + "minSeq": { + "type": "integer" + } + } + }, + "errCode": { + "type": "integer" + }, + "errMsg": { + "type": "string" + }, + "msgIncr": { + "type": "integer" + }, + "reqIdentifier": { + "type": "integer" + } + } + }, + "apiThird.paramsTencentCloudStorageCredential": { + "type": "object", + "properties": { + "operationID": { + "type": "string" + }, + "token": { + "type": "string" + } + } + }, + "apiThird.resultTencentCredential": { + "type": "object", + "properties": { + "bucket": { + "type": "string" + }, + "data": {}, + "errCode": { + "type": "integer" + }, + "errMsg": { + "type": "string" + }, + "region": { + "type": "string" + } + } + }, + "friend.UserInfo": { + "type": "object", + "properties": { + "applyTime": { + "type": "string" + }, + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "flag": { + "type": "integer" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "reqMessage": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.blackListUserInfo": { + "type": "object", + "properties": { + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.friendInfo": { + "type": "object", + "properties": { + "birth": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "isInBlackList": { + "type": "integer" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.paramsAddFriend": { + "type": "object", + "required": [ + "operationID", + "uid" + ], + "properties": { + "operationID": { + "type": "string" + }, + "reqMessage": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.paramsAddFriendResponse": { + "type": "object", + "required": [ + "flag", + "operationID", + "uid" + ], + "properties": { + "flag": { + "type": "integer" + }, + "operationID": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.paramsGetApplyList": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "friend.paramsGetFriendLIst": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "friend.paramsImportFriendReq": { + "type": "object", + "required": [ + "operationID", + "ownerUid", + "uidList" + ], + "properties": { + "operationID": { + "type": "string" + }, + "ownerUid": { + "type": "string" + }, + "uidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "friend.paramsSearchFriend": { + "type": "object", + "required": [ + "operationID", + "uid" + ], + "properties": { + "operationID": { + "type": "string" + }, + "ownerUid": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.paramsSetFriendComment": { + "type": "object", + "required": [ + "operationID", + "uid" + ], + "properties": { + "comment": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.resultFriendInfo": { + "type": "object", + "properties": { + "birth": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "friend.resultImportFriend": { + "type": "object", + "properties": { + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + }, + "failedUidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "group.GetGroupMemberListReq": { + "type": "object", + "properties": { + "filter": { + "type": "integer" + }, + "groupID": { + "type": "string" + }, + "nextSeq": { + "type": "integer" + }, + "operationID": { + "type": "string" + } + } + }, + "group.GetGroupMemberListResp": { + "type": "object", + "properties": { + "errorCode": { + "type": "integer" + }, + "errorMsg": { + "type": "string" + }, + "memberList": { + "type": "array", + "items": { + "$ref": "#/definitions/group.GroupMemberFullInfo" + } + }, + "nextSeq": { + "type": "integer" + } + } + }, + "group.GetGroupMembersInfoReq": { + "type": "object", + "properties": { + "groupID": { + "type": "string" + }, + "memberList": { + "type": "array", + "items": { + "type": "string" + } + }, + "operationID": { + "type": "string" + } + } + }, + "group.GetGroupMembersInfoResp": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/group.MemberResult" + } + }, + "errCode": { + "type": "integer" + }, + "errMsg": { + "type": "string" + } + } + }, + "group.GetJoinedGroupListReq": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "group.GetJoinedGroupListResp": { + "type": "object", + "properties": { + "errorCode": { + "type": "integer" + }, + "errorMsg": { + "type": "string" + }, + "groupList": { + "type": "array", + "items": { + "$ref": "#/definitions/group.GroupInfo" + } + } + } + }, + "group.GroupInfo": { + "type": "object", + "properties": { + "createTime": { + "type": "integer" + }, + "faceUrl": { + "type": "string" + }, + "groupId": { + "type": "string" + }, + "groupName": { + "type": "string" + }, + "introduction": { + "type": "string" + }, + "memberCount": { + "type": "integer" + }, + "notification": { + "type": "string" + }, + "ownerId": { + "type": "string" + } + } + }, + "group.GroupMemberFullInfo": { + "type": "object", + "properties": { + "faceUrl": { + "type": "string" + }, + "joinTime": { + "type": "integer" + }, + "nickName": { + "type": "string" + }, + "role": { + "type": "integer" + }, + "userId": { + "type": "string" + } + } + }, + "group.Id2Result": { + "type": "object", + "properties": { + "result": { + "type": "integer" + }, + "uId": { + "type": "string" + } + } + }, + "group.InviteUserToGroupReq": { + "type": "object", + "required": [ + "groupID", + "operationID", + "uidList" + ], + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "uidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "group.InviteUserToGroupResp": { + "type": "object", + "properties": { + "errorCode": { + "type": "integer" + }, + "errorMsg": { + "type": "string" + }, + "id2result": { + "type": "array", + "items": { + "$ref": "#/definitions/group.Id2Result" + } + } + } + }, + "group.KickGroupMemberResp": { + "type": "object", + "properties": { + "errorCode": { + "type": "integer" + }, + "errorMsg": { + "type": "string" + }, + "id2result": { + "type": "array", + "items": { + "$ref": "#/definitions/group.Id2Result" + } + } + } + }, + "group.MemberResult": { + "type": "object", + "properties": { + "faceUrl": { + "type": "string" + }, + "groupID": { + "type": "string" + }, + "joinTime": { + "type": "integer" + }, + "nickName": { + "type": "string" + }, + "role": { + "type": "integer" + }, + "userId": { + "type": "string" + } + } + }, + "group.getGroupAllMemberReq": { + "type": "object", + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsCreateGroup": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "ex": { + "type": "string" + }, + "faceUrl": { + "type": "string" + }, + "groupName": { + "type": "string" + }, + "introduction": { + "type": "string" + }, + "memberList": { + "type": "object", + "properties": { + "setRole": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "notification": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsGetGroupInfo": { + "type": "object", + "required": [ + "groupIDList", + "operationID" + ], + "properties": { + "groupIDList": { + "type": "array", + "items": { + "type": "string" + } + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsGroupApplicationList": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "group.paramsGroupApplicationListRet": { + "type": "object", + "properties": { + "createTime": { + "type": "integer" + }, + "flag": { + "type": "integer" + }, + "fromUserFaceURL": { + "type": "string" + }, + "fromUserID": { + "type": "string" + }, + "fromUserNickName": { + "type": "string" + }, + "groupID": { + "type": "string" + }, + "handleResult": { + "type": "integer" + }, + "handleStatus": { + "type": "integer" + }, + "handledMsg": { + "type": "string" + }, + "handledUser": { + "type": "string" + }, + "id": { + "type": "string" + }, + "reqMsg": { + "type": "string" + }, + "toUserFaceURL": { + "type": "string" + }, + "toUserID": { + "type": "string" + }, + "toUserNickName": { + "type": "string" + }, + "type": { + "type": "integer" + } + } + }, + "group.paramsGroupApplicationResponse": { + "type": "object", + "required": [ + "fromUserID", + "groupID", + "operationID", + "toUserID" + ], + "properties": { + "addTime": { + "type": "integer" + }, + "fromUserFaceUrl": { + "type": "string" + }, + "fromUserID": { + "type": "string" + }, + "fromUserNickName": { + "type": "string" + }, + "groupID": { + "type": "string" + }, + "handleResult": { + "type": "integer" + }, + "handleStatus": { + "type": "integer" + }, + "handledMsg": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "requestMsg": { + "type": "string" + }, + "toUserFaceUrl": { + "type": "string" + }, + "toUserID": { + "type": "string" + }, + "toUserNickName": { + "type": "string" + }, + "type": { + "type": "integer" + } + } + }, + "group.paramsJoinGroup": { + "type": "object", + "required": [ + "groupID", + "operationID" + ], + "properties": { + "groupID": { + "type": "string" + }, + "message": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsKickGroupMember": { + "type": "object", + "required": [ + "operationID", + "uidListInfo" + ], + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "uidListInfo": { + "type": "array", + "items": { + "type": "object", + "properties": { + "faceUrl": { + "type": "string" + }, + "joinTime": { + "type": "integer" + }, + "nickName": { + "type": "string" + }, + "role": { + "type": "integer" + }, + "userId": { + "type": "string" + } + } + } + } + } + }, + "group.paramsQuitGroup": { + "type": "object", + "required": [ + "groupID", + "operationID" + ], + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsSetGroupInfo": { + "type": "object", + "required": [ + "groupId", + "operationID" + ], + "properties": { + "faceUrl": { + "type": "string" + }, + "groupId": { + "type": "string" + }, + "groupName": { + "type": "string" + }, + "introduction": { + "type": "string" + }, + "notification": { + "type": "string" + }, + "operationID": { + "type": "string" + } + } + }, + "group.paramsTransferGroupOwner": { + "type": "object", + "required": [ + "groupID", + "operationID", + "uid" + ], + "properties": { + "groupID": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "group.resultGroupApplication": { + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "user": { + "type": "array", + "items": { + "$ref": "#/definitions/group.paramsGroupApplicationListRet" + } + } + } + }, + "manage.deleteUserResult": { + "type": "object", + "properties": { + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + }, + "failedUidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "manage.paramsDeleteUsers": { + "type": "object", + "required": [ + "deleteUidList", + "operationID" + ], + "properties": { + "deleteUidList": { + "type": "array", + "items": { + "type": "string" + } + }, + "operationID": { + "type": "string" + } + } + }, + "manage.paramsGetAllUsersUid": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + } + } + }, + "manage.paramsManagementSendMsg": { + "type": "object", + "required": [ + "content", + "contentType", + "operationID", + "recvID", + "sendID", + "sessionType" + ], + "properties": { + "content": { + "type": "object", + "additionalProperties": true + }, + "contentType": { + "type": "integer" + }, + "forceList": { + "type": "array", + "items": { + "type": "string" + } + }, + "operationID": { + "type": "string" + }, + "recvID": { + "type": "string" + }, + "sendID": { + "type": "string" + }, + "senderFaceURL": { + "type": "string" + }, + "senderNickName": { + "type": "string" + }, + "sessionType": { + "type": "integer" + } + } + }, + "manage.sendMsgResult": { + "type": "object", + "properties": { + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + }, + "msgID": { + "type": "string" + }, + "sendTime": { + "type": "integer" + } + } + }, + "manage.uidListResult": { + "type": "object", + "properties": { + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + }, + "uidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "user.queryUserInfoParam": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "operationID": { + "type": "string" + }, + "uidList": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "user.result": { + "type": "object", + "properties": { + "data": {}, + "errCode": { + "type": "integer", + "example": 0 + }, + "errMsg": { + "type": "string", + "example": "error" + } + } + }, + "user.updateUserInfoParam": { + "type": "object", + "required": [ + "operationID" + ], + "properties": { + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "operationID": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, + "user.userInfo": { + "type": "object", + "properties": { + "birth": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ex": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "icon": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 000000000..517f009d5 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,2208 @@ +definitions: + apiAuth.paramsUserRegister: + properties: + birth: + type: string + email: + type: string + ex: + type: string + gender: + type: integer + icon: + type: string + mobile: + type: string + name: + type: string + platform: + type: integer + secret: + type: string + uid: + type: string + required: + - name + - platform + - secret + - uid + type: object + apiAuth.paramsUserToken: + properties: + platform: + type: integer + secret: + type: string + uid: + type: string + required: + - platform + - secret + - uid + type: object + apiAuth.resultUserRegister: + properties: + expiredTime: + type: integer + token: + type: string + uid: + type: string + type: object + apiChat.paramsUserNewestSeq: + properties: + msgIncr: + type: integer + operationID: + type: string + reqIdentifier: + type: integer + sendID: + type: string + required: + - msgIncr + - operationID + - reqIdentifier + - sendID + type: object + apiChat.paramsUserPullMsg: + properties: + data: + properties: + seqBegin: + type: integer + seqEnd: + type: integer + required: + - seqBegin + - seqEnd + type: object + operationID: + type: string + reqIdentifier: + type: integer + sendID: + type: string + required: + - operationID + - reqIdentifier + - sendID + type: object + apiChat.paramsUserPullMsgBySeqList: + properties: + operationID: + type: string + reqIdentifier: + type: integer + sendID: + type: string + seqList: + items: + type: integer + type: array + required: + - operationID + - reqIdentifier + - sendID + type: object + apiChat.paramsUserSendMsg: + properties: + data: + properties: + clientMsgID: + type: string + content: + type: string + contentType: + type: integer + ext: + additionalProperties: true + type: object + forceList: + items: + type: string + type: array + msgFrom: + type: integer + offlineInfo: + additionalProperties: true + type: object + options: + additionalProperties: true + type: object + recvID: + type: string + sessionType: + type: integer + required: + - clientMsgID + - content + - contentType + - msgFrom + - recvID + - sessionType + type: object + operationID: + type: string + platformID: + type: integer + reqIdentifier: + type: integer + sendID: + type: string + senderFaceUrl: + type: string + senderNickName: + type: string + required: + - operationID + - platformID + - reqIdentifier + - sendID + type: object + apiChat.resultSendMsg: + properties: + clientMsgID: + type: string + sendTime: + type: integer + serverMsgID: + type: string + type: object + apiChat.resultUserNewestSeq: + properties: + data: + properties: + maxSeq: + type: integer + minSeq: + type: integer + type: object + errCode: + type: integer + errMsg: + type: string + msgIncr: + type: integer + reqIdentifier: + type: integer + type: object + apiThird.paramsTencentCloudStorageCredential: + properties: + operationID: + type: string + token: + type: string + type: object + apiThird.resultTencentCredential: + properties: + bucket: + type: string + data: {} + errCode: + type: integer + errMsg: + type: string + region: + type: string + type: object + friend.UserInfo: + properties: + applyTime: + type: string + birth: + type: string + email: + type: string + ex: + type: string + flag: + type: integer + gender: + type: integer + icon: + type: string + mobile: + type: string + name: + type: string + reqMessage: + type: string + uid: + type: string + type: object + friend.blackListUserInfo: + properties: + birth: + type: string + email: + type: string + ex: + type: string + gender: + type: integer + icon: + type: string + mobile: + type: string + name: + type: string + uid: + type: string + type: object + friend.friendInfo: + properties: + birth: + type: string + comment: + type: string + email: + type: string + ex: + type: string + gender: + type: integer + icon: + type: string + isInBlackList: + type: integer + mobile: + type: string + name: + type: string + uid: + type: string + type: object + friend.paramsAddFriend: + properties: + operationID: + type: string + reqMessage: + type: string + uid: + type: string + required: + - operationID + - uid + type: object + friend.paramsAddFriendResponse: + properties: + flag: + type: integer + operationID: + type: string + uid: + type: string + required: + - flag + - operationID + - uid + type: object + friend.paramsGetApplyList: + properties: + operationID: + type: string + required: + - operationID + type: object + friend.paramsGetFriendLIst: + properties: + operationID: + type: string + required: + - operationID + type: object + friend.paramsImportFriendReq: + properties: + operationID: + type: string + ownerUid: + type: string + uidList: + items: + type: string + type: array + required: + - operationID + - ownerUid + - uidList + type: object + friend.paramsSearchFriend: + properties: + operationID: + type: string + ownerUid: + type: string + uid: + type: string + required: + - operationID + - uid + type: object + friend.paramsSetFriendComment: + properties: + comment: + type: string + operationID: + type: string + uid: + type: string + required: + - operationID + - uid + type: object + friend.resultFriendInfo: + properties: + birth: + type: string + comment: + type: string + email: + type: string + ex: + type: string + gender: + type: integer + icon: + type: string + mobile: + type: string + name: + type: string + uid: + type: string + type: object + friend.resultImportFriend: + properties: + errCode: + example: 0 + type: integer + errMsg: + example: error + type: string + failedUidList: + items: + type: string + type: array + type: object + group.GetGroupMemberListReq: + properties: + filter: + type: integer + groupID: + type: string + nextSeq: + type: integer + operationID: + type: string + type: object + group.GetGroupMemberListResp: + properties: + errorCode: + type: integer + errorMsg: + type: string + memberList: + items: + $ref: '#/definitions/group.GroupMemberFullInfo' + type: array + nextSeq: + type: integer + type: object + group.GetGroupMembersInfoReq: + properties: + groupID: + type: string + memberList: + items: + type: string + type: array + operationID: + type: string + type: object + group.GetGroupMembersInfoResp: + properties: + data: + items: + $ref: '#/definitions/group.MemberResult' + type: array + errCode: + type: integer + errMsg: + type: string + type: object + group.GetJoinedGroupListReq: + properties: + operationID: + type: string + required: + - operationID + type: object + group.GetJoinedGroupListResp: + properties: + errorCode: + type: integer + errorMsg: + type: string + groupList: + items: + $ref: '#/definitions/group.GroupInfo' + type: array + type: object + group.GroupInfo: + properties: + createTime: + type: integer + faceUrl: + type: string + groupId: + type: string + groupName: + type: string + introduction: + type: string + memberCount: + type: integer + notification: + type: string + ownerId: + type: string + type: object + group.GroupMemberFullInfo: + properties: + faceUrl: + type: string + joinTime: + type: integer + nickName: + type: string + role: + type: integer + userId: + type: string + type: object + group.Id2Result: + properties: + result: + type: integer + uId: + type: string + type: object + group.InviteUserToGroupReq: + properties: + groupID: + type: string + operationID: + type: string + reason: + type: string + uidList: + items: + type: string + type: array + required: + - groupID + - operationID + - uidList + type: object + group.InviteUserToGroupResp: + properties: + errorCode: + type: integer + errorMsg: + type: string + id2result: + items: + $ref: '#/definitions/group.Id2Result' + type: array + type: object + group.KickGroupMemberResp: + properties: + errorCode: + type: integer + errorMsg: + type: string + id2result: + items: + $ref: '#/definitions/group.Id2Result' + type: array + type: object + group.MemberResult: + properties: + faceUrl: + type: string + groupID: + type: string + joinTime: + type: integer + nickName: + type: string + role: + type: integer + userId: + type: string + type: object + group.getGroupAllMemberReq: + properties: + groupID: + type: string + operationID: + type: string + type: object + group.paramsCreateGroup: + properties: + ex: + type: string + faceUrl: + type: string + groupName: + type: string + introduction: + type: string + memberList: + properties: + setRole: + type: string + uid: + type: string + type: object + notification: + type: string + operationID: + type: string + required: + - operationID + type: object + group.paramsGetGroupInfo: + properties: + groupIDList: + items: + type: string + type: array + operationID: + type: string + required: + - groupIDList + - operationID + type: object + group.paramsGroupApplicationList: + properties: + operationID: + type: string + required: + - operationID + type: object + group.paramsGroupApplicationListRet: + properties: + createTime: + type: integer + flag: + type: integer + fromUserFaceURL: + type: string + fromUserID: + type: string + fromUserNickName: + type: string + groupID: + type: string + handleResult: + type: integer + handleStatus: + type: integer + handledMsg: + type: string + handledUser: + type: string + id: + type: string + reqMsg: + type: string + toUserFaceURL: + type: string + toUserID: + type: string + toUserNickName: + type: string + type: + type: integer + type: object + group.paramsGroupApplicationResponse: + properties: + addTime: + type: integer + fromUserFaceUrl: + type: string + fromUserID: + type: string + fromUserNickName: + type: string + groupID: + type: string + handleResult: + type: integer + handleStatus: + type: integer + handledMsg: + type: string + operationID: + type: string + requestMsg: + type: string + toUserFaceUrl: + type: string + toUserID: + type: string + toUserNickName: + type: string + type: + type: integer + required: + - fromUserID + - groupID + - operationID + - toUserID + type: object + group.paramsJoinGroup: + properties: + groupID: + type: string + message: + type: string + operationID: + type: string + required: + - groupID + - operationID + type: object + group.paramsKickGroupMember: + properties: + groupID: + type: string + operationID: + type: string + reason: + type: string + uidListInfo: + items: + properties: + faceUrl: + type: string + joinTime: + type: integer + nickName: + type: string + role: + type: integer + userId: + type: string + type: object + type: array + required: + - operationID + - uidListInfo + type: object + group.paramsQuitGroup: + properties: + groupID: + type: string + operationID: + type: string + required: + - groupID + - operationID + type: object + group.paramsSetGroupInfo: + properties: + faceUrl: + type: string + groupId: + type: string + groupName: + type: string + introduction: + type: string + notification: + type: string + operationID: + type: string + required: + - groupId + - operationID + type: object + group.paramsTransferGroupOwner: + properties: + groupID: + type: string + operationID: + type: string + uid: + type: string + required: + - groupID + - operationID + - uid + type: object + group.resultGroupApplication: + properties: + count: + type: integer + user: + items: + $ref: '#/definitions/group.paramsGroupApplicationListRet' + type: array + type: object + manage.deleteUserResult: + properties: + errCode: + example: 0 + type: integer + errMsg: + example: error + type: string + failedUidList: + items: + type: string + type: array + type: object + manage.paramsDeleteUsers: + properties: + deleteUidList: + items: + type: string + type: array + operationID: + type: string + required: + - deleteUidList + - operationID + type: object + manage.paramsGetAllUsersUid: + properties: + operationID: + type: string + required: + - operationID + type: object + manage.paramsManagementSendMsg: + properties: + content: + additionalProperties: true + type: object + contentType: + type: integer + forceList: + items: + type: string + type: array + operationID: + type: string + recvID: + type: string + sendID: + type: string + senderFaceURL: + type: string + senderNickName: + type: string + sessionType: + type: integer + required: + - content + - contentType + - operationID + - recvID + - sendID + - sessionType + type: object + manage.sendMsgResult: + properties: + errCode: + example: 0 + type: integer + errMsg: + example: error + type: string + msgID: + type: string + sendTime: + type: integer + type: object + manage.uidListResult: + properties: + errCode: + example: 0 + type: integer + errMsg: + example: error + type: string + uidList: + items: + type: string + type: array + type: object + user.queryUserInfoParam: + properties: + operationID: + type: string + uidList: + items: + type: string + type: array + required: + - operationID + type: object + user.result: + properties: + data: {} + errCode: + example: 0 + type: integer + errMsg: + example: error + type: string + type: object + user.updateUserInfoParam: + properties: + birth: + type: string + email: + type: string + ex: + type: string + gender: + type: integer + icon: + type: string + mobile: + type: string + name: + type: string + operationID: + type: string + uid: + type: string + required: + - operationID + type: object + user.userInfo: + properties: + birth: + type: string + email: + type: string + ex: + type: string + gender: + type: integer + icon: + type: string + mobile: + type: string + name: + type: string + uid: + type: string + type: object +info: + contact: {} +paths: + /auth/user_register: + post: + consumes: + - application/json + description: register a new user + parameters: + - description: new user params + in: body + name: body + required: true + schema: + $ref: '#/definitions/apiAuth.paramsUserRegister' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + $ref: '#/definitions/apiAuth.resultUserRegister' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - auth + /auth/user_token: + post: + consumes: + - application/json + description: get token + parameters: + - description: get token params + in: body + name: body + required: true + schema: + $ref: '#/definitions/apiAuth.paramsUserToken' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + $ref: '#/definitions/apiAuth.resultUserRegister' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - auth + /chat/newest_seq: + post: + consumes: + - application/json + description: get latest message seq + parameters: + - description: user get latest seq params + in: body + name: body + required: true + schema: + $ref: '#/definitions/apiChat.paramsUserNewestSeq' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/apiChat.resultUserNewestSeq' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - chat + /chat/pull_msg: + post: + consumes: + - application/json + description: user pull messages + parameters: + - description: user pull messages + in: body + name: body + required: true + schema: + $ref: '#/definitions/apiChat.paramsUserPullMsg' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + reqIdentifier: + type: integer + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - chat + /chat/pull_msg_by_seq: + post: + consumes: + - application/json + description: user pull msg by seq + parameters: + - description: pull msg by seq + in: body + name: body + required: true + schema: + $ref: '#/definitions/apiChat.paramsUserPullMsgBySeqList' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + reqIdentifier: + type: integer + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - chat + /chat/send_msg: + post: + consumes: + - application/json + description: user send messages + parameters: + - description: user send messages + in: body + name: body + required: true + schema: + $ref: '#/definitions/apiChat.paramsUserSendMsg' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + $ref: '#/definitions/apiChat.resultSendMsg' + reqIdentifier: + type: integer + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + tags: + - chat + /friend/add_blacklist: + post: + consumes: + - application/json + description: add a user into black list + parameters: + - description: add black list params + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsSearchFriend' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/add_friend: + post: + consumes: + - application/json + description: add a new friend by uid + parameters: + - description: add friend params + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsAddFriend' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/add_friend_response: + post: + consumes: + - application/json + description: the response of adding friend + parameters: + - description: response of adding friend + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsAddFriendResponse' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/delete_friend: + post: + consumes: + - application/json + description: delete friend + parameters: + - description: delete friend params + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsSearchFriend' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/get_blacklist: + post: + consumes: + - application/json + description: get black list + parameters: + - description: get black list + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsSearchFriend' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + items: + $ref: '#/definitions/friend.blackListUserInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/get_friend_apply_list: + post: + consumes: + - application/json + description: get friend apply list + parameters: + - description: get friend apply list + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsGetApplyList' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + items: + $ref: '#/definitions/friend.UserInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/get_friend_list: + post: + consumes: + - application/json + description: get friend apply list + parameters: + - description: get friend apply list + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsGetFriendLIst' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + items: + $ref: '#/definitions/friend.friendInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/get_friends_info: + post: + consumes: + - application/json + description: get friend info + parameters: + - description: search friend params + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsSearchFriend' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/get_self_apply_list: + post: + consumes: + - application/json + description: get friend apply list + parameters: + - description: get friend apply list + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsGetApplyList' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + items: + $ref: '#/definitions/friend.UserInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/import_friend: + post: + consumes: + - application/json + description: import friend + parameters: + - description: import friend params + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsImportFriendReq' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/friend.resultImportFriend' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/is_friend: + post: + consumes: + - application/json + description: check is friend + parameters: + - description: is friend params + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsSearchFriend' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/remove_blacklist: + post: + consumes: + - application/json + description: remove black list + parameters: + - description: remove black list params + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsSearchFriend' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /friend/set_friend_comment: + post: + consumes: + - application/json + description: set friend comment + parameters: + - description: set friend comment + in: body + name: body + required: true + schema: + $ref: '#/definitions/friend.paramsSetFriendComment' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - friend + /group/create_group: + post: + consumes: + - application/json + description: create group + parameters: + - description: create group params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.paramsCreateGroup' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/get_group_all_member_list: + post: + consumes: + - application/json + description: get group all members + parameters: + - description: get group all members params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.getGroupAllMemberReq' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/group.GetGroupMemberListResp' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/get_group_applicationList: + post: + consumes: + - application/json + description: get group application list + parameters: + - description: get group application list params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.paramsGroupApplicationList' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + $ref: '#/definitions/group.resultGroupApplication' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/get_group_member_list: + post: + consumes: + - application/json + description: get group member list + parameters: + - description: get group member list params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.GetGroupMemberListReq' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/group.GetGroupMemberListResp' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/get_group_members_info: + post: + consumes: + - application/json + description: get group members info + parameters: + - description: get group members info params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.GetGroupMembersInfoReq' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/group.GetGroupMembersInfoResp' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/get_groups_info: + post: + consumes: + - application/json + description: get groups info + parameters: + - description: get groups info params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.paramsGetGroupInfo' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + items: + $ref: '#/definitions/group.GroupInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/get_joined_group_list: + post: + consumes: + - application/json + description: get joined group list + parameters: + - description: get joined group list params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.GetJoinedGroupListReq' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/group.GetJoinedGroupListResp' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/group_application_response: + post: + consumes: + - application/json + description: response of application group + parameters: + - description: application group param + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.paramsGroupApplicationResponse' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/invite_user_to_group: + post: + consumes: + - application/json + description: invite user to group + parameters: + - description: invite user to group params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.InviteUserToGroupReq' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/group.InviteUserToGroupResp' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/kick_group: + post: + consumes: + - application/json + description: kick member from group + parameters: + - description: kick member from group params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.paramsKickGroupMember' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/group.KickGroupMemberResp' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/set_group_info: + post: + consumes: + - application/json + description: set group info + parameters: + - description: set group info params + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.paramsSetGroupInfo' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /group/transfer_group: + post: + consumes: + - application/json + description: transfer group owner + parameters: + - description: transfer group owner param + in: body + name: body + required: true + schema: + $ref: '#/definitions/group.paramsTransferGroupOwner' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - group + /manager/delete_user: + post: + consumes: + - application/json + description: delete user + parameters: + - description: user to be deleted + in: body + name: body + required: true + schema: + $ref: '#/definitions/manage.paramsDeleteUsers' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/manage.deleteUserResult' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - manage + /manager/get_all_users_uid: + post: + consumes: + - application/json + description: get all user ids + parameters: + - description: all user ids + in: body + name: body + required: true + schema: + $ref: '#/definitions/manage.paramsGetAllUsersUid' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/manage.uidListResult' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/manage.uidListResult' + tags: + - manage + /manager/send_msg: + post: + consumes: + - application/json + description: manage send message + parameters: + - description: manage send message + in: body + name: body + required: true + schema: + $ref: '#/definitions/manage.paramsManagementSendMsg' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/manage.sendMsgResult' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - manage + /third/user_register: + post: + consumes: + - application/json + description: get Tencent cloud storage credential + parameters: + - description: get Tencent cloud storage credential params + in: body + name: body + required: true + schema: + $ref: '#/definitions/apiThird.paramsTencentCloudStorageCredential' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/apiThird.resultTencentCredential' + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - third + /user/get_user_info: + post: + consumes: + - application/json + description: get user info by uid list + parameters: + - description: get userInfo by uidList + in: body + name: body + required: true + schema: + $ref: '#/definitions/user.queryUserInfoParam' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/user.result' + - properties: + data: + items: + $ref: '#/definitions/user.userInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/user.result' + tags: + - user + /user/update_user_info: + post: + consumes: + - application/json + description: update user info + parameters: + - description: new user info + in: body + name: body + required: true + schema: + $ref: '#/definitions/user.updateUserInfoParam' + - description: token + in: header + name: token + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/user.result' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/user.result' + tags: + - user +swagger: "2.0" diff --git a/go.mod b/go.mod index 8efd048e6..dff96a634 100644 --- a/go.mod +++ b/go.mod @@ -8,13 +8,15 @@ require ( github.com/antonfisher/nested-logrus-formatter v1.3.0 github.com/bwmarrin/snowflake v0.3.0 github.com/coreos/go-semver v0.3.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/eapache/go-resiliency v1.2.0 // indirect github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect github.com/eapache/queue v1.1.0 // indirect github.com/frankban/quicktest v1.14.0 // indirect github.com/garyburd/redigo v1.6.2 - github.com/gin-gonic/gin v1.7.0 + github.com/gin-gonic/gin v1.7.4 + github.com/go-openapi/spec v0.20.4 // indirect github.com/go-playground/validator/v10 v10.4.1 github.com/golang-jwt/jwt/v4 v4.1.0 github.com/golang/protobuf v1.5.2 @@ -34,12 +36,16 @@ require ( github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 + github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 // indirect + github.com/swaggo/gin-swagger v1.3.3 // indirect + github.com/swaggo/swag v1.7.4 // indirect github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698 golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb - golang.org/x/net v0.0.0-20210917221730-978cfadd31cf - golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect + golang.org/x/net v0.0.0-20211111160137-58aab5ef257a + golang.org/x/sys v0.0.0-20211112143042-c6105e7cf70d // indirect + golang.org/x/tools v0.1.7 // indirect google.golang.org/grpc v1.33.2 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b diff --git a/go.sum b/go.sum index e50dd1004..56ac84b4c 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,12 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0 h1:9oksLxC6uxVPHPVYUmq6xhr1BOF/hHobWH2UzO67z1s= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc= @@ -26,6 +32,10 @@ github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmf github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28= github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -55,25 +65,48 @@ github.com/frankban/quicktest v1.14.0 h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzP github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM= github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/gzip v0.0.3/go.mod h1:YxxswVZIqOvcHEQpsSn+QF5guQtO1dCfy0shBPy4jFc= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= +github.com/gin-gonic/gin v1.7.4 h1:QmUZXrvJ9qZ3GfWvQ+2wnW/1ePrTEJqPKMYEU3lD/DM= +github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/spec v0.20.3 h1:uH9RQ6vdyPSs2pSy9fL8QPspDF2AMIMPtmK5coSSjtQ= +github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg= +github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -168,6 +201,9 @@ github.com/lestrrat-go/strftime v1.0.4/go.mod h1:E1nN3pCbtMSu1yjSVeyuRFVm/U0xoR7 github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -191,6 +227,7 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olivere/elastic/v7 v7.0.23 h1:b7tjMogDMhf2CisGI+L02LXLVa0ZyE82Z15XfW1e8t8= github.com/olivere/elastic/v7 v7.0.23/go.mod h1:OuWmD2DiuYhddWegBKPWQuelVKBLrW0fa/VUYgxuGTY= @@ -223,6 +260,13 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= @@ -243,6 +287,13 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= +github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 h1:+iNTcqQJy0OZ5jk6a5NLib47eqXK8uYcPX+O4+cBpEM= +github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= +github.com/swaggo/gin-swagger v1.3.3 h1:XHyYmeNVFG5PbyWHG4jXtxOm2P4kiZapDCWsyDDiQ/I= +github.com/swaggo/gin-swagger v1.3.3/go.mod h1:ymsZuGpbbu+S7ZoQ49QPpZoDBj6uqhb8WizgQPVgWl0= +github.com/swaggo/swag v1.7.4 h1:up+ixy8yOqJKiFcuhMgkuYuF4xnevuhnFAXXF8OSfNg= +github.com/swaggo/swag v1.7.4/go.mod h1:zD8h6h4SPv7t3l+4BKdRquqW1ASWjKZgT6Qv9z3kNqI= github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca h1:G/aIr3WiUesWHL2YGYgEqjM5tCAJ43Ml+0C18wDkWWs= github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -252,10 +303,14 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698 h1:jWtjCJX1qxhHISBMLRztWwR+EXkI7MJAF2HjHAE/x/I= @@ -287,6 +342,7 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -296,17 +352,24 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf h1:R150MpwJIv1MpS0N/pc+NhTM8ajzvlmxlY5OYsrevXQ= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211111160137-58aab5ef257a h1:c83jeVQW0KGKNaKBRfelNYNHaev+qawl9yaA825s8XE= +golang.org/x/net v0.0.0-20211111160137-58aab5ef257a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -319,14 +382,22 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211112143042-c6105e7cf70d h1:jp6PtFmjL+vGsuzd86xYqaJGv6eXdLvmVGzVVLI6EPI= +golang.org/x/sys v0.0.0-20211112143042-c6105e7cf70d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -339,6 +410,10 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -363,6 +438,7 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= @@ -371,9 +447,13 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/api/auth/user_register.go b/internal/api/auth/user_register.go index e0d69eeda..40e039e12 100644 --- a/internal/api/auth/user_register.go +++ b/internal/api/auth/user_register.go @@ -6,11 +6,12 @@ import ( "Open_IM/pkg/grpc-etcdv3/getcdv3" pbAuth "Open_IM/pkg/proto/auth" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsUserRegister struct type paramsUserRegister struct { Secret string `json:"secret" binding:"required,max=32"` Platform int32 `json:"platform" binding:"required,min=1,max=7"` @@ -24,6 +25,13 @@ type paramsUserRegister struct { Ex string `json:"ex" binding:"omitempty,max=1024"` } +// resultUserRegister struct +type resultUserRegister struct { + UID string `json:"uid"` + Token string `json:"token"` + ExpiredTime int64 `json:"expiredTime"` +} + func newUserRegisterReq(params *paramsUserRegister) *pbAuth.UserRegisterReq { pbData := pbAuth.UserRegisterReq{ UID: params.UID, @@ -38,9 +46,20 @@ func newUserRegisterReq(params *paramsUserRegister) *pbAuth.UserRegisterReq { return &pbData } +// @Summary +// @Schemes +// @Description register a new user +// @Tags auth +// @Accept json +// @Produce json +// @Param body body apiAuth.paramsUserRegister true "new user params" +// @Success 200 {object} user.result{data=apiAuth.resultUserRegister} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /auth/user_register [post] func UserRegister(c *gin.Context) { log.Info("", "", "api user_register init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) + etcdConn := getcdv3.GetAuthConn() client := pbAuth.NewAuthClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/auth/user_token.go b/internal/api/auth/user_token.go index 31839b6b0..3f37b9ea9 100644 --- a/internal/api/auth/user_token.go +++ b/internal/api/auth/user_token.go @@ -6,11 +6,12 @@ import ( "Open_IM/pkg/grpc-etcdv3/getcdv3" pbAuth "Open_IM/pkg/proto/auth" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsUserToken struct type paramsUserToken struct { Secret string `json:"secret" binding:"required,max=32"` Platform int32 `json:"platform" binding:"required,min=1,max=8"` @@ -25,9 +26,20 @@ func newUserTokenReq(params *paramsUserToken) *pbAuth.UserTokenReq { return &pbData } +// @Summary +// @Schemes +// @Description get token +// @Tags auth +// @Accept json +// @Produce json +// @Param body body apiAuth.paramsUserToken true "get token params" +// @Success 200 {object} user.result{data=apiAuth.resultUserRegister} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /auth/user_token [post] func UserToken(c *gin.Context) { log.Info("", "", "api user_token init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) + etcdConn := getcdv3.GetAuthConn() client := pbAuth.NewAuthClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/chat/get_max_min_seq.go b/internal/api/chat/get_max_min_seq.go index 06db8fd9d..916d919e9 100644 --- a/internal/api/chat/get_max_min_seq.go +++ b/internal/api/chat/get_max_min_seq.go @@ -1,17 +1,17 @@ package apiChat import ( - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbMsg "Open_IM/pkg/proto/chat" "Open_IM/pkg/utils" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsUserNewestSeq struct type paramsUserNewestSeq struct { ReqIdentifier int `json:"reqIdentifier" binding:"required"` SendID string `json:"sendID" binding:"required"` @@ -19,6 +19,30 @@ type paramsUserNewestSeq struct { MsgIncr int `json:"msgIncr" binding:"required"` } +// resultUserNewestSeq struct +type resultUserNewestSeq struct { + ErrCode int32 `json:"errCode` + ErrMsg string `json:"errMsg"` + MsgIncr int `json:"msgIncr"` + ReqIdentifier int `json:"reqIdentifier"` + Data struct { + MaxSeq int64 `json:"maxSeq,omitempty"` + MinSeq int64 `json:"minSeq,omitempty"` + } `json:"data"` +} + +// @Summary +// @Schemes +// @Description get latest message seq +// @Tags chat +// @Accept json +// @Produce json +// @Param body body apiChat.paramsUserNewestSeq true "user get latest seq params" +// @Param token header string true "token" +// @Success 200 {object} apiChat.resultUserNewestSeq +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /chat/newest_seq [post] func UserGetSeq(c *gin.Context) { params := paramsUserNewestSeq{} if err := c.BindJSON(¶ms); err != nil { @@ -34,7 +58,7 @@ func UserGetSeq(c *gin.Context) { pbData := pbMsg.GetMaxAndMinSeqReq{} pbData.UserID = params.SendID pbData.OperationID = params.OperationID - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + grpcConn := getcdv3.GetOfflineMessageConn() if grpcConn == nil { log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", params) @@ -43,6 +67,7 @@ func UserGetSeq(c *gin.Context) { reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData) if err != nil { log.ErrorByKv("rpc call failed to getNewSeq", pbData.OperationID, "err", err, "pbData", pbData.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } diff --git a/internal/api/chat/pull_msg.go b/internal/api/chat/pull_msg.go index 4fb90b61f..14103b6e4 100644 --- a/internal/api/chat/pull_msg.go +++ b/internal/api/chat/pull_msg.go @@ -1,17 +1,17 @@ package apiChat import ( - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" - "Open_IM/pkg/proto/chat" + pbChat "Open_IM/pkg/proto/chat" "Open_IM/pkg/utils" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsUserPullMsg struct type paramsUserPullMsg struct { ReqIdentifier *int `json:"reqIdentifier" binding:"required"` SendID string `json:"sendID" binding:"required"` @@ -22,6 +22,18 @@ type paramsUserPullMsg struct { } } +// @Summary +// @Schemes +// @Description user pull messages +// @Tags chat +// @Accept json +// @Produce json +// @Param body body apiChat.paramsUserPullMsg true "user pull messages" +// @Param token header string true "token" +// @Success 200 {object} user.result{reqIdentifier=int} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /chat/pull_msg [post] func UserPullMsg(c *gin.Context) { params := paramsUserPullMsg{} if err := c.BindJSON(¶ms); err != nil { @@ -39,7 +51,7 @@ func UserPullMsg(c *gin.Context) { pbData.OperationID = params.OperationID pbData.SeqBegin = *params.Data.SeqBegin pbData.SeqEnd = *params.Data.SeqEnd - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + grpcConn := getcdv3.GetOfflineMessageConn() msgClient := pbChat.NewChatClient(grpcConn) reply, err := msgClient.PullMessage(context.Background(), &pbData) if err != nil { @@ -71,6 +83,7 @@ func UserPullMsg(c *gin.Context) { } +// paramsUserPullMsgBySeqList struct type paramsUserPullMsgBySeqList struct { ReqIdentifier int `json:"reqIdentifier" binding:"required"` SendID string `json:"sendID" binding:"required"` @@ -78,6 +91,18 @@ type paramsUserPullMsgBySeqList struct { SeqList []int64 `json:"seqList"` } +// @Summary +// @Schemes +// @Description user pull msg by seq +// @Tags chat +// @Accept json +// @Produce json +// @Param body body apiChat.paramsUserPullMsgBySeqList true "pull msg by seq" +// @Param token header string true "token" +// @Success 200 {object} user.result{reqIdentifier=int} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /chat/pull_msg_by_seq [post] func UserPullMsgBySeqList(c *gin.Context) { params := paramsUserPullMsgBySeqList{} if err := c.BindJSON(¶ms); err != nil { @@ -95,11 +120,12 @@ func UserPullMsgBySeqList(c *gin.Context) { pbData.OperationID = params.OperationID pbData.SeqList = params.SeqList - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + grpcConn := getcdv3.GetOfflineMessageConn() msgClient := pbChat.NewChatClient(grpcConn) reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData) if err != nil { log.ErrorByKv("PullMessageBySeqList error", pbData.OperationID, "err", err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } log.InfoByKv("rpc call success to PullMessageBySeqList", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(), diff --git a/internal/api/chat/send_msg.go b/internal/api/chat/send_msg.go index 6d7294109..402d5224f 100644 --- a/internal/api/chat/send_msg.go +++ b/internal/api/chat/send_msg.go @@ -1,18 +1,18 @@ package apiChat import ( - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" "Open_IM/pkg/utils" "context" "Open_IM/pkg/grpc-etcdv3/getcdv3" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsUserSendMsg struct type paramsUserSendMsg struct { ReqIdentifier int32 `json:"reqIdentifier" binding:"required"` PlatformID int32 `json:"platformID" binding:"required"` @@ -57,6 +57,24 @@ func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSend return &pbData } +// resultSendMsg struct +type resultSendMsg struct { + ClientMsgID string `json:"clientMsgID"` + ServerMsgID string `json:"serverMsgID"` + SendTime int64 `json:"sendTime"` +} + +// @Summary +// @Schemes +// @Description user send messages +// @Tags chat +// @Accept json +// @Produce json +// @Param body body apiChat.paramsUserSendMsg true "user send messages" +// @Param token header string true "token" +// @Success 200 {object} user.result{reqIdentifier=int,data=resultSendMsg} +// @Failure 400 {object} user.result +// @Router /chat/send_msg [post] func UserSendMsg(c *gin.Context) { params := paramsUserSendMsg{} if err := c.BindJSON(¶ms); err != nil { @@ -72,7 +90,7 @@ func UserSendMsg(c *gin.Context) { pbData := newUserSendMsgReq(token, ¶ms) log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + etcdConn := getcdv3.GetOfflineMessageConn() client := pbChat.NewChatClient(etcdConn) log.Info("", "", "api UserSendMsg call, api call rpc...") diff --git a/internal/api/friend/add_blacklist.go b/internal/api/friend/add_blacklist.go index e0969faf3..350981b9b 100644 --- a/internal/api/friend/add_blacklist.go +++ b/internal/api/friend/add_blacklist.go @@ -1,26 +1,31 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" -) -/* -type paramsAddBlackList struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` -}*/ + "github.com/gin-gonic/gin" +) +// @Summary +// @Schemes +// @Description add a user into black list +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsSearchFriend true "add black list params" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/add_blacklist [post] func AddBlacklist(c *gin.Context) { log.Info("", "", "api add blacklist init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/add_friend.go b/internal/api/friend/add_friend.go index d949df083..1e7017982 100644 --- a/internal/api/friend/add_friend.go +++ b/internal/api/friend/add_friend.go @@ -1,33 +1,52 @@ package friend import ( - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbFriend "Open_IM/pkg/proto/friend" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsImportFriendReq struct type paramsImportFriendReq struct { OperationID string `json:"operationID" binding:"required"` UIDList []string `json:"uidList" binding:"required"` OwnerUid string `json:"ownerUid" binding:"required"` } +// resultImportFriend struct +type resultImportFriend struct { + ErrCode int `json:"errCode" example:"0"` + ErrMsg string `json:"errMsg" example:"error"` + FailedUidList []string `json:"failedUidList" example: []` +} + +// paramsAddFriend struct type paramsAddFriend struct { OperationID string `json:"operationID" binding:"required"` UID string `json:"uid" binding:"required"` ReqMessage string `json:"reqMessage"` } -// +// @Summary +// @Schemes +// @Description import friend +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsImportFriendReq true "import friend params" +// @Param token header string true "token" +// @Success 200 {object} friend.resultImportFriend +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/import_friend [post] func ImportFriend(c *gin.Context) { log.Info("", "", "ImportFriend init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) params := paramsImportFriendReq{} @@ -53,10 +72,22 @@ func ImportFriend(c *gin.Context) { log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String()) } +// @Summary +// @Schemes +// @Description add a new friend by uid +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsAddFriend true "add friend params" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/add_friend [post] func AddFriend(c *gin.Context) { log.Info("", "", "api add friend init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) params := paramsAddFriend{} diff --git a/internal/api/friend/add_friend_response.go b/internal/api/friend/add_friend_response.go index 37e801b3e..e6e3a5b62 100644 --- a/internal/api/friend/add_friend_response.go +++ b/internal/api/friend/add_friend_response.go @@ -1,27 +1,39 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" "fmt" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsAddFriendResponse struct type paramsAddFriendResponse struct { OperationID string `json:"operationID" binding:"required"` UID string `json:"uid" binding:"required"` Flag int32 `json:"flag" binding:"required"` } +// @Summary +// @Schemes +// @Description the response of adding friend +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsAddFriendResponse true "response of adding friend" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/add_friend_response [post] func AddFriendResponse(c *gin.Context) { log.Info("", "", fmt.Sprintf("api add friend response init ....")) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/delete_friend.go b/internal/api/friend/delete_friend.go index 4bdbedeee..c7c16de4e 100644 --- a/internal/api/friend/delete_friend.go +++ b/internal/api/friend/delete_friend.go @@ -1,26 +1,38 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" "fmt" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsDeleteFriend struct type paramsDeleteFriend struct { OperationID string `json:"operationID" binding:"required"` UID string `json:"uid" binding:"required"` } +// @Summary +// @Schemes +// @Description delete friend +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsSearchFriend true "delete friend params" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/delete_friend [post] func DeleteFriend(c *gin.Context) { log.Info("", "", fmt.Sprintf("api delete_friend init ....")) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/get_blcaklist.go b/internal/api/friend/get_blcaklist.go index 5e875a5e8..2684e56ab 100644 --- a/internal/api/friend/get_blcaklist.go +++ b/internal/api/friend/get_blcaklist.go @@ -1,21 +1,22 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" "fmt" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsGetBlackList struct type paramsGetBlackList struct { OperationID string `json:"operationID" binding:"required"` } +// blackListUserInfo struct type blackListUserInfo struct { UID string `json:"uid"` Name string `json:"name"` @@ -27,10 +28,22 @@ type blackListUserInfo struct { Ex string `json:"ex"` } +// @Summary +// @Schemes +// @Description get black list +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsSearchFriend true "get black list" +// @Param token header string true "token" +// @Success 200 {object} user.result{data=[]friend.blackListUserInfo} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/get_blacklist [post] func GetBlacklist(c *gin.Context) { log.Info("", "", "api get blacklist init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/get_friend_apply_list.go b/internal/api/friend/get_friend_apply_list.go index d7ca192e4..822eb12c5 100644 --- a/internal/api/friend/get_friend_apply_list.go +++ b/internal/api/friend/get_friend_apply_list.go @@ -1,19 +1,21 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsGetApplyList struct type paramsGetApplyList struct { OperationID string `json:"operationID" binding:"required"` } + +// UserInfo struct type UserInfo struct { UID string `json:"uid"` Name string `json:"name"` @@ -28,10 +30,22 @@ type UserInfo struct { Flag int32 `json:"flag"` } +// @Summary +// @Schemes +// @Description get friend apply list +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsGetApplyList true "get friend apply list" +// @Param token header string true "token" +// @Success 200 {object} user.result{data=[]friend.UserInfo} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/get_friend_apply_list [post] func GetFriendApplyList(c *gin.Context) { log.Info("", "", "api get_friend_apply_list init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() @@ -78,10 +92,22 @@ func GetFriendApplyList(c *gin.Context) { log.InfoByArgs("api get friend apply list success return,get args=%s,return args=%s", req.String(), RpcResp.String()) } +// @Summary +// @Schemes +// @Description get self friend apply list +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsGetApplyList true "get self friend apply list" +// @Param token header string true "token" +// @Success 200 {object} user.result{data=[]friend.UserInfo} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/get_self_apply_list [post] func GetSelfApplyList(c *gin.Context) { log.Info("", "", "api get self friend apply list init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/get_friend_list.go b/internal/api/friend/get_friend_list.go index db1361572..de8b23215 100644 --- a/internal/api/friend/get_friend_list.go +++ b/internal/api/friend/get_friend_list.go @@ -1,21 +1,22 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" "fmt" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsGetFriendLIst struct type paramsGetFriendLIst struct { OperationID string `json:"operationID" binding:"required"` } +// friendInfo struct type friendInfo struct { UID string `json:"uid"` Name string `json:"name"` @@ -29,10 +30,22 @@ type friendInfo struct { IsInBlackList int32 `json:"isInBlackList"` } +// @Summary +// @Schemes +// @Description get friend apply list +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsGetFriendLIst true "get friend apply list" +// @Param token header string true "token" +// @Success 200 {object} user.result{data=[]friend.friendInfo} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/get_friend_list [post] func GetFriendList(c *gin.Context) { log.Info("", "", fmt.Sprintf("api get_friendlist init ....")) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/get_friends_info.go b/internal/api/friend/get_friends_info.go index 47ee88a10..d16d4ed1f 100644 --- a/internal/api/friend/get_friends_info.go +++ b/internal/api/friend/get_friends_info.go @@ -1,26 +1,50 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" "fmt" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsSearchFriend struct type paramsSearchFriend struct { OperationID string `json:"operationID" binding:"required"` UID string `json:"uid" binding:"required"` OwnerUid string `json:"ownerUid"` } +// resultFriendInfo struct +type resultFriendInfo struct { + UID string `json:"uid"` + Name string `json:"name"` + Icon string `json:"icon"` + Gender int32 `json:"gender"` + Mobile string `json:"mobile"` + Birth string `json:"birth"` + Email string `json:"email"` + Ex string `json:"ex"` + Comment string `json:"comment"` +} + +// @Summary +// @Schemes +// @Description get friend info +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsSearchFriend true "search friend params" +// @Param token header string true "token" +// @Success 200 {object} user.result{data=friend.resultFriendInfo} +// @Failure 200 {object} user.result +// @Router /friend/get_friends_info [post] func GetFriendsInfo(c *gin.Context) { log.Info("", "", fmt.Sprintf("api search friend init ....")) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/is_friend.go b/internal/api/friend/is_friend.go index 2e856b558..1cae7c451 100644 --- a/internal/api/friend/is_friend.go +++ b/internal/api/friend/is_friend.go @@ -1,25 +1,37 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsIsFriend struct type paramsIsFriend struct { OperationID string `json:"operationID" binding:"required"` ReceiveUid string `json:"receive_uid"` } +// @Summary +// @Schemes +// @Description check is friend +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsSearchFriend true "is friend params" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/is_friend [post] func IsFriend(c *gin.Context) { log.Info("", "", "api is friend init....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/remove_blacklist.go b/internal/api/friend/remove_blacklist.go index 57a018513..4aad89c14 100644 --- a/internal/api/friend/remove_blacklist.go +++ b/internal/api/friend/remove_blacklist.go @@ -1,25 +1,37 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsRemoveBlackList struct type paramsRemoveBlackList struct { OperationID string `json:"operationID" binding:"required"` UID string `json:"uid" binding:"required"` } +// @Summary +// @Schemes +// @Description remove black list +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsSearchFriend true "remove black list params" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/remove_blacklist [post] func RemoveBlacklist(c *gin.Context) { log.Info("", "", "api remove_blacklist init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/friend/set_friend_comment.go b/internal/api/friend/set_friend_comment.go index e16f7e598..1300a0693 100644 --- a/internal/api/friend/set_friend_comment.go +++ b/internal/api/friend/set_friend_comment.go @@ -1,26 +1,38 @@ package friend import ( - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsSetFriendComment struct type paramsSetFriendComment struct { OperationID string `json:"operationID" binding:"required"` UID string `json:"uid" binding:"required"` Comment string `json:"comment"` } +// @Summary +// @Schemes +// @Description set friend comment +// @Tags friend +// @Accept json +// @Produce json +// @Param body body friend.paramsSetFriendComment true "set friend comment" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /friend/set_friend_comment [post] func SetFriendComment(c *gin.Context) { log.Info("", "", "api set friend comment init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/group/create_group.go b/internal/api/group/create_group.go index fd9cc14f7..95969b7e4 100644 --- a/internal/api/group/create_group.go +++ b/internal/api/group/create_group.go @@ -1,16 +1,28 @@ package group import ( - pb "Open_IM/pkg/proto/group" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pb "Open_IM/pkg/proto/group" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsCreateGroup struct +type paramsCreateGroup struct { + MemberList struct { + Uid string `json:"uid"` + SetRole string `json:"setRole,omitempty"` + } `json:"memberList"` + GroupName string `json:"groupName"` + Introduction string `json:"introduction"` + Notification string `json:"notification"` + FaceUrl string `json:"faceUrl"` + OperationID string `json:"operationID" binding:"required"` + Ex string `json:"ex"` +} type paramsCreateGroupStruct struct { MemberList []*pb.GroupAddMemberInfo `json:"memberList"` GroupName string `json:"groupName"` @@ -21,10 +33,22 @@ type paramsCreateGroupStruct struct { Ex string `json:"ex"` } +// @Summary +// @Schemes +// @Description create group +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsCreateGroup true "create group params" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/create_group [post] func CreateGroup(c *gin.Context) { log.Info("", "", "api create group init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/group/get_group_applicationList.go b/internal/api/group/get_group_applicationList.go index faceb921e..1abf57082 100644 --- a/internal/api/group/get_group_applicationList.go +++ b/internal/api/group/get_group_applicationList.go @@ -1,17 +1,17 @@ package group import ( - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/group" "Open_IM/pkg/utils" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsGroupApplicationList struct type paramsGroupApplicationList struct { OperationID string `json:"operationID" binding:"required"` } @@ -23,6 +23,7 @@ func newUserRegisterReq(params *paramsGroupApplicationList) *group.GetGroupAppli return &pbData } +// paramsGroupApplicationListRet struct type paramsGroupApplicationListRet struct { ID string `json:"id"` GroupID string `json:"groupID"` @@ -42,9 +43,27 @@ type paramsGroupApplicationListRet struct { HandleResult int32 `json:"handleResult"` } +// resultGroupApplication struct +type resultGroupApplication struct { + Count int `json:"count"` + User []paramsGroupApplicationListRet `json:"user"` +} + +// @Summary +// @Schemes +// @Description get group application list +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsGroupApplicationList true "get group application list params" +// @Param token header string true "token" +// @Success 200 {object} user.result{data=group.resultGroupApplication} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/get_group_applicationList [post] func GetGroupApplicationList(c *gin.Context) { log.Info("", "", "api GetGroupApplicationList init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := group.NewGroupClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/group/get_groups_info.go b/internal/api/group/get_groups_info.go index b2825485a..9babb56f8 100644 --- a/internal/api/group/get_groups_info.go +++ b/internal/api/group/get_groups_info.go @@ -1,14 +1,13 @@ package group import ( - pb "Open_IM/pkg/proto/group" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pb "Open_IM/pkg/proto/group" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) type paramsGetGroupInfo struct { @@ -16,10 +15,22 @@ type paramsGetGroupInfo struct { OperationID string `json:"operationID" binding:"required"` } +// @Summary +// @Schemes +// @Description get groups info +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsGetGroupInfo true "get groups info params" +// @Param token header string true "token" +// @Success 200 {object} user.result{data=[]group.GroupInfo} +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/get_groups_info [post] func GetGroupsInfo(c *gin.Context) { log.Info("", "", "api get groups info init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/group/group.go b/internal/api/group/group.go index e26d235b2..dbe300453 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -1,17 +1,19 @@ package group import ( - pb "Open_IM/pkg/proto/group" "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pb "Open_IM/pkg/proto/group" "context" "fmt" - "github.com/gin-gonic/gin" "net/http" "strings" + + "github.com/gin-gonic/gin" ) +// InviteUserToGroupReq struct type InviteUserToGroupReq struct { GroupID string `json:"groupID" binding:"required"` UidList []string `json:"uidList" binding:"required"` @@ -19,10 +21,25 @@ type InviteUserToGroupReq struct { OperationID string `json:"operationID" binding:"required"` } +// GetJoinedGroupListReq struct type GetJoinedGroupListReq struct { OperationID string `json:"operationID" binding:"required"` } +// paramsKickGroupMember struct +type paramsKickGroupMember struct { + GroupID string `json:"groupID"` + UidListInfo []struct { + UserId string `json:"userId,omitempty"` + Role int32 `json:"role,omitempty"` + JoinTime uint64 `json:"joinTime,omitempty"` + NickName string `json:"nickName,omitempty"` + FaceUrl string `json:"faceUrl,omitempty"` + } `json:"uidListInfo" binding:"required"` + Reason string `json:"reason"` + OperationID string `json:"operationID" binding:"required"` +} + type KickGroupMemberReq struct { GroupID string `json:"groupID"` UidListInfo []*pb.GroupMemberFullInfo `json:"uidListInfo" binding:"required"` @@ -30,10 +47,22 @@ type KickGroupMemberReq struct { OperationID string `json:"operationID" binding:"required"` } +// @Summary +// @Schemes +// @Description kick member from group +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsKickGroupMember true "kick member from group params" +// @Param token header string true "token" +// @Success 200 {object} group.KickGroupMemberResp +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/kick_group [post] func KickGroupMember(c *gin.Context) { log.Info("", "", "KickGroupMember start....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) params := KickGroupMemberReq{} @@ -58,6 +87,7 @@ func KickGroupMember(c *gin.Context) { return } + // KickGroupMemberResp struct type KickGroupMemberResp struct { ErrorCode int32 `json:"errCode"` ErrorMsg string `json:"errMsg"` @@ -75,21 +105,36 @@ func KickGroupMember(c *gin.Context) { c.JSON(http.StatusOK, memberListResp) } +// GetGroupMembersInfoReq struct type GetGroupMembersInfoReq struct { GroupID string `json:"groupID"` MemberList []string `json:"memberList"` OperationID string `json:"operationID"` } + +// GetGroupMembersInfoResp struct type GetGroupMembersInfoResp struct { ErrorCode int32 `json:"errCode"` ErrorMsg string `json:"errMsg"` Data []MemberResult `json:"data"` } +// @Summary +// @Schemes +// @Description get group members info +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.GetGroupMembersInfoReq true "get group members info params" +// @Param token header string true "token" +// @Success 200 {object} group.GetGroupMembersInfoResp +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/get_group_members_info [post] func GetGroupMembersInfo(c *gin.Context) { log.Info("", "", "GetGroupMembersInfo start....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) params := GetGroupMembersInfoReq{} @@ -128,17 +173,21 @@ func GetGroupMembersInfo(c *gin.Context) { c.JSON(http.StatusOK, memberListResp) } +// GetGroupMemberListReq struct type GetGroupMemberListReq struct { GroupID string `json:"groupID"` Filter int32 `json:"filter"` - NextSeq int32 `json:"nextSeq"` + NextSeq int32 `json:"nextSeq,omitempty"` OperationID string `json:"operationID"` } + +// getGroupAllMemberReq struct type getGroupAllMemberReq struct { GroupID string `json:"groupID"` OperationID string `json:"operationID"` } +// MemberResult struct type MemberResult struct { GroupId string `json:"groupID"` UserId string `json:"userId"` @@ -148,10 +197,22 @@ type MemberResult struct { FaceUrl string `json:"faceUrl"` } +// @Summary +// @Schemes +// @Description get group member list +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.GetGroupMemberListReq true "get group member list params" +// @Param token header string true "token" +// @Success 200 {object} group.GetGroupMemberListResp +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/get_group_member_list [post] func GetGroupMemberList(c *gin.Context) { log.Info("", "", "GetGroupMemberList start....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) params := GetGroupMemberListReq{} @@ -174,6 +235,7 @@ func GetGroupMemberList(c *gin.Context) { return } + // GetGroupMemberListResp struct type GetGroupMemberListResp struct { ErrorCode int32 `json:"errCode"` ErrorMsg string `json:"errMsg"` @@ -198,10 +260,22 @@ func GetGroupMemberList(c *gin.Context) { } +// @Summary +// @Schemes +// @Description get group all members +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.getGroupAllMemberReq true "get group all members params" +// @Param token header string true "token" +// @Success 200 {object} group.GetGroupMemberListResp +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/get_group_all_member_list [post] func GetGroupAllMember(c *gin.Context) { log.Info("", "", "GetGroupAllMember start....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) params := getGroupAllMemberReq{} @@ -222,6 +296,7 @@ func GetGroupAllMember(c *gin.Context) { return } + // GetGroupMemberListResp struct type GetGroupMemberListResp struct { ErrorCode int32 `json:"errCode"` ErrorMsg string `json:"errMsg"` @@ -243,6 +318,7 @@ func GetGroupAllMember(c *gin.Context) { c.JSON(http.StatusOK, memberListResp) } +// groupResult struct type groupResult struct { GroupId string `json:"groupId"` GroupName string `json:"groupName"` @@ -254,10 +330,22 @@ type groupResult struct { MemberCount uint32 `json:"memberCount"` } +// @Summary +// @Schemes +// @Description get joined group list +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.GetJoinedGroupListReq true "get joined group list params" +// @Param token header string true "token" +// @Success 200 {object} group.GetJoinedGroupListResp +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/get_joined_group_list [post] func GetJoinedGroupList(c *gin.Context) { log.Info("", "", "GetJoinedGroupList start....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() fmt.Println("config: ", etcdConn, config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) client := pb.NewGroupClient(etcdConn) @@ -280,6 +368,7 @@ func GetJoinedGroupList(c *gin.Context) { } log.Info(req.Token, req.OperationID, "GetJoinedGroupList: ", RpcResp) + // GetJoinedGroupListResp struct type GetJoinedGroupListResp struct { ErrorCode int32 `json:"errCode"` ErrorMsg string `json:"errMsg"` @@ -302,14 +391,27 @@ func GetJoinedGroupList(c *gin.Context) { c.JSON(http.StatusOK, GroupListResp) } +// Id2Result struct type Id2Result struct { UId string `json:"uid"` Result int32 `json:"result"` } +// @Summary +// @Schemes +// @Description invite user to group +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.InviteUserToGroupReq true "invite user to group params" +// @Param token header string true "token" +// @Success 200 {object} group.InviteUserToGroupResp +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/invite_user_to_group [post] func InviteUserToGroup(c *gin.Context) { log.Info("", "", "InviteUserToGroup start....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) params := InviteUserToGroupReq{} @@ -333,6 +435,7 @@ func InviteUserToGroup(c *gin.Context) { return } + // InviteUserToGroupResp struct type InviteUserToGroupResp struct { ErrorCode int32 `json:"errCode"` ErrorMsg string `json:"errMsg"` diff --git a/internal/api/group/group_application_response.go b/internal/api/group/group_application_response.go index 70dd966eb..b387096a9 100644 --- a/internal/api/group/group_application_response.go +++ b/internal/api/group/group_application_response.go @@ -1,17 +1,17 @@ package group import ( - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/group" "Open_IM/pkg/utils" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsGroupApplicationResponse struct type paramsGroupApplicationResponse struct { OperationID string `json:"operationID" binding:"required"` GroupID string `json:"groupID" binding:"required"` @@ -49,9 +49,21 @@ func newGroupApplicationResponse(params *paramsGroupApplicationResponse) *group. return &pbData } +// @Summary +// @Schemes +// @Description response of application group +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsGroupApplicationResponse true "application group param" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/group_application_response [post] func ApplicationGroupResponse(c *gin.Context) { log.Info("", "", "api GroupApplicationResponse init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := group.NewGroupClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/group/join_group.go b/internal/api/group/join_group.go index 5e85e288e..a3e00e3aa 100644 --- a/internal/api/group/join_group.go +++ b/internal/api/group/join_group.go @@ -1,26 +1,38 @@ package group import ( - pb "Open_IM/pkg/proto/group" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pb "Open_IM/pkg/proto/group" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsJoinGroup struct type paramsJoinGroup struct { GroupID string `json:"groupID" binding:"required"` Message string `json:"message"` OperationID string `json:"operationID" binding:"required"` } +// @Summary +// @Schemes +// @Description join group +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsJoinGroup true "join group params" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/set_group_info [post] func JoinGroup(c *gin.Context) { log.Info("", "", "api join group init....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/group/quit_group.go b/internal/api/group/quit_group.go index 1caea9d0a..3e138691c 100644 --- a/internal/api/group/quit_group.go +++ b/internal/api/group/quit_group.go @@ -1,25 +1,37 @@ package group import ( - pb "Open_IM/pkg/proto/group" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pb "Open_IM/pkg/proto/group" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsQuitGroup struct type paramsQuitGroup struct { GroupID string `json:"groupID" binding:"required"` OperationID string `json:"operationID" binding:"required"` } +// @Summary +// @Schemes +// @Description quit group +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsQuitGroup true "quit group" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/set_group_info [post] func QuitGroup(c *gin.Context) { log.Info("", "", "api quit group init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/group/set_group_info.go b/internal/api/group/set_group_info.go index 03a3f8c43..80b3ac61d 100644 --- a/internal/api/group/set_group_info.go +++ b/internal/api/group/set_group_info.go @@ -1,16 +1,16 @@ package group import ( - pb "Open_IM/pkg/proto/group" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pb "Open_IM/pkg/proto/group" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsSetGroupInfo struct type paramsSetGroupInfo struct { GroupID string `json:"groupId" binding:"required"` GroupName string `json:"groupName"` @@ -20,10 +20,22 @@ type paramsSetGroupInfo struct { OperationID string `json:"operationID" binding:"required"` } +// @Summary +// @Schemes +// @Description set group info +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsSetGroupInfo true "set group info params" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/set_group_info [post] func SetGroupInfo(c *gin.Context) { log.Info("", "", "api set group info init...") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pb.NewGroupClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/group/transfer_group_owner.go b/internal/api/group/transfer_group_owner.go index f7baaba3f..f3fdf2152 100644 --- a/internal/api/group/transfer_group_owner.go +++ b/internal/api/group/transfer_group_owner.go @@ -1,17 +1,17 @@ package group import ( - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/group" "Open_IM/pkg/utils" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsTransferGroupOwner struct type paramsTransferGroupOwner struct { OperationID string `json:"operationID" binding:"required"` GroupID string `json:"groupID" binding:"required"` @@ -27,9 +27,21 @@ func newTransferGroupOwnerReq(params *paramsTransferGroupOwner) *group.TransferG return &pbData } +// @Summary +// @Schemes +// @Description transfer group owner +// @Tags group +// @Accept json +// @Produce json +// @Param body body group.paramsTransferGroupOwner true "transfer group owner param" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /group/transfer_group [post] func TransferGroupOwner(c *gin.Context) { log.Info("", "", "api TransferGroupOwner init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := group.NewGroupClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go index a398dce10..3523f4108 100644 --- a/internal/api/manage/management_chat.go +++ b/internal/api/manage/management_chat.go @@ -14,15 +14,16 @@ import ( pbChat "Open_IM/pkg/proto/chat" "Open_IM/pkg/utils" "context" + "net/http" + "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" "github.com/mitchellh/mapstructure" - "net/http" - "strings" ) var validate *validator.Validate +// paramsManagementSendMsg struct type paramsManagementSendMsg struct { OperationID string `json:"operationID" binding:"required"` SendID string `json:"sendID" binding:"required"` @@ -35,6 +36,14 @@ type paramsManagementSendMsg struct { SessionType int32 `json:"sessionType" binding:"required"` } +// sendMsgResult struct +type sendMsgResult struct { + ErrCode int `json:"errCode" example:"0"` + ErrMsg string `json:"errMsg" example:"error"` + SendTime int `json:"sendTime" example:0` + MsgID string `json:"msgID" example:""` +} + func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq { var newContent string switch params.ContentType { @@ -71,6 +80,19 @@ func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq { func init() { validate = validator.New() } + +// @Summary +// @Schemes +// @Description manage send message +// @Tags manage +// @Accept json +// @Produce json +// @Param body body manage.paramsManagementSendMsg true "manage send message" +// @Param token header string true "token" +// @Success 200 {object} manage.sendMsgResult +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /manager/send_msg [post] func ManagementSendMsg(c *gin.Context) { var data interface{} params := paramsManagementSendMsg{} @@ -117,7 +139,7 @@ func ManagementSendMsg(c *gin.Context) { pbData := newUserSendMsgReq(¶ms) log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + etcdConn := getcdv3.GetOfflineMessageConn() client := pbChat.NewChatClient(etcdConn) log.Info("", "", "api ManagementSendMsg call, api call rpc...") diff --git a/internal/api/manage/management_user.go b/internal/api/manage/management_user.go index cd43fd59b..aa7d76398 100644 --- a/internal/api/manage/management_user.go +++ b/internal/api/manage/management_user.go @@ -7,24 +7,52 @@ package manage import ( - pbUser "Open_IM/pkg/proto/user" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbUser "Open_IM/pkg/proto/user" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// paramsDeleteUsers struct type paramsDeleteUsers struct { OperationID string `json:"operationID" binding:"required"` DeleteUidList []string `json:"deleteUidList" binding:"required"` } + +// paramsGetAllUsersUid struct type paramsGetAllUsersUid struct { OperationID string `json:"operationID" binding:"required"` } +// deleteUserResult struct +type deleteUserResult struct { + ErrCode int `json:"errCode" example:"0"` + ErrMsg string `json:"errMsg" example:"error"` + FailedUidList []string `json:"failedUidList" example:[]` +} + +// uidListResult struct +type uidListResult struct { + ErrCode int `json:"errCode" example:"0"` + ErrMsg string `json:"errMsg" example:"error"` + UidList []string `json:"uidList" example:[]` +} + +// @Summary +// @Schemes +// @Description delete user +// @Tags manage +// @Accept json +// @Produce json +// @Param body body manage.paramsDeleteUsers true "user to be deleted" +// @Param token header string true "token" +// @Success 200 {object} manage.deleteUserResult +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /manager/delete_user [post] func DeleteUser(c *gin.Context) { params := paramsDeleteUsers{} if err := c.BindJSON(¶ms); err != nil { @@ -32,7 +60,7 @@ func DeleteUser(c *gin.Context) { return } log.InfoByKv("DeleteUser req come here", params.OperationID, "DeleteUidList", params.DeleteUidList) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) + etcdConn := getcdv3.GetUserConn() client := pbUser.NewUserClient(etcdConn) //defer etcdConn.Close() @@ -51,6 +79,18 @@ func DeleteUser(c *gin.Context) { resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList} c.JSON(http.StatusOK, resp) } + +// @Summary +// @Schemes +// @Description get all user ids +// @Tags manage +// @Accept json +// @Produce json +// @Param body body manage.paramsGetAllUsersUid true "all user ids" +// @Param token header string true "token" +// @Success 200 {object} manage.uidListResult +// @Failure 500 {object} manage.uidListResult +// @Router /manager/get_all_users_uid [post] func GetAllUsersUid(c *gin.Context) { params := paramsGetAllUsersUid{} if err := c.BindJSON(¶ms); err != nil { @@ -58,7 +98,7 @@ func GetAllUsersUid(c *gin.Context) { return } log.InfoByKv("GetAllUsersUid req come here", params.OperationID) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) + etcdConn := getcdv3.GetUserConn() client := pbUser.NewUserClient(etcdConn) //defer etcdConn.Close() diff --git a/internal/api/third/tencent_cloud_storage_credential.go b/internal/api/third/tencent_cloud_storage_credential.go index af68d8fd8..20c458c4d 100644 --- a/internal/api/third/tencent_cloud_storage_credential.go +++ b/internal/api/third/tencent_cloud_storage_credential.go @@ -3,20 +3,43 @@ package apiThird import ( "Open_IM/pkg/common/config" log2 "Open_IM/pkg/common/log" - "github.com/gin-gonic/gin" - sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" "net/http" "time" + + "github.com/gin-gonic/gin" + sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" ) +// paramsTencentCloudStorageCredential struct type paramsTencentCloudStorageCredential struct { Token string `json:"token"` OperationID string `json:"operationID"` } +// resultTencentCredential struct +type resultTencentCredential struct { + ErrCode int `json:"errCode` + ErrMsg string `json:"errMsg"` + Region string `json:"region"` + Bucket string `json:"bucket"` + Data interface{} `json:"data"` +} + var lastTime int64 var lastRes *sts.CredentialResult +// @Summary +// @Schemes +// @Description get Tencent cloud storage credential +// @Tags third +// @Accept json +// @Produce json +// @Param body body apiThird.paramsTencentCloudStorageCredential true "get Tencent cloud storage credential params" +// @Param token header string true "token" +// @Success 200 {object} apiThird.resultTencentCredential +// @Failure 400 {object} user.result +// @Failure 500 {object} user.result +// @Router /third/user_register [post] func TencentCloudStorageCredential(c *gin.Context) { params := paramsTencentCloudStorageCredential{} if err := c.BindJSON(¶ms); err != nil { diff --git a/internal/api/user/get_user_info.go b/internal/api/user/get_user_info.go index 4e93787b5..209f9f0f3 100644 --- a/internal/api/user/get_user_info.go +++ b/internal/api/user/get_user_info.go @@ -1,16 +1,23 @@ package user import ( - pbUser "Open_IM/pkg/proto/user" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbUser "Open_IM/pkg/proto/user" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) +// result struct +type result struct { + ErrCode int `json:"errCode" example:"0"` + ErrMsg string `json:"errMsg" example:"error"` + Data interface{} `json:"data,omitempty"` +} + +// userInfo struct type userInfo struct { UID string `json:"uid"` Name string `json:"name"` @@ -22,14 +29,30 @@ type userInfo struct { Ex string `json:"ex"` } +// queryUserInfoParam struct +type queryUserInfoParam struct { + OperationID string `json:"operationID" binding:"required"` + UIDList []string `json:"uidList"` +} + +// @Summary +// @Description get user info by uid list +// @Tags user +// @Accept json +// @Produce json +// @Param body body user.queryUserInfoParam true "get userInfo by uidList" +// @Param token header string true "token" +// @Success 200 {object} user.result{data=[]user.userInfo} +// @Failure 400 {object} user.result +// @Router /user/get_user_info [post] func GetUserInfo(c *gin.Context) { log.InfoByKv("api get userinfo init...", "") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) + etcdConn := getcdv3.GetUserConn() client := pbUser.NewUserClient(etcdConn) //defer etcdConn.Close() - params := paramsStruct{} + params := queryUserInfoParam{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return @@ -44,8 +67,8 @@ func GetUserInfo(c *gin.Context) { if err != nil { log.Error(req.Token, req.OperationID, "err=%s,call get user info rpc server failed", err) c.JSON(http.StatusInternalServerError, gin.H{ - "errorCode": 500, - "errorMsg": "call rpc server failed", + "errCode": 500, + "errMsg": "call rpc server failed", }) return } diff --git a/internal/api/user/get_user_info_test.go b/internal/api/user/get_user_info_test.go new file mode 100644 index 000000000..c8329d761 --- /dev/null +++ b/internal/api/user/get_user_info_test.go @@ -0,0 +1,31 @@ +package user + +import ( + "bytes" + "net/http" + "net/http/httptest" + "testing" + + "github.com/gin-gonic/gin" + "github.com/stretchr/testify/assert" +) + +func init() { + gin.SetMode(gin.TestMode) +} + +func Test_UserRegister(t *testing.T) { + res := httptest.NewRecorder() + c, _ := gin.CreateTestContext(res) + c.Request, _ = http.NewRequest("POST", "/", bytes.NewBufferString(`{"uidList": []}`)) + + GetUserInfo(c) + assert.Equal(t, 400, res.Code) + + res = httptest.NewRecorder() + c, _ = gin.CreateTestContext(res) + c.Request, _ = http.NewRequest("POST", "/", bytes.NewBufferString(`{"operationID": "1", "uidList": []}`)) + + GetUserInfo(c) + assert.Equal(t, 200, res.Code) +} diff --git a/internal/api/user/update_user_info.go b/internal/api/user/update_user_info.go index 1bcc32117..f4a1a3cfd 100644 --- a/internal/api/user/update_user_info.go +++ b/internal/api/user/update_user_info.go @@ -1,38 +1,46 @@ package user import ( - pbUser "Open_IM/pkg/proto/user" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbUser "Open_IM/pkg/proto/user" "context" - "github.com/gin-gonic/gin" "net/http" - "strings" + + "github.com/gin-gonic/gin" ) -type paramsStruct struct { - OperationID string `json:"operationID" binding:"required"` - UIDList []string `json:"uidList"` - Platform int32 `json:"platform"` - Name string `json:"name"` - Icon string `json:"icon"` - Gender int32 `json:"gender"` - Mobile string `json:"mobile"` - Birth string `json:"birth"` - Email string `json:"email"` - Ex string `json:"ex"` - Uid string `json:"uid"` +// updateUserInfoParam struct +type updateUserInfoParam struct { + OperationID string `json:"operationID" binding:"required"` + Name string `json:"name"` + Icon string `json:"icon"` + Gender int32 `json:"gender"` + Mobile string `json:"mobile"` + Birth string `json:"birth"` + Email string `json:"email"` + Ex string `json:"ex"` + Uid string `json:"uid"` } +// @Summary +// @Description update user info +// @Tags user +// @Accept json +// @Produce json +// @Param body body user.updateUserInfoParam true "new user info" +// @Param token header string true "token" +// @Success 200 {object} user.result +// @Failure 500 {object} user.result +// @Router /user/update_user_info [post] func UpdateUserInfo(c *gin.Context) { log.InfoByKv("api update userinfo init...", "") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) + etcdConn := getcdv3.GetUserConn() client := pbUser.NewUserClient(etcdConn) //defer etcdConn.Close() - params := paramsStruct{} + params := updateUserInfoParam{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return diff --git a/internal/msg_gateway/gate/logic.go b/internal/msg_gateway/gate/logic.go index 9eadb529e..3f7f14cf5 100644 --- a/internal/msg_gateway/gate/logic.go +++ b/internal/msg_gateway/gate/logic.go @@ -1,7 +1,6 @@ package gate import ( - "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" @@ -12,10 +11,10 @@ import ( "context" "encoding/gob" "encoding/json" + "runtime" + "github.com/golang/protobuf/proto" "github.com/gorilla/websocket" - "runtime" - "strings" ) func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) { @@ -69,7 +68,7 @@ func (ws *WServer) getSeqReq(conn *UserConn, m *Req) { nReply := new(pbChat.GetMaxAndMinSeqResp) pbData.UserID = m.SendID pbData.OperationID = m.OperationID - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + grpcConn := getcdv3.GetOfflineMessageConn() if grpcConn == nil { log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", m) } @@ -110,7 +109,7 @@ func (ws *WServer) pullMsgReq(conn *UserConn, m *Req) { pbData.OperationID = m.OperationID pbData.SeqBegin = data.(SeqData).SeqBegin pbData.SeqEnd = data.(SeqData).SeqEnd - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + grpcConn := getcdv3.GetOfflineMessageConn() msgClient := pbChat.NewChatClient(grpcConn) reply, err := msgClient.PullMessage(context.Background(), &pbData) if err != nil { @@ -176,7 +175,7 @@ func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { pbData.SeqList = data.(open_im_sdk.PullMessageBySeqListReq).SeqList pbData.UserID = m.SendID pbData.OperationID = m.OperationID - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + grpcConn := getcdv3.GetOfflineMessageConn() msgClient := pbChat.NewChatClient(grpcConn) reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData) if err != nil { @@ -219,7 +218,7 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) { SendTime: sendTime, } log.NewInfo(m.OperationID, "Ws call success to sendMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, data) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + etcdConn := getcdv3.GetOfflineMessageConn() client := pbChat.NewChatClient(etcdConn) reply, err := client.UserSendMsg(context.Background(), &pbData) if err != nil { diff --git a/internal/msg_transfer/logic/history_msg_handler.go b/internal/msg_transfer/logic/history_msg_handler.go index e3b5efb05..9ae3c5a0f 100644 --- a/internal/msg_transfer/logic/history_msg_handler.go +++ b/internal/msg_transfer/logic/history_msg_handler.go @@ -10,9 +10,10 @@ import ( pbPush "Open_IM/pkg/proto/push" "Open_IM/pkg/utils" "context" + "strings" + "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" - "strings" ) type fcb func(msg []byte, msgKey string) @@ -138,7 +139,7 @@ func sendMessageToPush(message *pbMsg.MsgSvrToPushSvrChatMsg) { msg.SendTime = message.SendTime msg.MsgID = message.MsgID msg.OfflineInfo = message.OfflineInfo - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName) + grpcConn := getcdv3.GetPushConn() if grpcConn == nil { log.ErrorByKv("rpc dial failed", msg.OperationID, "push data", msg.String()) pid, offset, err := producer.SendMessage(message) diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index 8f5a004d9..e6754212c 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -19,7 +19,6 @@ import ( "Open_IM/pkg/utils" "context" "encoding/json" - "strings" ) type OpenIMContent struct { @@ -40,7 +39,7 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) { //isSenderSync := utils.GetSwitchFromOptions(MOptions, "senderSync") isOfflinePush := utils.GetSwitchFromOptions(MOptions, "offlinePush") log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData) - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) + grpcCons := getcdv3.GetOnlineMessageConn() //Online push message log.InfoByKv("test", sendPbData.OperationID, "len grpc", len(grpcCons), "data", sendPbData) for _, v := range grpcCons { @@ -120,7 +119,7 @@ func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) { sendMsgToKafka(m, m.SendID, "msgKey--sendID") sendMsgToKafka(m, m.RecvID, "msgKey--recvID") case constant.GroupChatType: - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pbGroup.NewGroupClient(etcdConn) req := &pbGroup.GetGroupAllMemberReq{ GroupID: m.RecvID, diff --git a/internal/rpc/chat/send_msg.go b/internal/rpc/chat/send_msg.go index 5cfc4ee71..3c31ab2dc 100644 --- a/internal/rpc/chat/send_msg.go +++ b/internal/rpc/chat/send_msg.go @@ -16,7 +16,6 @@ import ( "math/rand" "net/http" "strconv" - "strings" "time" ) @@ -103,7 +102,7 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (* } return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime) case constant.GroupChatType: - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + etcdConn := getcdv3.GetGroupConn() client := pbGroup.NewGroupClient(etcdConn) req := &pbGroup.GetGroupAllMemberReq{ GroupID: pbData.RecvID, diff --git a/internal/rpc/user/internal_service/get_user_info_to_client.go b/internal/rpc/user/internal_service/get_user_info_to_client.go index 4cd0d0d2d..bda770824 100644 --- a/internal/rpc/user/internal_service/get_user_info_to_client.go +++ b/internal/rpc/user/internal_service/get_user_info_to_client.go @@ -1,15 +1,13 @@ package internal_service import ( - pbUser "Open_IM/pkg/proto/user" - "Open_IM/pkg/common/config" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbUser "Open_IM/pkg/proto/user" "context" - "strings" ) func GetUserInfoClient(req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) { - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) + etcdConn := getcdv3.GetUserConn() client := pbUser.NewUserClient(etcdConn) RpcResp, err := client.GetUserInfo(context.Background(), req) return RpcResp, err diff --git a/internal/rpc/user/update_user_info.go b/internal/rpc/user/update_user_info.go index 14fe9f0db..dce22ab06 100644 --- a/internal/rpc/user/update_user_info.go +++ b/internal/rpc/user/update_user_info.go @@ -12,7 +12,6 @@ import ( pbUser "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" - "strings" ) func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserInfoReq) (*pbUser.CommonResp, error) { @@ -36,7 +35,7 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI log.Error(req.Token, req.OperationID, "update user some attribute failed,err=%s", err.Error()) return &pbUser.CommonResp{ErrorCode: config.ErrModifyUserInfo.ErrCode, ErrorMsg: config.ErrModifyUserInfo.ErrMsg}, nil } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + etcdConn := getcdv3.GetFriendConn() client := pbFriend.NewFriendClient(etcdConn) newReq := &pbFriend.GetFriendListReq{ OperationID: req.OperationID, diff --git a/pkg/grpc-etcdv3/getcdv3/resolver.go b/pkg/grpc-etcdv3/getcdv3/resolver.go index aa41f86c4..94e03aaf1 100644 --- a/pkg/grpc-etcdv3/getcdv3/resolver.go +++ b/pkg/grpc-etcdv3/getcdv3/resolver.go @@ -1,17 +1,21 @@ package getcdv3 import ( + "Open_IM/pkg/common/config" "context" "fmt" + "go.etcd.io/etcd/clientv3" "go.etcd.io/etcd/mvcc/mvccpb" + //"google.golang.org/genproto/googleapis/ads/googleads/v1/services" - "google.golang.org/grpc" - "google.golang.org/grpc/balancer/roundrobin" - "google.golang.org/grpc/resolver" "strings" "sync" "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/balancer/roundrobin" + "google.golang.org/grpc/resolver" ) type Resolver struct { @@ -88,6 +92,34 @@ func GetConn(schema, etcdaddr, serviceName string) *grpc.ClientConn { return r.grpcClientConn } +func GetAuthConn() *grpc.ClientConn { + return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) +} + +func GetOfflineMessageConn() *grpc.ClientConn { + return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) +} + +func GetFriendConn() *grpc.ClientConn { + return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) +} + +func GetGroupConn() *grpc.ClientConn { + return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) +} + +func GetUserConn() *grpc.ClientConn { + return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) +} + +func GetPushConn() *grpc.ClientConn { + return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName) +} + +func GetOnlineMessageConn() []*grpc.ClientConn { + return GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) +} + func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { if r.cli == nil { return nil, fmt.Errorf("etcd clientv3 client failed, etcd:%s", target) diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index fae312019..a17cc979c 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -163,6 +163,7 @@ func (m *CreateGroupReq) GetEx() string { return "" } +// GroupAddMemberInfo struct type GroupAddMemberInfo struct { Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` SetRole int32 `protobuf:"varint,2,opt,name=setRole" json:"setRole,omitempty"` @@ -1879,6 +1880,7 @@ func (m *GetJoinedGroupListReq) GetOperationID() string { return "" } +// GroupInfo struct type GroupInfo struct { GroupId string `protobuf:"bytes,1,opt,name=groupId" json:"groupId,omitempty"` GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"`