apihttp

package
v0.0.11-otel Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	*internalapi.API
}

func (*API) AcceptInvite

func (api *API) AcceptInvite(c *gin.Context)

AcceptInvite godoc @Summary accept an invitation @Description accept an invitation based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param AcceptInviteReq body AcceptInviteReq true "Accept Invite Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/accept_invite [post]

func (*API) CancelMatch

func (api *API) CancelMatch(c *gin.Context)

CancelMatch godoc @Summary cancel match @Description cancel match @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param uid path string true "player uid" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/cancel_match/{uid} [post]

func (*API) ChangeRole

func (api *API) ChangeRole(c *gin.Context)

ChangeRole godoc @Summary change a player's role @Description change a player's role based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param ChangeRoleReq body ChangeRoleReq true "Change Role Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/change_role [post]

func (*API) CreateGroup

func (api *API) CreateGroup(c *gin.Context)

CreateGroup godoc @Summary create a new group @Description create a new group based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param CreateGroup body pto.CreateGroup true "Create Group Request Body" @Success 200 {object} CreateGroupRsp @Failure 200 {object} string @Router /match/create_group [post]

func (*API) DissolveGroup

func (api *API) DissolveGroup(c *gin.Context)

DissolveGroup godoc @Summary dissolve a group @Description dissolve a group based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param uid path string true "User ID" @Success 200 {object} string "ok" @Failure 200 {object} string "Concrete Error Msg" @Router /match/dissolve_group/{uid} [post]

func (*API) EnterGroup

func (api *API) EnterGroup(c *gin.Context)

EnterGroup godoc @Summary enter a group @Description enter a group based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param EnterGroupReq body EnterGroupReq true "Enter Group Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/enter_group [post]

func (*API) ExitGame

func (api *API) ExitGame(c *gin.Context)

ExitGame godoc @Summary exit game @Description exit game @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param ExitGameReq body ExitGameReq true "Exit Game Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/exit_game [post]

func (*API) ExitGroup

func (api *API) ExitGroup(c *gin.Context)

ExitGroup godoc @Summary exit a group @Description exit a group based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param uid path string true "User ID" @Success 200 {object} string "ok" @Failure 200 {object} string "Concrete Error Msg" @Router /match/exit_group/{uid} [post]

func (*API) Invite

func (api *API) Invite(c *gin.Context)

Invite godoc @Summary invite a player @Description invite a player based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param InviteReq body InviteReq true "Invite Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/invite [post]

func (*API) KickPlayer

func (api *API) KickPlayer(c *gin.Context)

KickPlayer godoc @Summary kick a player @Description kick a player based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param KickPlayerReq body KickPlayerReq true "Kick Player Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/kick_player [post]

func (*API) Ready

func (api *API) Ready(c *gin.Context)

Ready godoc @Summary ready @Description ready @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param uid path string true "player uid" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/ready/{uid} [post]

func (*API) RefuseInvite

func (api *API) RefuseInvite(c *gin.Context)

RefuseInvite godoc @Summary refuse an invitation @Description refuse an invitation based on the request @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param RefuseInviteReq body RefuseInviteReq true "Refuse Invite Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/refuse_invite [post]

func (*API) SetNearbyJoinGroup

func (api *API) SetNearbyJoinGroup(c *gin.Context)

SetNearbyJoinGroup godoc @Summary set nearby join group @Description set whether group can be entered from nearby players list @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param SetNearbyJoinGroupReq body SetNearbyJoinGroupReq true "Set Nearby Join Group Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/set_nearby_join_group [post]

func (*API) SetRecentJoinGroup

func (api *API) SetRecentJoinGroup(c *gin.Context)

SetRecentJoinGroup godoc @Summary set recent join group @Description set whether group can be entered from recent players list @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param SetRecentJoinGroupReq body SetRecentJoinGroupReq true "Set Recent Join Group Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/set_recent_join_group [post]

func (*API) SetVoiceState

func (api *API) SetVoiceState(c *gin.Context)

SetVoiceState godoc @Summary set voice state @Description set player voice state @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param SetVoiceStateReq body SetVoiceStateReq true "Set Voice State Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/set_voice_state [post]

