game_service

package
v0.0.0-...-919a667 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package game_service is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_rpsls_game_service_v1_game_service_proto protoreflect.FileDescriptor
View Source
var GameService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "rpsls.game_service.v1.GameService",
	HandlerType: (*GameServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetChoicesV1",
			Handler:    _GameService_GetChoicesV1_Handler,
		},
		{
			MethodName: "GetChoiceV1",
			Handler:    _GameService_GetChoiceV1_Handler,
		},
		{
			MethodName: "PlayRoundV1",
			Handler:    _GameService_PlayRoundV1_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "rpsls/game_service/v1/game_service.proto",
}

GameService_ServiceDesc is the grpc.ServiceDesc for GameService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterGameServiceHandler

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

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

func RegisterGameServiceHandlerClient

func RegisterGameServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GameServiceClient) error

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

func RegisterGameServiceHandlerFromEndpoint

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

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

func RegisterGameServiceHandlerServer

func RegisterGameServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GameServiceServer) error

RegisterGameServiceHandlerServer registers the http handlers for service GameService to "mux". UnaryRPC :call GameServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterGameServiceHandlerFromEndpoint instead.

func RegisterGameServiceServer

func RegisterGameServiceServer(s grpc.ServiceRegistrar, srv GameServiceServer)

Types

type GameServiceClient

type GameServiceClient interface {
	// Get all the choices that are usable for the UI
	GetChoicesV1(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
	// Get a randomly generated choice
	GetChoiceV1(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetChoiceV1Response, error)
	// Play a round against a computer opponent
	PlayRoundV1(ctx context.Context, in *PlayRoundV1Request, opts ...grpc.CallOption) (*PlayRoundV1Response, error)
}

GameServiceClient is the client API for GameService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type GameServiceServer

type GameServiceServer interface {
	// Get all the choices that are usable for the UI
	GetChoicesV1(context.Context, *emptypb.Empty) (*httpbody.HttpBody, error)
	// Get a randomly generated choice
	GetChoiceV1(context.Context, *emptypb.Empty) (*GetChoiceV1Response, error)
	// Play a round against a computer opponent
	PlayRoundV1(context.Context, *PlayRoundV1Request) (*PlayRoundV1Response, error)
	// contains filtered or unexported methods
}

GameServiceServer is the server API for GameService service. All implementations must embed UnimplementedGameServiceServer for forward compatibility

type GetChoiceV1Response

type GetChoiceV1Response struct {
	Id   int32  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*GetChoiceV1Response) Descriptor deprecated

func (*GetChoiceV1Response) Descriptor() ([]byte, []int)

Deprecated: Use GetChoiceV1Response.ProtoReflect.Descriptor instead.

func (*GetChoiceV1Response) GetId

func (x *GetChoiceV1Response) GetId() int32

func (*GetChoiceV1Response) GetName

func (x *GetChoiceV1Response) GetName() string

func (*GetChoiceV1Response) ProtoMessage

func (*GetChoiceV1Response) ProtoMessage()

func (*GetChoiceV1Response) ProtoReflect

func (x *GetChoiceV1Response) ProtoReflect() protoreflect.Message

func (*GetChoiceV1Response) Reset

func (x *GetChoiceV1Response) Reset()

func (*GetChoiceV1Response) String

func (x *GetChoiceV1Response) String() string

func (*GetChoiceV1Response) Validate

func (m *GetChoiceV1Response) Validate() error

Validate checks the field values on GetChoiceV1Response with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetChoiceV1Response) ValidateAll

func (m *GetChoiceV1Response) ValidateAll() error

ValidateAll checks the field values on GetChoiceV1Response with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetChoiceV1ResponseMultiError, or nil if none found.

type GetChoiceV1ResponseMultiError

type GetChoiceV1ResponseMultiError []error

GetChoiceV1ResponseMultiError is an error wrapping multiple validation errors returned by GetChoiceV1Response.ValidateAll() if the designated constraints aren't met.

func (GetChoiceV1ResponseMultiError) AllErrors

func (m GetChoiceV1ResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetChoiceV1ResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GetChoiceV1ResponseValidationError

type GetChoiceV1ResponseValidationError struct {
	// contains filtered or unexported fields
}

GetChoiceV1ResponseValidationError is the validation error returned by GetChoiceV1Response.Validate if the designated constraints aren't met.

func (GetChoiceV1ResponseValidationError) Cause

Cause function returns cause value.

func (GetChoiceV1ResponseValidationError) Error

Error satisfies the builtin error interface

func (GetChoiceV1ResponseValidationError) ErrorName

ErrorName returns error name.

func (GetChoiceV1ResponseValidationError) Field

Field function returns field value.

func (GetChoiceV1ResponseValidationError) Key

Key function returns key value.

func (GetChoiceV1ResponseValidationError) Reason

Reason function returns reason value.

type PlayRoundV1Request

type PlayRoundV1Request struct {
	Player int32 `protobuf:"varint,1,opt,name=player,proto3" json:"player,omitempty"`
	// contains filtered or unexported fields
}

func (*PlayRoundV1Request) Descriptor deprecated

func (*PlayRoundV1Request) Descriptor() ([]byte, []int)

Deprecated: Use PlayRoundV1Request.ProtoReflect.Descriptor instead.

func (*PlayRoundV1Request) GetPlayer

func (x *PlayRoundV1Request) GetPlayer() int32

func (*PlayRoundV1Request) ProtoMessage

func (*PlayRoundV1Request) ProtoMessage()

func (*PlayRoundV1Request) ProtoReflect

func (x *PlayRoundV1Request) ProtoReflect() protoreflect.Message

func (*PlayRoundV1Request) Reset

func (x *PlayRoundV1Request) Reset()

func (*PlayRoundV1Request) String

func (x *PlayRoundV1Request) String() string

func (*PlayRoundV1Request) Validate

func (m *PlayRoundV1Request) Validate() error

Validate checks the field values on PlayRoundV1Request with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PlayRoundV1Request) ValidateAll

