v1

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var DeckService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "transport.v1.DeckService",
	HandlerType: (*DeckServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateDeck",
			Handler:    _DeckService_CreateDeck_Handler,
		},
		{
			MethodName: "OpenDeck",
			Handler:    _DeckService_OpenDeck_Handler,
		},
		{
			MethodName: "DrawCards",
			Handler:    _DeckService_DrawCards_Handler,
		},
		{
			MethodName: "ShuffleDeck",
			Handler:    _DeckService_ShuffleDeck_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "transport/v1/deck_service.proto",
}

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

View Source
var File_transport_v1_deck_proto protoreflect.FileDescriptor
View Source
var File_transport_v1_deck_service_proto protoreflect.FileDescriptor

Functions

func RegisterDeckServiceHandler

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

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

func RegisterDeckServiceHandlerClient

func RegisterDeckServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DeckServiceClient) error

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

func RegisterDeckServiceHandlerFromEndpoint

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

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

func RegisterDeckServiceHandlerServer

func RegisterDeckServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DeckServiceServer) error

RegisterDeckServiceHandlerServer registers the http handlers for service DeckService to "mux". UnaryRPC :call DeckServiceServer 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 RegisterDeckServiceHandlerFromEndpoint instead.

func RegisterDeckServiceServer

func RegisterDeckServiceServer(s grpc.ServiceRegistrar, srv DeckServiceServer)

Types

type Card

type Card struct {
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	Suit  string `protobuf:"bytes,2,opt,name=suit,proto3" json:"suit,omitempty"`
	Code  string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
	// contains filtered or unexported fields
}

Card represents a single card.

func (*Card) Descriptor deprecated

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

Deprecated: Use Card.ProtoReflect.Descriptor instead.

func (*Card) GetCode

func (x *Card) GetCode() string

func (*Card) GetSuit

func (x *Card) GetSuit() string

func (*Card) GetValue

func (x *Card) GetValue() string

func (*Card) ProtoMessage

func (*Card) ProtoMessage()

func (*Card) ProtoReflect

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

func (*Card) Reset

func (x *Card) Reset()

func (*Card) String

func (x *Card) String() string

type CreateDeckRequest

type CreateDeckRequest struct {
	Comp  *string  `protobuf:"bytes,1,opt,name=comp,proto3,oneof" json:"comp,omitempty"`
	Codes []string `protobuf:"bytes,2,rep,name=codes,proto3" json:"codes,omitempty"`
	// contains filtered or unexported fields
}

CreateDeckRequest holds the composition and optional codes needed to create a deck.

func (*CreateDeckRequest) Descriptor deprecated

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

Deprecated: Use CreateDeckRequest.ProtoReflect.Descriptor instead.

func (*CreateDeckRequest) GetCodes

func (x *CreateDeckRequest) GetCodes() []string

func (*CreateDeckRequest) GetComp

func (x *CreateDeckRequest) GetComp() string

func (*CreateDeckRequest) ProtoMessage

func (*CreateDeckRequest) ProtoMessage()

func (*CreateDeckRequest) ProtoReflect

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

func (*CreateDeckRequest) Reset

func (x *CreateDeckRequest) Reset()

func (*CreateDeckRequest) String

func (x *CreateDeckRequest) String() string

type CreateDeckResponse

type CreateDeckResponse struct {
	Deck *DeckClosed `protobuf:"bytes,1,opt,name=deck,proto3" json:"deck,omitempty"`
	// contains filtered or unexported fields
}

CreateDeckResponse holds the deck created.

func (*CreateDeckResponse) Descriptor deprecated

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

Deprecated: Use CreateDeckResponse.ProtoReflect.Descriptor instead.

func (*CreateDeckResponse) GetDeck

func (x *CreateDeckResponse) GetDeck() *DeckClosed

func (*CreateDeckResponse) ProtoMessage

func (*CreateDeckResponse) ProtoMessage()

func (*CreateDeckResponse) ProtoReflect

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

func (*CreateDeckResponse) Reset

func (x *CreateDeckResponse) Reset()

func (*CreateDeckResponse) String

func (x *CreateDeckResponse) String() string

type DeckClosed

type DeckClosed struct {
	Id        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Shuffled  bool   `protobuf:"varint,2,opt,name=shuffled,proto3" json:"shuffled,omitempty"`
	Remaining uint32 `protobuf:"varint,3,opt,name=remaining,proto3" json:"remaining,omitempty"`
	// contains filtered or unexported fields
}

DeckClosed represents a closed deck of cards.