func (*API) StartMatch

func (api *API) StartMatch(c *gin.Context)

StartMatch godoc @Summary start match @Description start to match @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param uid path string true "player uid" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/start_match/{uid} [post]

func (*API) Unready

func (api *API) Unready(c *gin.Context)

Unready godoc @Summary unready @Description unready @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param uid path string true "player uid" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/unready/{uid} [post]

func (*API) UploadPlayerAttr

func (api *API) UploadPlayerAttr(c *gin.Context)

UploadPlayerAttrReq godoc @Summary upload player attr @Description upload player attr @Tags match service @Accept json @Produce json @Param x-request-id header string false "Request ID" @Param UploadPlayerAttrReq body UploadPlayerAttrReq true "Upload Player Attr Request Body" @Success 200 {object} string "ok" @Failure 400 {object} string "Bad Request" @Failure 200 {object} string "Concrete Error Msg" @Router /match/upload_player_attr [post]

type AcceptInviteReq

type AcceptInviteReq struct {
	InviterUID  string          `json:"inviter_uid" binding:"required"`
	InviteeInfo *pto.PlayerInfo `json:"invitee_info" binding:"required"`
	GroupID     int64           `json:"group_id" binding:"required"`
}

type ChangeRoleReq

type ChangeRoleReq struct {
	CaptainUID string          `json:"captain_uid" binding:"required"`
	TargetUID  string          `json:"target_uid" binding:"required"`
	Role       entry.GroupRole `json:"role" binding:"required"`
}

type CreateGroupRsp

type CreateGroupRsp struct {
	GroupID int64 `json:"group_id,omitempty"`
}

type EnterGroupReq

type EnterGroupReq struct {
	PlayerInfo pto.EnterGroup `json:"player_info" binding:"required"`
	GroupID    int64          `json:"group_id" binding:"required"`
}

type ExitGameReq

type ExitGameReq struct {
	UID    string `json:"uid" binding:"required"`
	RoomID int64  `json:"room_id" binding:"required"`
}

type ExitGroupReq

type ExitGroupReq struct {
	UID     string `json:"uid" binding:"required"`
	GroupID int64  `json:"group_id" binding:"required"`
}

type Infra

type Infra struct {
	*api.InfraBase
}

Infra is the infrastructure for the http api.

func NewInfra

NewInfra creates a new Infra for the http api.

func (*Infra) Start

func (i *Infra) Start()

Start starts the http api infrastructure, if any errors occur, it will panic.

func (*Infra) Stop

func (i *Infra) Stop()

Stop stops the http api infrastructure.

type InviteReq

type InviteReq struct {
	InviterUID string `json:"inviter_uid" binding:"required"`
	InviteeUID string `json:"invitee_uid" binding:"required"`
}

type KickPlayerReq

type KickPlayerReq struct {
	CaptainUID string `json:"captain_uid" binding:"required"`
	KickedUID  string `json:"kicked_uid" binding:"required"`
}

type RefuseInviteReq

type RefuseInviteReq struct {
	InviterUID string `json:"inviter_uid" binding:"required"`
	InviteeUID string `json:"invitee_uid" binding:"required"`
	GroupID    int64  `json:"group_id" binding:"required"`
	RefuseMsg  string `json:"refuse_msg"`
}

type SetNearbyJoinGroupReq

type SetNearbyJoinGroupReq struct {
	CaptainUID string `json:"captain_uid" binding:"required"`
	Allow      bool   `json:"allow"`
}

type SetRecentJoinGroupReq

type SetRecentJoinGroupReq struct {
	CaptainUID string `json:"captain_uid" binding:"required"`
	Allow      bool   `json:"allow"`
}

type SetVoiceStateReq

type SetVoiceStateReq struct {
	UID   string                 `json:"uid" binding:"required"`
	State entry.PlayerVoiceState `json:"state" binding:"gte=0,lte=1"`
}

type UploadPlayerAttrReq

type UploadPlayerAttrReq struct {
	UID string `json:"uid" binding:"required"`
	pto.UploadPlayerAttr
}

Jump to

Keyboard shortcuts

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