v1

package
v0.0.0-...-182277c Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT 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 File_api_protobuf_user_v1_user_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.protobuf.user.v1.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListUsersByIDs",
			Handler:    _UserService_ListUsersByIDs_Handler,
		},
		{
			MethodName: "GetUser",
			Handler:    _UserService_GetUser_Handler,
		},
		{
			MethodName: "GetUserByEmail",
			Handler:    _UserService_GetUserByEmail_Handler,
		},
		{
			MethodName: "GetUserByUsername",
			Handler:    _UserService_GetUserByUsername_Handler,
		},
		{
			MethodName: "CreateUser",
			Handler:    _UserService_CreateUser_Handler,
		},
		{
			MethodName: "UpdateUser",
			Handler:    _UserService_UpdateUser_Handler,
		},
		{
			MethodName: "DeleteUser",
			Handler:    _UserService_DeleteUser_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/protobuf/user/v1/user.proto",
}

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

Functions

func RegisterUserServiceHandler

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

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

func RegisterUserServiceHandlerClient

func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error

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

func RegisterUserServiceHandlerFromEndpoint

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

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

func RegisterUserServiceHandlerServer

func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error

RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux". UnaryRPC :call UserServiceServer 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 RegisterUserServiceHandlerFromEndpoint instead.

func RegisterUserServiceServer

func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)

Types

type CreateUserRequest

type CreateUserRequest struct {
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

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 {
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateUserResponse) Descriptor deprecated

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

Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead.

func (*CreateUserResponse) GetUser

func (x *CreateUserResponse) GetUser() *User

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 DeleteUserRequest

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

func (*DeleteUserRequest) Descriptor deprecated

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

Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.

func (*DeleteUserRequest) GetId

func (x *DeleteUserRequest) GetId() uint64

func (*DeleteUserRequest) ProtoMessage

func (*DeleteUserRequest) ProtoMessage()

func (*DeleteUserRequest) ProtoReflect

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

func (*DeleteUserRequest) Reset

func (x *DeleteUserRequest) Reset()

func (*DeleteUserRequest) String

func (x *DeleteUserRequest) String() string

type DeleteUserResponse

type DeleteUserResponse struct {
	Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteUserResponse) Descriptor deprecated

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

Deprecated: Use DeleteUserResponse.ProtoReflect.Descriptor instead.

func (*DeleteUserResponse) GetSuccess

func (x *DeleteUserResponse) GetSuccess() bool

func (*DeleteUserResponse) ProtoMessage

func (*DeleteUserResponse) ProtoMessage()

func (*DeleteUserResponse) ProtoReflect

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

func (*DeleteUserResponse) Reset

func (x *DeleteUserResponse) Reset()

func (*DeleteUserResponse) String

func (x *DeleteUserResponse) String() string

type GetUserByEmailRequest

type GetUserByEmailRequest struct {
	Email    string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*GetUserByEmailRequest) Descriptor deprecated

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

Deprecated: Use GetUserByEmailRequest.ProtoReflect.Descriptor instead.

func (*GetUserByEmailRequest) GetEmail

func (x *GetUserByEmailRequest) GetEmail() string

func (*GetUserByEmailRequest) GetPassword

func (x *GetUserByEmailRequest) GetPassword() string

func (*GetUserByEmailRequest) ProtoMessage

func (*GetUserByEmailRequest) ProtoMessage()

func (*GetUserByEmailRequest) ProtoReflect

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

func (*GetUserByEmailRequest) Reset

func (x *GetUserByEmailRequest) Reset()

func (*GetUserByEmailRequest) String

func (x *GetUserByEmailRequest) String() string

type GetUserByUsernameRequest

type GetUserByUsernameRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*GetUserByUsernameRequest) Descriptor deprecated

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

Deprecated: Use GetUserByUsernameRequest.ProtoReflect.Descriptor instead.

func (*GetUserByUsernameRequest) GetPassword

func (x *GetUserByUsernameRequest) GetPassword() string

func (*GetUserByUsernameRequest) GetUsername

func (x *GetUserByUsernameRequest) GetUsername() string

func (*GetUserByUsernameRequest) ProtoMessage

func (*GetUserByUsernameRequest) ProtoMessage()

func (*GetUserByUsernameRequest) ProtoReflect

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

func (*GetUserByUsernameRequest) Reset

func (x *GetUserByUsernameRequest) Reset()

func (*GetUserByUsernameRequest) String

func (x *GetUserByUsernameRequest) String() string

type GetUserRequest

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

func (*GetUserRequest) Descriptor deprecated

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

Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead.

func (*GetUserRequest) GetId

func (x *GetUserRequest) GetId() uint64

func (*GetUserRequest) ProtoMessage

func (*GetUserRequest) ProtoMessage()

func (*GetUserRequest) ProtoReflect

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

func (*GetUserRequest) Reset

func (x *GetUserRequest) Reset()

func (*GetUserRequest) String

func (x *GetUserRequest) String() string

type GetUserResponse

type GetUserResponse struct {
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*GetUserResponse) Descriptor deprecated

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

Deprecated: Use GetUserResponse.ProtoReflect.Descriptor instead.

