Documentation ¶
Overview ¶
Package api is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterUsersHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUsersHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UsersClient) error
- func RegisterUsersHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUsersHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UsersServer) error
- func RegisterUsersServer(s grpc.ServiceRegistrar, srv UsersServer)
- type GetMe
- type GetMe_Request
- type GetMe_Response
- func (*GetMe_Response) Descriptor() ([]byte, []int)deprecated
- func (x *GetMe_Response) GetCreatedAt() *timestamppb.Timestamp
- func (x *GetMe_Response) GetNickname() string
- func (x *GetMe_Response) GetUserId() string
- func (*GetMe_Response) ProtoMessage()
- func (x *GetMe_Response) ProtoReflect() protoreflect.Message
- func (x *GetMe_Response) Reset()
- func (x *GetMe_Response) String() string
- type Login
- type Login_Request
- type Login_Response
- func (*Login_Response) Descriptor() ([]byte, []int)deprecated
- func (x *Login_Response) GetCreatedAt() *timestamppb.Timestamp
- func (x *Login_Response) GetNickname() string
- func (x *Login_Response) GetUserId() string
- func (*Login_Response) ProtoMessage()
- func (x *Login_Response) ProtoReflect() protoreflect.Message
- func (x *Login_Response) Reset()
- func (x *Login_Response) String() string
- type UnimplementedUsersServer
- type UnsafeUsersServer
- type UpdateMe
- type UpdateMe_Request
- type UpdateMe_Response
- func (*UpdateMe_Response) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateMe_Response) GetCreatedAt() *timestamppb.Timestamp
- func (x *UpdateMe_Response) GetNickname() string
- func (x *UpdateMe_Response) GetUserId() string
- func (*UpdateMe_Response) ProtoMessage()
- func (x *UpdateMe_Response) ProtoReflect() protoreflect.Message
- func (x *UpdateMe_Response) Reset()
- func (x *UpdateMe_Response) String() string
- type UsersClient
- type UsersServer
Constants ¶
const ( Users_Login_FullMethodName = "/api.Users/Login" Users_GetMe_FullMethodName = "/api.Users/GetMe" Users_UpdateMe_FullMethodName = "/api.Users/UpdateMe" )
Variables ¶
var File_pkg_api_users_proto protoreflect.FileDescriptor
var SwaggerJson []byte
var Users_ServiceDesc = grpc.ServiceDesc{ ServiceName: "api.Users", HandlerType: (*UsersServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Login", Handler: _Users_Login_Handler, }, { MethodName: "GetMe", Handler: _Users_GetMe_Handler, }, { MethodName: "UpdateMe", Handler: _Users_UpdateMe_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "pkg/api/users.proto", }
Users_ServiceDesc is the grpc.ServiceDesc for Users service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterUsersHandler ¶
RegisterUsersHandler registers the http handlers for service Users to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUsersHandlerClient ¶
func RegisterUsersHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UsersClient) error
RegisterUsersHandlerClient registers the http handlers for service Users to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UsersClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UsersClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UsersClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterUsersHandlerFromEndpoint ¶
func RegisterUsersHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUsersHandlerFromEndpoint is same as RegisterUsersHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUsersHandlerServer ¶
func RegisterUsersHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UsersServer) error
RegisterUsersHandlerServer registers the http handlers for service Users to "mux". UnaryRPC :call UsersServer 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 RegisterUsersHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterUsersServer ¶
func RegisterUsersServer(s grpc.ServiceRegistrar, srv UsersServer)
Types ¶
type GetMe ¶ added in v0.0.4
type GetMe struct {
// contains filtered or unexported fields
}
func (*GetMe) Descriptor
deprecated
added in
v0.0.4
func (*GetMe) ProtoMessage ¶ added in v0.0.4
func (*GetMe) ProtoMessage()
func (*GetMe) ProtoReflect ¶ added in v0.0.4
func (x *GetMe) ProtoReflect() protoreflect.Message
type GetMe_Request ¶ added in v0.0.4
type GetMe_Request struct {
// contains filtered or unexported fields
}
func (*GetMe_Request) Descriptor
deprecated
added in
v0.0.4
func (*GetMe_Request) Descriptor() ([]byte, []int)
Deprecated: Use GetMe_Request.ProtoReflect.Descriptor instead.
func (*GetMe_Request) ProtoMessage ¶ added in v0.0.4
func (*GetMe_Request) ProtoMessage()
func (*GetMe_Request) ProtoReflect ¶ added in v0.0.4
func (x *GetMe_Request) ProtoReflect() protoreflect.Message
func (*GetMe_Request) Reset ¶ added in v0.0.4
func (x *GetMe_Request) Reset()
func (*GetMe_Request) String ¶ added in v0.0.4
func (x *GetMe_Request) String() string
type GetMe_Response ¶ added in v0.0.4
type GetMe_Response struct { UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // contains filtered or unexported fields }
func (*GetMe_Response) Descriptor
deprecated
added in
v0.0.4
func (*GetMe_Response) Descriptor() ([]byte, []int)
Deprecated: Use GetMe_Response.ProtoReflect.Descriptor instead.
func (*GetMe_Response) GetCreatedAt ¶ added in v0.0.4
func (x *GetMe_Response) GetCreatedAt() *timestamppb.Timestamp
func (*GetMe_Response) GetNickname ¶ added in v0.0.4
func (x *GetMe_Response) GetNickname() string
func (*GetMe_Response) GetUserId ¶ added in v0.0.4
func (x *GetMe_Response) GetUserId() string
func (*GetMe_Response) ProtoMessage ¶ added in v0.0.4
func (*GetMe_Response) ProtoMessage()
func (*GetMe_Response) ProtoReflect ¶ added in v0.0.4
func (x *GetMe_Response) ProtoReflect() protoreflect.Message
func (*GetMe_Response) Reset ¶ added in v0.0.4
func (x *GetMe_Response) Reset()
func (*GetMe_Response) String ¶ added in v0.0.4
func (x *GetMe_Response) String() string
type Login ¶
type Login struct {
// contains filtered or unexported fields
}
func (*Login) Descriptor
deprecated
func (*Login) ProtoMessage ¶
func (*Login) ProtoMessage()
func (*Login) ProtoReflect ¶
func (x *Login) ProtoReflect() protoreflect.Message
type Login_Request ¶
type Login_Request struct {
// contains filtered or unexported fields
}
func (*Login_Request) Descriptor
deprecated
func (*Login_Request) Descriptor() ([]byte, []int)
Deprecated: Use Login_Request.ProtoReflect.Descriptor instead.
func (*Login_Request) ProtoMessage ¶
func (*Login_Request) ProtoMessage()
func (*Login_Request) ProtoReflect ¶
func (x *Login_Request) ProtoReflect() protoreflect.Message
func (*Login_Request) Reset ¶
func (x *Login_Request) Reset()
func (*Login_Request) String ¶
func (x *Login_Request) String() string
type Login_Response ¶
type Login_Response struct { UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // contains filtered or unexported fields }
func (*Login_Response) Descriptor
deprecated
func (*Login_Response) Descriptor() ([]byte, []int)
Deprecated: Use Login_Response.ProtoReflect.Descriptor instead.
func (*Login_Response) GetCreatedAt ¶ added in v0.0.3
func (x *Login_Response) GetCreatedAt() *timestamppb.Timestamp
func (*Login_Response) GetNickname ¶ added in v0.0.3
func (x *Login_Response) GetNickname() string
func (*Login_Response) GetUserId ¶ added in v0.0.3
func (x *Login_Response) GetUserId() string
func (*Login_Response) ProtoMessage ¶
func (*Login_Response) ProtoMessage()
func (*Login_Response) ProtoReflect ¶
func (x *Login_Response) ProtoReflect() protoreflect.Message
func (*Login_Response) Reset ¶
func (x *Login_Response) Reset()
func (*Login_Response) String ¶
func (x *Login_Response) String() string
type UnimplementedUsersServer ¶
type UnimplementedUsersServer struct { }
UnimplementedUsersServer must be embedded to have forward compatible implementations.
func (UnimplementedUsersServer) GetMe ¶ added in v0.0.4
func (UnimplementedUsersServer) GetMe(context.Context, *GetMe_Request) (*GetMe_Response, error)
func (UnimplementedUsersServer) Login ¶
func (UnimplementedUsersServer) Login(context.Context, *Login_Request) (*Login_Response, error)
func (UnimplementedUsersServer) UpdateMe ¶ added in v0.0.4
func (UnimplementedUsersServer) UpdateMe(context.Context, *UpdateMe_Request) (*UpdateMe_Response, error)
type UnsafeUsersServer ¶
type UnsafeUsersServer interface {
// contains filtered or unexported methods
}
UnsafeUsersServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UsersServer will result in compilation errors.
type UpdateMe ¶ added in v0.0.4
type UpdateMe struct {
// contains filtered or unexported fields
}
func (*UpdateMe) Descriptor
deprecated
added in
v0.0.4
func (*UpdateMe) ProtoMessage ¶ added in v0.0.4
func (*UpdateMe) ProtoMessage()
func (*UpdateMe) ProtoReflect ¶ added in v0.0.4
func (x *UpdateMe) ProtoReflect() protoreflect.Message
type UpdateMe_Request ¶ added in v0.0.4
type UpdateMe_Request struct { Nickname string `protobuf:"bytes,1,opt,name=nickname,proto3" json:"nickname,omitempty"` // contains filtered or unexported fields }
func (*UpdateMe_Request) Descriptor
deprecated
added in
v0.0.4
func (*UpdateMe_Request) Descriptor() ([]byte, []int)
Deprecated: Use UpdateMe_Request.ProtoReflect.Descriptor instead.
func (*UpdateMe_Request) GetNickname ¶ added in v0.0.4
func (x *UpdateMe_Request) GetNickname() string
func (*UpdateMe_Request) ProtoMessage ¶ added in v0.0.4
func (*UpdateMe_Request) ProtoMessage()
func (*UpdateMe_Request) ProtoReflect ¶ added in v0.0.4
func (x *UpdateMe_Request) ProtoReflect() protoreflect.Message
func (*UpdateMe_Request) Reset ¶ added in v0.0.4
func (x *UpdateMe_Request) Reset()
func (*UpdateMe_Request) String ¶ added in v0.0.4
func (x *UpdateMe_Request) String() string
type UpdateMe_Response ¶ added in v0.0.4
type UpdateMe_Response struct { UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // contains filtered or unexported fields }
func (*UpdateMe_Response) Descriptor
deprecated
added in
v0.0.4
func (*UpdateMe_Response) Descriptor() ([]byte, []int)
Deprecated: Use UpdateMe_Response.ProtoReflect.Descriptor instead.
func (*UpdateMe_Response) GetCreatedAt ¶ added in v0.0.4
func (x *UpdateMe_Response) GetCreatedAt() *timestamppb.Timestamp
func (*UpdateMe_Response) GetNickname ¶ added in v0.0.4
func (x *UpdateMe_Response) GetNickname() string
func (*UpdateMe_Response) GetUserId ¶ added in v0.0.4
func (x *UpdateMe_Response) GetUserId() string
func (*UpdateMe_Response) ProtoMessage ¶ added in v0.0.4
func (*UpdateMe_Response) ProtoMessage()
func (*UpdateMe_Response) ProtoReflect ¶ added in v0.0.4
func (x *UpdateMe_Response) ProtoReflect() protoreflect.Message
func (*UpdateMe_Response) Reset ¶ added in v0.0.4
func (x *UpdateMe_Response) Reset()
func (*UpdateMe_Response) String ¶ added in v0.0.4
func (x *UpdateMe_Response) String() string
type UsersClient ¶
type UsersClient interface { Login(ctx context.Context, in *Login_Request, opts ...grpc.CallOption) (*Login_Response, error) GetMe(ctx context.Context, in *GetMe_Request, opts ...grpc.CallOption) (*GetMe_Response, error) UpdateMe(ctx context.Context, in *UpdateMe_Request, opts ...grpc.CallOption) (*UpdateMe_Response, error) }
UsersClient is the client API for Users 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 NewUsersClient ¶
func NewUsersClient(cc grpc.ClientConnInterface) UsersClient
type UsersServer ¶
type UsersServer interface { Login(context.Context, *Login_Request) (*Login_Response, error) GetMe(context.Context, *GetMe_Request) (*GetMe_Response, error) UpdateMe(context.Context, *UpdateMe_Request) (*UpdateMe_Response, error) // contains filtered or unexported methods }
UsersServer is the server API for Users service. All implementations must embed UnimplementedUsersServer for forward compatibility