apiconnect

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GameServiceGetSessionV1Procedure is the fully-qualified name of the GameService's GetSessionV1
	// RPC.
	GameServiceGetSessionV1Procedure = "/api.GameService/GetSessionV1"
	// GameServiceListPlayingSessionsV1Procedure is the fully-qualified name of the GameService's
	// ListPlayingSessionsV1 RPC.
	GameServiceListPlayingSessionsV1Procedure = "/api.GameService/ListPlayingSessionsV1"
	// GameServiceStartPlayingV1Procedure is the fully-qualified name of the GameService's
	// StartPlayingV1 RPC.
	GameServiceStartPlayingV1Procedure = "/api.GameService/StartPlayingV1"
)

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 (
	// GameServiceName is the fully-qualified name of the GameService service.
	GameServiceName = "api.GameService"
)
View Source
const (
	// JankenServiceChooseHandV1Procedure is the fully-qualified name of the JankenService's
	// ChooseHandV1 RPC.
	JankenServiceChooseHandV1Procedure = "/api.JankenService/ChooseHandV1"
)

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 (
	// JankenServiceName is the fully-qualified name of the JankenService service.
	JankenServiceName = "api.JankenService"
)

Variables

This section is empty.

Functions

func NewGameServiceHandler

func NewGameServiceHandler(svc GameServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewGameServiceHandler 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.

func NewJankenServiceHandler

func NewJankenServiceHandler(svc JankenServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewJankenServiceHandler 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 GameServiceClient

type GameServiceClient interface {
	// ゲームセッションを取得します。
	GetSessionV1(context.Context, *connect.Request[api.GameServiceGetSessionV1Request]) (*connect.Response[api.GameServiceGetSessionV1Response], error)
	// プレイ中のゲームセッションリストを取得します。
	ListPlayingSessionsV1(context.Context, *connect.Request[api.GameServiceListPlayingSessionsV1Request]) (*connect.Response[api.GameServiceListPlayingSessionsV1Response], error)
	// ゲームを開始します。
	// なお、チート対策のためゲーム終了判定はサーバー側で行います。
	StartPlayingV1(context.Context, *connect.Request[api.GameServiceStartPlayingV1Request]) (*connect.Response[api.GameServiceStartPlayingV1Response], error)
}

GameServiceClient is a client for the api.GameService service.

func NewGameServiceClient

func NewGameServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GameServiceClient

NewGameServiceClient constructs a client for the api.GameService 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 GameServiceHandler

type GameServiceHandler interface {
	// ゲームセッションを取得します。
	GetSessionV1(context.Context, *connect.Request[api.GameServiceGetSessionV1Request]) (*connect.Response[api.GameServiceGetSessionV1Response], error)
	// プレイ中のゲームセッションリストを取得します。
	ListPlayingSessionsV1(context.Context, *connect.Request[api.GameServiceListPlayingSessionsV1Request]) (*connect.Response[api.GameServiceListPlayingSessionsV1Response], error)
	// ゲームを開始します。
	// なお、チート対策のためゲーム終了判定はサーバー側で行います。
	StartPlayingV1(context.Context, *connect.Request[api.GameServiceStartPlayingV1Request]) (*connect.Response[api.GameServiceStartPlayingV1Response], error)
}

GameServiceHandler is an implementation of the api.GameService service.

type JankenServiceClient

JankenServiceClient is a client for the api.JankenService service.

func NewJankenServiceClient

func NewJankenServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) JankenServiceClient

NewJankenServiceClient constructs a client for the api.JankenService 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 JankenServiceHandler

JankenServiceHandler is an implementation of the api.JankenService service.

type UnimplementedGameServiceHandler

type UnimplementedGameServiceHandler struct{}

UnimplementedGameServiceHandler returns CodeUnimplemented from all methods.

type UnimplementedJankenServiceHandler

type UnimplementedJankenServiceHandler struct{}

UnimplementedJankenServiceHandler returns CodeUnimplemented from all methods.

Jump to

Keyboard shortcuts

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