pb

package
v0.0.0-...-fea6390 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	GoBank_RegisterUser_FullMethodName = "/pb.GoBank/RegisterUser"
	GoBank_LoginUser_FullMethodName    = "/pb.GoBank/LoginUser"
	GoBank_UpdateUser_FullMethodName   = "/pb.GoBank/UpdateUser"
	GoBank_VerifyEmail_FullMethodName  = "/pb.GoBank/VerifyEmail"
)

Variables

View Source
var File_rpc_login_user_proto protoreflect.FileDescriptor
View Source
var File_rpc_register_user_proto protoreflect.FileDescriptor
View Source
var File_rpc_update_user_proto protoreflect.FileDescriptor
View Source
var File_rpc_verify_email_proto protoreflect.FileDescriptor
View Source
var File_service_gobank_proto protoreflect.FileDescriptor
View Source
var GoBank_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pb.GoBank",
	HandlerType: (*GoBankServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RegisterUser",
			Handler:    _GoBank_RegisterUser_Handler,
		},
		{
			MethodName: "LoginUser",
			Handler:    _GoBank_LoginUser_Handler,
		},
		{
			MethodName: "UpdateUser",
			Handler:    _GoBank_UpdateUser_Handler,
		},
		{
			MethodName: "VerifyEmail",
			Handler:    _GoBank_VerifyEmail_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service_gobank.proto",
}

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

Functions

func RegisterGoBankHandler

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

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

func RegisterGoBankHandlerClient

func RegisterGoBankHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GoBankClient) error

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

func RegisterGoBankHandlerFromEndpoint

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

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

func RegisterGoBankHandlerServer

func RegisterGoBankHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GoBankServer) error

RegisterGoBankHandlerServer registers the http handlers for service GoBank to "mux". UnaryRPC :call GoBankServer 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 RegisterGoBankHandlerFromEndpoint 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 RegisterGoBankServer

func RegisterGoBankServer(s grpc.ServiceRegistrar, srv GoBankServer)

Types

type GoBankClient

type GoBankClient interface {
	RegisterUser(ctx context.Context, in *RegisterUserRequest, opts ...grpc.CallOption) (*RegisterUserResponse, error)
	LoginUser(ctx context.Context, in *LoginUserRequest, opts ...grpc.CallOption) (*LoginUserResponse, error)
	UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error)
	VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...grpc.CallOption) (*VerifyEmailResponse, error)
}

GoBankClient is the client API for GoBank 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 NewGoBankClient

func NewGoBankClient(cc grpc.ClientConnInterface) GoBankClient

type GoBankServer

type GoBankServer interface {
	RegisterUser(context.Context, *RegisterUserRequest) (*RegisterUserResponse, error)
	LoginUser(context.Context, *LoginUserRequest) (*LoginUserResponse, error)
	UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error)
	VerifyEmail(context.Context, *VerifyEmailRequest) (*VerifyEmailResponse, error)
	// contains filtered or unexported methods
}

GoBankServer is the server API for GoBank service. All implementations must embed UnimplementedGoBankServer for forward compatibility.

type LoginUserRequest

type LoginUserRequest 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 (*LoginUserRequest) Descriptor deprecated

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

Deprecated: Use LoginUserRequest.ProtoReflect.Descriptor instead.

func (*LoginUserRequest) GetPassword

func (x *LoginUserRequest) GetPassword() string

func (*LoginUserRequest) GetUsername

func (x *LoginUserRequest) GetUsername() string

func (*LoginUserRequest) ProtoMessage

func (*LoginUserRequest) ProtoMessage()

func (*LoginUserRequest) ProtoReflect

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

func (*LoginUserRequest) Reset

func (x *LoginUserRequest) Reset()

func (*LoginUserRequest) String

func (x *LoginUserRequest) String() string

type LoginUserResponse