func (m *PlayRoundV1Request) ValidateAll() error

ValidateAll checks the field values on PlayRoundV1Request with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PlayRoundV1RequestMultiError, or nil if none found.

type PlayRoundV1RequestMultiError

type PlayRoundV1RequestMultiError []error

PlayRoundV1RequestMultiError is an error wrapping multiple validation errors returned by PlayRoundV1Request.ValidateAll() if the designated constraints aren't met.

func (PlayRoundV1RequestMultiError) AllErrors

func (m PlayRoundV1RequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PlayRoundV1RequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type PlayRoundV1RequestValidationError

type PlayRoundV1RequestValidationError struct {
	// contains filtered or unexported fields
}

PlayRoundV1RequestValidationError is the validation error returned by PlayRoundV1Request.Validate if the designated constraints aren't met.

func (PlayRoundV1RequestValidationError) Cause

Cause function returns cause value.

func (PlayRoundV1RequestValidationError) Error

Error satisfies the builtin error interface

func (PlayRoundV1RequestValidationError) ErrorName

ErrorName returns error name.

func (PlayRoundV1RequestValidationError) Field

Field function returns field value.

func (PlayRoundV1RequestValidationError) Key

Key function returns key value.

func (PlayRoundV1RequestValidationError) Reason

Reason function returns reason value.

type PlayRoundV1Response

type PlayRoundV1Response struct {
	Player   int32  `protobuf:"varint,1,opt,name=player,proto3" json:"player,omitempty"`
	Computer int32  `protobuf:"varint,2,opt,name=computer,proto3" json:"computer,omitempty"`
	Results  string `protobuf:"bytes,3,opt,name=results,proto3" json:"results,omitempty"`
	// contains filtered or unexported fields
}

func (*PlayRoundV1Response) Descriptor deprecated

func (*PlayRoundV1Response) Descriptor() ([]byte, []int)

Deprecated: Use PlayRoundV1Response.ProtoReflect.Descriptor instead.

func (*PlayRoundV1Response) GetComputer

func (x *PlayRoundV1Response) GetComputer() int32

func (*PlayRoundV1Response) GetPlayer

func (x *PlayRoundV1Response) GetPlayer() int32

func (*PlayRoundV1Response) GetResults

func (x *PlayRoundV1Response) GetResults() string

func (*PlayRoundV1Response) ProtoMessage

func (*PlayRoundV1Response) ProtoMessage()

func (*PlayRoundV1Response) ProtoReflect

func (x *PlayRoundV1Response) ProtoReflect() protoreflect.Message

func (*PlayRoundV1Response) Reset

func (x *PlayRoundV1Response) Reset()

func (*PlayRoundV1Response) String

func (x *PlayRoundV1Response) String() string

func (*PlayRoundV1Response) Validate

func (m *PlayRoundV1Response) Validate() error

Validate checks the field values on PlayRoundV1Response with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PlayRoundV1Response) ValidateAll

func (m *PlayRoundV1Response) ValidateAll() error

ValidateAll checks the field values on PlayRoundV1Response with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PlayRoundV1ResponseMultiError, or nil if none found.

type PlayRoundV1ResponseMultiError

type PlayRoundV1ResponseMultiError []error

PlayRoundV1ResponseMultiError is an error wrapping multiple validation errors returned by PlayRoundV1Response.ValidateAll() if the designated constraints aren't met.

func (PlayRoundV1ResponseMultiError) AllErrors

func (m PlayRoundV1ResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PlayRoundV1ResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type PlayRoundV1ResponseValidationError

type PlayRoundV1ResponseValidationError struct {
	// contains filtered or unexported fields
}

PlayRoundV1ResponseValidationError is the validation error returned by PlayRoundV1Response.Validate if the designated constraints aren't met.

func (PlayRoundV1ResponseValidationError) Cause

Cause function returns cause value.

func (PlayRoundV1ResponseValidationError) Error

Error satisfies the builtin error interface

func (PlayRoundV1ResponseValidationError) ErrorName

ErrorName returns error name.

func (PlayRoundV1ResponseValidationError) Field

Field function returns field value.

func (PlayRoundV1ResponseValidationError) Key

Key function returns key value.

func (PlayRoundV1ResponseValidationError) Reason

Reason function returns reason value.

type UnimplementedGameServiceServer

type UnimplementedGameServiceServer struct {
}

UnimplementedGameServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedGameServiceServer) GetChoiceV1

func (UnimplementedGameServiceServer) GetChoicesV1

func (UnimplementedGameServiceServer) PlayRoundV1

type UnsafeGameServiceServer

type UnsafeGameServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeGameServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GameServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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