contract update
This commit is contained in:
parent
ecdc68eda2
commit
7cef9cbe8d
3 changed files with 192 additions and 8 deletions
|
|
@ -133,6 +133,126 @@ func (x *VerifyTokenResponse) GetAccessCode() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
type PersonalRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserUuid string `protobuf:"bytes,1,opt,name=userUuid,proto3" json:"userUuid,omitempty"`
|
||||
ServiceId int32 `protobuf:"varint,2,opt,name=serviceId,proto3" json:"serviceId,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PersonalRequest) Reset() {
|
||||
*x = PersonalRequest{}
|
||||
mi := &file_proto_verify_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PersonalRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PersonalRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PersonalRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_verify_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 PersonalRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PersonalRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_verify_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *PersonalRequest) GetUserUuid() string {
|
||||
if x != nil {
|
||||
return x.UserUuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PersonalRequest) GetServiceId() int32 {
|
||||
if x != nil {
|
||||
return x.ServiceId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type PersonalResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
|
||||
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Surname string `protobuf:"bytes,4,opt,name=surname,proto3" json:"surname,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PersonalResponse) Reset() {
|
||||
*x = PersonalResponse{}
|
||||
mi := &file_proto_verify_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PersonalResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PersonalResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PersonalResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_verify_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 PersonalResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PersonalResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_verify_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *PersonalResponse) GetEmail() string {
|
||||
if x != nil {
|
||||
return x.Email
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PersonalResponse) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PersonalResponse) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PersonalResponse) GetSurname() string {
|
||||
if x != nil {
|
||||
return x.Surname
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_proto_verify_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_proto_verify_proto_rawDesc = "" +
|
||||
|
|
@ -146,9 +266,18 @@ const file_proto_verify_proto_rawDesc = "" +
|
|||
"\aisValid\x18\x02 \x01(\bR\aisValid\x12\x1e\n" +
|
||||
"\n" +
|
||||
"accessCode\x18\x03 \x01(\x05R\n" +
|
||||
"accessCode2c\n" +
|
||||
"accessCode\"K\n" +
|
||||
"\x0fPersonalRequest\x12\x1a\n" +
|
||||
"\buserUuid\x18\x01 \x01(\tR\buserUuid\x12\x1c\n" +
|
||||
"\tserviceId\x18\x02 \x01(\x05R\tserviceId\"r\n" +
|
||||
"\x10PersonalResponse\x12\x14\n" +
|
||||
"\x05email\x18\x01 \x01(\tR\x05email\x12\x1a\n" +
|
||||
"\busername\x18\x02 \x01(\tR\busername\x12\x12\n" +
|
||||
"\x04name\x18\x03 \x01(\tR\x04name\x12\x18\n" +
|
||||
"\asurname\x18\x04 \x01(\tR\asurname2\xb7\x01\n" +
|
||||
"\vAuthService\x12T\n" +
|
||||
"\vVerifyToken\x12!.verifyAuth.v1.VerifyTokenRequest\x1a\".verifyAuth.v1.VerifyTokenResponseB\x19Z\x17/pkg/verify/v1;verifyV1b\x06proto3"
|
||||
"\vVerifyToken\x12!.verifyAuth.v1.VerifyTokenRequest\x1a\".verifyAuth.v1.VerifyTokenResponse\x12R\n" +
|
||||
"\x0fGetPersonalInfo\x12\x1e.verifyAuth.v1.PersonalRequest\x1a\x1f.verifyAuth.v1.PersonalResponseB\x19Z\x17/pkg/verify/v1;verifyV1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_proto_verify_proto_rawDescOnce sync.Once
|
||||
|
|
@ -162,16 +291,20 @@ func file_proto_verify_proto_rawDescGZIP() []byte {
|
|||
return file_proto_verify_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_verify_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_proto_verify_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_proto_verify_proto_goTypes = []any{
|
||||
(*VerifyTokenRequest)(nil), // 0: verifyAuth.v1.VerifyTokenRequest
|
||||
(*VerifyTokenResponse)(nil), // 1: verifyAuth.v1.VerifyTokenResponse
|
||||
(*PersonalRequest)(nil), // 2: verifyAuth.v1.PersonalRequest
|
||||
(*PersonalResponse)(nil), // 3: verifyAuth.v1.PersonalResponse
|
||||
}
|
||||
var file_proto_verify_proto_depIdxs = []int32{
|
||||
0, // 0: verifyAuth.v1.AuthService.VerifyToken:input_type -> verifyAuth.v1.VerifyTokenRequest
|
||||
1, // 1: verifyAuth.v1.AuthService.VerifyToken:output_type -> verifyAuth.v1.VerifyTokenResponse
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
2, // 1: verifyAuth.v1.AuthService.GetPersonalInfo:input_type -> verifyAuth.v1.PersonalRequest
|
||||
1, // 2: verifyAuth.v1.AuthService.VerifyToken:output_type -> verifyAuth.v1.VerifyTokenResponse
|
||||
3, // 3: verifyAuth.v1.AuthService.GetPersonalInfo:output_type -> verifyAuth.v1.PersonalResponse
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] 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
|
||||
|
|
@ -188,7 +321,7 @@ func file_proto_verify_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_verify_proto_rawDesc), len(file_proto_verify_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ import (
|
|||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
AuthService_VerifyToken_FullMethodName = "/verifyAuth.v1.AuthService/VerifyToken"
|
||||
AuthService_VerifyToken_FullMethodName = "/verifyAuth.v1.AuthService/VerifyToken"
|
||||
AuthService_GetPersonalInfo_FullMethodName = "/verifyAuth.v1.AuthService/GetPersonalInfo"
|
||||
)
|
||||
|
||||
// AuthServiceClient is the client API for AuthService service.
|
||||
|
|
@ -27,6 +28,7 @@ const (
|
|||
// 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 AuthServiceClient interface {
|
||||
VerifyToken(ctx context.Context, in *VerifyTokenRequest, opts ...grpc.CallOption) (*VerifyTokenResponse, error)
|
||||
GetPersonalInfo(ctx context.Context, in *PersonalRequest, opts ...grpc.CallOption) (*PersonalResponse, error)
|
||||
}
|
||||
|
||||
type authServiceClient struct {
|
||||
|
|
@ -47,11 +49,22 @@ func (c *authServiceClient) VerifyToken(ctx context.Context, in *VerifyTokenRequ
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authServiceClient) GetPersonalInfo(ctx context.Context, in *PersonalRequest, opts ...grpc.CallOption) (*PersonalResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PersonalResponse)
|
||||
err := c.cc.Invoke(ctx, AuthService_GetPersonalInfo_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AuthServiceServer is the server API for AuthService service.
|
||||
// All implementations must embed UnimplementedAuthServiceServer
|
||||
// for forward compatibility.
|
||||
type AuthServiceServer interface {
|
||||
VerifyToken(context.Context, *VerifyTokenRequest) (*VerifyTokenResponse, error)
|
||||
GetPersonalInfo(context.Context, *PersonalRequest) (*PersonalResponse, error)
|
||||
mustEmbedUnimplementedAuthServiceServer()
|
||||
}
|
||||
|
||||
|
|
@ -65,6 +78,9 @@ type UnimplementedAuthServiceServer struct{}
|
|||
func (UnimplementedAuthServiceServer) VerifyToken(context.Context, *VerifyTokenRequest) (*VerifyTokenResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method VerifyToken not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) GetPersonalInfo(context.Context, *PersonalRequest) (*PersonalResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPersonalInfo not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
|
||||
func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
|
|
@ -104,6 +120,24 @@ func _AuthService_VerifyToken_Handler(srv interface{}, ctx context.Context, dec
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthService_GetPersonalInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PersonalRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthServiceServer).GetPersonalInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthService_GetPersonalInfo_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthServiceServer).GetPersonalInfo(ctx, req.(*PersonalRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
|
@ -115,6 +149,10 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "VerifyToken",
|
||||
Handler: _AuthService_VerifyToken_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPersonalInfo",
|
||||
Handler: _AuthService_GetPersonalInfo_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "proto/verify.proto",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,19 @@ message VerifyTokenResponse {
|
|||
int32 accessCode = 3;
|
||||
}
|
||||
|
||||
message PersonalRequest {
|
||||
string userUuid = 1;
|
||||
int32 serviceId = 2;
|
||||
}
|
||||
|
||||
message PersonalResponse {
|
||||
string email = 1;
|
||||
string username = 2;
|
||||
string name = 3;
|
||||
string surname = 4;
|
||||
}
|
||||
|
||||
service AuthService {
|
||||
rpc VerifyToken(VerifyTokenRequest) returns (VerifyTokenResponse);
|
||||
rpc GetPersonalInfo(PersonalRequest) returns (PersonalResponse);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue