// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.4.0 // - protoc v3.19.4 // source: generate/protobuf/permission.proto package permission 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.62.0 or later. const _ = grpc.SupportPackageIsVersion8 const ( TokenService_NewToken_FullMethodName = "/permission.TokenService/NewToken" TokenService_RefreshToken_FullMethodName = "/permission.TokenService/RefreshToken" TokenService_CancelToken_FullMethodName = "/permission.TokenService/CancelToken" TokenService_ValidationToken_FullMethodName = "/permission.TokenService/ValidationToken" TokenService_CancelTokens_FullMethodName = "/permission.TokenService/CancelTokens" TokenService_CancelTokenByDeviceId_FullMethodName = "/permission.TokenService/CancelTokenByDeviceId" TokenService_GetUserTokensByDeviceId_FullMethodName = "/permission.TokenService/GetUserTokensByDeviceId" TokenService_GetUserTokensByUid_FullMethodName = "/permission.TokenService/GetUserTokensByUid" TokenService_NewOneTimeToken_FullMethodName = "/permission.TokenService/NewOneTimeToken" TokenService_CancelOneTimeToken_FullMethodName = "/permission.TokenService/CancelOneTimeToken" ) // TokenServiceClient is the client API for TokenService 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. // // 跟 Token 相關的大小事,這次只回應錯誤,以及結果,不統一規範 // 錯誤碼應該在 Biz GW 在做回應,另外我這邊取名字比較通用, // access_token -> token , refresh_token -> one_time_token type TokenServiceClient interface { // NewToken 建立一個新的 Token,例如:AccessToken NewToken(ctx context.Context, in *AuthorizationReq, opts ...grpc.CallOption) (*TokenResp, error) // RefreshToken 更新目前的token 以及裡面包含的一次性 Token RefreshToken(ctx context.Context, in *RefreshTokenReq, opts ...grpc.CallOption) (*RefreshTokenResp, error) // CancelToken 取消 Token,也包含他裡面的 One Time Toke CancelToken(ctx context.Context, in *CancelTokenReq, opts ...grpc.CallOption) (*OKResp, error) // ValidationToken 驗證這個 Token 有沒有效 ValidationToken(ctx context.Context, in *ValidationTokenReq, opts ...grpc.CallOption) (*ValidationTokenResp, error) // CancelTokens 取消 Token 從UID 視角,以及 token id 視角出發, UID 登出,底下所有 Device ID 也要登出, Token ID 登出, 所有 UID + Device 都要登出 CancelTokens(ctx context.Context, in *DoTokenByUIDReq, opts ...grpc.CallOption) (*OKResp, error) // CancelTokenByDeviceId 取消 Token, 從 Device 視角出發,可以選,登出這個Device 下所有 token ,登出這個Device 下指定token CancelTokenByDeviceId(ctx context.Context, in *DoTokenByDeviceIDReq, opts ...grpc.CallOption) (*OKResp, error) // GetUserTokensByDeviceId 取得目前所對應的 DeviceID 所存在的 Tokens GetUserTokensByDeviceId(ctx context.Context, in *DoTokenByDeviceIDReq, opts ...grpc.CallOption) (*Tokens, error) // GetUserTokensByUid 取得目前所對應的 UID 所存在的 Tokens GetUserTokensByUid(ctx context.Context, in *QueryTokenByUIDReq, opts ...grpc.CallOption) (*Tokens, error) // NewOneTimeToken 建立一次性使用,例如:RefreshToken NewOneTimeToken(ctx context.Context, in *CreateOneTimeTokenReq, opts ...grpc.CallOption) (*CreateOneTimeTokenResp, error) // CancelOneTimeToken 取消一次性使用 CancelOneTimeToken(ctx context.Context, in *CancelOneTimeTokenReq, opts ...grpc.CallOption) (*OKResp, error) } type tokenServiceClient struct { cc grpc.ClientConnInterface } func NewTokenServiceClient(cc grpc.ClientConnInterface) TokenServiceClient { return &tokenServiceClient{cc} } func (c *tokenServiceClient) NewToken(ctx context.Context, in *AuthorizationReq, opts ...grpc.CallOption) (*TokenResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(TokenResp) err := c.cc.Invoke(ctx, TokenService_NewToken_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenReq, opts ...grpc.CallOption) (*RefreshTokenResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RefreshTokenResp) err := c.cc.Invoke(ctx, TokenService_RefreshToken_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) CancelToken(ctx context.Context, in *CancelTokenReq, opts ...grpc.CallOption) (*OKResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(OKResp) err := c.cc.Invoke(ctx, TokenService_CancelToken_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) ValidationToken(ctx context.Context, in *ValidationTokenReq, opts ...grpc.CallOption) (*ValidationTokenResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ValidationTokenResp) err := c.cc.Invoke(ctx, TokenService_ValidationToken_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) CancelTokens(ctx context.Context, in *DoTokenByUIDReq, opts ...grpc.CallOption) (*OKResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(OKResp) err := c.cc.Invoke(ctx, TokenService_CancelTokens_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) CancelTokenByDeviceId(ctx context.Context, in *DoTokenByDeviceIDReq, opts ...grpc.CallOption) (*OKResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(OKResp) err := c.cc.Invoke(ctx, TokenService_CancelTokenByDeviceId_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) GetUserTokensByDeviceId(ctx context.Context, in *DoTokenByDeviceIDReq, opts ...grpc.CallOption) (*Tokens, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Tokens) err := c.cc.Invoke(ctx, TokenService_GetUserTokensByDeviceId_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) GetUserTokensByUid(ctx context.Context, in *QueryTokenByUIDReq, opts ...grpc.CallOption) (*Tokens, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Tokens) err := c.cc.Invoke(ctx, TokenService_GetUserTokensByUid_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) NewOneTimeToken(ctx context.Context, in *CreateOneTimeTokenReq, opts ...grpc.CallOption) (*CreateOneTimeTokenResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CreateOneTimeTokenResp) err := c.cc.Invoke(ctx, TokenService_NewOneTimeToken_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *tokenServiceClient) CancelOneTimeToken(ctx context.Context, in *CancelOneTimeTokenReq, opts ...grpc.CallOption) (*OKResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(OKResp) err := c.cc.Invoke(ctx, TokenService_CancelOneTimeToken_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } // TokenServiceServer is the server API for TokenService service. // All implementations must embed UnimplementedTokenServiceServer // for forward compatibility // // 跟 Token 相關的大小事,這次只回應錯誤,以及結果,不統一規範 // 錯誤碼應該在 Biz GW 在做回應,另外我這邊取名字比較通用, // access_token -> token , refresh_token -> one_time_token type TokenServiceServer interface { // NewToken 建立一個新的 Token,例如:AccessToken NewToken(context.Context, *AuthorizationReq) (*TokenResp, error) // RefreshToken 更新目前的token 以及裡面包含的一次性 Token RefreshToken(context.Context, *RefreshTokenReq) (*RefreshTokenResp, error) // CancelToken 取消 Token,也包含他裡面的 One Time Toke CancelToken(context.Context, *CancelTokenReq) (*OKResp, error) // ValidationToken 驗證這個 Token 有沒有效 ValidationToken(context.Context, *ValidationTokenReq) (*ValidationTokenResp, error) // CancelTokens 取消 Token 從UID 視角,以及 token id 視角出發, UID 登出,底下所有 Device ID 也要登出, Token ID 登出, 所有 UID + Device 都要登出 CancelTokens(context.Context, *DoTokenByUIDReq) (*OKResp, error) // CancelTokenByDeviceId 取消 Token, 從 Device 視角出發,可以選,登出這個Device 下所有 token ,登出這個Device 下指定token CancelTokenByDeviceId(context.Context, *DoTokenByDeviceIDReq) (*OKResp, error) // GetUserTokensByDeviceId 取得目前所對應的 DeviceID 所存在的 Tokens GetUserTokensByDeviceId(context.Context, *DoTokenByDeviceIDReq) (*Tokens, error) // GetUserTokensByUid 取得目前所對應的 UID 所存在的 Tokens GetUserTokensByUid(context.Context, *QueryTokenByUIDReq) (*Tokens, error) // NewOneTimeToken 建立一次性使用,例如:RefreshToken NewOneTimeToken(context.Context, *CreateOneTimeTokenReq) (*CreateOneTimeTokenResp, error) // CancelOneTimeToken 取消一次性使用 CancelOneTimeToken(context.Context, *CancelOneTimeTokenReq) (*OKResp, error) mustEmbedUnimplementedTokenServiceServer() } // UnimplementedTokenServiceServer must be embedded to have forward compatible implementations. type UnimplementedTokenServiceServer struct { } func (UnimplementedTokenServiceServer) NewToken(context.Context, *AuthorizationReq) (*TokenResp, error) { return nil, status.Errorf(codes.Unimplemented, "method NewToken not implemented") } func (UnimplementedTokenServiceServer) RefreshToken(context.Context, *RefreshTokenReq) (*RefreshTokenResp, error) { return nil, status.Errorf(codes.Unimplemented, "method RefreshToken not implemented") } func (UnimplementedTokenServiceServer) CancelToken(context.Context, *CancelTokenReq) (*OKResp, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelToken not implemented") } func (UnimplementedTokenServiceServer) ValidationToken(context.Context, *ValidationTokenReq) (*ValidationTokenResp, error) { return nil, status.Errorf(codes.Unimplemented, "method ValidationToken not implemented") } func (UnimplementedTokenServiceServer) CancelTokens(context.Context, *DoTokenByUIDReq) (*OKResp, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelTokens not implemented") } func (UnimplementedTokenServiceServer) CancelTokenByDeviceId(context.Context, *DoTokenByDeviceIDReq) (*OKResp, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelTokenByDeviceId not implemented") } func (UnimplementedTokenServiceServer) GetUserTokensByDeviceId(context.Context, *DoTokenByDeviceIDReq) (*Tokens, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUserTokensByDeviceId not implemented") } func (UnimplementedTokenServiceServer) GetUserTokensByUid(context.Context, *QueryTokenByUIDReq) (*Tokens, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUserTokensByUid not implemented") } func (UnimplementedTokenServiceServer) NewOneTimeToken(context.Context, *CreateOneTimeTokenReq) (*CreateOneTimeTokenResp, error) { return nil, status.Errorf(codes.Unimplemented, "method NewOneTimeToken not implemented") } func (UnimplementedTokenServiceServer) CancelOneTimeToken(context.Context, *CancelOneTimeTokenReq) (*OKResp, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelOneTimeToken not implemented") } func (UnimplementedTokenServiceServer) mustEmbedUnimplementedTokenServiceServer() {} // UnsafeTokenServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to TokenServiceServer will // result in compilation errors. type UnsafeTokenServiceServer interface { mustEmbedUnimplementedTokenServiceServer() } func RegisterTokenServiceServer(s grpc.ServiceRegistrar, srv TokenServiceServer) { s.RegisterService(&TokenService_ServiceDesc, srv) } func _TokenService_NewToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AuthorizationReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).NewToken(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_NewToken_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).NewToken(ctx, req.(*AuthorizationReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RefreshTokenReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).RefreshToken(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_RefreshToken_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).RefreshToken(ctx, req.(*RefreshTokenReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_CancelToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CancelTokenReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).CancelToken(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_CancelToken_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).CancelToken(ctx, req.(*CancelTokenReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_ValidationToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ValidationTokenReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).ValidationToken(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_ValidationToken_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).ValidationToken(ctx, req.(*ValidationTokenReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_CancelTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DoTokenByUIDReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).CancelTokens(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_CancelTokens_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).CancelTokens(ctx, req.(*DoTokenByUIDReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_CancelTokenByDeviceId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DoTokenByDeviceIDReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).CancelTokenByDeviceId(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_CancelTokenByDeviceId_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).CancelTokenByDeviceId(ctx, req.(*DoTokenByDeviceIDReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_GetUserTokensByDeviceId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DoTokenByDeviceIDReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).GetUserTokensByDeviceId(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_GetUserTokensByDeviceId_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).GetUserTokensByDeviceId(ctx, req.(*DoTokenByDeviceIDReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_GetUserTokensByUid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryTokenByUIDReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).GetUserTokensByUid(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_GetUserTokensByUid_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).GetUserTokensByUid(ctx, req.(*QueryTokenByUIDReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_NewOneTimeToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateOneTimeTokenReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).NewOneTimeToken(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_NewOneTimeToken_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).NewOneTimeToken(ctx, req.(*CreateOneTimeTokenReq)) } return interceptor(ctx, in, info, handler) } func _TokenService_CancelOneTimeToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CancelOneTimeTokenReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TokenServiceServer).CancelOneTimeToken(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: TokenService_CancelOneTimeToken_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TokenServiceServer).CancelOneTimeToken(ctx, req.(*CancelOneTimeTokenReq)) } return interceptor(ctx, in, info, handler) } // TokenService_ServiceDesc is the grpc.ServiceDesc for TokenService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var TokenService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "permission.TokenService", HandlerType: (*TokenServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "NewToken", Handler: _TokenService_NewToken_Handler, }, { MethodName: "RefreshToken", Handler: _TokenService_RefreshToken_Handler, }, { MethodName: "CancelToken", Handler: _TokenService_CancelToken_Handler, }, { MethodName: "ValidationToken", Handler: _TokenService_ValidationToken_Handler, }, { MethodName: "CancelTokens", Handler: _TokenService_CancelTokens_Handler, }, { MethodName: "CancelTokenByDeviceId", Handler: _TokenService_CancelTokenByDeviceId_Handler, }, { MethodName: "GetUserTokensByDeviceId", Handler: _TokenService_GetUserTokensByDeviceId_Handler, }, { MethodName: "GetUserTokensByUid", Handler: _TokenService_GetUserTokensByUid_Handler, }, { MethodName: "NewOneTimeToken", Handler: _TokenService_NewOneTimeToken_Handler, }, { MethodName: "CancelOneTimeToken", Handler: _TokenService_CancelOneTimeToken_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "generate/protobuf/permission.proto", }