func (*DeckClosed) Descriptor deprecated

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

Deprecated: Use DeckClosed.ProtoReflect.Descriptor instead.

func (*DeckClosed) GetId

func (x *DeckClosed) GetId() string

func (*DeckClosed) GetRemaining

func (x *DeckClosed) GetRemaining() uint32

func (*DeckClosed) GetShuffled

func (x *DeckClosed) GetShuffled() bool

func (*DeckClosed) ProtoMessage

func (*DeckClosed) ProtoMessage()

func (*DeckClosed) ProtoReflect

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

func (*DeckClosed) Reset

func (x *DeckClosed) Reset()

func (*DeckClosed) String

func (x *DeckClosed) String() string

type DeckOpened

type DeckOpened struct {
	Id        string  `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Shuffled  bool    `protobuf:"varint,2,opt,name=shuffled,proto3" json:"shuffled,omitempty"`
	Remaining uint32  `protobuf:"varint,3,opt,name=remaining,proto3" json:"remaining,omitempty"`
	Cards     []*Card `protobuf:"bytes,4,rep,name=cards,proto3" json:"cards,omitempty"`
	// contains filtered or unexported fields
}

DeckOpened represents a opened deck of cards.

func (*DeckOpened) Descriptor deprecated

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

Deprecated: Use DeckOpened.ProtoReflect.Descriptor instead.

func (*DeckOpened) GetCards

func (x *DeckOpened) GetCards() []*Card

func (*DeckOpened) GetId

func (x *DeckOpened) GetId() string

func (*DeckOpened) GetRemaining

func (x *DeckOpened) GetRemaining() uint32

func (*DeckOpened) GetShuffled

func (x *DeckOpened) GetShuffled() bool

func (*DeckOpened) ProtoMessage

func (*DeckOpened) ProtoMessage()

func (*DeckOpened) ProtoReflect

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

func (*DeckOpened) Reset

func (x *DeckOpened) Reset()

func (*DeckOpened) String

func (x *DeckOpened) String() string

type DeckServiceClient

type DeckServiceClient interface {
	// CreateDeck creates a new full or partial deck of cards given an optional
	// list of codes.
	CreateDeck(ctx context.Context, in *CreateDeckRequest, opts ...grpc.CallOption) (*CreateDeckResponse, error)
	// OpenDeck opens a deck of cards given an id.
	OpenDeck(ctx context.Context, in *OpenDeckRequest, opts ...grpc.CallOption) (*OpenDeckResponse, error)
	// DrawCards draws cards from a deck of cards given an id and the number of
	// cards.
	DrawCards(ctx context.Context, in *DrawCardsRequest, opts ...grpc.CallOption) (*DrawCardsResponse, error)
	// ShuffleDeck shuffles a deck of cards given an id.
	ShuffleDeck(ctx context.Context, in *ShuffleDeckRequest, opts ...grpc.CallOption) (*ShuffleDeckResponse, error)
}

DeckServiceClient is the client API for DeckService 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 DeckServiceServer

type DeckServiceServer interface {
	// CreateDeck creates a new full or partial deck of cards given an optional
	// list of codes.
	CreateDeck(context.Context, *CreateDeckRequest) (*CreateDeckResponse, error)
	// OpenDeck opens a deck of cards given an id.
	OpenDeck(context.Context, *OpenDeckRequest) (*OpenDeckResponse, error)
	// DrawCards draws cards from a deck of cards given an id and the number of
	// cards.
	DrawCards(context.Context, *DrawCardsRequest) (*DrawCardsResponse, error)
	// ShuffleDeck shuffles a deck of cards given an id.
	ShuffleDeck(context.Context, *ShuffleDeckRequest) (*ShuffleDeckResponse, error)
	// contains filtered or unexported methods
}

DeckServiceServer is the server API for DeckService service. All implementations must embed UnimplementedDeckServiceServer for forward compatibility

type DrawCardsRequest

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

DrawCardsRequest holds the id of the deck and number of cards to draw from the deck.

func (*DrawCardsRequest) Descriptor deprecated

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

Deprecated: Use DrawCardsRequest.ProtoReflect.Descriptor instead.

func (*DrawCardsRequest) GetId

func (x *DrawCardsRequest) GetId() string

func (*DrawCardsRequest) GetNum

func (x *DrawCardsRequest) GetNum() int32

func (*DrawCardsRequest) ProtoMessage

func (*DrawCardsRequest) ProtoMessage()

func (*DrawCardsRequest) ProtoReflect

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

func (*DrawCardsRequest) Reset

func (x *DrawCardsRequest) Reset()

func (*DrawCardsRequest) String

func (x *DrawCardsRequest) String() string

type DrawCardsResponse

type DrawCardsResponse struct {
	Cards []*Card `protobuf:"bytes,1,rep,name=cards,proto3" json:"cards,omitempty"`
	// contains filtered or unexported fields
}

DrawCardsResponse holds the cards drawn.

func (*DrawCardsResponse) Descriptor deprecated

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

Deprecated: Use DrawCardsResponse.ProtoReflect.Descriptor instead.

func (*DrawCardsResponse) GetCards

func (x *DrawCardsResponse) GetCards() []*Card

func (*DrawCardsResponse) ProtoMessage

func (*DrawCardsResponse) ProtoMessage()

func (*DrawCardsResponse) ProtoReflect

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

func (*DrawCardsResponse) Reset

func (x *DrawCardsResponse) Reset()

func (*DrawCardsResponse) String

func (x *DrawCardsResponse) String() string

type OpenDeckRequest

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

OpenDeckRequest holds the deck id needed to open a deck.

func (*OpenDeckRequest) Descriptor deprecated

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

Deprecated: Use OpenDeckRequest.ProtoReflect.Descriptor instead.

func (*OpenDeckRequest) GetId

func (x *OpenDeckRequest) GetId() string

func (*OpenDeckRequest) ProtoMessage

func (*OpenDeckRequest) ProtoMessage()

func (*OpenDeckRequest) ProtoReflect

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

func (*OpenDeckRequest) Reset

func (x *OpenDeckRequest) Reset()

func (*OpenDeckRequest) String

func (x *OpenDeckRequest) String() string

type OpenDeckResponse

type OpenDeckResponse struct {
	Deck *DeckOpened `protobuf:"bytes,1,opt,name=deck,proto3" json:"deck,omitempty"`
	// contains filtered or unexported fields
}

OpenDeckResponse holds the deck opened.

func (*OpenDeckResponse) Descriptor deprecated

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

Deprecated: Use OpenDeckResponse.ProtoReflect.Descriptor instead.

func (*OpenDeckResponse) GetDeck

func (x *OpenDeckResponse) GetDeck() *DeckOpened

func (*OpenDeckResponse) ProtoMessage

func (*OpenDeckResponse) ProtoMessage()

func (*OpenDeckResponse) ProtoReflect

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

func (*OpenDeckResponse) Reset

func (x *OpenDeckResponse) Reset()

func (*OpenDeckResponse) String

func (x *OpenDeckResponse) String() string

type ShuffleDeckRequest

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

ShuffleDeckRequest holds the id of the deck to shuffle.

func (*ShuffleDeckRequest) Descriptor deprecated

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

Deprecated: Use ShuffleDeckRequest.ProtoReflect.Descriptor instead.

func (*ShuffleDeckRequest) GetId

func (x *ShuffleDeckRequest) GetId() string

func (*ShuffleDeckRequest) ProtoMessage

func (*ShuffleDeckRequest) ProtoMessage()

func (*ShuffleDeckRequest) ProtoReflect

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

func (*ShuffleDeckRequest) Reset

func (x *ShuffleDeckRequest) Reset()

func (*ShuffleDeckRequest) String

func (x *ShuffleDeckRequest) String() string

type ShuffleDeckResponse

type ShuffleDeckResponse struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

ShuffleDeckResponse holds the message after shuffling a deck.

func (*ShuffleDeckResponse) Descriptor deprecated

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

Deprecated: Use ShuffleDeckResponse.ProtoReflect.Descriptor instead.

func (*ShuffleDeckResponse) GetMessage

func (x *ShuffleDeckResponse) GetMessage() string

func (*ShuffleDeckResponse) ProtoMessage

func (*ShuffleDeckResponse) ProtoMessage()

func (*ShuffleDeckResponse) ProtoReflect

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

func (*ShuffleDeckResponse) Reset

func (x *ShuffleDeckResponse) Reset()

func (*ShuffleDeckResponse) String

func (x *ShuffleDeckResponse) String() string

type UnimplementedDeckServiceServer

type UnimplementedDeckServiceServer struct {
}

UnimplementedDeckServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedDeckServiceServer) CreateDeck

func (UnimplementedDeckServiceServer) DrawCards

func (UnimplementedDeckServiceServer) OpenDeck

func (UnimplementedDeckServiceServer) ShuffleDeck

type UnsafeDeckServiceServer

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

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

Jump to

Keyboard shortcuts

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