You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/test/e2e/api/user/curd.go

44 lines
1.4 KiB

☀️ feat: Enhancing OpenIM with Integrated E2E Testing and CI/CD Enhancements (#1359) * cicd: robot automated Change * feat: add api test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add api test make file Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim e2e test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim e2e test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: Fixed some unused scripts and some names Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * docs: optimize openim docs Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add prom address Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim info test * feat: add openim images config path Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: fix tim file rename * fix: fix tim file rename * fix: fix tim file rename * fix: fix tim file rename * fix: add openim test e2e * feat: add openim test .keep Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim test .keep Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> Co-authored-by: cubxxw <cubxxw@users.noreply.github.com>
1 year ago
package user
import (
gettoken "github.com/openimsdk/open-im-server/v3/test/e2e/api/token"
)
// 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 {
requestBody := UserInfoRequest{
UserIDs: userIDs,
}
return sendPostRequestWithToken("http://your-api-host:port/user/get_users_info", token, requestBody)
}
// UpdateUserInfo updates the information for a user
func UpdateUserInfo(token, userID, nickname, faceURL string) error {
requestBody := UserInfoRequest{
UserInfo: &gettoken.User{
UserID: userID,
Nickname: nickname,
FaceURL: faceURL,
},
}
return sendPostRequestWithToken("http://your-api-host:port/user/update_user_info", token, requestBody)
}
// GetUsersOnlineStatus retrieves the online status for a list of user IDs
func GetUsersOnlineStatus(token string, userIDs []string) error {
requestBody := GetUsersOnlineStatusRequest{
UserIDs: userIDs,
}
return sendPostRequestWithToken("http://your-api-host:port/user/get_users_online_status", token, requestBody)
}