gapi

package
v0.0.0-...-8fa2ce1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

rpc_get_game_by_id.go

rpc_get_player_game.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RateLimitMiddleware

func RateLimitMiddleware(r rate.Limit, b int) func(http.Handler) http.Handler

RateLimitMiddleware creates a new HTTP middleware for rate limiting.

Types

type Metadata

type Metadata struct {
	UserAgent string
	ClientIP  string
}

type Server

type Server struct {
	pb.UnimplementedDessertedServer

	Store db.Store
	// contains filtered or unexported fields
}

Server serves gRPC requests for our desserted service.

func NewServer

func NewServer(config util.Config, store db.Store, mailer *mailer.Mailer) (*Server, token.Maker, error)

NewServer creates a new gRPC server

func (*Server) AcceptFriendRequest

func (server *Server) AcceptFriendRequest(ctx context.Context, req *pb.AcceptFriendRequestRequest) (*emptypb.Empty, error)

AcceptFriendRequest updates the status of a friend request to accepted.

func (*Server) AcceptGameInvite

func (server *Server) AcceptGameInvite(ctx context.Context, req *pb.AcceptGameInviteRequest) (*emptypb.Empty, error)

AcceptGameInvite allows a user to accept an invitation to a game.

func (*Server) ActivateUser

func (server *Server) ActivateUser(ctx context.Context, req *pb.ActivateUserRequest) (*pb.ActivateUserResponse, error)

func (*Server) AddPlayerToGame

func (server *Server) AddPlayerToGame(ctx context.Context, req *pb.AddPlayerToGameRequest) (*emptypb.Empty, error)

Will use this functionality in the future if players want to "find an open game" Requires adding a private/public column to games

func (*Server) CheckUserSession

func (server *Server) CheckUserSession(ctx context.Context, req *pb.CheckUserSessionRequest) (*pb.CheckUserSessionResponse, error)

func (*Server) CreateFriendship

func (server *Server) CreateFriendship(ctx context.Context, req *pb.CreateFriendshipRequest) (*pb.CreateFriendshipResponse, error)

CreateFriendship creates a new friendship between two users.

func (*Server) CreateGame

func (server *Server) CreateGame(ctx context.Context, req *pb.CreateGameRequest) (*pb.CreateGameResponse, error)

func (*Server) CreateUser

func (server *Server) CreateUser(ctx context.Context, req *pb.CreateUserRequest) (*pb.CreateUserResponse, error)

func (*Server) DrawCard

func (server *Server) DrawCard(ctx context.Context, req *pb.DrawCardRequest) (*pb.DrawCardResponse, error)

DrawCard handles the request to draw a card from the deck in a game session.

func (*Server) GetGameByID

func (server *Server) GetGameByID(ctx context.Context, req *pb.GetGameByIDRequest) (*pb.GetGameByIDResponse, error)

GetGameByID retrieves the details of a game by its ID.

func (*Server) GetPlayerGame

func (server *Server) GetPlayerGame(ctx context.Context, req *pb.GetPlayerGameRequest) (*pb.GetPlayerGameResponse, error)

GetPlayerGame retrieves the game data for a given player.

func (*Server) GetPlayerHand

func (server *Server) GetPlayerHand(ctx context.Context, req *pb.GetPlayerHandRequest) (*pb.GetPlayerHandResponse, error)

GetPlayerHand retrieves the cards in a player's hand for a given game.

func (*Server) InvitePlayersToGame

func (server *Server) InvitePlayersToGame(ctx context.Context, req *pb.InvitePlayersToGameRequest) (*emptypb.Empty, error)

func (*Server) ListActivePlayerGames

func (server *Server) ListActivePlayerGames(ctx context.Context, req *pb.ListPlayerGamesRequest) (*pb.ListPlayerGamesResponse, error)

ListActivePlayerGames lists active games for a player.

func (*Server) ListFriendRequests

func (server *Server) ListFriendRequests(ctx context.Context, req *pb.ListFriendRequestsRequest) (*pb.ListFriendRequestsResponse, error)

ListFriendRequests lists all pending friend requests for a user.

func (*Server) ListGameInvites

func (server *Server) ListGameInvites(ctx context.Context, req *pb.ListGameInvitesRequest) (*pb.ListGameInvitesResponse, error)

ListGameInvites lists all pending game invitations for a user.

func (*Server) ListGamePlayers

func (server *Server) ListGamePlayers(ctx context.Context, req *pb.ListGamePlayersRequest) (*pb.ListGamePlayersResponse, error)

func (*Server) ListUserFriends

func (server *Server) ListUserFriends(ctx context.Context, req *pb.ListUserFriendsRequest) (*pb.ListUserFriendsResponse, error)

ListUserFriends lists the friendships of a given user.

func (*Server) LoginUser

func (server *Server) LoginUser(ctx context.Context, req *pb.LoginUserRequest) (*pb.LoginUserResponse, error)

func (*Server) Logout

func (server *Server) Logout(ctx context.Context, req *pb.LogoutRequest) (*emptypb.Empty, error)

Logout invalidates the user's session.

func (*Server) PlayDessert

func (server *Server) PlayDessert(ctx context.Context, req *pb.PlayDessertRequest) (*pb.PlayDessertResponse, error)

func (*Server) RenewAccessToken

func (server *Server) RenewAccessToken(ctx context.Context, req *pb.RenewAccessRequest) (*pb.RenewAccessResponse, error)

func (*Server) StartGame

func (server *Server) StartGame(ctx context.Context, req *pb.StartGameRequest) (*pb.StartGameResponse, error)

StartGame starts a game session.

func (*Server) UpdateUser

func (server *Server) UpdateUser(ctx context.Context, req *pb.UpdateUserRequest) (*pb.UpdateUserResponse, error)

Jump to

Keyboard shortcuts

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