Documentation ¶
Overview ¶
Package sdk is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterUserAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserAPIClient) error
- func RegisterUserAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserAPIServer) error
- func RegisterUserAPIServer(s grpc.ServiceRegistrar, srv UserAPIServer)
- type CreateUserRequest
- type CreateUserResponse
- type UnimplementedUserAPIServer
- type UnsafeUserAPIServer
- type User
- type UserAPIClient
- type UserAPIServer
Constants ¶
This section is empty.
Variables ¶
var File_example_proto protoreflect.FileDescriptor
var UserAPI_ServiceDesc = grpc.ServiceDesc{ ServiceName: "phogolabs.plex.example.sdk.UserAPI", HandlerType: (*UserAPIServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateUser", Handler: _UserAPI_CreateUser_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "example.proto", }
UserAPI_ServiceDesc is the grpc.ServiceDesc for UserAPI service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterUserAPIHandler ¶
func RegisterUserAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterUserAPIHandler registers the http handlers for service UserAPI to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserAPIHandlerClient ¶
func RegisterUserAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserAPIClient) error
RegisterUserAPIHandlerClient registers the http handlers for service UserAPI to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserAPIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserAPIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserAPIClient" to call the correct interceptors.
func RegisterUserAPIHandlerFromEndpoint ¶
func RegisterUserAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserAPIHandlerFromEndpoint is same as RegisterUserAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserAPIHandlerServer ¶
func RegisterUserAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserAPIServer) error
RegisterUserAPIHandlerServer registers the http handlers for service UserAPI to "mux". UnaryRPC :call UserAPIServer 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 RegisterUserAPIHandlerFromEndpoint instead.
func RegisterUserAPIServer ¶
func RegisterUserAPIServer(s grpc.ServiceRegistrar, srv UserAPIServer)
Types ¶
type CreateUserRequest ¶
type CreateUserRequest struct { // User represents a user User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty" validate:"required"` // contains filtered or unexported fields }
CreateUserRequest creates an account for given email and password
func (*CreateUserRequest) Descriptor
deprecated
func (*CreateUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.
func (*CreateUserRequest) GetUser ¶
func (x *CreateUserRequest) GetUser() *User
func (*CreateUserRequest) ProtoMessage ¶
func (*CreateUserRequest) ProtoMessage()
func (*CreateUserRequest) ProtoReflect ¶
func (x *CreateUserRequest) ProtoReflect() protoreflect.Message
func (*CreateUserRequest) Reset ¶
func (x *CreateUserRequest) Reset()
func (*CreateUserRequest) String ¶
func (x *CreateUserRequest) String() string
type CreateUserResponse ¶
type CreateUserResponse struct { // Represents the publication's unique identifier. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" validate:"required,gt=0,uuid"` // contains filtered or unexported fields }
CreateUserResponse is the payload returned when a new user is created
func (*CreateUserResponse) Descriptor
deprecated
func (*CreateUserResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead.
func (*CreateUserResponse) GetId ¶
func (x *CreateUserResponse) GetId() string
func (*CreateUserResponse) ProtoMessage ¶
func (*CreateUserResponse) ProtoMessage()
func (*CreateUserResponse) ProtoReflect ¶
func (x *CreateUserResponse) ProtoReflect() protoreflect.Message
func (*CreateUserResponse) Reset ¶
func (x *CreateUserResponse) Reset()
func (*CreateUserResponse) String ¶
func (x *CreateUserResponse) String() string
type UnimplementedUserAPIServer ¶
type UnimplementedUserAPIServer struct { }
UnimplementedUserAPIServer should be embedded to have forward compatible implementations.
func (UnimplementedUserAPIServer) CreateUser ¶
func (UnimplementedUserAPIServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error)
type UnsafeUserAPIServer ¶
type UnsafeUserAPIServer interface {
// contains filtered or unexported methods
}
UnsafeUserAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserAPIServer will result in compilation errors.
type User ¶
type User struct { // Represents the user's email address. Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty" validate:"required,gt=0,lte=256,email" form:"email"` // Represents the user's password. Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" validate:"required,gte=8" form:"password"` // contains filtered or unexported fields }
User details
func (*User) Descriptor
deprecated
func (*User) GetPassword ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserAPIClient ¶
type UserAPIClient interface { // CreateUser creates a new user for given email and password CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) }
UserAPIClient is the client API for UserAPI 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.
func NewUserAPIClient ¶
func NewUserAPIClient(cc grpc.ClientConnInterface) UserAPIClient
type UserAPIServer ¶
type UserAPIServer interface { // CreateUser creates a new user for given email and password CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) }
UserAPIServer is the server API for UserAPI service. All implementations should embed UnimplementedUserAPIServer for forward compatibility