func (*GetUserResponse) GetUser

func (x *GetUserResponse) GetUser() *User

func (*GetUserResponse) ProtoMessage

func (*GetUserResponse) ProtoMessage()

func (*GetUserResponse) ProtoReflect

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

func (*GetUserResponse) Reset

func (x *GetUserResponse) Reset()

func (*GetUserResponse) String

func (x *GetUserResponse) String() string

type ListUsersByIDsRequest

type ListUsersByIDsRequest struct {
	Ids []uint64 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"`
	// contains filtered or unexported fields
}

func (*ListUsersByIDsRequest) Descriptor deprecated

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

Deprecated: Use ListUsersByIDsRequest.ProtoReflect.Descriptor instead.

func (*ListUsersByIDsRequest) GetIds

func (x *ListUsersByIDsRequest) GetIds() []uint64

func (*ListUsersByIDsRequest) ProtoMessage

func (*ListUsersByIDsRequest) ProtoMessage()

func (*ListUsersByIDsRequest) ProtoReflect

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

func (*ListUsersByIDsRequest) Reset

func (x *ListUsersByIDsRequest) Reset()

func (*ListUsersByIDsRequest) String

func (x *ListUsersByIDsRequest) String() string

type ListUsersByIDsResponse

type ListUsersByIDsResponse struct {
	Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
	// contains filtered or unexported fields
}

func (*ListUsersByIDsResponse) Descriptor deprecated

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

Deprecated: Use ListUsersByIDsResponse.ProtoReflect.Descriptor instead.

func (*ListUsersByIDsResponse) GetUsers

func (x *ListUsersByIDsResponse) GetUsers() []*User

func (*ListUsersByIDsResponse) ProtoMessage

func (*ListUsersByIDsResponse) ProtoMessage()

func (*ListUsersByIDsResponse) ProtoReflect

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

func (*ListUsersByIDsResponse) Reset

func (x *ListUsersByIDsResponse) Reset()

func (*ListUsersByIDsResponse) String

func (x *ListUsersByIDsResponse) String() string

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) CreateUser

func (UnimplementedUserServiceServer) DeleteUser

func (UnimplementedUserServiceServer) GetUser

func (UnimplementedUserServiceServer) GetUserByEmail

func (UnimplementedUserServiceServer) GetUserByUsername

func (UnimplementedUserServiceServer) ListUsersByIDs

func (UnimplementedUserServiceServer) UpdateUser

type UnsafeUserServiceServer

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

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

type UpdateUserRequest

type UpdateUserRequest struct {
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateUserRequest) Descriptor deprecated

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

Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.

func (*UpdateUserRequest) GetUser

func (x *UpdateUserRequest) GetUser() *User

func (*UpdateUserRequest) ProtoMessage

func (*UpdateUserRequest) ProtoMessage()

func (*UpdateUserRequest) ProtoReflect

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

func (*UpdateUserRequest) Reset

func (x *UpdateUserRequest) Reset()

func (*UpdateUserRequest) String

func (x *UpdateUserRequest) String() string

type UpdateUserResponse

type UpdateUserResponse struct {
	Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateUserResponse) Descriptor deprecated

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

Deprecated: Use UpdateUserResponse.ProtoReflect.Descriptor instead.

func (*UpdateUserResponse) GetSuccess

func (x *UpdateUserResponse) GetSuccess() bool

func (*UpdateUserResponse) ProtoMessage

func (*UpdateUserResponse) ProtoMessage()

func (*UpdateUserResponse) ProtoReflect

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

func (*UpdateUserResponse) Reset

func (x *UpdateUserResponse) Reset()

func (*UpdateUserResponse) String

func (x *UpdateUserResponse) String() string

type User

type User struct {
	Id        uint64                 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Uuid      string                 `protobuf:"bytes,2,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Username  string                 `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
	Email     string                 `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"`
	Avatar    string                 `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"`
	Password  string                 `protobuf:"bytes,6,opt,name=password,proto3" json:"password,omitempty"`
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetAvatar

func (x *User) GetAvatar() string

func (*User) GetCreatedAt

func (x *User) GetCreatedAt() *timestamppb.Timestamp

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetId

func (x *User) GetId() uint64

func (*User) GetPassword

func (x *User) GetPassword() string

func (*User) GetUpdatedAt

func (x *User) GetUpdatedAt() *timestamppb.Timestamp

func (*User) GetUsername

func (x *User) GetUsername() string

func (*User) GetUuid

func (x *User) GetUuid() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

type UserServiceClient

type UserServiceClient interface {
	ListUsersByIDs(ctx context.Context, in *ListUsersByIDsRequest, opts ...grpc.CallOption) (*ListUsersByIDsResponse, error)
	GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error)
	GetUserByEmail(ctx context.Context, in *GetUserByEmailRequest, opts ...grpc.CallOption) (*GetUserResponse, error)
	GetUserByUsername(ctx context.Context, in *GetUserByUsernameRequest, opts ...grpc.CallOption) (*GetUserResponse, error)
	CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error)
	UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error)
	DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error)
}

UserServiceClient is the client API for UserService 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 UserServiceServer

UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility

Jump to

Keyboard shortcuts

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