type LoginUserResponse struct {
	User                  *User                `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	SessionId             string               `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	AccessToken           string               `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken          string               `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	AccessTokenExpiresAt  *timestamp.Timestamp `protobuf:"bytes,5,opt,name=access_token_expires_at,json=accessTokenExpiresAt,proto3" json:"access_token_expires_at,omitempty"`
	RefreshTokenExpiresAt *timestamp.Timestamp `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*LoginUserResponse) Descriptor deprecated

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

Deprecated: Use LoginUserResponse.ProtoReflect.Descriptor instead.

func (*LoginUserResponse) GetAccessToken

func (x *LoginUserResponse) GetAccessToken() string

func (*LoginUserResponse) GetAccessTokenExpiresAt

func (x *LoginUserResponse) GetAccessTokenExpiresAt() *timestamp.Timestamp

func (*LoginUserResponse) GetRefreshToken

func (x *LoginUserResponse) GetRefreshToken() string

func (*LoginUserResponse) GetRefreshTokenExpiresAt

func (x *LoginUserResponse) GetRefreshTokenExpiresAt() *timestamp.Timestamp

func (*LoginUserResponse) GetSessionId

func (x *LoginUserResponse) GetSessionId() string

func (*LoginUserResponse) GetUser

func (x *LoginUserResponse) GetUser() *User

func (*LoginUserResponse) ProtoMessage

func (*LoginUserResponse) ProtoMessage()

func (*LoginUserResponse) ProtoReflect

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

func (*LoginUserResponse) Reset

func (x *LoginUserResponse) Reset()

func (*LoginUserResponse) String

func (x *LoginUserResponse) String() string

type RegisterUserRequest

type RegisterUserRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	FullName string `protobuf:"bytes,2,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"`
	Email    string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*RegisterUserRequest) Descriptor deprecated

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

Deprecated: Use RegisterUserRequest.ProtoReflect.Descriptor instead.

func (*RegisterUserRequest) GetEmail

func (x *RegisterUserRequest) GetEmail() string

func (*RegisterUserRequest) GetFullName

func (x *RegisterUserRequest) GetFullName() string

func (*RegisterUserRequest) GetPassword

func (x *RegisterUserRequest) GetPassword() string

func (*RegisterUserRequest) GetUsername

func (x *RegisterUserRequest) GetUsername() string

func (*RegisterUserRequest) ProtoMessage

func (*RegisterUserRequest) ProtoMessage()

func (*RegisterUserRequest) ProtoReflect

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

func (*RegisterUserRequest) Reset

func (x *RegisterUserRequest) Reset()

func (*RegisterUserRequest) String

func (x *RegisterUserRequest) String() string

type RegisterUserResponse

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

func (*RegisterUserResponse) Descriptor deprecated

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

Deprecated: Use RegisterUserResponse.ProtoReflect.Descriptor instead.

func (*RegisterUserResponse) GetUser

func (x *RegisterUserResponse) GetUser() *User

func (*RegisterUserResponse) ProtoMessage

func (*RegisterUserResponse) ProtoMessage()

func (*RegisterUserResponse) ProtoReflect

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

func (*RegisterUserResponse) Reset

func (x *RegisterUserResponse) Reset()

func (*RegisterUserResponse) String

func (x *RegisterUserResponse) String() string

type UnimplementedGoBankServer

type UnimplementedGoBankServer struct{}

UnimplementedGoBankServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedGoBankServer) LoginUser

func (UnimplementedGoBankServer) RegisterUser

func (UnimplementedGoBankServer) UpdateUser

func (UnimplementedGoBankServer) VerifyEmail

type UnsafeGoBankServer

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

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

type UpdateUserRequest

type UpdateUserRequest struct {
	Username string  `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	FullName *string `protobuf:"bytes,2,opt,name=full_name,json=fullName,proto3,oneof" json:"full_name,omitempty"`
	Email    *string `protobuf:"bytes,3,opt,name=email,proto3,oneof" json:"email,omitempty"`
	Password *string `protobuf:"bytes,4,opt,name=password,proto3,oneof" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateUserRequest) Descriptor deprecated

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

Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.

func (*UpdateUserRequest) GetEmail

func (x *UpdateUserRequest) GetEmail() string

func (*UpdateUserRequest) GetFullName

func (x *UpdateUserRequest) GetFullName() string

func (*UpdateUserRequest) GetPassword

func (x *UpdateUserRequest) GetPassword() string

func (*UpdateUserRequest) GetUsername

func (x *UpdateUserRequest) GetUsername() string

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

func (*UpdateUserResponse) Descriptor deprecated

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

Deprecated: Use UpdateUserResponse.ProtoReflect.Descriptor instead.

func (*UpdateUserResponse) GetUser

func (x *UpdateUserResponse) GetUser() *User

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 {
	Username          string               `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	FullName          string               `protobuf:"bytes,2,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"`
	Email             string               `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	PasswordChangedAt *timestamp.Timestamp `protobuf:"bytes,4,opt,name=password_changed_at,json=passwordChangedAt,proto3" json:"password_changed_at,omitempty"`
	CreatedAt         *timestamp.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetCreatedAt

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

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetFullName

func (x *User) GetFullName() string

func (*User) GetPasswordChangedAt

func (x *User) GetPasswordChangedAt() *timestamp.Timestamp

func (*User) GetUsername

func (x *User) GetUsername() 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 VerifyEmailRequest

type VerifyEmailRequest struct {
	EmailId    int64  `protobuf:"varint,1,opt,name=email_id,json=emailId,proto3" json:"email_id,omitempty"`
	SecretCode string `protobuf:"bytes,2,opt,name=secret_code,json=secretCode,proto3" json:"secret_code,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyEmailRequest) Descriptor deprecated

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

Deprecated: Use VerifyEmailRequest.ProtoReflect.Descriptor instead.

func (*VerifyEmailRequest) GetEmailId

func (x *VerifyEmailRequest) GetEmailId() int64

func (*VerifyEmailRequest) GetSecretCode

func (x *VerifyEmailRequest) GetSecretCode() string

func (*VerifyEmailRequest) ProtoMessage

func (*VerifyEmailRequest) ProtoMessage()

func (*VerifyEmailRequest) ProtoReflect

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

func (*VerifyEmailRequest) Reset

func (x *VerifyEmailRequest) Reset()

func (*VerifyEmailRequest) String

func (x *VerifyEmailRequest) String() string

type VerifyEmailResponse

type VerifyEmailResponse struct {
	IsVerified bool `protobuf:"varint,1,opt,name=is_verified,json=isVerified,proto3" json:"is_verified,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyEmailResponse) Descriptor deprecated

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

Deprecated: Use VerifyEmailResponse.ProtoReflect.Descriptor instead.

func (*VerifyEmailResponse) GetIsVerified

func (x *VerifyEmailResponse) GetIsVerified() bool

func (*VerifyEmailResponse) ProtoMessage

func (*VerifyEmailResponse) ProtoMessage()

func (*VerifyEmailResponse) ProtoReflect

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

func (*VerifyEmailResponse) Reset

func (x *VerifyEmailResponse) Reset()

func (*VerifyEmailResponse) String

func (x *VerifyEmailResponse) String() string

Jump to

Keyboard shortcuts

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