From 0174a4f4ff3ed1df9c2ec5d3864205042b8723fd Mon Sep 17 00:00:00 2001 From: sky Date: Wed, 20 Aug 2025 19:51:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=20protobuf?= =?UTF-8?q?=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- account/v1/account.pb.go | 882 ++++++++++++++++++ .../v1/accountv1connect/account.connect.go | 281 ++++++ go.mod | 8 + go.sum | 10 + notification/v1/notification.pb.go | 528 +++++++++++ .../notification.connect.go | 139 +++ 6 files changed, 1848 insertions(+) create mode 100644 account/v1/account.pb.go create mode 100644 account/v1/accountv1connect/account.connect.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 notification/v1/notification.pb.go create mode 100644 notification/v1/notificationv1connect/notification.connect.go diff --git a/account/v1/account.pb.go b/account/v1/account.pb.go new file mode 100644 index 0000000..3c02117 --- /dev/null +++ b/account/v1/account.pb.go @@ -0,0 +1,882 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.7 +// protoc (unknown) +// source: account/v1/account.proto + +package accountv1 + +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 AuthenticationType int32 + +const ( + AuthenticationType_AUTHENTICATION_TYPE_UNSPECIFIED AuthenticationType = 0 + AuthenticationType_AUTHENTICATION_TYPE_NAME AuthenticationType = 1 // 用户名 + AuthenticationType_AUTHENTICATION_TYPE_PHONE AuthenticationType = 2 // 手机号 + AuthenticationType_AUTHENTICATION_TYPE_EMAIL AuthenticationType = 3 // 邮箱 + AuthenticationType_AUTHENTICATION_TYPE_WECHAT AuthenticationType = 4 // 微信 +) + +// Enum value maps for AuthenticationType. +var ( + AuthenticationType_name = map[int32]string{ + 0: "AUTHENTICATION_TYPE_UNSPECIFIED", + 1: "AUTHENTICATION_TYPE_NAME", + 2: "AUTHENTICATION_TYPE_PHONE", + 3: "AUTHENTICATION_TYPE_EMAIL", + 4: "AUTHENTICATION_TYPE_WECHAT", + } + AuthenticationType_value = map[string]int32{ + "AUTHENTICATION_TYPE_UNSPECIFIED": 0, + "AUTHENTICATION_TYPE_NAME": 1, + "AUTHENTICATION_TYPE_PHONE": 2, + "AUTHENTICATION_TYPE_EMAIL": 3, + "AUTHENTICATION_TYPE_WECHAT": 4, + } +) + +func (x AuthenticationType) Enum() *AuthenticationType { + p := new(AuthenticationType) + *p = x + return p +} + +func (x AuthenticationType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AuthenticationType) Descriptor() protoreflect.EnumDescriptor { + return file_account_v1_account_proto_enumTypes[0].Descriptor() +} + +func (AuthenticationType) Type() protoreflect.EnumType { + return &file_account_v1_account_proto_enumTypes[0] +} + +func (x AuthenticationType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AuthenticationType.Descriptor instead. +func (AuthenticationType) EnumDescriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{0} +} + +type SendCredentialRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AuthType AuthenticationType `protobuf:"varint,1,opt,name=auth_type,json=authType,proto3,enum=account.v1.AuthenticationType" json:"auth_type,omitempty"` // 认证类型 + AuthId string `protobuf:"bytes,2,opt,name=auth_id,json=authId,proto3" json:"auth_id,omitempty"` // 认证ID,根据auth_type存储不同的账号信息 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendCredentialRequest) Reset() { + *x = SendCredentialRequest{} + mi := &file_account_v1_account_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendCredentialRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendCredentialRequest) ProtoMessage() {} + +func (x *SendCredentialRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_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 SendCredentialRequest.ProtoReflect.Descriptor instead. +func (*SendCredentialRequest) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{0} +} + +func (x *SendCredentialRequest) GetAuthType() AuthenticationType { + if x != nil { + return x.AuthType + } + return AuthenticationType_AUTHENTICATION_TYPE_UNSPECIFIED +} + +func (x *SendCredentialRequest) GetAuthId() string { + if x != nil { + return x.AuthId + } + return "" +} + +type SendCredentialResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendCredentialResponse) Reset() { + *x = SendCredentialResponse{} + mi := &file_account_v1_account_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendCredentialResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendCredentialResponse) ProtoMessage() {} + +func (x *SendCredentialResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_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 SendCredentialResponse.ProtoReflect.Descriptor instead. +func (*SendCredentialResponse) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{1} +} + +type AuthRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AuthType AuthenticationType `protobuf:"varint,1,opt,name=auth_type,json=authType,proto3,enum=account.v1.AuthenticationType" json:"auth_type,omitempty"` // 认证类型 + AuthId string `protobuf:"bytes,2,opt,name=auth_id,json=authId,proto3" json:"auth_id,omitempty"` // 认证ID,根据auth_type存储不同的账号信息 + Credential string `protobuf:"bytes,3,opt,name=credential,proto3" json:"credential,omitempty"` // 凭证,可以是验证码或密码 + InvitationCode string `protobuf:"bytes,4,opt,name=invitation_code,json=invitationCode,proto3" json:"invitation_code,omitempty"` // 邀请码 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthRequest) Reset() { + *x = AuthRequest{} + mi := &file_account_v1_account_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthRequest) ProtoMessage() {} + +func (x *AuthRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[2] + 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 AuthRequest.ProtoReflect.Descriptor instead. +func (*AuthRequest) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{2} +} + +func (x *AuthRequest) GetAuthType() AuthenticationType { + if x != nil { + return x.AuthType + } + return AuthenticationType_AUTHENTICATION_TYPE_UNSPECIFIED +} + +func (x *AuthRequest) GetAuthId() string { + if x != nil { + return x.AuthId + } + return "" +} + +func (x *AuthRequest) GetCredential() string { + if x != nil { + return x.Credential + } + return "" +} + +func (x *AuthRequest) GetInvitationCode() string { + if x != nil { + return x.InvitationCode + } + return "" +} + +type AuthResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthResponse) Reset() { + *x = AuthResponse{} + mi := &file_account_v1_account_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthResponse) ProtoMessage() {} + +func (x *AuthResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[3] + 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 AuthResponse.ProtoReflect.Descriptor instead. +func (*AuthResponse) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{3} +} + +func (x *AuthResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type SetPasswordRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AuthType AuthenticationType `protobuf:"varint,1,opt,name=auth_type,json=authType,proto3,enum=account.v1.AuthenticationType" json:"auth_type,omitempty"` // 认证类型 + AuthId string `protobuf:"bytes,2,opt,name=auth_id,json=authId,proto3" json:"auth_id,omitempty"` // 认证ID,根据auth_type存储不同的账号信息 + Credential string `protobuf:"bytes,3,opt,name=credential,proto3" json:"credential,omitempty"` // 凭证,可以是验证码或旧密码 + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` // 新密码 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetPasswordRequest) Reset() { + *x = SetPasswordRequest{} + mi := &file_account_v1_account_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetPasswordRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetPasswordRequest) ProtoMessage() {} + +func (x *SetPasswordRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[4] + 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 SetPasswordRequest.ProtoReflect.Descriptor instead. +func (*SetPasswordRequest) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{4} +} + +func (x *SetPasswordRequest) GetAuthType() AuthenticationType { + if x != nil { + return x.AuthType + } + return AuthenticationType_AUTHENTICATION_TYPE_UNSPECIFIED +} + +func (x *SetPasswordRequest) GetAuthId() string { + if x != nil { + return x.AuthId + } + return "" +} + +func (x *SetPasswordRequest) GetCredential() string { + if x != nil { + return x.Credential + } + return "" +} + +func (x *SetPasswordRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type SetPasswordResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetPasswordResponse) Reset() { + *x = SetPasswordResponse{} + mi := &file_account_v1_account_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetPasswordResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetPasswordResponse) ProtoMessage() {} + +func (x *SetPasswordResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[5] + 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 SetPasswordResponse.ProtoReflect.Descriptor instead. +func (*SetPasswordResponse) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{5} +} + +type SetNameRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetNameRequest) Reset() { + *x = SetNameRequest{} + mi := &file_account_v1_account_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetNameRequest) ProtoMessage() {} + +func (x *SetNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[6] + 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 SetNameRequest.ProtoReflect.Descriptor instead. +func (*SetNameRequest) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{6} +} + +func (x *SetNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type SetNameResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetNameResponse) Reset() { + *x = SetNameResponse{} + mi := &file_account_v1_account_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetNameResponse) ProtoMessage() {} + +func (x *SetNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[7] + 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 SetNameResponse.ProtoReflect.Descriptor instead. +func (*SetNameResponse) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{7} +} + +type GetAvatarUploadURLRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAvatarUploadURLRequest) Reset() { + *x = GetAvatarUploadURLRequest{} + mi := &file_account_v1_account_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAvatarUploadURLRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAvatarUploadURLRequest) ProtoMessage() {} + +func (x *GetAvatarUploadURLRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[8] + 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 GetAvatarUploadURLRequest.ProtoReflect.Descriptor instead. +func (*GetAvatarUploadURLRequest) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{8} +} + +type GetAvatarUploadURLResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAvatarUploadURLResponse) Reset() { + *x = GetAvatarUploadURLResponse{} + mi := &file_account_v1_account_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAvatarUploadURLResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAvatarUploadURLResponse) ProtoMessage() {} + +func (x *GetAvatarUploadURLResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[9] + 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 GetAvatarUploadURLResponse.ProtoReflect.Descriptor instead. +func (*GetAvatarUploadURLResponse) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{9} +} + +func (x *GetAvatarUploadURLResponse) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type SetAvatarRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetAvatarRequest) Reset() { + *x = SetAvatarRequest{} + mi := &file_account_v1_account_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetAvatarRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetAvatarRequest) ProtoMessage() {} + +func (x *SetAvatarRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[10] + 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 SetAvatarRequest.ProtoReflect.Descriptor instead. +func (*SetAvatarRequest) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{10} +} + +func (x *SetAvatarRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type SetAvatarResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetAvatarResponse) Reset() { + *x = SetAvatarResponse{} + mi := &file_account_v1_account_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetAvatarResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetAvatarResponse) ProtoMessage() {} + +func (x *SetAvatarResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[11] + 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 SetAvatarResponse.ProtoReflect.Descriptor instead. +func (*SetAvatarResponse) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{11} +} + +type GetUserInfoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserInfoRequest) Reset() { + *x = GetUserInfoRequest{} + mi := &file_account_v1_account_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserInfoRequest) ProtoMessage() {} + +func (x *GetUserInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[12] + 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 GetUserInfoRequest.ProtoReflect.Descriptor instead. +func (*GetUserInfoRequest) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{12} +} + +type GetUserInfoResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Avatar string `protobuf:"bytes,2,opt,name=avatar,proto3" json:"avatar,omitempty"` + InvitationCode string `protobuf:"bytes,3,opt,name=invitation_code,json=invitationCode,proto3" json:"invitation_code,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Phone string `protobuf:"bytes,5,opt,name=phone,proto3" json:"phone,omitempty"` + Email string `protobuf:"bytes,6,opt,name=email,proto3" json:"email,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserInfoResponse) Reset() { + *x = GetUserInfoResponse{} + mi := &file_account_v1_account_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserInfoResponse) ProtoMessage() {} + +func (x *GetUserInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_v1_account_proto_msgTypes[13] + 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 GetUserInfoResponse.ProtoReflect.Descriptor instead. +func (*GetUserInfoResponse) Descriptor() ([]byte, []int) { + return file_account_v1_account_proto_rawDescGZIP(), []int{13} +} + +func (x *GetUserInfoResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *GetUserInfoResponse) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *GetUserInfoResponse) GetInvitationCode() string { + if x != nil { + return x.InvitationCode + } + return "" +} + +func (x *GetUserInfoResponse) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetUserInfoResponse) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *GetUserInfoResponse) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +var File_account_v1_account_proto protoreflect.FileDescriptor + +const file_account_v1_account_proto_rawDesc = "" + + "\n" + + "\x18account/v1/account.proto\x12\n" + + "account.v1\"m\n" + + "\x15SendCredentialRequest\x12;\n" + + "\tauth_type\x18\x01 \x01(\x0e2\x1e.account.v1.AuthenticationTypeR\bauthType\x12\x17\n" + + "\aauth_id\x18\x02 \x01(\tR\x06authId\"\x18\n" + + "\x16SendCredentialResponse\"\xac\x01\n" + + "\vAuthRequest\x12;\n" + + "\tauth_type\x18\x01 \x01(\x0e2\x1e.account.v1.AuthenticationTypeR\bauthType\x12\x17\n" + + "\aauth_id\x18\x02 \x01(\tR\x06authId\x12\x1e\n" + + "\n" + + "credential\x18\x03 \x01(\tR\n" + + "credential\x12'\n" + + "\x0finvitation_code\x18\x04 \x01(\tR\x0einvitationCode\"$\n" + + "\fAuthResponse\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\"\xa6\x01\n" + + "\x12SetPasswordRequest\x12;\n" + + "\tauth_type\x18\x01 \x01(\x0e2\x1e.account.v1.AuthenticationTypeR\bauthType\x12\x17\n" + + "\aauth_id\x18\x02 \x01(\tR\x06authId\x12\x1e\n" + + "\n" + + "credential\x18\x03 \x01(\tR\n" + + "credential\x12\x1a\n" + + "\bpassword\x18\x04 \x01(\tR\bpassword\"\x15\n" + + "\x13SetPasswordResponse\"$\n" + + "\x0eSetNameRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\x11\n" + + "\x0fSetNameResponse\"\x1b\n" + + "\x19GetAvatarUploadURLRequest\".\n" + + "\x1aGetAvatarUploadURLResponse\x12\x10\n" + + "\x03url\x18\x01 \x01(\tR\x03url\"$\n" + + "\x10SetAvatarRequest\x12\x10\n" + + "\x03url\x18\x01 \x01(\tR\x03url\"\x13\n" + + "\x11SetAvatarResponse\"\x14\n" + + "\x12GetUserInfoRequest\"\xa6\x01\n" + + "\x13GetUserInfoResponse\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06avatar\x18\x02 \x01(\tR\x06avatar\x12'\n" + + "\x0finvitation_code\x18\x03 \x01(\tR\x0einvitationCode\x12\x12\n" + + "\x04name\x18\x04 \x01(\tR\x04name\x12\x14\n" + + "\x05phone\x18\x05 \x01(\tR\x05phone\x12\x14\n" + + "\x05email\x18\x06 \x01(\tR\x05email*\xb5\x01\n" + + "\x12AuthenticationType\x12#\n" + + "\x1fAUTHENTICATION_TYPE_UNSPECIFIED\x10\x00\x12\x1c\n" + + "\x18AUTHENTICATION_TYPE_NAME\x10\x01\x12\x1d\n" + + "\x19AUTHENTICATION_TYPE_PHONE\x10\x02\x12\x1d\n" + + "\x19AUTHENTICATION_TYPE_EMAIL\x10\x03\x12\x1e\n" + + "\x1aAUTHENTICATION_TYPE_WECHAT\x10\x042\xb7\x04\n" + + "\x0eAccountService\x12W\n" + + "\x0eSendCredential\x12!.account.v1.SendCredentialRequest\x1a\".account.v1.SendCredentialResponse\x129\n" + + "\x04Auth\x12\x17.account.v1.AuthRequest\x1a\x18.account.v1.AuthResponse\x12N\n" + + "\vSetPassword\x12\x1e.account.v1.SetPasswordRequest\x1a\x1f.account.v1.SetPasswordResponse\x12B\n" + + "\aSetName\x12\x1a.account.v1.SetNameRequest\x1a\x1b.account.v1.SetNameResponse\x12c\n" + + "\x12GetAvatarUploadURL\x12%.account.v1.GetAvatarUploadURLRequest\x1a&.account.v1.GetAvatarUploadURLResponse\x12H\n" + + "\tSetAvatar\x12\x1c.account.v1.SetAvatarRequest\x1a\x1d.account.v1.SetAvatarResponse\x12N\n" + + "\vGetUserInfo\x12\x1e.account.v1.GetUserInfoRequest\x1a\x1f.account.v1.GetUserInfoResponseB2Z0git.0yue.com/shenxianhe/sdk/account/v1;accountv1b\x06proto3" + +var ( + file_account_v1_account_proto_rawDescOnce sync.Once + file_account_v1_account_proto_rawDescData []byte +) + +func file_account_v1_account_proto_rawDescGZIP() []byte { + file_account_v1_account_proto_rawDescOnce.Do(func() { + file_account_v1_account_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_account_v1_account_proto_rawDesc), len(file_account_v1_account_proto_rawDesc))) + }) + return file_account_v1_account_proto_rawDescData +} + +var file_account_v1_account_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_account_v1_account_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_account_v1_account_proto_goTypes = []any{ + (AuthenticationType)(0), // 0: account.v1.AuthenticationType + (*SendCredentialRequest)(nil), // 1: account.v1.SendCredentialRequest + (*SendCredentialResponse)(nil), // 2: account.v1.SendCredentialResponse + (*AuthRequest)(nil), // 3: account.v1.AuthRequest + (*AuthResponse)(nil), // 4: account.v1.AuthResponse + (*SetPasswordRequest)(nil), // 5: account.v1.SetPasswordRequest + (*SetPasswordResponse)(nil), // 6: account.v1.SetPasswordResponse + (*SetNameRequest)(nil), // 7: account.v1.SetNameRequest + (*SetNameResponse)(nil), // 8: account.v1.SetNameResponse + (*GetAvatarUploadURLRequest)(nil), // 9: account.v1.GetAvatarUploadURLRequest + (*GetAvatarUploadURLResponse)(nil), // 10: account.v1.GetAvatarUploadURLResponse + (*SetAvatarRequest)(nil), // 11: account.v1.SetAvatarRequest + (*SetAvatarResponse)(nil), // 12: account.v1.SetAvatarResponse + (*GetUserInfoRequest)(nil), // 13: account.v1.GetUserInfoRequest + (*GetUserInfoResponse)(nil), // 14: account.v1.GetUserInfoResponse +} +var file_account_v1_account_proto_depIdxs = []int32{ + 0, // 0: account.v1.SendCredentialRequest.auth_type:type_name -> account.v1.AuthenticationType + 0, // 1: account.v1.AuthRequest.auth_type:type_name -> account.v1.AuthenticationType + 0, // 2: account.v1.SetPasswordRequest.auth_type:type_name -> account.v1.AuthenticationType + 1, // 3: account.v1.AccountService.SendCredential:input_type -> account.v1.SendCredentialRequest + 3, // 4: account.v1.AccountService.Auth:input_type -> account.v1.AuthRequest + 5, // 5: account.v1.AccountService.SetPassword:input_type -> account.v1.SetPasswordRequest + 7, // 6: account.v1.AccountService.SetName:input_type -> account.v1.SetNameRequest + 9, // 7: account.v1.AccountService.GetAvatarUploadURL:input_type -> account.v1.GetAvatarUploadURLRequest + 11, // 8: account.v1.AccountService.SetAvatar:input_type -> account.v1.SetAvatarRequest + 13, // 9: account.v1.AccountService.GetUserInfo:input_type -> account.v1.GetUserInfoRequest + 2, // 10: account.v1.AccountService.SendCredential:output_type -> account.v1.SendCredentialResponse + 4, // 11: account.v1.AccountService.Auth:output_type -> account.v1.AuthResponse + 6, // 12: account.v1.AccountService.SetPassword:output_type -> account.v1.SetPasswordResponse + 8, // 13: account.v1.AccountService.SetName:output_type -> account.v1.SetNameResponse + 10, // 14: account.v1.AccountService.GetAvatarUploadURL:output_type -> account.v1.GetAvatarUploadURLResponse + 12, // 15: account.v1.AccountService.SetAvatar:output_type -> account.v1.SetAvatarResponse + 14, // 16: account.v1.AccountService.GetUserInfo:output_type -> account.v1.GetUserInfoResponse + 10, // [10:17] is the sub-list for method output_type + 3, // [3:10] 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_account_v1_account_proto_init() } +func file_account_v1_account_proto_init() { + if File_account_v1_account_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_account_v1_account_proto_rawDesc), len(file_account_v1_account_proto_rawDesc)), + NumEnums: 1, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_account_v1_account_proto_goTypes, + DependencyIndexes: file_account_v1_account_proto_depIdxs, + EnumInfos: file_account_v1_account_proto_enumTypes, + MessageInfos: file_account_v1_account_proto_msgTypes, + }.Build() + File_account_v1_account_proto = out.File + file_account_v1_account_proto_goTypes = nil + file_account_v1_account_proto_depIdxs = nil +} diff --git a/account/v1/accountv1connect/account.connect.go b/account/v1/accountv1connect/account.connect.go new file mode 100644 index 0000000..49d3d29 --- /dev/null +++ b/account/v1/accountv1connect/account.connect.go @@ -0,0 +1,281 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: account/v1/account.proto + +package accountv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "git.0yue.com/shenxianhe/sdk/account/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // AccountServiceName is the fully-qualified name of the AccountService service. + AccountServiceName = "account.v1.AccountService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AccountServiceSendCredentialProcedure is the fully-qualified name of the AccountService's + // SendCredential RPC. + AccountServiceSendCredentialProcedure = "/account.v1.AccountService/SendCredential" + // AccountServiceAuthProcedure is the fully-qualified name of the AccountService's Auth RPC. + AccountServiceAuthProcedure = "/account.v1.AccountService/Auth" + // AccountServiceSetPasswordProcedure is the fully-qualified name of the AccountService's + // SetPassword RPC. + AccountServiceSetPasswordProcedure = "/account.v1.AccountService/SetPassword" + // AccountServiceSetNameProcedure is the fully-qualified name of the AccountService's SetName RPC. + AccountServiceSetNameProcedure = "/account.v1.AccountService/SetName" + // AccountServiceGetAvatarUploadURLProcedure is the fully-qualified name of the AccountService's + // GetAvatarUploadURL RPC. + AccountServiceGetAvatarUploadURLProcedure = "/account.v1.AccountService/GetAvatarUploadURL" + // AccountServiceSetAvatarProcedure is the fully-qualified name of the AccountService's SetAvatar + // RPC. + AccountServiceSetAvatarProcedure = "/account.v1.AccountService/SetAvatar" + // AccountServiceGetUserInfoProcedure is the fully-qualified name of the AccountService's + // GetUserInfo RPC. + AccountServiceGetUserInfoProcedure = "/account.v1.AccountService/GetUserInfo" +) + +// AccountServiceClient is a client for the account.v1.AccountService service. +type AccountServiceClient interface { + SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error) + Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error) + SetPassword(context.Context, *connect.Request[v1.SetPasswordRequest]) (*connect.Response[v1.SetPasswordResponse], error) + SetName(context.Context, *connect.Request[v1.SetNameRequest]) (*connect.Response[v1.SetNameResponse], error) + GetAvatarUploadURL(context.Context, *connect.Request[v1.GetAvatarUploadURLRequest]) (*connect.Response[v1.GetAvatarUploadURLResponse], error) + SetAvatar(context.Context, *connect.Request[v1.SetAvatarRequest]) (*connect.Response[v1.SetAvatarResponse], error) + GetUserInfo(context.Context, *connect.Request[v1.GetUserInfoRequest]) (*connect.Response[v1.GetUserInfoResponse], error) +} + +// NewAccountServiceClient constructs a client for the account.v1.AccountService service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAccountServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AccountServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + accountServiceMethods := v1.File_account_v1_account_proto.Services().ByName("AccountService").Methods() + return &accountServiceClient{ + sendCredential: connect.NewClient[v1.SendCredentialRequest, v1.SendCredentialResponse]( + httpClient, + baseURL+AccountServiceSendCredentialProcedure, + connect.WithSchema(accountServiceMethods.ByName("SendCredential")), + connect.WithClientOptions(opts...), + ), + auth: connect.NewClient[v1.AuthRequest, v1.AuthResponse]( + httpClient, + baseURL+AccountServiceAuthProcedure, + connect.WithSchema(accountServiceMethods.ByName("Auth")), + connect.WithClientOptions(opts...), + ), + setPassword: connect.NewClient[v1.SetPasswordRequest, v1.SetPasswordResponse]( + httpClient, + baseURL+AccountServiceSetPasswordProcedure, + connect.WithSchema(accountServiceMethods.ByName("SetPassword")), + connect.WithClientOptions(opts...), + ), + setName: connect.NewClient[v1.SetNameRequest, v1.SetNameResponse]( + httpClient, + baseURL+AccountServiceSetNameProcedure, + connect.WithSchema(accountServiceMethods.ByName("SetName")), + connect.WithClientOptions(opts...), + ), + getAvatarUploadURL: connect.NewClient[v1.GetAvatarUploadURLRequest, v1.GetAvatarUploadURLResponse]( + httpClient, + baseURL+AccountServiceGetAvatarUploadURLProcedure, + connect.WithSchema(accountServiceMethods.ByName("GetAvatarUploadURL")), + connect.WithClientOptions(opts...), + ), + setAvatar: connect.NewClient[v1.SetAvatarRequest, v1.SetAvatarResponse]( + httpClient, + baseURL+AccountServiceSetAvatarProcedure, + connect.WithSchema(accountServiceMethods.ByName("SetAvatar")), + connect.WithClientOptions(opts...), + ), + getUserInfo: connect.NewClient[v1.GetUserInfoRequest, v1.GetUserInfoResponse]( + httpClient, + baseURL+AccountServiceGetUserInfoProcedure, + connect.WithSchema(accountServiceMethods.ByName("GetUserInfo")), + connect.WithClientOptions(opts...), + ), + } +} + +// accountServiceClient implements AccountServiceClient. +type accountServiceClient struct { + sendCredential *connect.Client[v1.SendCredentialRequest, v1.SendCredentialResponse] + auth *connect.Client[v1.AuthRequest, v1.AuthResponse] + setPassword *connect.Client[v1.SetPasswordRequest, v1.SetPasswordResponse] + setName *connect.Client[v1.SetNameRequest, v1.SetNameResponse] + getAvatarUploadURL *connect.Client[v1.GetAvatarUploadURLRequest, v1.GetAvatarUploadURLResponse] + setAvatar *connect.Client[v1.SetAvatarRequest, v1.SetAvatarResponse] + getUserInfo *connect.Client[v1.GetUserInfoRequest, v1.GetUserInfoResponse] +} + +// SendCredential calls account.v1.AccountService.SendCredential. +func (c *accountServiceClient) SendCredential(ctx context.Context, req *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error) { + return c.sendCredential.CallUnary(ctx, req) +} + +// Auth calls account.v1.AccountService.Auth. +func (c *accountServiceClient) Auth(ctx context.Context, req *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error) { + return c.auth.CallUnary(ctx, req) +} + +// SetPassword calls account.v1.AccountService.SetPassword. +func (c *accountServiceClient) SetPassword(ctx context.Context, req *connect.Request[v1.SetPasswordRequest]) (*connect.Response[v1.SetPasswordResponse], error) { + return c.setPassword.CallUnary(ctx, req) +} + +// SetName calls account.v1.AccountService.SetName. +func (c *accountServiceClient) SetName(ctx context.Context, req *connect.Request[v1.SetNameRequest]) (*connect.Response[v1.SetNameResponse], error) { + return c.setName.CallUnary(ctx, req) +} + +// GetAvatarUploadURL calls account.v1.AccountService.GetAvatarUploadURL. +func (c *accountServiceClient) GetAvatarUploadURL(ctx context.Context, req *connect.Request[v1.GetAvatarUploadURLRequest]) (*connect.Response[v1.GetAvatarUploadURLResponse], error) { + return c.getAvatarUploadURL.CallUnary(ctx, req) +} + +// SetAvatar calls account.v1.AccountService.SetAvatar. +func (c *accountServiceClient) SetAvatar(ctx context.Context, req *connect.Request[v1.SetAvatarRequest]) (*connect.Response[v1.SetAvatarResponse], error) { + return c.setAvatar.CallUnary(ctx, req) +} + +// GetUserInfo calls account.v1.AccountService.GetUserInfo. +func (c *accountServiceClient) GetUserInfo(ctx context.Context, req *connect.Request[v1.GetUserInfoRequest]) (*connect.Response[v1.GetUserInfoResponse], error) { + return c.getUserInfo.CallUnary(ctx, req) +} + +// AccountServiceHandler is an implementation of the account.v1.AccountService service. +type AccountServiceHandler interface { + SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error) + Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error) + SetPassword(context.Context, *connect.Request[v1.SetPasswordRequest]) (*connect.Response[v1.SetPasswordResponse], error) + SetName(context.Context, *connect.Request[v1.SetNameRequest]) (*connect.Response[v1.SetNameResponse], error) + GetAvatarUploadURL(context.Context, *connect.Request[v1.GetAvatarUploadURLRequest]) (*connect.Response[v1.GetAvatarUploadURLResponse], error) + SetAvatar(context.Context, *connect.Request[v1.SetAvatarRequest]) (*connect.Response[v1.SetAvatarResponse], error) + GetUserInfo(context.Context, *connect.Request[v1.GetUserInfoRequest]) (*connect.Response[v1.GetUserInfoResponse], error) +} + +// NewAccountServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAccountServiceHandler(svc AccountServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + accountServiceMethods := v1.File_account_v1_account_proto.Services().ByName("AccountService").Methods() + accountServiceSendCredentialHandler := connect.NewUnaryHandler( + AccountServiceSendCredentialProcedure, + svc.SendCredential, + connect.WithSchema(accountServiceMethods.ByName("SendCredential")), + connect.WithHandlerOptions(opts...), + ) + accountServiceAuthHandler := connect.NewUnaryHandler( + AccountServiceAuthProcedure, + svc.Auth, + connect.WithSchema(accountServiceMethods.ByName("Auth")), + connect.WithHandlerOptions(opts...), + ) + accountServiceSetPasswordHandler := connect.NewUnaryHandler( + AccountServiceSetPasswordProcedure, + svc.SetPassword, + connect.WithSchema(accountServiceMethods.ByName("SetPassword")), + connect.WithHandlerOptions(opts...), + ) + accountServiceSetNameHandler := connect.NewUnaryHandler( + AccountServiceSetNameProcedure, + svc.SetName, + connect.WithSchema(accountServiceMethods.ByName("SetName")), + connect.WithHandlerOptions(opts...), + ) + accountServiceGetAvatarUploadURLHandler := connect.NewUnaryHandler( + AccountServiceGetAvatarUploadURLProcedure, + svc.GetAvatarUploadURL, + connect.WithSchema(accountServiceMethods.ByName("GetAvatarUploadURL")), + connect.WithHandlerOptions(opts...), + ) + accountServiceSetAvatarHandler := connect.NewUnaryHandler( + AccountServiceSetAvatarProcedure, + svc.SetAvatar, + connect.WithSchema(accountServiceMethods.ByName("SetAvatar")), + connect.WithHandlerOptions(opts...), + ) + accountServiceGetUserInfoHandler := connect.NewUnaryHandler( + AccountServiceGetUserInfoProcedure, + svc.GetUserInfo, + connect.WithSchema(accountServiceMethods.ByName("GetUserInfo")), + connect.WithHandlerOptions(opts...), + ) + return "/account.v1.AccountService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AccountServiceSendCredentialProcedure: + accountServiceSendCredentialHandler.ServeHTTP(w, r) + case AccountServiceAuthProcedure: + accountServiceAuthHandler.ServeHTTP(w, r) + case AccountServiceSetPasswordProcedure: + accountServiceSetPasswordHandler.ServeHTTP(w, r) + case AccountServiceSetNameProcedure: + accountServiceSetNameHandler.ServeHTTP(w, r) + case AccountServiceGetAvatarUploadURLProcedure: + accountServiceGetAvatarUploadURLHandler.ServeHTTP(w, r) + case AccountServiceSetAvatarProcedure: + accountServiceSetAvatarHandler.ServeHTTP(w, r) + case AccountServiceGetUserInfoProcedure: + accountServiceGetUserInfoHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAccountServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAccountServiceHandler struct{} + +func (UnimplementedAccountServiceHandler) SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("account.v1.AccountService.SendCredential is not implemented")) +} + +func (UnimplementedAccountServiceHandler) Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("account.v1.AccountService.Auth is not implemented")) +} + +func (UnimplementedAccountServiceHandler) SetPassword(context.Context, *connect.Request[v1.SetPasswordRequest]) (*connect.Response[v1.SetPasswordResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("account.v1.AccountService.SetPassword is not implemented")) +} + +func (UnimplementedAccountServiceHandler) SetName(context.Context, *connect.Request[v1.SetNameRequest]) (*connect.Response[v1.SetNameResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("account.v1.AccountService.SetName is not implemented")) +} + +func (UnimplementedAccountServiceHandler) GetAvatarUploadURL(context.Context, *connect.Request[v1.GetAvatarUploadURLRequest]) (*connect.Response[v1.GetAvatarUploadURLResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("account.v1.AccountService.GetAvatarUploadURL is not implemented")) +} + +func (UnimplementedAccountServiceHandler) SetAvatar(context.Context, *connect.Request[v1.SetAvatarRequest]) (*connect.Response[v1.SetAvatarResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("account.v1.AccountService.SetAvatar is not implemented")) +} + +func (UnimplementedAccountServiceHandler) GetUserInfo(context.Context, *connect.Request[v1.GetUserInfoRequest]) (*connect.Response[v1.GetUserInfoResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("account.v1.AccountService.GetUserInfo is not implemented")) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b0106dc --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module git.0yue.com/shenxianhe/sdk + +go 1.25.0 + +require ( + connectrpc.com/connect v1.18.1 + google.golang.org/protobuf v1.36.7 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..39493b9 --- /dev/null +++ b/go.sum @@ -0,0 +1,10 @@ +connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw= +connectrpc.com/connect v1.18.1/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A= +google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= diff --git a/notification/v1/notification.pb.go b/notification/v1/notification.pb.go new file mode 100644 index 0000000..2f9453d --- /dev/null +++ b/notification/v1/notification.pb.go @@ -0,0 +1,528 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.7 +// protoc (unknown) +// source: notification/v1/notification.proto + +package notificationv1 + +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 SMSSignStatus int32 + +const ( + SMSSignStatus_SMS_SIGN_STATUS_UNSPECIFIED SMSSignStatus = 0 + SMSSignStatus_SMS_SIGN_STATUS_APPLYING SMSSignStatus = 1 // 审核中 + SMSSignStatus_SMS_SIGN_STATUS_PASSED SMSSignStatus = 2 // 审核通过 + SMSSignStatus_SMS_SIGN_STATUS_REJECTED SMSSignStatus = 3 // 审核拒绝 + SMSSignStatus_SMS_SIGN_STATUS_CANCELED SMSSignStatus = 4 // 已取消 +) + +// Enum value maps for SMSSignStatus. +var ( + SMSSignStatus_name = map[int32]string{ + 0: "SMS_SIGN_STATUS_UNSPECIFIED", + 1: "SMS_SIGN_STATUS_APPLYING", + 2: "SMS_SIGN_STATUS_PASSED", + 3: "SMS_SIGN_STATUS_REJECTED", + 4: "SMS_SIGN_STATUS_CANCELED", + } + SMSSignStatus_value = map[string]int32{ + "SMS_SIGN_STATUS_UNSPECIFIED": 0, + "SMS_SIGN_STATUS_APPLYING": 1, + "SMS_SIGN_STATUS_PASSED": 2, + "SMS_SIGN_STATUS_REJECTED": 3, + "SMS_SIGN_STATUS_CANCELED": 4, + } +) + +func (x SMSSignStatus) Enum() *SMSSignStatus { + p := new(SMSSignStatus) + *p = x + return p +} + +func (x SMSSignStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SMSSignStatus) Descriptor() protoreflect.EnumDescriptor { + return file_notification_v1_notification_proto_enumTypes[0].Descriptor() +} + +func (SMSSignStatus) Type() protoreflect.EnumType { + return &file_notification_v1_notification_proto_enumTypes[0] +} + +func (x SMSSignStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SMSSignStatus.Descriptor instead. +func (SMSSignStatus) EnumDescriptor() ([]byte, []int) { + return file_notification_v1_notification_proto_rawDescGZIP(), []int{0} +} + +type SendSMSRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone,omitempty"` + SignName string `protobuf:"bytes,2,opt,name=sign_name,json=signName,proto3" json:"sign_name,omitempty"` + TemplateCode string `protobuf:"bytes,3,opt,name=template_code,json=templateCode,proto3" json:"template_code,omitempty"` + TemplateParams map[string]string `protobuf:"bytes,4,rep,name=template_params,json=templateParams,proto3" json:"template_params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendSMSRequest) Reset() { + *x = SendSMSRequest{} + mi := &file_notification_v1_notification_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendSMSRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendSMSRequest) ProtoMessage() {} + +func (x *SendSMSRequest) ProtoReflect() protoreflect.Message { + mi := &file_notification_v1_notification_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 SendSMSRequest.ProtoReflect.Descriptor instead. +func (*SendSMSRequest) Descriptor() ([]byte, []int) { + return file_notification_v1_notification_proto_rawDescGZIP(), []int{0} +} + +func (x *SendSMSRequest) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *SendSMSRequest) GetSignName() string { + if x != nil { + return x.SignName + } + return "" +} + +func (x *SendSMSRequest) GetTemplateCode() string { + if x != nil { + return x.TemplateCode + } + return "" +} + +func (x *SendSMSRequest) GetTemplateParams() map[string]string { + if x != nil { + return x.TemplateParams + } + return nil +} + +type SendSMSResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendSMSResponse) Reset() { + *x = SendSMSResponse{} + mi := &file_notification_v1_notification_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendSMSResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendSMSResponse) ProtoMessage() {} + +func (x *SendSMSResponse) ProtoReflect() protoreflect.Message { + mi := &file_notification_v1_notification_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 SendSMSResponse.ProtoReflect.Descriptor instead. +func (*SendSMSResponse) Descriptor() ([]byte, []int) { + return file_notification_v1_notification_proto_rawDescGZIP(), []int{1} +} + +type ListSMSSignRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Offset int32 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSMSSignRequest) Reset() { + *x = ListSMSSignRequest{} + mi := &file_notification_v1_notification_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSMSSignRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSMSSignRequest) ProtoMessage() {} + +func (x *ListSMSSignRequest) ProtoReflect() protoreflect.Message { + mi := &file_notification_v1_notification_proto_msgTypes[2] + 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 ListSMSSignRequest.ProtoReflect.Descriptor instead. +func (*ListSMSSignRequest) Descriptor() ([]byte, []int) { + return file_notification_v1_notification_proto_rawDescGZIP(), []int{2} +} + +func (x *ListSMSSignRequest) GetOffset() int32 { + if x != nil { + return x.Offset + } + return 0 +} + +type SMSSignReason struct { + state protoimpl.MessageState `protogen:"open.v1"` + Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + SubContent string `protobuf:"bytes,2,opt,name=sub_content,json=subContent,proto3" json:"sub_content,omitempty"` + CreateAt int32 `protobuf:"varint,3,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SMSSignReason) Reset() { + *x = SMSSignReason{} + mi := &file_notification_v1_notification_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SMSSignReason) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMSSignReason) ProtoMessage() {} + +func (x *SMSSignReason) ProtoReflect() protoreflect.Message { + mi := &file_notification_v1_notification_proto_msgTypes[3] + 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 SMSSignReason.ProtoReflect.Descriptor instead. +func (*SMSSignReason) Descriptor() ([]byte, []int) { + return file_notification_v1_notification_proto_rawDescGZIP(), []int{3} +} + +func (x *SMSSignReason) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *SMSSignReason) GetSubContent() string { + if x != nil { + return x.SubContent + } + return "" +} + +func (x *SMSSignReason) GetCreateAt() int32 { + if x != nil { + return x.CreateAt + } + return 0 +} + +type SMSSign struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 签名ID + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // 签名名称 + Status SMSSignStatus `protobuf:"varint,3,opt,name=status,proto3,enum=notification.v1.SMSSignStatus" json:"status,omitempty"` // 签名状态 + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` // 签名类型 + Reasons *SMSSignReason `protobuf:"bytes,5,opt,name=reasons,proto3" json:"reasons,omitempty"` // 签名拒绝原因 + CreatedAt int32 `protobuf:"varint,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SMSSign) Reset() { + *x = SMSSign{} + mi := &file_notification_v1_notification_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SMSSign) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMSSign) ProtoMessage() {} + +func (x *SMSSign) ProtoReflect() protoreflect.Message { + mi := &file_notification_v1_notification_proto_msgTypes[4] + 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 SMSSign.ProtoReflect.Descriptor instead. +func (*SMSSign) Descriptor() ([]byte, []int) { + return file_notification_v1_notification_proto_rawDescGZIP(), []int{4} +} + +func (x *SMSSign) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SMSSign) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SMSSign) GetStatus() SMSSignStatus { + if x != nil { + return x.Status + } + return SMSSignStatus_SMS_SIGN_STATUS_UNSPECIFIED +} + +func (x *SMSSign) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *SMSSign) GetReasons() *SMSSignReason { + if x != nil { + return x.Reasons + } + return nil +} + +func (x *SMSSign) GetCreatedAt() int32 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type ListSMSSignResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*SMSSign `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSMSSignResponse) Reset() { + *x = ListSMSSignResponse{} + mi := &file_notification_v1_notification_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSMSSignResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSMSSignResponse) ProtoMessage() {} + +func (x *ListSMSSignResponse) ProtoReflect() protoreflect.Message { + mi := &file_notification_v1_notification_proto_msgTypes[5] + 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 ListSMSSignResponse.ProtoReflect.Descriptor instead. +func (*ListSMSSignResponse) Descriptor() ([]byte, []int) { + return file_notification_v1_notification_proto_rawDescGZIP(), []int{5} +} + +func (x *ListSMSSignResponse) GetList() []*SMSSign { + if x != nil { + return x.List + } + return nil +} + +func (x *ListSMSSignResponse) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +var File_notification_v1_notification_proto protoreflect.FileDescriptor + +const file_notification_v1_notification_proto_rawDesc = "" + + "\n" + + "\"notification/v1/notification.proto\x12\x0fnotification.v1\"\x89\x02\n" + + "\x0eSendSMSRequest\x12\x14\n" + + "\x05phone\x18\x01 \x01(\tR\x05phone\x12\x1b\n" + + "\tsign_name\x18\x02 \x01(\tR\bsignName\x12#\n" + + "\rtemplate_code\x18\x03 \x01(\tR\ftemplateCode\x12\\\n" + + "\x0ftemplate_params\x18\x04 \x03(\v23.notification.v1.SendSMSRequest.TemplateParamsEntryR\x0etemplateParams\x1aA\n" + + "\x13TemplateParamsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x11\n" + + "\x0fSendSMSResponse\",\n" + + "\x12ListSMSSignRequest\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x05R\x06offset\"g\n" + + "\rSMSSignReason\x12\x18\n" + + "\acontent\x18\x01 \x01(\tR\acontent\x12\x1f\n" + + "\vsub_content\x18\x02 \x01(\tR\n" + + "subContent\x12\x1b\n" + + "\tcreate_at\x18\x03 \x01(\x05R\bcreateAt\"\xd2\x01\n" + + "\aSMSSign\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x126\n" + + "\x06status\x18\x03 \x01(\x0e2\x1e.notification.v1.SMSSignStatusR\x06status\x12\x12\n" + + "\x04type\x18\x04 \x01(\tR\x04type\x128\n" + + "\areasons\x18\x05 \x01(\v2\x1e.notification.v1.SMSSignReasonR\areasons\x12\x1d\n" + + "\n" + + "created_at\x18\x06 \x01(\x05R\tcreatedAt\"Y\n" + + "\x13ListSMSSignResponse\x12,\n" + + "\x04list\x18\x01 \x03(\v2\x18.notification.v1.SMSSignR\x04list\x12\x14\n" + + "\x05count\x18\x02 \x01(\x05R\x05count*\xa6\x01\n" + + "\rSMSSignStatus\x12\x1f\n" + + "\x1bSMS_SIGN_STATUS_UNSPECIFIED\x10\x00\x12\x1c\n" + + "\x18SMS_SIGN_STATUS_APPLYING\x10\x01\x12\x1a\n" + + "\x16SMS_SIGN_STATUS_PASSED\x10\x02\x12\x1c\n" + + "\x18SMS_SIGN_STATUS_REJECTED\x10\x03\x12\x1c\n" + + "\x18SMS_SIGN_STATUS_CANCELED\x10\x042\xbd\x01\n" + + "\x13NotificationService\x12X\n" + + "\vListSMSSign\x12#.notification.v1.ListSMSSignRequest\x1a$.notification.v1.ListSMSSignResponse\x12L\n" + + "\aSendSMS\x12\x1f.notification.v1.SendSMSRequest\x1a .notification.v1.SendSMSResponseB notification.v1.SendSMSRequest.TemplateParamsEntry + 0, // 1: notification.v1.SMSSign.status:type_name -> notification.v1.SMSSignStatus + 4, // 2: notification.v1.SMSSign.reasons:type_name -> notification.v1.SMSSignReason + 5, // 3: notification.v1.ListSMSSignResponse.list:type_name -> notification.v1.SMSSign + 3, // 4: notification.v1.NotificationService.ListSMSSign:input_type -> notification.v1.ListSMSSignRequest + 1, // 5: notification.v1.NotificationService.SendSMS:input_type -> notification.v1.SendSMSRequest + 6, // 6: notification.v1.NotificationService.ListSMSSign:output_type -> notification.v1.ListSMSSignResponse + 2, // 7: notification.v1.NotificationService.SendSMS:output_type -> notification.v1.SendSMSResponse + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_notification_v1_notification_proto_init() } +func file_notification_v1_notification_proto_init() { + if File_notification_v1_notification_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_notification_v1_notification_proto_rawDesc), len(file_notification_v1_notification_proto_rawDesc)), + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_notification_v1_notification_proto_goTypes, + DependencyIndexes: file_notification_v1_notification_proto_depIdxs, + EnumInfos: file_notification_v1_notification_proto_enumTypes, + MessageInfos: file_notification_v1_notification_proto_msgTypes, + }.Build() + File_notification_v1_notification_proto = out.File + file_notification_v1_notification_proto_goTypes = nil + file_notification_v1_notification_proto_depIdxs = nil +} diff --git a/notification/v1/notificationv1connect/notification.connect.go b/notification/v1/notificationv1connect/notification.connect.go new file mode 100644 index 0000000..492a8f2 --- /dev/null +++ b/notification/v1/notificationv1connect/notification.connect.go @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: notification/v1/notification.proto + +package notificationv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "git.0yue.com/shenxianhe/sdk/notification/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // NotificationServiceName is the fully-qualified name of the NotificationService service. + NotificationServiceName = "notification.v1.NotificationService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // NotificationServiceListSMSSignProcedure is the fully-qualified name of the NotificationService's + // ListSMSSign RPC. + NotificationServiceListSMSSignProcedure = "/notification.v1.NotificationService/ListSMSSign" + // NotificationServiceSendSMSProcedure is the fully-qualified name of the NotificationService's + // SendSMS RPC. + NotificationServiceSendSMSProcedure = "/notification.v1.NotificationService/SendSMS" +) + +// NotificationServiceClient is a client for the notification.v1.NotificationService service. +type NotificationServiceClient interface { + ListSMSSign(context.Context, *connect.Request[v1.ListSMSSignRequest]) (*connect.Response[v1.ListSMSSignResponse], error) + SendSMS(context.Context, *connect.Request[v1.SendSMSRequest]) (*connect.Response[v1.SendSMSResponse], error) +} + +// NewNotificationServiceClient constructs a client for the notification.v1.NotificationService +// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for +// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply +// the connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewNotificationServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) NotificationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + notificationServiceMethods := v1.File_notification_v1_notification_proto.Services().ByName("NotificationService").Methods() + return ¬ificationServiceClient{ + listSMSSign: connect.NewClient[v1.ListSMSSignRequest, v1.ListSMSSignResponse]( + httpClient, + baseURL+NotificationServiceListSMSSignProcedure, + connect.WithSchema(notificationServiceMethods.ByName("ListSMSSign")), + connect.WithClientOptions(opts...), + ), + sendSMS: connect.NewClient[v1.SendSMSRequest, v1.SendSMSResponse]( + httpClient, + baseURL+NotificationServiceSendSMSProcedure, + connect.WithSchema(notificationServiceMethods.ByName("SendSMS")), + connect.WithClientOptions(opts...), + ), + } +} + +// notificationServiceClient implements NotificationServiceClient. +type notificationServiceClient struct { + listSMSSign *connect.Client[v1.ListSMSSignRequest, v1.ListSMSSignResponse] + sendSMS *connect.Client[v1.SendSMSRequest, v1.SendSMSResponse] +} + +// ListSMSSign calls notification.v1.NotificationService.ListSMSSign. +func (c *notificationServiceClient) ListSMSSign(ctx context.Context, req *connect.Request[v1.ListSMSSignRequest]) (*connect.Response[v1.ListSMSSignResponse], error) { + return c.listSMSSign.CallUnary(ctx, req) +} + +// SendSMS calls notification.v1.NotificationService.SendSMS. +func (c *notificationServiceClient) SendSMS(ctx context.Context, req *connect.Request[v1.SendSMSRequest]) (*connect.Response[v1.SendSMSResponse], error) { + return c.sendSMS.CallUnary(ctx, req) +} + +// NotificationServiceHandler is an implementation of the notification.v1.NotificationService +// service. +type NotificationServiceHandler interface { + ListSMSSign(context.Context, *connect.Request[v1.ListSMSSignRequest]) (*connect.Response[v1.ListSMSSignResponse], error) + SendSMS(context.Context, *connect.Request[v1.SendSMSRequest]) (*connect.Response[v1.SendSMSResponse], error) +} + +// NewNotificationServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewNotificationServiceHandler(svc NotificationServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + notificationServiceMethods := v1.File_notification_v1_notification_proto.Services().ByName("NotificationService").Methods() + notificationServiceListSMSSignHandler := connect.NewUnaryHandler( + NotificationServiceListSMSSignProcedure, + svc.ListSMSSign, + connect.WithSchema(notificationServiceMethods.ByName("ListSMSSign")), + connect.WithHandlerOptions(opts...), + ) + notificationServiceSendSMSHandler := connect.NewUnaryHandler( + NotificationServiceSendSMSProcedure, + svc.SendSMS, + connect.WithSchema(notificationServiceMethods.ByName("SendSMS")), + connect.WithHandlerOptions(opts...), + ) + return "/notification.v1.NotificationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case NotificationServiceListSMSSignProcedure: + notificationServiceListSMSSignHandler.ServeHTTP(w, r) + case NotificationServiceSendSMSProcedure: + notificationServiceSendSMSHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedNotificationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedNotificationServiceHandler struct{} + +func (UnimplementedNotificationServiceHandler) ListSMSSign(context.Context, *connect.Request[v1.ListSMSSignRequest]) (*connect.Response[v1.ListSMSSignResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("notification.v1.NotificationService.ListSMSSign is not implemented")) +} + +func (UnimplementedNotificationServiceHandler) SendSMS(context.Context, *connect.Request[v1.SendSMSRequest]) (*connect.Response[v1.SendSMSResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("notification.v1.NotificationService.SendSMS is not implemented")) +}