perm_grpc.pb.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. // versions:
  3. // - protoc-gen-go-grpc v1.6.1
  4. // - protoc v7.34.1
  5. // source: pb/perm.proto
  6. package pb
  7. import (
  8. context "context"
  9. grpc "google.golang.org/grpc"
  10. codes "google.golang.org/grpc/codes"
  11. status "google.golang.org/grpc/status"
  12. )
  13. // This is a compile-time assertion to ensure that this generated file
  14. // is compatible with the grpc package it is being compiled against.
  15. // Requires gRPC-Go v1.64.0 or later.
  16. const _ = grpc.SupportPackageIsVersion9
  17. const (
  18. PermService_SyncPermissions_FullMethodName = "/pb.PermService/SyncPermissions"
  19. PermService_Login_FullMethodName = "/pb.PermService/Login"
  20. PermService_RefreshToken_FullMethodName = "/pb.PermService/RefreshToken"
  21. PermService_VerifyToken_FullMethodName = "/pb.PermService/VerifyToken"
  22. PermService_GetUserPerms_FullMethodName = "/pb.PermService/GetUserPerms"
  23. PermService_Logout_FullMethodName = "/pb.PermService/Logout"
  24. )
  25. // PermServiceClient is the client API for PermService service.
  26. //
  27. // 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.
  28. //
  29. // PermService 权限管理系统 gRPC 服务,供接入产品的服务端调用。
  30. type PermServiceClient interface {
  31. // SyncPermissions 同步权限声明。产品服务端通过 appKey/appSecret 认证后批量同步权限定义(新增/更新/禁用不在列表中的权限)。
  32. SyncPermissions(ctx context.Context, in *SyncPermissionsReq, opts ...grpc.CallOption) (*SyncPermissionsResp, error)
  33. // Login 产品端登录。产品成员通过用户名密码 + productCode 登录,返回 JWT 令牌对及用户权限信息。
  34. Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error)
  35. // RefreshToken 刷新令牌。使用有效的 refreshToken 换取新的令牌对,旧令牌即时失效(单会话轮转)。
  36. RefreshToken(ctx context.Context, in *RefreshTokenReq, opts ...grpc.CallOption) (*RefreshTokenResp, error)
  37. // VerifyToken 验证令牌。校验 accessToken 的有效性(签名、过期、用户状态、产品状态、成员资格、tokenVersion),返回用户权限信息。
  38. VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error)
  39. // GetUserPerms 查询用户权限。产品服务端通过 appKey/appSecret 认证后查询指定用户在该产品下的成员类型和权限列表。
  40. GetUserPerms(ctx context.Context, in *GetUserPermsReq, opts ...grpc.CallOption) (*GetUserPermsResp, error)
  41. // Logout 用户登出。使当前 accessToken 对应用户的所有令牌立即失效(递增 tokenVersion)。
  42. Logout(ctx context.Context, in *LogoutReq, opts ...grpc.CallOption) (*LogoutResp, error)
  43. }
  44. type permServiceClient struct {
  45. cc grpc.ClientConnInterface
  46. }
  47. func NewPermServiceClient(cc grpc.ClientConnInterface) PermServiceClient {
  48. return &permServiceClient{cc}
  49. }
  50. func (c *permServiceClient) SyncPermissions(ctx context.Context, in *SyncPermissionsReq, opts ...grpc.CallOption) (*SyncPermissionsResp, error) {
  51. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  52. out := new(SyncPermissionsResp)
  53. err := c.cc.Invoke(ctx, PermService_SyncPermissions_FullMethodName, in, out, cOpts...)
  54. if err != nil {
  55. return nil, err
  56. }
  57. return out, nil
  58. }
  59. func (c *permServiceClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
  60. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  61. out := new(LoginResp)
  62. err := c.cc.Invoke(ctx, PermService_Login_FullMethodName, in, out, cOpts...)
  63. if err != nil {
  64. return nil, err
  65. }
  66. return out, nil
  67. }
  68. func (c *permServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenReq, opts ...grpc.CallOption) (*RefreshTokenResp, error) {
  69. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  70. out := new(RefreshTokenResp)
  71. err := c.cc.Invoke(ctx, PermService_RefreshToken_FullMethodName, in, out, cOpts...)
  72. if err != nil {
  73. return nil, err
  74. }
  75. return out, nil
  76. }
  77. func (c *permServiceClient) VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) {
  78. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  79. out := new(VerifyTokenResp)
  80. err := c.cc.Invoke(ctx, PermService_VerifyToken_FullMethodName, in, out, cOpts...)
  81. if err != nil {
  82. return nil, err
  83. }
  84. return out, nil
  85. }
  86. func (c *permServiceClient) GetUserPerms(ctx context.Context, in *GetUserPermsReq, opts ...grpc.CallOption) (*GetUserPermsResp, error) {
  87. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  88. out := new(GetUserPermsResp)
  89. err := c.cc.Invoke(ctx, PermService_GetUserPerms_FullMethodName, in, out, cOpts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. return out, nil
  94. }
  95. func (c *permServiceClient) Logout(ctx context.Context, in *LogoutReq, opts ...grpc.CallOption) (*LogoutResp, error) {
  96. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  97. out := new(LogoutResp)
  98. err := c.cc.Invoke(ctx, PermService_Logout_FullMethodName, in, out, cOpts...)
  99. if err != nil {
  100. return nil, err
  101. }
  102. return out, nil
  103. }
  104. // PermServiceServer is the server API for PermService service.
  105. // All implementations must embed UnimplementedPermServiceServer
  106. // for forward compatibility.
  107. //
  108. // PermService 权限管理系统 gRPC 服务,供接入产品的服务端调用。
  109. type PermServiceServer interface {
  110. // SyncPermissions 同步权限声明。产品服务端通过 appKey/appSecret 认证后批量同步权限定义(新增/更新/禁用不在列表中的权限)。
  111. SyncPermissions(context.Context, *SyncPermissionsReq) (*SyncPermissionsResp, error)
  112. // Login 产品端登录。产品成员通过用户名密码 + productCode 登录,返回 JWT 令牌对及用户权限信息。
  113. Login(context.Context, *LoginReq) (*LoginResp, error)
  114. // RefreshToken 刷新令牌。使用有效的 refreshToken 换取新的令牌对,旧令牌即时失效(单会话轮转)。
  115. RefreshToken(context.Context, *RefreshTokenReq) (*RefreshTokenResp, error)
  116. // VerifyToken 验证令牌。校验 accessToken 的有效性(签名、过期、用户状态、产品状态、成员资格、tokenVersion),返回用户权限信息。
  117. VerifyToken(context.Context, *VerifyTokenReq) (*VerifyTokenResp, error)
  118. // GetUserPerms 查询用户权限。产品服务端通过 appKey/appSecret 认证后查询指定用户在该产品下的成员类型和权限列表。
  119. GetUserPerms(context.Context, *GetUserPermsReq) (*GetUserPermsResp, error)
  120. // Logout 用户登出。使当前 accessToken 对应用户的所有令牌立即失效(递增 tokenVersion)。
  121. Logout(context.Context, *LogoutReq) (*LogoutResp, error)
  122. mustEmbedUnimplementedPermServiceServer()
  123. }
  124. // UnimplementedPermServiceServer must be embedded to have
  125. // forward compatible implementations.
  126. //
  127. // NOTE: this should be embedded by value instead of pointer to avoid a nil
  128. // pointer dereference when methods are called.
  129. type UnimplementedPermServiceServer struct{}
  130. func (UnimplementedPermServiceServer) SyncPermissions(context.Context, *SyncPermissionsReq) (*SyncPermissionsResp, error) {
  131. return nil, status.Error(codes.Unimplemented, "method SyncPermissions not implemented")
  132. }
  133. func (UnimplementedPermServiceServer) Login(context.Context, *LoginReq) (*LoginResp, error) {
  134. return nil, status.Error(codes.Unimplemented, "method Login not implemented")
  135. }
  136. func (UnimplementedPermServiceServer) RefreshToken(context.Context, *RefreshTokenReq) (*RefreshTokenResp, error) {
  137. return nil, status.Error(codes.Unimplemented, "method RefreshToken not implemented")
  138. }
  139. func (UnimplementedPermServiceServer) VerifyToken(context.Context, *VerifyTokenReq) (*VerifyTokenResp, error) {
  140. return nil, status.Error(codes.Unimplemented, "method VerifyToken not implemented")
  141. }
  142. func (UnimplementedPermServiceServer) GetUserPerms(context.Context, *GetUserPermsReq) (*GetUserPermsResp, error) {
  143. return nil, status.Error(codes.Unimplemented, "method GetUserPerms not implemented")
  144. }
  145. func (UnimplementedPermServiceServer) Logout(context.Context, *LogoutReq) (*LogoutResp, error) {
  146. return nil, status.Error(codes.Unimplemented, "method Logout not implemented")
  147. }
  148. func (UnimplementedPermServiceServer) mustEmbedUnimplementedPermServiceServer() {}
  149. func (UnimplementedPermServiceServer) testEmbeddedByValue() {}
  150. // UnsafePermServiceServer may be embedded to opt out of forward compatibility for this service.
  151. // Use of this interface is not recommended, as added methods to PermServiceServer will
  152. // result in compilation errors.
  153. type UnsafePermServiceServer interface {
  154. mustEmbedUnimplementedPermServiceServer()
  155. }
  156. func RegisterPermServiceServer(s grpc.ServiceRegistrar, srv PermServiceServer) {
  157. // If the following call panics, it indicates UnimplementedPermServiceServer was
  158. // embedded by pointer and is nil. This will cause panics if an
  159. // unimplemented method is ever invoked, so we test this at initialization
  160. // time to prevent it from happening at runtime later due to I/O.
  161. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
  162. t.testEmbeddedByValue()
  163. }
  164. s.RegisterService(&PermService_ServiceDesc, srv)
  165. }
  166. func _PermService_SyncPermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  167. in := new(SyncPermissionsReq)
  168. if err := dec(in); err != nil {
  169. return nil, err
  170. }
  171. if interceptor == nil {
  172. return srv.(PermServiceServer).SyncPermissions(ctx, in)
  173. }
  174. info := &grpc.UnaryServerInfo{
  175. Server: srv,
  176. FullMethod: PermService_SyncPermissions_FullMethodName,
  177. }
  178. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  179. return srv.(PermServiceServer).SyncPermissions(ctx, req.(*SyncPermissionsReq))
  180. }
  181. return interceptor(ctx, in, info, handler)
  182. }
  183. func _PermService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  184. in := new(LoginReq)
  185. if err := dec(in); err != nil {
  186. return nil, err
  187. }
  188. if interceptor == nil {
  189. return srv.(PermServiceServer).Login(ctx, in)
  190. }
  191. info := &grpc.UnaryServerInfo{
  192. Server: srv,
  193. FullMethod: PermService_Login_FullMethodName,
  194. }
  195. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  196. return srv.(PermServiceServer).Login(ctx, req.(*LoginReq))
  197. }
  198. return interceptor(ctx, in, info, handler)
  199. }
  200. func _PermService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  201. in := new(RefreshTokenReq)
  202. if err := dec(in); err != nil {
  203. return nil, err
  204. }
  205. if interceptor == nil {
  206. return srv.(PermServiceServer).RefreshToken(ctx, in)
  207. }
  208. info := &grpc.UnaryServerInfo{
  209. Server: srv,
  210. FullMethod: PermService_RefreshToken_FullMethodName,
  211. }
  212. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  213. return srv.(PermServiceServer).RefreshToken(ctx, req.(*RefreshTokenReq))
  214. }
  215. return interceptor(ctx, in, info, handler)
  216. }
  217. func _PermService_VerifyToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  218. in := new(VerifyTokenReq)
  219. if err := dec(in); err != nil {
  220. return nil, err
  221. }
  222. if interceptor == nil {
  223. return srv.(PermServiceServer).VerifyToken(ctx, in)
  224. }
  225. info := &grpc.UnaryServerInfo{
  226. Server: srv,
  227. FullMethod: PermService_VerifyToken_FullMethodName,
  228. }
  229. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  230. return srv.(PermServiceServer).VerifyToken(ctx, req.(*VerifyTokenReq))
  231. }
  232. return interceptor(ctx, in, info, handler)
  233. }
  234. func _PermService_GetUserPerms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  235. in := new(GetUserPermsReq)
  236. if err := dec(in); err != nil {
  237. return nil, err
  238. }
  239. if interceptor == nil {
  240. return srv.(PermServiceServer).GetUserPerms(ctx, in)
  241. }
  242. info := &grpc.UnaryServerInfo{
  243. Server: srv,
  244. FullMethod: PermService_GetUserPerms_FullMethodName,
  245. }
  246. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  247. return srv.(PermServiceServer).GetUserPerms(ctx, req.(*GetUserPermsReq))
  248. }
  249. return interceptor(ctx, in, info, handler)
  250. }
  251. func _PermService_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  252. in := new(LogoutReq)
  253. if err := dec(in); err != nil {
  254. return nil, err
  255. }
  256. if interceptor == nil {
  257. return srv.(PermServiceServer).Logout(ctx, in)
  258. }
  259. info := &grpc.UnaryServerInfo{
  260. Server: srv,
  261. FullMethod: PermService_Logout_FullMethodName,
  262. }
  263. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  264. return srv.(PermServiceServer).Logout(ctx, req.(*LogoutReq))
  265. }
  266. return interceptor(ctx, in, info, handler)
  267. }
  268. // PermService_ServiceDesc is the grpc.ServiceDesc for PermService service.
  269. // It's only intended for direct use with grpc.RegisterService,
  270. // and not to be introspected or modified (even as a copy)
  271. var PermService_ServiceDesc = grpc.ServiceDesc{
  272. ServiceName: "pb.PermService",
  273. HandlerType: (*PermServiceServer)(nil),
  274. Methods: []grpc.MethodDesc{
  275. {
  276. MethodName: "SyncPermissions",
  277. Handler: _PermService_SyncPermissions_Handler,
  278. },
  279. {
  280. MethodName: "Login",
  281. Handler: _PermService_Login_Handler,
  282. },
  283. {
  284. MethodName: "RefreshToken",
  285. Handler: _PermService_RefreshToken_Handler,
  286. },
  287. {
  288. MethodName: "VerifyToken",
  289. Handler: _PermService_VerifyToken_Handler,
  290. },
  291. {
  292. MethodName: "GetUserPerms",
  293. Handler: _PermService_GetUserPerms_Handler,
  294. },
  295. {
  296. MethodName: "Logout",
  297. Handler: _PermService_Logout_Handler,
  298. },
  299. },
  300. Streams: []grpc.StreamDesc{},
  301. Metadata: "pb/perm.proto",
  302. }