token

package
v3.5.0-rc.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	APIHost         = "http://127.0.0.1:10002"
	UserTokenURL    = APIHost + "/auth/user_token"
	UserRegisterURL = APIHost + "/user/user_register"
	SecretKey       = "openIM123"
	OperationID     = "1646445464564"
)

API endpoints and other constants.

Variables

This section is empty.

Functions

func GetUserToken

func GetUserToken(userID string) (string, error)

GetUserToken requests a user token from the API.

func RegisterUser

func RegisterUser(token, userID, nickname, faceURL string) error

RegisterUser registers a new user using the API.

Types

type User

type User struct {
	UserID   string `json:"userID"`
	Nickname string `json:"nickname"`
	FaceURL  string `json:"faceURL"`
}

User represents user data for registration.

type UserRegisterRequest

type UserRegisterRequest struct {
	Secret string `json:"secret"`
	Users  []User `json:"users"`
}

UserRegisterRequest represents a request to register a user.

type UserTokenRequest

type UserTokenRequest struct {
	Secret     string `json:"secret"`
	PlatformID int    `json:"platformID"`
	UserID     string `json:"userID"`
}

UserTokenRequest represents a request to get a user token.

type UserTokenResponse

type UserTokenResponse struct {
	Token   string `json:"token"`
	ErrCode int    `json:"errCode"`
}

UserTokenResponse represents a response containing a user token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL