mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 11:05:59 +08:00
feat: add openim docker
Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// API endpoints and other constants
|
||||
// API endpoints and other constants.
|
||||
const (
|
||||
APIHost = "http://127.0.0.1:10002"
|
||||
UserTokenURL = APIHost + "/auth/user_token"
|
||||
@@ -18,27 +18,27 @@ const (
|
||||
OperationID = "1646445464564"
|
||||
)
|
||||
|
||||
// UserTokenRequest represents a request to get a user token
|
||||
// UserTokenRequest represents a request to get a user token.
|
||||
type UserTokenRequest struct {
|
||||
Secret string `json:"secret"`
|
||||
PlatformID int `json:"platformID"`
|
||||
UserID string `json:"userID"`
|
||||
}
|
||||
|
||||
// UserTokenResponse represents a response containing a user token
|
||||
// UserTokenResponse represents a response containing a user token.
|
||||
type UserTokenResponse struct {
|
||||
Token string `json:"token"`
|
||||
ErrCode int `json:"errCode"`
|
||||
}
|
||||
|
||||
// User represents user data for registration
|
||||
// User represents user data for registration.
|
||||
type User struct {
|
||||
UserID string `json:"userID"`
|
||||
Nickname string `json:"nickname"`
|
||||
FaceURL string `json:"faceURL"`
|
||||
}
|
||||
|
||||
// UserRegisterRequest represents a request to register a user
|
||||
// UserRegisterRequest represents a request to register a user.
|
||||
type UserRegisterRequest struct {
|
||||
Secret string `json:"secret"`
|
||||
Users []User `json:"users"`
|
||||
@@ -58,7 +58,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// GetUserToken requests a user token from the API
|
||||
// GetUserToken requests a user token from the API.
|
||||
func GetUserToken(userID string) (string, error) {
|
||||
reqBody := UserTokenRequest{
|
||||
Secret: SecretKey,
|
||||
@@ -88,7 +88,7 @@ func GetUserToken(userID string) (string, error) {
|
||||
return tokenResp.Token, nil
|
||||
}
|
||||
|
||||
// RegisterUser registers a new user using the API
|
||||
// RegisterUser registers a new user using the API.
|
||||
func RegisterUser(token, userID, nickname, faceURL string) error {
|
||||
user := User{
|
||||
UserID: userID,
|
||||
|
||||
Reference in New Issue
Block a user