feat: 0.0.1

This commit is contained in:
FernandoJVideira committed 2026-01-08 01:15:07 +00:00
commit 961bdd81d4
146 files changed
+10444

No files matched your search

+200
View File
@@ -0,0 +1,200 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc v6.33.1
// source: rpc_create_user.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type CreateUserRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
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"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateUserRequest) Reset() {
*x = CreateUserRequest{}
mi := &file_rpc_create_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateUserRequest) ProtoMessage() {}
func (x *CreateUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_create_user_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.
func (*CreateUserRequest) Descriptor() ([]byte, []int) {
return file_rpc_create_user_proto_rawDescGZIP(), []int{0}
}
func (x *CreateUserRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *CreateUserRequest) GetFullName() string {
if x != nil {
return x.FullName
}
return ""
}
func (x *CreateUserRequest) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *CreateUserRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type CreateUserResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateUserResponse) Reset() {
*x = CreateUserResponse{}
mi := &file_rpc_create_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateUserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateUserResponse) ProtoMessage() {}
func (x *CreateUserResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_create_user_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead.
func (*CreateUserResponse) Descriptor() ([]byte, []int) {
return file_rpc_create_user_proto_rawDescGZIP(), []int{1}
}
func (x *CreateUserResponse) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
var File_rpc_create_user_proto protoreflect.FileDescriptor
const file_rpc_create_user_proto_rawDesc = "" +
"\n" +
"\x15rpc_create_user.proto\x12\x02pb\x1a\n" +
"user.proto\"~\n" +
"\x11CreateUserRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12\x1b\n" +
"\tfull_name\x18\x02 \x01(\tR\bfullName\x12\x14\n" +
"\x05email\x18\x03 \x01(\tR\x05email\x12\x1a\n" +
"\bpassword\x18\x04 \x01(\tR\bpassword\"2\n" +
"\x12CreateUserResponse\x12\x1c\n" +
"\x04user\x18\x01 \x01(\v2\b.pb.UserR\x04userB,Z*github.com/FernandoJVideira/simple_bank/pbb\x06proto3"
var (
file_rpc_create_user_proto_rawDescOnce sync.Once
file_rpc_create_user_proto_rawDescData []byte
)
func file_rpc_create_user_proto_rawDescGZIP() []byte {
file_rpc_create_user_proto_rawDescOnce.Do(func() {
file_rpc_create_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_rpc_create_user_proto_rawDesc), len(file_rpc_create_user_proto_rawDesc)))
})
return file_rpc_create_user_proto_rawDescData
}
var file_rpc_create_user_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_rpc_create_user_proto_goTypes = []any{
(*CreateUserRequest)(nil), // 0: pb.CreateUserRequest
(*CreateUserResponse)(nil), // 1: pb.CreateUserResponse
(*User)(nil), // 2: pb.User
}
var file_rpc_create_user_proto_depIdxs = []int32{
2, // 0: pb.CreateUserResponse.user:type_name -> pb.User
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_rpc_create_user_proto_init() }
func file_rpc_create_user_proto_init() {
if File_rpc_create_user_proto != nil {
return
}
file_user_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_create_user_proto_rawDesc), len(file_rpc_create_user_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_rpc_create_user_proto_goTypes,
DependencyIndexes: file_rpc_create_user_proto_depIdxs,
MessageInfos: file_rpc_create_user_proto_msgTypes,
}.Build()
File_rpc_create_user_proto = out.File
file_rpc_create_user_proto_goTypes = nil
file_rpc_create_user_proto_depIdxs = nil
}
+232
View File
@@ -0,0 +1,232 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc v6.33.1
// source: rpc_login_user.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type LoginUserRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LoginUserRequest) Reset() {
*x = LoginUserRequest{}
mi := &file_rpc_login_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LoginUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginUserRequest) ProtoMessage() {}
func (x *LoginUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_login_user_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginUserRequest.ProtoReflect.Descriptor instead.
func (*LoginUserRequest) Descriptor() ([]byte, []int) {
return file_rpc_login_user_proto_rawDescGZIP(), []int{0}
}
func (x *LoginUserRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *LoginUserRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type LoginUserResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
AccessTokenExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=access_token_expires_at,json=accessTokenExpiresAt,proto3" json:"access_token_expires_at,omitempty"`
RefreshToken string `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
RefreshTokenExpiresAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=refresh_token_expires_at,json=refreshTokenExpiresAt,proto3" json:"refresh_token_expires_at,omitempty"`
User *User `protobuf:"bytes,6,opt,name=user,proto3" json:"user,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LoginUserResponse) Reset() {
*x = LoginUserResponse{}
mi := &file_rpc_login_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LoginUserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginUserResponse) ProtoMessage() {}
func (x *LoginUserResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_login_user_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginUserResponse.ProtoReflect.Descriptor instead.
func (*LoginUserResponse) Descriptor() ([]byte, []int) {
return file_rpc_login_user_proto_rawDescGZIP(), []int{1}
}
func (x *LoginUserResponse) GetSessionId() string {
if x != nil {
return x.SessionId
}
return ""
}
func (x *LoginUserResponse) GetAccessToken() string {
if x != nil {
return x.AccessToken
}
return ""
}
func (x *LoginUserResponse) GetAccessTokenExpiresAt() *timestamppb.Timestamp {
if x != nil {
return x.AccessTokenExpiresAt
}
return nil
}
func (x *LoginUserResponse) GetRefreshToken() string {
if x != nil {
return x.RefreshToken
}
return ""
}
func (x *LoginUserResponse) GetRefreshTokenExpiresAt() *timestamppb.Timestamp {
if x != nil {
return x.RefreshTokenExpiresAt
}
return nil
}
func (x *LoginUserResponse) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
var File_rpc_login_user_proto protoreflect.FileDescriptor
const file_rpc_login_user_proto_rawDesc = "" +
"\n" +
"\x14rpc_login_user.proto\x12\x02pb\x1a\n" +
"user.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"J\n" +
"\x10LoginUserRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" +
"\bpassword\x18\x02 \x01(\tR\bpassword\"\xc0\x02\n" +
"\x11LoginUserResponse\x12\x1d\n" +
"\n" +
"session_id\x18\x01 \x01(\tR\tsessionId\x12!\n" +
"\faccess_token\x18\x02 \x01(\tR\vaccessToken\x12Q\n" +
"\x17access_token_expires_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\x14accessTokenExpiresAt\x12#\n" +
"\rrefresh_token\x18\x04 \x01(\tR\frefreshToken\x12S\n" +
"\x18refresh_token_expires_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\x15refreshTokenExpiresAt\x12\x1c\n" +
"\x04user\x18\x06 \x01(\v2\b.pb.UserR\x04userB,Z*github.com/FernandoJVideira/simple_bank/pbb\x06proto3"
var (
file_rpc_login_user_proto_rawDescOnce sync.Once
file_rpc_login_user_proto_rawDescData []byte
)
func file_rpc_login_user_proto_rawDescGZIP() []byte {
file_rpc_login_user_proto_rawDescOnce.Do(func() {
file_rpc_login_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_rpc_login_user_proto_rawDesc), len(file_rpc_login_user_proto_rawDesc)))
})
return file_rpc_login_user_proto_rawDescData
}
var file_rpc_login_user_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_rpc_login_user_proto_goTypes = []any{
(*LoginUserRequest)(nil), // 0: pb.LoginUserRequest
(*LoginUserResponse)(nil), // 1: pb.LoginUserResponse
(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
(*User)(nil), // 3: pb.User
}
var file_rpc_login_user_proto_depIdxs = []int32{
2, // 0: pb.LoginUserResponse.access_token_expires_at:type_name -> google.protobuf.Timestamp
2, // 1: pb.LoginUserResponse.refresh_token_expires_at:type_name -> google.protobuf.Timestamp
3, // 2: pb.LoginUserResponse.user:type_name -> pb.User
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_rpc_login_user_proto_init() }
func file_rpc_login_user_proto_init() {
if File_rpc_login_user_proto != nil {
return
}
file_user_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_login_user_proto_rawDesc), len(file_rpc_login_user_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_rpc_login_user_proto_goTypes,
DependencyIndexes: file_rpc_login_user_proto_depIdxs,
MessageInfos: file_rpc_login_user_proto_msgTypes,
}.Build()
File_rpc_login_user_proto = out.File
file_rpc_login_user_proto_goTypes = nil
file_rpc_login_user_proto_depIdxs = nil
}
+205
View File
@@ -0,0 +1,205 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc v6.33.1
// source: rpc_update_user.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type UpdateUserRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
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"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UpdateUserRequest) Reset() {
*x = UpdateUserRequest{}
mi := &file_rpc_update_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UpdateUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateUserRequest) ProtoMessage() {}
func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_update_user_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserRequest) Descriptor() ([]byte, []int) {
return file_rpc_update_user_proto_rawDescGZIP(), []int{0}
}
func (x *UpdateUserRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *UpdateUserRequest) GetFullName() string {
if x != nil && x.FullName != nil {
return *x.FullName
}
return ""
}
func (x *UpdateUserRequest) GetEmail() string {
if x != nil && x.Email != nil {
return *x.Email
}
return ""
}
func (x *UpdateUserRequest) GetPassword() string {
if x != nil && x.Password != nil {
return *x.Password
}
return ""
}
type UpdateUserResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UpdateUserResponse) Reset() {
*x = UpdateUserResponse{}
mi := &file_rpc_update_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UpdateUserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateUserResponse) ProtoMessage() {}
func (x *UpdateUserResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_update_user_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateUserResponse.ProtoReflect.Descriptor instead.
func (*UpdateUserResponse) Descriptor() ([]byte, []int) {
return file_rpc_update_user_proto_rawDescGZIP(), []int{1}
}
func (x *UpdateUserResponse) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
var File_rpc_update_user_proto protoreflect.FileDescriptor
const file_rpc_update_user_proto_rawDesc = "" +
"\n" +
"\x15rpc_update_user.proto\x12\x02pb\x1a\n" +
"user.proto\"\xb2\x01\n" +
"\x11UpdateUserRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12 \n" +
"\tfull_name\x18\x02 \x01(\tH\x00R\bfullName\x88\x01\x01\x12\x19\n" +
"\x05email\x18\x03 \x01(\tH\x01R\x05email\x88\x01\x01\x12\x1f\n" +
"\bpassword\x18\x04 \x01(\tH\x02R\bpassword\x88\x01\x01B\f\n" +
"\n" +
"_full_nameB\b\n" +
"\x06_emailB\v\n" +
"\t_password\"2\n" +
"\x12UpdateUserResponse\x12\x1c\n" +
"\x04user\x18\x01 \x01(\v2\b.pb.UserR\x04userB,Z*github.com/FernandoJVideira/simple_bank/pbb\x06proto3"
var (
file_rpc_update_user_proto_rawDescOnce sync.Once
file_rpc_update_user_proto_rawDescData []byte
)
func file_rpc_update_user_proto_rawDescGZIP() []byte {
file_rpc_update_user_proto_rawDescOnce.Do(func() {
file_rpc_update_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_rpc_update_user_proto_rawDesc), len(file_rpc_update_user_proto_rawDesc)))
})
return file_rpc_update_user_proto_rawDescData
}
var file_rpc_update_user_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_rpc_update_user_proto_goTypes = []any{
(*UpdateUserRequest)(nil), // 0: pb.UpdateUserRequest
(*UpdateUserResponse)(nil), // 1: pb.UpdateUserResponse
(*User)(nil), // 2: pb.User
}
var file_rpc_update_user_proto_depIdxs = []int32{
2, // 0: pb.UpdateUserResponse.user:type_name -> pb.User
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_rpc_update_user_proto_init() }
func file_rpc_update_user_proto_init() {
if File_rpc_update_user_proto != nil {
return
}
file_user_proto_init()
file_rpc_update_user_proto_msgTypes[0].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_update_user_proto_rawDesc), len(file_rpc_update_user_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_rpc_update_user_proto_goTypes,
DependencyIndexes: file_rpc_update_user_proto_depIdxs,
MessageInfos: file_rpc_update_user_proto_msgTypes,
}.Build()
File_rpc_update_user_proto = out.File
file_rpc_update_user_proto_goTypes = nil
file_rpc_update_user_proto_depIdxs = nil
}
+179
View File
@@ -0,0 +1,179 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc v6.33.1
// source: rpc_verify_email.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type VerifyEmailRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VerifyEmailRequest) Reset() {
*x = VerifyEmailRequest{}
mi := &file_rpc_verify_email_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VerifyEmailRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VerifyEmailRequest) ProtoMessage() {}
func (x *VerifyEmailRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_verify_email_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VerifyEmailRequest.ProtoReflect.Descriptor instead.
func (*VerifyEmailRequest) Descriptor() ([]byte, []int) {
return file_rpc_verify_email_proto_rawDescGZIP(), []int{0}
}
func (x *VerifyEmailRequest) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *VerifyEmailRequest) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
type VerifyEmailResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
IsVerified bool `protobuf:"varint,1,opt,name=is_verified,json=isVerified,proto3" json:"is_verified,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VerifyEmailResponse) Reset() {
*x = VerifyEmailResponse{}
mi := &file_rpc_verify_email_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VerifyEmailResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VerifyEmailResponse) ProtoMessage() {}
func (x *VerifyEmailResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_verify_email_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VerifyEmailResponse.ProtoReflect.Descriptor instead.
func (*VerifyEmailResponse) Descriptor() ([]byte, []int) {
return file_rpc_verify_email_proto_rawDescGZIP(), []int{1}
}
func (x *VerifyEmailResponse) GetIsVerified() bool {
if x != nil {
return x.IsVerified
}
return false
}
var File_rpc_verify_email_proto protoreflect.FileDescriptor
const file_rpc_verify_email_proto_rawDesc = "" +
"\n" +
"\x16rpc_verify_email.proto\x12\x02pb\"8\n" +
"\x12VerifyEmailRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
"\x04code\x18\x02 \x01(\tR\x04code\"6\n" +
"\x13VerifyEmailResponse\x12\x1f\n" +
"\vis_verified\x18\x01 \x01(\bR\n" +
"isVerifiedB,Z*github.com/FernandoJVideira/simple_bank/pbb\x06proto3"
var (
file_rpc_verify_email_proto_rawDescOnce sync.Once
file_rpc_verify_email_proto_rawDescData []byte
)
func file_rpc_verify_email_proto_rawDescGZIP() []byte {
file_rpc_verify_email_proto_rawDescOnce.Do(func() {
file_rpc_verify_email_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_rpc_verify_email_proto_rawDesc), len(file_rpc_verify_email_proto_rawDesc)))
})
return file_rpc_verify_email_proto_rawDescData
}
var file_rpc_verify_email_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_rpc_verify_email_proto_goTypes = []any{
(*VerifyEmailRequest)(nil), // 0: pb.VerifyEmailRequest
(*VerifyEmailResponse)(nil), // 1: pb.VerifyEmailResponse
}
var file_rpc_verify_email_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_rpc_verify_email_proto_init() }
func file_rpc_verify_email_proto_init() {
if File_rpc_verify_email_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_verify_email_proto_rawDesc), len(file_rpc_verify_email_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_rpc_verify_email_proto_goTypes,
DependencyIndexes: file_rpc_verify_email_proto_depIdxs,
MessageInfos: file_rpc_verify_email_proto_msgTypes,
}.Build()
File_rpc_verify_email_proto = out.File
file_rpc_verify_email_proto_goTypes = nil
file_rpc_verify_email_proto_depIdxs = nil
}
+93
View File
@@ -0,0 +1,93 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc v6.33.1
// source: service_simple_bank.proto
package pb
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_service_simple_bank_proto protoreflect.FileDescriptor
const file_service_simple_bank_proto_rawDesc = "" +
"\n" +
"\x19service_simple_bank.proto\x12\x02pb\x1a\x1cgoogle/api/annotations.proto\x1a\x15rpc_create_user.proto\x1a\x14rpc_login_user.proto\x1a\x15rpc_update_user.proto\x1a\x16rpc_verify_email.proto\x1a.protoc-gen-openapiv2/options/annotations.proto2\xf6\x04\n" +
"\n" +
"SimpleBank\x12\x95\x01\n" +
"\n" +
"CreateUser\x12\x15.pb.CreateUserRequest\x1a\x16.pb.CreateUserResponse\"X\x92A;\x12\vCreate User\x1a,Create a new user in the Simple Bank system.\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v1/create_user\x12\x95\x01\n" +
"\tLoginUser\x12\x14.pb.LoginUserRequest\x1a\x15.pb.LoginUserResponse\"[\x92A?\x12\n" +
"Login User\x1a1Login an existing user in the Simple Bank system.\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/v1/login_user\x12\x99\x01\n" +
"\vVerifyEmail\x12\x16.pb.VerifyEmailRequest\x1a\x17.pb.VerifyEmailResponse\"Y\x92A>\x12\fVerify Email\x1a.Verify user's email in the Simple Bank system.\x82\xd3\xe4\x93\x02\x12\x12\x10/v1/verify_email\x12\x9b\x01\n" +
"\n" +
"UpdateUser\x12\x15.pb.UpdateUserRequest\x1a\x16.pb.UpdateUserResponse\"^\x92AA\x12\vUpdate User\x1a2Update an existing user in the Simple Bank system.\x82\xd3\xe4\x93\x02\x14:\x01*2\x0f/v1/update_userB\xa5\x01\x92Av\x12t\n" +
"\x0fSimple Bank API\"Z\n" +
"\bfvideira\x12/https://github.com/FernandoJVideira/simple_bank\x1a\[email protected]\x050.0.1Z*github.com/FernandoJVideira/simple_bank/pbb\x06proto3"
var file_service_simple_bank_proto_goTypes = []any{
(*CreateUserRequest)(nil), // 0: pb.CreateUserRequest
(*LoginUserRequest)(nil), // 1: pb.LoginUserRequest
(*VerifyEmailRequest)(nil), // 2: pb.VerifyEmailRequest
(*UpdateUserRequest)(nil), // 3: pb.UpdateUserRequest
(*CreateUserResponse)(nil), // 4: pb.CreateUserResponse
(*LoginUserResponse)(nil), // 5: pb.LoginUserResponse
(*VerifyEmailResponse)(nil), // 6: pb.VerifyEmailResponse
(*UpdateUserResponse)(nil), // 7: pb.UpdateUserResponse
}
var file_service_simple_bank_proto_depIdxs = []int32{
0, // 0: pb.SimpleBank.CreateUser:input_type -> pb.CreateUserRequest
1, // 1: pb.SimpleBank.LoginUser:input_type -> pb.LoginUserRequest
2, // 2: pb.SimpleBank.VerifyEmail:input_type -> pb.VerifyEmailRequest
3, // 3: pb.SimpleBank.UpdateUser:input_type -> pb.UpdateUserRequest
4, // 4: pb.SimpleBank.CreateUser:output_type -> pb.CreateUserResponse
5, // 5: pb.SimpleBank.LoginUser:output_type -> pb.LoginUserResponse
6, // 6: pb.SimpleBank.VerifyEmail:output_type -> pb.VerifyEmailResponse
7, // 7: pb.SimpleBank.UpdateUser:output_type -> pb.UpdateUserResponse
4, // [4:8] is the sub-list for method output_type
0, // [0:4] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_service_simple_bank_proto_init() }
func file_service_simple_bank_proto_init() {
if File_service_simple_bank_proto != nil {
return
}
file_rpc_create_user_proto_init()
file_rpc_login_user_proto_init()
file_rpc_update_user_proto_init()
file_rpc_verify_email_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_service_simple_bank_proto_rawDesc), len(file_service_simple_bank_proto_rawDesc)),
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_service_simple_bank_proto_goTypes,
DependencyIndexes: file_service_simple_bank_proto_depIdxs,
}.Build()
File_service_simple_bank_proto = out.File
file_service_simple_bank_proto_goTypes = nil
file_service_simple_bank_proto_depIdxs = nil
}
+363
View File
@@ -0,0 +1,363 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: service_simple_bank.proto
/*
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package pb
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_SimpleBank_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client SimpleBankClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CreateUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.CreateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_SimpleBank_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, server SimpleBankServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CreateUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.CreateUser(ctx, &protoReq)
return msg, metadata, err
}
func request_SimpleBank_LoginUser_0(ctx context.Context, marshaler runtime.Marshaler, client SimpleBankClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq LoginUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.LoginUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_SimpleBank_LoginUser_0(ctx context.Context, marshaler runtime.Marshaler, server SimpleBankServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq LoginUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.LoginUser(ctx, &protoReq)
return msg, metadata, err
}
var filter_SimpleBank_VerifyEmail_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
func request_SimpleBank_VerifyEmail_0(ctx context.Context, marshaler runtime.Marshaler, client SimpleBankClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq VerifyEmailRequest
metadata runtime.ServerMetadata
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SimpleBank_VerifyEmail_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.VerifyEmail(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_SimpleBank_VerifyEmail_0(ctx context.Context, marshaler runtime.Marshaler, server SimpleBankServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq VerifyEmailRequest
metadata runtime.ServerMetadata
)
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SimpleBank_VerifyEmail_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.VerifyEmail(ctx, &protoReq)
return msg, metadata, err
}
func request_SimpleBank_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, client SimpleBankClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq UpdateUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.UpdateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_SimpleBank_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, server SimpleBankServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq UpdateUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.UpdateUser(ctx, &protoReq)
return msg, metadata, err
}
// RegisterSimpleBankHandlerServer registers the http handlers for service SimpleBank to "mux".
// UnaryRPC :call SimpleBankServer 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 RegisterSimpleBankHandlerFromEndpoint 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 RegisterSimpleBankHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SimpleBankServer) error {
mux.Handle(http.MethodPost, pattern_SimpleBank_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.SimpleBank/CreateUser", runtime.WithHTTPPathPattern("/v1/create_user"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_SimpleBank_CreateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SimpleBank_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_SimpleBank_LoginUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.SimpleBank/LoginUser", runtime.WithHTTPPathPattern("/v1/login_user"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_SimpleBank_LoginUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SimpleBank_LoginUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_SimpleBank_VerifyEmail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.SimpleBank/VerifyEmail", runtime.WithHTTPPathPattern("/v1/verify_email"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_SimpleBank_VerifyEmail_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SimpleBank_VerifyEmail_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPatch, pattern_SimpleBank_UpdateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.SimpleBank/UpdateUser", runtime.WithHTTPPathPattern("/v1/update_user"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_SimpleBank_UpdateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SimpleBank_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterSimpleBankHandlerFromEndpoint is same as RegisterSimpleBankHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterSimpleBankHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterSimpleBankHandler(ctx, mux, conn)
}
// RegisterSimpleBankHandler registers the http handlers for service SimpleBank to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterSimpleBankHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterSimpleBankHandlerClient(ctx, mux, NewSimpleBankClient(conn))
}
// RegisterSimpleBankHandlerClient registers the http handlers for service SimpleBank
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SimpleBankClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SimpleBankClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "SimpleBankClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterSimpleBankHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SimpleBankClient) error {
mux.Handle(http.MethodPost, pattern_SimpleBank_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.SimpleBank/CreateUser", runtime.WithHTTPPathPattern("/v1/create_user"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_SimpleBank_CreateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SimpleBank_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_SimpleBank_LoginUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.SimpleBank/LoginUser", runtime.WithHTTPPathPattern("/v1/login_user"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_SimpleBank_LoginUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SimpleBank_LoginUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_SimpleBank_VerifyEmail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.SimpleBank/VerifyEmail", runtime.WithHTTPPathPattern("/v1/verify_email"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_SimpleBank_VerifyEmail_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SimpleBank_VerifyEmail_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPatch, pattern_SimpleBank_UpdateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.SimpleBank/UpdateUser", runtime.WithHTTPPathPattern("/v1/update_user"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_SimpleBank_UpdateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SimpleBank_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_SimpleBank_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "create_user"}, ""))
pattern_SimpleBank_LoginUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "login_user"}, ""))
pattern_SimpleBank_VerifyEmail_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "verify_email"}, ""))
pattern_SimpleBank_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "update_user"}, ""))
)
var (
forward_SimpleBank_CreateUser_0 = runtime.ForwardResponseMessage
forward_SimpleBank_LoginUser_0 = runtime.ForwardResponseMessage
forward_SimpleBank_VerifyEmail_0 = runtime.ForwardResponseMessage
forward_SimpleBank_UpdateUser_0 = runtime.ForwardResponseMessage
)
+235
View File
@@ -0,0 +1,235 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.33.1
// source: service_simple_bank.proto
package pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
SimpleBank_CreateUser_FullMethodName = "/pb.SimpleBank/CreateUser"
SimpleBank_LoginUser_FullMethodName = "/pb.SimpleBank/LoginUser"
SimpleBank_VerifyEmail_FullMethodName = "/pb.SimpleBank/VerifyEmail"
SimpleBank_UpdateUser_FullMethodName = "/pb.SimpleBank/UpdateUser"
)
// SimpleBankClient is the client API for SimpleBank 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 SimpleBankClient interface {
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error)
LoginUser(ctx context.Context, in *LoginUserRequest, opts ...grpc.CallOption) (*LoginUserResponse, error)
VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...grpc.CallOption) (*VerifyEmailResponse, error)
UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error)
}
type simpleBankClient struct {
cc grpc.ClientConnInterface
}
func NewSimpleBankClient(cc grpc.ClientConnInterface) SimpleBankClient {
return &simpleBankClient{cc}
}
func (c *simpleBankClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateUserResponse)
err := c.cc.Invoke(ctx, SimpleBank_CreateUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *simpleBankClient) LoginUser(ctx context.Context, in *LoginUserRequest, opts ...grpc.CallOption) (*LoginUserResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoginUserResponse)
err := c.cc.Invoke(ctx, SimpleBank_LoginUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *simpleBankClient) VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...grpc.CallOption) (*VerifyEmailResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(VerifyEmailResponse)
err := c.cc.Invoke(ctx, SimpleBank_VerifyEmail_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *simpleBankClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateUserResponse)
err := c.cc.Invoke(ctx, SimpleBank_UpdateUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SimpleBankServer is the server API for SimpleBank service.
// All implementations must embed UnimplementedSimpleBankServer
// for forward compatibility.
type SimpleBankServer interface {
CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error)
LoginUser(context.Context, *LoginUserRequest) (*LoginUserResponse, error)
VerifyEmail(context.Context, *VerifyEmailRequest) (*VerifyEmailResponse, error)
UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error)
mustEmbedUnimplementedSimpleBankServer()
}
// UnimplementedSimpleBankServer 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.
type UnimplementedSimpleBankServer struct{}
func (UnimplementedSimpleBankServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")
}
func (UnimplementedSimpleBankServer) LoginUser(context.Context, *LoginUserRequest) (*LoginUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LoginUser not implemented")
}
func (UnimplementedSimpleBankServer) VerifyEmail(context.Context, *VerifyEmailRequest) (*VerifyEmailResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VerifyEmail not implemented")
}
func (UnimplementedSimpleBankServer) UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented")
}
func (UnimplementedSimpleBankServer) mustEmbedUnimplementedSimpleBankServer() {}
func (UnimplementedSimpleBankServer) testEmbeddedByValue() {}
// UnsafeSimpleBankServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SimpleBankServer will
// result in compilation errors.
type UnsafeSimpleBankServer interface {
mustEmbedUnimplementedSimpleBankServer()
}
func RegisterSimpleBankServer(s grpc.ServiceRegistrar, srv SimpleBankServer) {
// If the following call pancis, it indicates UnimplementedSimpleBankServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&SimpleBank_ServiceDesc, srv)
}
func _SimpleBank_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SimpleBankServer).CreateUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SimpleBank_CreateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SimpleBankServer).CreateUser(ctx, req.(*CreateUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SimpleBank_LoginUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SimpleBankServer).LoginUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SimpleBank_LoginUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SimpleBankServer).LoginUser(ctx, req.(*LoginUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SimpleBank_VerifyEmail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VerifyEmailRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SimpleBankServer).VerifyEmail(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SimpleBank_VerifyEmail_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SimpleBankServer).VerifyEmail(ctx, req.(*VerifyEmailRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SimpleBank_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SimpleBankServer).UpdateUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SimpleBank_UpdateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SimpleBankServer).UpdateUser(ctx, req.(*UpdateUserRequest))
}
return interceptor(ctx, in, info, handler)
}
// SimpleBank_ServiceDesc is the grpc.ServiceDesc for SimpleBank service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SimpleBank_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pb.SimpleBank",
HandlerType: (*SimpleBankServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateUser",
Handler: _SimpleBank_CreateUser_Handler,
},
{
MethodName: "LoginUser",
Handler: _SimpleBank_LoginUser_Handler,
},
{
MethodName: "VerifyEmail",
Handler: _SimpleBank_VerifyEmail_Handler,
},
{
MethodName: "UpdateUser",
Handler: _SimpleBank_UpdateUser_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_simple_bank.proto",
}
+164
View File
@@ -0,0 +1,164 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc v6.33.1
// source: user.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type User struct {
state protoimpl.MessageState `protogen:"open.v1"`
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 *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=password_changed_at,json=passwordChangedAt,proto3" json:"password_changed_at,omitempty"`
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *User) Reset() {
*x = User{}
mi := &file_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *User) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
mi := &file_user_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
return file_user_proto_rawDescGZIP(), []int{0}
}
func (x *User) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *User) GetFullName() string {
if x != nil {
return x.FullName
}
return ""
}
func (x *User) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *User) GetPasswordChangedAt() *timestamppb.Timestamp {
if x != nil {
return x.PasswordChangedAt
}
return nil
}
func (x *User) GetCreatedAt() *timestamppb.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
var File_user_proto protoreflect.FileDescriptor
const file_user_proto_rawDesc = "" +
"\n" +
"\n" +
"user.proto\x12\x02pb\x1a\x1fgoogle/protobuf/timestamp.proto\"\xdc\x01\n" +
"\x04User\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12\x1b\n" +
"\tfull_name\x18\x02 \x01(\tR\bfullName\x12\x14\n" +
"\x05email\x18\x03 \x01(\tR\x05email\x12J\n" +
"\x13password_changed_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\x11passwordChangedAt\x129\n" +
"\n" +
"created_at\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAtB,Z*github.com/FernandoJVideira/simple_bank/pbb\x06proto3"
var (
file_user_proto_rawDescOnce sync.Once
file_user_proto_rawDescData []byte
)
func file_user_proto_rawDescGZIP() []byte {
file_user_proto_rawDescOnce.Do(func() {
file_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_user_proto_rawDesc), len(file_user_proto_rawDesc)))
})
return file_user_proto_rawDescData
}
var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_user_proto_goTypes = []any{
(*User)(nil), // 0: pb.User
(*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp
}
var file_user_proto_depIdxs = []int32{
1, // 0: pb.User.password_changed_at:type_name -> google.protobuf.Timestamp
1, // 1: pb.User.created_at:type_name -> google.protobuf.Timestamp
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_user_proto_init() }
func file_user_proto_init() {
if File_user_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_proto_rawDesc), len(file_user_proto_rawDesc)),
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_user_proto_goTypes,
DependencyIndexes: file_user_proto_depIdxs,
MessageInfos: file_user_proto_msgTypes,
}.Build()
File_user_proto = out.File
file_user_proto_goTypes = nil
file_user_proto_depIdxs = nil
}