gatev1connect

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GateServiceGetPlayerProcedure is the fully-qualified name of the GateService's GetPlayer RPC.
	GateServiceGetPlayerProcedure = "/minekube.gate.v1.GateService/GetPlayer"
	// GateServiceListPlayersProcedure is the fully-qualified name of the GateService's ListPlayers RPC.
	GateServiceListPlayersProcedure = "/minekube.gate.v1.GateService/ListPlayers"
	// GateServiceListServersProcedure is the fully-qualified name of the GateService's ListServers RPC.
	GateServiceListServersProcedure = "/minekube.gate.v1.GateService/ListServers"
	// GateServiceRegisterServerProcedure is the fully-qualified name of the GateService's
	// RegisterServer RPC.
	GateServiceRegisterServerProcedure = "/minekube.gate.v1.GateService/RegisterServer"
	// GateServiceUnregisterServerProcedure is the fully-qualified name of the GateService's
	// UnregisterServer RPC.
	GateServiceUnregisterServerProcedure = "/minekube.gate.v1.GateService/UnregisterServer"
	// GateServiceConnectPlayerProcedure is the fully-qualified name of the GateService's ConnectPlayer
	// RPC.
	GateServiceConnectPlayerProcedure = "/minekube.gate.v1.GateService/ConnectPlayer"
	// GateServiceDisconnectPlayerProcedure is the fully-qualified name of the GateService's
	// DisconnectPlayer RPC.
	GateServiceDisconnectPlayerProcedure = "/minekube.gate.v1.GateService/DisconnectPlayer"
)

These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.

Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.

View Source
const (
	// GateServiceName is the fully-qualified name of the GateService service.
	GateServiceName = "minekube.gate.v1.GateService"
)

Variables

This section is empty.

Functions

func NewGateServiceHandler

func NewGateServiceHandler(svc GateServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewGateServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

Types

type GateServiceClient

type GateServiceClient interface {
	// GetPlayer returns the player by the given id or username.
	// Returns NOT_FOUND if the player is not online.
	// Returns INVALID_ARGUMENT if neither id nor username is provided, or if the id format is invalid.
	GetPlayer(context.Context, *connect.Request[v1.GetPlayerRequest]) (*connect.Response[v1.GetPlayerResponse], error)
	// ListPlayers returns all online players.
	// If servers are specified in the request, only returns players on those servers.
	ListPlayers(context.Context, *connect.Request[v1.ListPlayersRequest]) (*connect.Response[v1.ListPlayersResponse], error)
	// ListServers returns all registered servers.
	ListServers(context.Context, *connect.Request[v1.ListServersRequest]) (*connect.Response[v1.ListServersResponse], error)
	// RegisterServer adds a server to the proxy.
	// Returns ALREADY_EXISTS if a server with the same name is already registered.
	// Returns INVALID_ARGUMENT if the server name or address is invalid.
	RegisterServer(context.Context, *connect.Request[v1.RegisterServerRequest]) (*connect.Response[v1.RegisterServerResponse], error)
	// UnregisterServer removes a server from the proxy.
	// Returns NOT_FOUND if no matching server is found.
	// Returns INVALID_ARGUMENT if neither name nor address is provided.
	UnregisterServer(context.Context, *connect.Request[v1.UnregisterServerRequest]) (*connect.Response[v1.UnregisterServerResponse], error)
	// ConnectPlayer connects a player to a specified server.
	// Returns NOT_FOUND if either the player or target server doesn't exist.
	// Returns FAILED_PRECONDITION if the connection attempt fails.
	ConnectPlayer(context.Context, *connect.Request[v1.ConnectPlayerRequest]) (*connect.Response[v1.ConnectPlayerResponse], error)
	// DisconnectPlayer disconnects a player from the proxy.
	// Returns NOT_FOUND if the player doesn't exist.
	// Returns INVALID_ARGUMENT if the reason text is malformed.
	DisconnectPlayer(context.Context, *connect.Request[v1.DisconnectPlayerRequest]) (*connect.Response[v1.DisconnectPlayerResponse], error)
}

GateServiceClient is a client for the minekube.gate.v1.GateService service.

func NewGateServiceClient

func NewGateServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GateServiceClient

NewGateServiceClient constructs a client for the minekube.gate.v1.GateService service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type GateServiceHandler

type GateServiceHandler interface {
	// GetPlayer returns the player by the given id or username.
	// Returns NOT_FOUND if the player is not online.
	// Returns INVALID_ARGUMENT if neither id nor username is provided, or if the id format is invalid.
	GetPlayer(context.Context, *connect.Request[v1.GetPlayerRequest]) (*connect.Response[v1.GetPlayerResponse], error)
	// ListPlayers returns all online players.
	// If servers are specified in the request, only returns players on those servers.
	ListPlayers(context.Context, *connect.Request[v1.ListPlayersRequest]) (*connect.Response[v1.ListPlayersResponse], error)
	// ListServers returns all registered servers.
	ListServers(context.Context, *connect.Request[v1.ListServersRequest]) (*connect.Response[v1.ListServersResponse], error)
	// RegisterServer adds a server to the proxy.
	// Returns ALREADY_EXISTS if a server with the same name is already registered.
	// Returns INVALID_ARGUMENT if the server name or address is invalid.
	RegisterServer(context.Context, *connect.Request[v1.RegisterServerRequest]) (*connect.Response[v1.RegisterServerResponse], error)
	// UnregisterServer removes a server from the proxy.
	// Returns NOT_FOUND if no matching server is found.
	// Returns INVALID_ARGUMENT if neither name nor address is provided.
	UnregisterServer(context.Context, *connect.Request[v1.UnregisterServerRequest]) (*connect.Response[v1.UnregisterServerResponse], error)
	// ConnectPlayer connects a player to a specified server.
	// Returns NOT_FOUND if either the player or target server doesn't exist.
	// Returns FAILED_PRECONDITION if the connection attempt fails.
	ConnectPlayer(context.Context, *connect.Request[v1.ConnectPlayerRequest]) (*connect.Response[v1.ConnectPlayerResponse], error)
	// DisconnectPlayer disconnects a player from the proxy.
	// Returns NOT_FOUND if the player doesn't exist.
	// Returns INVALID_ARGUMENT if the reason text is malformed.
	DisconnectPlayer(context.Context, *connect.Request[v1.DisconnectPlayerRequest]) (*connect.Response[v1.DisconnectPlayerResponse], error)
}

GateServiceHandler is an implementation of the minekube.gate.v1.GateService service.

type UnimplementedGateServiceHandler

type UnimplementedGateServiceHandler struct{}

UnimplementedGateServiceHandler returns CodeUnimplemented from all methods.

Jump to

Keyboard shortcuts

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