mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-10-31 00:12:18 +08:00 
			
		
		
		
	* feat: add openim server code Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo and redis env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add zk and redis mongo env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add kafka and redis mongo env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim docker Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim docker Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim docker Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim copyright Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix: docker compose Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix: remove openim chat config file Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim config set Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim config set Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix: fix Security vulnerability Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix: fix Security vulnerability Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix: docker compose Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * Update kubernetes.go * Update discoveryregister.go * fix: copyright-add Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
		
			
				
	
	
		
			72 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright © 2023 OpenIM. All rights reserved.
 | |
| //
 | |
| // Licensed under the Apache License, Version 2.0 (the "License");
 | |
| // you may not use this file except in compliance with the License.
 | |
| // You may obtain a copy of the License at
 | |
| //
 | |
| //     http://www.apache.org/licenses/LICENSE-2.0
 | |
| //
 | |
| // Unless required by applicable law or agreed to in writing, software
 | |
| // distributed under the License is distributed on an "AS IS" BASIS,
 | |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | |
| // See the License for the specific language governing permissions and
 | |
| // limitations under the License.
 | |
| 
 | |
| package user
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 
 | |
| 	gettoken "github.com/openimsdk/open-im-server/v3/test/e2e/api/token"
 | |
| 	"github.com/openimsdk/open-im-server/v3/test/e2e/framework/config"
 | |
| )
 | |
| 
 | |
| // UserInfoRequest represents a request to get or update user information.
 | |
| type UserInfoRequest struct {
 | |
| 	UserIDs  []string       `json:"userIDs,omitempty"`
 | |
| 	UserInfo *gettoken.User `json:"userInfo,omitempty"`
 | |
| }
 | |
| 
 | |
| // GetUsersOnlineStatusRequest represents a request to get users' online status.
 | |
| type GetUsersOnlineStatusRequest struct {
 | |
| 	UserIDs []string `json:"userIDs"`
 | |
| }
 | |
| 
 | |
| // GetUsersInfo retrieves detailed information for a list of user IDs.
 | |
| func GetUsersInfo(token string, userIDs []string) error {
 | |
| 
 | |
| 	url := fmt.Sprintf("http://%s:%s/user/get_users_info", config.LoadConfig().APIHost, config.LoadConfig().APIPort)
 | |
| 
 | |
| 	requestBody := UserInfoRequest{
 | |
| 		UserIDs: userIDs,
 | |
| 	}
 | |
| 	return sendPostRequestWithToken(url, token, requestBody)
 | |
| }
 | |
| 
 | |
| // UpdateUserInfo updates the information for a user.
 | |
| func UpdateUserInfo(token, userID, nickname, faceURL string) error {
 | |
| 
 | |
| 	url := fmt.Sprintf("http://%s:%s/user/update_user_info", config.LoadConfig().APIHost, config.LoadConfig().APIPort)
 | |
| 
 | |
| 	requestBody := UserInfoRequest{
 | |
| 		UserInfo: &gettoken.User{
 | |
| 			UserID:   userID,
 | |
| 			Nickname: nickname,
 | |
| 			FaceURL:  faceURL,
 | |
| 		},
 | |
| 	}
 | |
| 	return sendPostRequestWithToken(url, token, requestBody)
 | |
| }
 | |
| 
 | |
| // GetUsersOnlineStatus retrieves the online status for a list of user IDs.
 | |
| func GetUsersOnlineStatus(token string, userIDs []string) error {
 | |
| 
 | |
| 	url := fmt.Sprintf("http://%s:%s/user/get_users_online_status", config.LoadConfig().APIHost, config.LoadConfig().APIPort)
 | |
| 
 | |
| 	requestBody := GetUsersOnlineStatusRequest{
 | |
| 		UserIDs: userIDs,
 | |
| 	}
 | |
| 
 | |
| 	return sendPostRequestWithToken(url, token, requestBody)
 | |
| }
 |