auth_service_grpc.pb.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. // versions:
  3. // - protoc-gen-go-grpc v1.5.1
  4. // - protoc (unknown)
  5. // source: api/v1/auth_service.proto
  6. package apiv1
  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. emptypb "google.golang.org/protobuf/types/known/emptypb"
  13. )
  14. // This is a compile-time assertion to ensure that this generated file
  15. // is compatible with the grpc package it is being compiled against.
  16. // Requires gRPC-Go v1.64.0 or later.
  17. const _ = grpc.SupportPackageIsVersion9
  18. const (
  19. AuthService_GetAuthStatus_FullMethodName = "/memos.api.v1.AuthService/GetAuthStatus"
  20. AuthService_SignIn_FullMethodName = "/memos.api.v1.AuthService/SignIn"
  21. AuthService_SignInWithSSO_FullMethodName = "/memos.api.v1.AuthService/SignInWithSSO"
  22. AuthService_SignUp_FullMethodName = "/memos.api.v1.AuthService/SignUp"
  23. AuthService_SignOut_FullMethodName = "/memos.api.v1.AuthService/SignOut"
  24. )
  25. // AuthServiceClient is the client API for AuthService 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. type AuthServiceClient interface {
  29. // GetAuthStatus returns the current auth status of the user.
  30. GetAuthStatus(ctx context.Context, in *GetAuthStatusRequest, opts ...grpc.CallOption) (*User, error)
  31. // SignIn signs in the user with the given username and password.
  32. SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*User, error)
  33. // SignInWithSSO signs in the user with the given SSO code.
  34. SignInWithSSO(ctx context.Context, in *SignInWithSSORequest, opts ...grpc.CallOption) (*User, error)
  35. // SignUp signs up the user with the given username and password.
  36. SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*User, error)
  37. // SignOut signs out the user.
  38. SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
  39. }
  40. type authServiceClient struct {
  41. cc grpc.ClientConnInterface
  42. }
  43. func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
  44. return &authServiceClient{cc}
  45. }
  46. func (c *authServiceClient) GetAuthStatus(ctx context.Context, in *GetAuthStatusRequest, opts ...grpc.CallOption) (*User, error) {
  47. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  48. out := new(User)
  49. err := c.cc.Invoke(ctx, AuthService_GetAuthStatus_FullMethodName, in, out, cOpts...)
  50. if err != nil {
  51. return nil, err
  52. }
  53. return out, nil
  54. }
  55. func (c *authServiceClient) SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*User, error) {
  56. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  57. out := new(User)
  58. err := c.cc.Invoke(ctx, AuthService_SignIn_FullMethodName, in, out, cOpts...)
  59. if err != nil {
  60. return nil, err
  61. }
  62. return out, nil
  63. }
  64. func (c *authServiceClient) SignInWithSSO(ctx context.Context, in *SignInWithSSORequest, opts ...grpc.CallOption) (*User, error) {
  65. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  66. out := new(User)
  67. err := c.cc.Invoke(ctx, AuthService_SignInWithSSO_FullMethodName, in, out, cOpts...)
  68. if err != nil {
  69. return nil, err
  70. }
  71. return out, nil
  72. }
  73. func (c *authServiceClient) SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*User, error) {
  74. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  75. out := new(User)
  76. err := c.cc.Invoke(ctx, AuthService_SignUp_FullMethodName, in, out, cOpts...)
  77. if err != nil {
  78. return nil, err
  79. }
  80. return out, nil
  81. }
  82. func (c *authServiceClient) SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
  83. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  84. out := new(emptypb.Empty)
  85. err := c.cc.Invoke(ctx, AuthService_SignOut_FullMethodName, in, out, cOpts...)
  86. if err != nil {
  87. return nil, err
  88. }
  89. return out, nil
  90. }
  91. // AuthServiceServer is the server API for AuthService service.
  92. // All implementations must embed UnimplementedAuthServiceServer
  93. // for forward compatibility.
  94. type AuthServiceServer interface {
  95. // GetAuthStatus returns the current auth status of the user.
  96. GetAuthStatus(context.Context, *GetAuthStatusRequest) (*User, error)
  97. // SignIn signs in the user with the given username and password.
  98. SignIn(context.Context, *SignInRequest) (*User, error)
  99. // SignInWithSSO signs in the user with the given SSO code.
  100. SignInWithSSO(context.Context, *SignInWithSSORequest) (*User, error)
  101. // SignUp signs up the user with the given username and password.
  102. SignUp(context.Context, *SignUpRequest) (*User, error)
  103. // SignOut signs out the user.
  104. SignOut(context.Context, *SignOutRequest) (*emptypb.Empty, error)
  105. mustEmbedUnimplementedAuthServiceServer()
  106. }
  107. // UnimplementedAuthServiceServer must be embedded to have
  108. // forward compatible implementations.
  109. //
  110. // NOTE: this should be embedded by value instead of pointer to avoid a nil
  111. // pointer dereference when methods are called.
  112. type UnimplementedAuthServiceServer struct{}
  113. func (UnimplementedAuthServiceServer) GetAuthStatus(context.Context, *GetAuthStatusRequest) (*User, error) {
  114. return nil, status.Errorf(codes.Unimplemented, "method GetAuthStatus not implemented")
  115. }
  116. func (UnimplementedAuthServiceServer) SignIn(context.Context, *SignInRequest) (*User, error) {
  117. return nil, status.Errorf(codes.Unimplemented, "method SignIn not implemented")
  118. }
  119. func (UnimplementedAuthServiceServer) SignInWithSSO(context.Context, *SignInWithSSORequest) (*User, error) {
  120. return nil, status.Errorf(codes.Unimplemented, "method SignInWithSSO not implemented")
  121. }
  122. func (UnimplementedAuthServiceServer) SignUp(context.Context, *SignUpRequest) (*User, error) {
  123. return nil, status.Errorf(codes.Unimplemented, "method SignUp not implemented")
  124. }
  125. func (UnimplementedAuthServiceServer) SignOut(context.Context, *SignOutRequest) (*emptypb.Empty, error) {
  126. return nil, status.Errorf(codes.Unimplemented, "method SignOut not implemented")
  127. }
  128. func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
  129. func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
  130. // UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service.
  131. // Use of this interface is not recommended, as added methods to AuthServiceServer will
  132. // result in compilation errors.
  133. type UnsafeAuthServiceServer interface {
  134. mustEmbedUnimplementedAuthServiceServer()
  135. }
  136. func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {
  137. // If the following call pancis, it indicates UnimplementedAuthServiceServer was
  138. // embedded by pointer and is nil. This will cause panics if an
  139. // unimplemented method is ever invoked, so we test this at initialization
  140. // time to prevent it from happening at runtime later due to I/O.
  141. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
  142. t.testEmbeddedByValue()
  143. }
  144. s.RegisterService(&AuthService_ServiceDesc, srv)
  145. }
  146. func _AuthService_GetAuthStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  147. in := new(GetAuthStatusRequest)
  148. if err := dec(in); err != nil {
  149. return nil, err
  150. }
  151. if interceptor == nil {
  152. return srv.(AuthServiceServer).GetAuthStatus(ctx, in)
  153. }
  154. info := &grpc.UnaryServerInfo{
  155. Server: srv,
  156. FullMethod: AuthService_GetAuthStatus_FullMethodName,
  157. }
  158. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  159. return srv.(AuthServiceServer).GetAuthStatus(ctx, req.(*GetAuthStatusRequest))
  160. }
  161. return interceptor(ctx, in, info, handler)
  162. }
  163. func _AuthService_SignIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  164. in := new(SignInRequest)
  165. if err := dec(in); err != nil {
  166. return nil, err
  167. }
  168. if interceptor == nil {
  169. return srv.(AuthServiceServer).SignIn(ctx, in)
  170. }
  171. info := &grpc.UnaryServerInfo{
  172. Server: srv,
  173. FullMethod: AuthService_SignIn_FullMethodName,
  174. }
  175. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  176. return srv.(AuthServiceServer).SignIn(ctx, req.(*SignInRequest))
  177. }
  178. return interceptor(ctx, in, info, handler)
  179. }
  180. func _AuthService_SignInWithSSO_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  181. in := new(SignInWithSSORequest)
  182. if err := dec(in); err != nil {
  183. return nil, err
  184. }
  185. if interceptor == nil {
  186. return srv.(AuthServiceServer).SignInWithSSO(ctx, in)
  187. }
  188. info := &grpc.UnaryServerInfo{
  189. Server: srv,
  190. FullMethod: AuthService_SignInWithSSO_FullMethodName,
  191. }
  192. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  193. return srv.(AuthServiceServer).SignInWithSSO(ctx, req.(*SignInWithSSORequest))
  194. }
  195. return interceptor(ctx, in, info, handler)
  196. }
  197. func _AuthService_SignUp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  198. in := new(SignUpRequest)
  199. if err := dec(in); err != nil {
  200. return nil, err
  201. }
  202. if interceptor == nil {
  203. return srv.(AuthServiceServer).SignUp(ctx, in)
  204. }
  205. info := &grpc.UnaryServerInfo{
  206. Server: srv,
  207. FullMethod: AuthService_SignUp_FullMethodName,
  208. }
  209. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  210. return srv.(AuthServiceServer).SignUp(ctx, req.(*SignUpRequest))
  211. }
  212. return interceptor(ctx, in, info, handler)
  213. }
  214. func _AuthService_SignOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  215. in := new(SignOutRequest)
  216. if err := dec(in); err != nil {
  217. return nil, err
  218. }
  219. if interceptor == nil {
  220. return srv.(AuthServiceServer).SignOut(ctx, in)
  221. }
  222. info := &grpc.UnaryServerInfo{
  223. Server: srv,
  224. FullMethod: AuthService_SignOut_FullMethodName,
  225. }
  226. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  227. return srv.(AuthServiceServer).SignOut(ctx, req.(*SignOutRequest))
  228. }
  229. return interceptor(ctx, in, info, handler)
  230. }
  231. // AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
  232. // It's only intended for direct use with grpc.RegisterService,
  233. // and not to be introspected or modified (even as a copy)
  234. var AuthService_ServiceDesc = grpc.ServiceDesc{
  235. ServiceName: "memos.api.v1.AuthService",
  236. HandlerType: (*AuthServiceServer)(nil),
  237. Methods: []grpc.MethodDesc{
  238. {
  239. MethodName: "GetAuthStatus",
  240. Handler: _AuthService_GetAuthStatus_Handler,
  241. },
  242. {
  243. MethodName: "SignIn",
  244. Handler: _AuthService_SignIn_Handler,
  245. },
  246. {
  247. MethodName: "SignInWithSSO",
  248. Handler: _AuthService_SignInWithSSO_Handler,
  249. },
  250. {
  251. MethodName: "SignUp",
  252. Handler: _AuthService_SignUp_Handler,
  253. },
  254. {
  255. MethodName: "SignOut",
  256. Handler: _AuthService_SignOut_Handler,
  257. },
  258. },
  259. Streams: []grpc.StreamDesc{},
  260. Metadata: "api/v1/auth_service.proto",
  261. }