apigrpc

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 3, 2019 License: Apache-2.0 Imports: 16 Imported by: 20

Documentation

Overview

Package apigrpc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterNakamaHandler

func RegisterNakamaHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterNakamaHandler registers the http handlers for service Nakama to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterNakamaHandlerClient

func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NakamaClient) error

RegisterNakamaHandlerClient registers the http handlers for service Nakama to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NakamaClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NakamaClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "NakamaClient" to call the correct interceptors.

func RegisterNakamaHandlerFromEndpoint

func RegisterNakamaHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterNakamaHandlerFromEndpoint is same as RegisterNakamaHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterNakamaServer

func RegisterNakamaServer(s *grpc.Server, srv NakamaServer)

Types

type NakamaClient

type NakamaClient interface {
	// Add friends by ID or username to a user's account.
	AddFriends(ctx context.Context, in *api.AddFriendsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Add users to a group.
	AddGroupUsers(ctx context.Context, in *api.AddGroupUsersRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Authenticate a user with a custom id against the server.
	AuthenticateCustom(ctx context.Context, in *api.AuthenticateCustomRequest, opts ...grpc.CallOption) (*api.Session, error)
	// Authenticate a user with a device id against the server.
	AuthenticateDevice(ctx context.Context, in *api.AuthenticateDeviceRequest, opts ...grpc.CallOption) (*api.Session, error)
	// Authenticate a user with an email+password against the server.
	AuthenticateEmail(ctx context.Context, in *api.AuthenticateEmailRequest, opts ...grpc.CallOption) (*api.Session, error)
	// Authenticate a user with a Facebook OAuth token against the server.
	AuthenticateFacebook(ctx context.Context, in *api.AuthenticateFacebookRequest, opts ...grpc.CallOption) (*api.Session, error)
	// Authenticate a user with Apple's GameCenter against the server.
	AuthenticateGameCenter(ctx context.Context, in *api.AuthenticateGameCenterRequest, opts ...grpc.CallOption) (*api.Session, error)
	// Authenticate a user with Google against the server.
	AuthenticateGoogle(ctx context.Context, in *api.AuthenticateGoogleRequest, opts ...grpc.CallOption) (*api.Session, error)
	// Authenticate a user with Steam against the server.
	AuthenticateSteam(ctx context.Context, in *api.AuthenticateSteamRequest, opts ...grpc.CallOption) (*api.Session, error)
	// Block one or more users by ID or username.
	BlockFriends(ctx context.Context, in *api.BlockFriendsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Create a new group with the current user as the owner.
	CreateGroup(ctx context.Context, in *api.CreateGroupRequest, opts ...grpc.CallOption) (*api.Group, error)
	// Delete one or more users by ID or username.
	DeleteFriends(ctx context.Context, in *api.DeleteFriendsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Delete a group by ID.
	DeleteGroup(ctx context.Context, in *api.DeleteGroupRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Delete a leaderboard record.
	DeleteLeaderboardRecord(ctx context.Context, in *api.DeleteLeaderboardRecordRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Delete one or more notifications for the current user.
	DeleteNotifications(ctx context.Context, in *api.DeleteNotificationsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Delete one or more objects by ID or username.
	DeleteStorageObjects(ctx context.Context, in *api.DeleteStorageObjectsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Fetch the current user's account.
	GetAccount(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*api.Account, error)
	// Fetch zero or more users by ID and/or username.
	GetUsers(ctx context.Context, in *api.GetUsersRequest, opts ...grpc.CallOption) (*api.Users, error)
	// A healthcheck which load balancers can use to check the service.
	Healthcheck(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
	// Import Facebook friends and add them to a user's account.
	ImportFacebookFriends(ctx context.Context, in *api.ImportFacebookFriendsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Immediately join an open group, or request to join a closed one.
	JoinGroup(ctx context.Context, in *api.JoinGroupRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Attempt to join an open and running tournament.
	JoinTournament(ctx context.Context, in *api.JoinTournamentRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Kick a set of users from a group.
	KickGroupUsers(ctx context.Context, in *api.KickGroupUsersRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Leave a group the user is a member of.
	LeaveGroup(ctx context.Context, in *api.LeaveGroupRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Add a custom ID to the social profiles on the current user's account.
	LinkCustom(ctx context.Context, in *api.AccountCustom, opts ...grpc.CallOption) (*empty.Empty, error)
	// Add a device ID to the social profiles on the current user's account.
	LinkDevice(ctx context.Context, in *api.AccountDevice, opts ...grpc.CallOption) (*empty.Empty, error)
	// Add an email+password to the social profiles on the current user's account.
	LinkEmail(ctx context.Context, in *api.AccountEmail, opts ...grpc.CallOption) (*empty.Empty, error)
	// Add Facebook to the social profiles on the current user's account.
	LinkFacebook(ctx context.Context, in *api.LinkFacebookRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Add Apple's GameCenter to the social profiles on the current user's account.
	LinkGameCenter(ctx context.Context, in *api.AccountGameCenter, opts ...grpc.CallOption) (*empty.Empty, error)
	// Add Google to the social profiles on the current user's account.
	LinkGoogle(ctx context.Context, in *api.AccountGoogle, opts ...grpc.CallOption) (*empty.Empty, error)
	// Add Steam to the social profiles on the current user's account.
	LinkSteam(ctx context.Context, in *api.AccountSteam, opts ...grpc.CallOption) (*empty.Empty, error)
	// List a channel's message history.
	ListChannelMessages(ctx context.Context, in *api.ListChannelMessagesRequest, opts ...grpc.CallOption) (*api.ChannelMessageList, error)
	// List all friends for the current user.
	ListFriends(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*api.Friends, error)
	// List groups based on given filters.
	ListGroups(ctx context.Context, in *api.ListGroupsRequest, opts ...grpc.CallOption) (*api.GroupList, error)
	// List all users that are part of a group.
	ListGroupUsers(ctx context.Context, in *api.ListGroupUsersRequest, opts ...grpc.CallOption) (*api.GroupUserList, error)
	// List leaderboard records.
	ListLeaderboardRecords(ctx context.Context, in *api.ListLeaderboardRecordsRequest, opts ...grpc.CallOption) (*api.LeaderboardRecordList, error)
	// List leaderboard records that belong to a user.
	ListLeaderboardRecordsAroundOwner(ctx context.Context, in *api.ListLeaderboardRecordsAroundOwnerRequest, opts ...grpc.CallOption) (*api.LeaderboardRecordList, error)
	// Fetch list of running matches.
	ListMatches(ctx context.Context, in *api.ListMatchesRequest, opts ...grpc.CallOption) (*api.MatchList, error)
	// Fetch list of notifications.
	ListNotifications(ctx context.Context, in *api.ListNotificationsRequest, opts ...grpc.CallOption) (*api.NotificationList, error)
	// List publicly readable storage objects in a given collection.
	ListStorageObjects(ctx context.Context, in *api.ListStorageObjectsRequest, opts ...grpc.CallOption) (*api.StorageObjectList, error)
	// List current or upcoming tournaments.
	ListTournaments(ctx context.Context, in *api.ListTournamentsRequest, opts ...grpc.CallOption) (*api.TournamentList, error)
	// List tournament records.
	ListTournamentRecords(ctx context.Context, in *api.ListTournamentRecordsRequest, opts ...grpc.CallOption) (*api.TournamentRecordList, error)
	// List tournament records for a given owner.
	ListTournamentRecordsAroundOwner(ctx context.Context, in *api.ListTournamentRecordsAroundOwnerRequest, opts ...grpc.CallOption) (*api.TournamentRecordList, error)
	// List groups the current user belongs to.
	ListUserGroups(ctx context.Context, in *api.ListUserGroupsRequest, opts ...grpc.CallOption) (*api.UserGroupList, error)
	// Promote a set of users in a group to the next role up.
	PromoteGroupUsers(ctx context.Context, in *api.PromoteGroupUsersRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Get storage objects.
	ReadStorageObjects(ctx context.Context, in *api.ReadStorageObjectsRequest, opts ...grpc.CallOption) (*api.StorageObjects, error)
	// Execute a Lua function on the server.
	RpcFunc(ctx context.Context, in *api.Rpc, opts ...grpc.CallOption) (*api.Rpc, error)
	// Remove the custom ID from the social profiles on the current user's account.
	UnlinkCustom(ctx context.Context, in *api.AccountCustom, opts ...grpc.CallOption) (*empty.Empty, error)
	// Remove the device ID from the social profiles on the current user's account.
	UnlinkDevice(ctx context.Context, in *api.AccountDevice, opts ...grpc.CallOption) (*empty.Empty, error)
	// Remove the email+password from the social profiles on the current user's account.
	UnlinkEmail(ctx context.Context, in *api.AccountEmail, opts ...grpc.CallOption) (*empty.Empty, error)
	// Remove Facebook from the social profiles on the current user's account.
	UnlinkFacebook(ctx context.Context, in *api.AccountFacebook, opts ...grpc.CallOption) (*empty.Empty, error)
	// Remove Apple's GameCenter from the social profiles on the current user's account.
	UnlinkGameCenter(ctx context.Context, in *api.AccountGameCenter, opts ...grpc.CallOption) (*empty.Empty, error)
	// Remove Google from the social profiles on the current user's account.
	UnlinkGoogle(ctx context.Context, in *api.AccountGoogle, opts ...grpc.CallOption) (*empty.Empty, error)
	// Remove Steam from the social profiles on the current user's account.
	UnlinkSteam(ctx context.Context, in *api.AccountSteam, opts ...grpc.CallOption) (*empty.Empty, error)
	// Update fields in the current user's account.
	UpdateAccount(ctx context.Context, in *api.UpdateAccountRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Update fields in a given group.
	UpdateGroup(ctx context.Context, in *api.UpdateGroupRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Write a record to a leaderboard.
	WriteLeaderboardRecord(ctx context.Context, in *api.WriteLeaderboardRecordRequest, opts ...grpc.CallOption) (*api.LeaderboardRecord, error)
	// Write objects into the storage engine.
	WriteStorageObjects(ctx context.Context, in *api.WriteStorageObjectsRequest, opts ...grpc.CallOption) (*api.StorageObjectAcks, error)
	// Write a record to a tournament.
	WriteTournamentRecord(ctx context.Context, in *api.WriteTournamentRecordRequest, opts ...grpc.CallOption) (*api.LeaderboardRecord, error)
}

NakamaClient is the client API for Nakama service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewNakamaClient

func NewNakamaClient(cc *grpc.ClientConn) NakamaClient

type NakamaServer

type NakamaServer interface {
	// Add friends by ID or username to a user's account.
	AddFriends(context.Context, *api.AddFriendsRequest) (*empty.Empty, error)
	// Add users to a group.
	AddGroupUsers(context.Context, *api.AddGroupUsersRequest) (*empty.Empty, error)
	// Authenticate a user with a custom id against the server.
	AuthenticateCustom(context.Context, *api.AuthenticateCustomRequest) (*api.Session, error)
	// Authenticate a user with a device id against the server.
	AuthenticateDevice(context.Context, *api.AuthenticateDeviceRequest) (*api.Session, error)
	// Authenticate a user with an email+password against the server.
	AuthenticateEmail(context.Context, *api.AuthenticateEmailRequest) (*api.Session, error)
	// Authenticate a user with a Facebook OAuth token against the server.
	AuthenticateFacebook(context.Context, *api.AuthenticateFacebookRequest) (*api.Session, error)
	// Authenticate a user with Apple's GameCenter against the server.
	AuthenticateGameCenter(context.Context, *api.AuthenticateGameCenterRequest) (*api.Session, error)
	// Authenticate a user with Google against the server.
	AuthenticateGoogle(context.Context, *api.AuthenticateGoogleRequest) (*api.Session, error)
	// Authenticate a user with Steam against the server.
	AuthenticateSteam(context.Context, *api.AuthenticateSteamRequest) (*api.Session, error)
	// Block one or more users by ID or username.
	BlockFriends(context.Context, *api.BlockFriendsRequest) (*empty.Empty, error)
	// Create a new group with the current user as the owner.
	CreateGroup(context.Context, *api.CreateGroupRequest) (*api.Group, error)
	// Delete one or more users by ID or username.
	DeleteFriends(context.Context, *api.DeleteFriendsRequest) (*empty.Empty, error)
	// Delete a group by ID.
	DeleteGroup(context.Context, *api.DeleteGroupRequest) (*empty.Empty, error)
	// Delete a leaderboard record.
	DeleteLeaderboardRecord(context.Context, *api.DeleteLeaderboardRecordRequest) (*empty.Empty, error)
	// Delete one or more notifications for the current user.
	DeleteNotifications(context.Context, *api.DeleteNotificationsRequest) (*empty.Empty, error)
	// Delete one or more objects by ID or username.
	DeleteStorageObjects(context.Context, *api.DeleteStorageObjectsRequest) (*empty.Empty, error)
	// Fetch the current user's account.
	GetAccount(context.Context, *empty.Empty) (*api.Account, error)
	// Fetch zero or more users by ID and/or username.
	GetUsers(context.Context, *api.GetUsersRequest) (*api.Users, error)
	// A healthcheck which load balancers can use to check the service.
	Healthcheck(context.Context, *empty.Empty) (*empty.Empty, error)
	// Import Facebook friends and add them to a user's account.
	ImportFacebookFriends(context.Context, *api.ImportFacebookFriendsRequest) (*empty.Empty, error)
	// Immediately join an open group, or request to join a closed one.
	JoinGroup(context.Context, *api.JoinGroupRequest) (*empty.Empty, error)
	// Attempt to join an open and running tournament.
	JoinTournament(context.Context, *api.JoinTournamentRequest) (*empty.Empty, error)
	// Kick a set of users from a group.
	KickGroupUsers(context.Context, *api.KickGroupUsersRequest) (*empty.Empty, error)
	// Leave a group the user is a member of.
	LeaveGroup(context.Context, *api.LeaveGroupRequest) (*empty.Empty, error)
	// Add a custom ID to the social profiles on the current user's account.
	LinkCustom(context.Context, *api.AccountCustom) (*empty.Empty, error)
	// Add a device ID to the social profiles on the current user's account.
	LinkDevice(context.Context, *api.AccountDevice) (*empty.Empty, error)
	// Add an email+password to the social profiles on the current user's account.
	LinkEmail(context.Context, *api.AccountEmail) (*empty.Empty, error)
	// Add Facebook to the social profiles on the current user's account.
	LinkFacebook(context.Context, *api.LinkFacebookRequest) (*empty.Empty, error)
	// Add Apple's GameCenter to the social profiles on the current user's account.
	LinkGameCenter(context.Context, *api.AccountGameCenter) (*empty.Empty, error)
	// Add Google to the social profiles on the current user's account.
	LinkGoogle(context.Context, *api.AccountGoogle) (*empty.Empty, error)
	// Add Steam to the social profiles on the current user's account.
	LinkSteam(context.Context, *api.AccountSteam) (*empty.Empty, error)
	// List a channel's message history.
	ListChannelMessages(context.Context, *api.ListChannelMessagesRequest) (*api.ChannelMessageList, error)
	// List all friends for the current user.
	ListFriends(context.Context, *empty.Empty) (*api.Friends, error)
	// List groups based on given filters.
	ListGroups(context.Context, *api.ListGroupsRequest) (*api.GroupList, error)
	// List all users that are part of a group.
	ListGroupUsers(context.Context, *api.ListGroupUsersRequest) (*api.GroupUserList, error)
	// List leaderboard records.
	ListLeaderboardRecords(context.Context, *api.ListLeaderboardRecordsRequest) (*api.LeaderboardRecordList, error)
	// List leaderboard records that belong to a user.
	ListLeaderboardRecordsAroundOwner(context.Context, *api.ListLeaderboardRecordsAroundOwnerRequest) (*api.LeaderboardRecordList, error)
	// Fetch list of running matches.
	ListMatches(context.Context, *api.ListMatchesRequest) (*api.MatchList, error)
	// Fetch list of notifications.
	ListNotifications(context.Context, *api.ListNotificationsRequest) (*api.NotificationList, error)
	// List publicly readable storage objects in a given collection.
	ListStorageObjects(context.Context, *api.ListStorageObjectsRequest) (*api.StorageObjectList, error)
	// List current or upcoming tournaments.
	ListTournaments(context.Context, *api.ListTournamentsRequest) (*api.TournamentList, error)
	// List tournament records.
	ListTournamentRecords(context.Context, *api.ListTournamentRecordsRequest) (*api.TournamentRecordList, error)
	// List tournament records for a given owner.
	ListTournamentRecordsAroundOwner(context.Context, *api.ListTournamentRecordsAroundOwnerRequest) (*api.TournamentRecordList, error)
	// List groups the current user belongs to.
	ListUserGroups(context.Context, *api.ListUserGroupsRequest) (*api.UserGroupList, error)
	// Promote a set of users in a group to the next role up.
	PromoteGroupUsers(context.Context, *api.PromoteGroupUsersRequest) (*empty.Empty, error)
	// Get storage objects.
	ReadStorageObjects(context.Context, *api.ReadStorageObjectsRequest) (*api.StorageObjects, error)
	// Execute a Lua function on the server.
	RpcFunc(context.Context, *api.Rpc) (*api.Rpc, error)
	// Remove the custom ID from the social profiles on the current user's account.
	UnlinkCustom(context.Context, *api.AccountCustom) (*empty.Empty, error)
	// Remove the device ID from the social profiles on the current user's account.
	UnlinkDevice(context.Context, *api.AccountDevice) (*empty.Empty, error)
	// Remove the email+password from the social profiles on the current user's account.
	UnlinkEmail(context.Context, *api.AccountEmail) (*empty.Empty, error)
	// Remove Facebook from the social profiles on the current user's account.
	UnlinkFacebook(context.Context, *api.AccountFacebook) (*empty.Empty, error)
	// Remove Apple's GameCenter from the social profiles on the current user's account.
	UnlinkGameCenter(context.Context, *api.AccountGameCenter) (*empty.Empty, error)
	// Remove Google from the social profiles on the current user's account.
	UnlinkGoogle(context.Context, *api.AccountGoogle) (*empty.Empty, error)
	// Remove Steam from the social profiles on the current user's account.
	UnlinkSteam(context.Context, *api.AccountSteam) (*empty.Empty, error)
	// Update fields in the current user's account.
	UpdateAccount(context.Context, *api.UpdateAccountRequest) (*empty.Empty, error)
	// Update fields in a given group.
	UpdateGroup(context.Context, *api.UpdateGroupRequest) (*empty.Empty, error)
	// Write a record to a leaderboard.
	WriteLeaderboardRecord(context.Context, *api.WriteLeaderboardRecordRequest) (*api.LeaderboardRecord, error)
	// Write objects into the storage engine.
	WriteStorageObjects(context.Context, *api.WriteStorageObjectsRequest) (*api.StorageObjectAcks, error)
	// Write a record to a tournament.
	WriteTournamentRecord(context.Context, *api.WriteTournamentRecordRequest) (*api.LeaderboardRecord, error)
}

NakamaServer is the server API for Nakama service.

Jump to

Keyboard shortcuts

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