You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

782 lines
33 KiB

  1. // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
  2. // source: proto/users.proto
  3. /*
  4. Package proto is a reverse proxy.
  5. It translates gRPC into RESTful JSON APIs.
  6. */
  7. package proto
  8. import (
  9. "context"
  10. "io"
  11. "net/http"
  12. "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
  13. "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
  14. "google.golang.org/grpc"
  15. "google.golang.org/grpc/codes"
  16. "google.golang.org/grpc/grpclog"
  17. "google.golang.org/grpc/metadata"
  18. "google.golang.org/grpc/status"
  19. "google.golang.org/protobuf/proto"
  20. )
  21. // Suppress "imported and not used" errors
  22. var _ codes.Code
  23. var _ io.Reader
  24. var _ status.Status
  25. var _ = runtime.String
  26. var _ = utilities.NewDoubleArray
  27. var _ = metadata.Join
  28. var (
  29. filter_Users_Register_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
  30. )
  31. func request_Users_Register_0(ctx context.Context, marshaler runtime.Marshaler, client UsersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  32. var protoReq RegisterRequest
  33. var metadata runtime.ServerMetadata
  34. if err := req.ParseForm(); err != nil {
  35. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  36. }
  37. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_Register_0); err != nil {
  38. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  39. }
  40. msg, err := client.Register(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  41. return msg, metadata, err
  42. }
  43. func local_request_Users_Register_0(ctx context.Context, marshaler runtime.Marshaler, server UsersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  44. var protoReq RegisterRequest
  45. var metadata runtime.ServerMetadata
  46. if err := req.ParseForm(); err != nil {
  47. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  48. }
  49. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_Register_0); err != nil {
  50. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  51. }
  52. msg, err := server.Register(ctx, &protoReq)
  53. return msg, metadata, err
  54. }
  55. var (
  56. filter_Users_Login_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
  57. )
  58. func request_Users_Login_0(ctx context.Context, marshaler runtime.Marshaler, client UsersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  59. var protoReq LoginRequest
  60. var metadata runtime.ServerMetadata
  61. if err := req.ParseForm(); err != nil {
  62. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  63. }
  64. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_Login_0); err != nil {
  65. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  66. }
  67. msg, err := client.Login(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  68. return msg, metadata, err
  69. }
  70. func local_request_Users_Login_0(ctx context.Context, marshaler runtime.Marshaler, server UsersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  71. var protoReq LoginRequest
  72. var metadata runtime.ServerMetadata
  73. if err := req.ParseForm(); err != nil {
  74. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  75. }
  76. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_Login_0); err != nil {
  77. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  78. }
  79. msg, err := server.Login(ctx, &protoReq)
  80. return msg, metadata, err
  81. }
  82. var (
  83. filter_Users_Logout_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
  84. )
  85. func request_Users_Logout_0(ctx context.Context, marshaler runtime.Marshaler, client UsersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  86. var protoReq LogoutRequest
  87. var metadata runtime.ServerMetadata
  88. if err := req.ParseForm(); err != nil {
  89. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  90. }
  91. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_Logout_0); err != nil {
  92. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  93. }
  94. msg, err := client.Logout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  95. return msg, metadata, err
  96. }
  97. func local_request_Users_Logout_0(ctx context.Context, marshaler runtime.Marshaler, server UsersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  98. var protoReq LogoutRequest
  99. var metadata runtime.ServerMetadata
  100. if err := req.ParseForm(); err != nil {
  101. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  102. }
  103. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_Logout_0); err != nil {
  104. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  105. }
  106. msg, err := server.Logout(ctx, &protoReq)
  107. return msg, metadata, err
  108. }
  109. var (
  110. filter_Users_Authorize_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
  111. )
  112. func request_Users_Authorize_0(ctx context.Context, marshaler runtime.Marshaler, client UsersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  113. var protoReq AuthorizeRequest
  114. var metadata runtime.ServerMetadata
  115. if err := req.ParseForm(); err != nil {
  116. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  117. }
  118. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_Authorize_0); err != nil {
  119. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  120. }
  121. msg, err := client.Authorize(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  122. return msg, metadata, err
  123. }
  124. func local_request_Users_Authorize_0(ctx context.Context, marshaler runtime.Marshaler, server UsersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  125. var protoReq AuthorizeRequest
  126. var metadata runtime.ServerMetadata
  127. if err := req.ParseForm(); err != nil {
  128. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  129. }
  130. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_Authorize_0); err != nil {
  131. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  132. }
  133. msg, err := server.Authorize(ctx, &protoReq)
  134. return msg, metadata, err
  135. }
  136. var (
  137. filter_Users_ResetPassword_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
  138. )
  139. func request_Users_ResetPassword_0(ctx context.Context, marshaler runtime.Marshaler, client UsersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  140. var protoReq ResetPasswordRequest
  141. var metadata runtime.ServerMetadata
  142. if err := req.ParseForm(); err != nil {
  143. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  144. }
  145. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_ResetPassword_0); err != nil {
  146. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  147. }
  148. msg, err := client.ResetPassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  149. return msg, metadata, err
  150. }
  151. func local_request_Users_ResetPassword_0(ctx context.Context, marshaler runtime.Marshaler, server UsersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  152. var protoReq ResetPasswordRequest
  153. var metadata runtime.ServerMetadata
  154. if err := req.ParseForm(); err != nil {
  155. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  156. }
  157. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_ResetPassword_0); err != nil {
  158. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  159. }
  160. msg, err := server.ResetPassword(ctx, &protoReq)
  161. return msg, metadata, err
  162. }
  163. var (
  164. filter_Users_ChangePassword_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
  165. )
  166. func request_Users_ChangePassword_0(ctx context.Context, marshaler runtime.Marshaler, client UsersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  167. var protoReq ChangePasswordRequest
  168. var metadata runtime.ServerMetadata
  169. if err := req.ParseForm(); err != nil {
  170. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  171. }
  172. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_ChangePassword_0); err != nil {
  173. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  174. }
  175. msg, err := client.ChangePassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  176. return msg, metadata, err
  177. }
  178. func local_request_Users_ChangePassword_0(ctx context.Context, marshaler runtime.Marshaler, server UsersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  179. var protoReq ChangePasswordRequest
  180. var metadata runtime.ServerMetadata
  181. if err := req.ParseForm(); err != nil {
  182. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  183. }
  184. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_ChangePassword_0); err != nil {
  185. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  186. }
  187. msg, err := server.ChangePassword(ctx, &protoReq)
  188. return msg, metadata, err
  189. }
  190. var (
  191. filter_Users_ListRoles_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
  192. )
  193. func request_Users_ListRoles_0(ctx context.Context, marshaler runtime.Marshaler, client UsersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  194. var protoReq ListRolesRequest
  195. var metadata runtime.ServerMetadata
  196. if err := req.ParseForm(); err != nil {
  197. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  198. }
  199. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_ListRoles_0); err != nil {
  200. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  201. }
  202. msg, err := client.ListRoles(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  203. return msg, metadata, err
  204. }
  205. func local_request_Users_ListRoles_0(ctx context.Context, marshaler runtime.Marshaler, server UsersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  206. var protoReq ListRolesRequest
  207. var metadata runtime.ServerMetadata
  208. if err := req.ParseForm(); err != nil {
  209. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  210. }
  211. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_ListRoles_0); err != nil {
  212. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  213. }
  214. msg, err := server.ListRoles(ctx, &protoReq)
  215. return msg, metadata, err
  216. }
  217. var (
  218. filter_Users_SetRoles_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
  219. )
  220. func request_Users_SetRoles_0(ctx context.Context, marshaler runtime.Marshaler, client UsersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  221. var protoReq SetRolesRequest
  222. var metadata runtime.ServerMetadata
  223. if err := req.ParseForm(); err != nil {
  224. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  225. }
  226. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_SetRoles_0); err != nil {
  227. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  228. }
  229. msg, err := client.SetRoles(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  230. return msg, metadata, err
  231. }
  232. func local_request_Users_SetRoles_0(ctx context.Context, marshaler runtime.Marshaler, server UsersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  233. var protoReq SetRolesRequest
  234. var metadata runtime.ServerMetadata
  235. if err := req.ParseForm(); err != nil {
  236. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  237. }
  238. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Users_SetRoles_0); err != nil {
  239. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  240. }
  241. msg, err := server.SetRoles(ctx, &protoReq)
  242. return msg, metadata, err
  243. }
  244. // RegisterUsersHandlerServer registers the http handlers for service Users to "mux".
  245. // UnaryRPC :call UsersServer directly.
  246. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
  247. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUsersHandlerFromEndpoint instead.
  248. func RegisterUsersHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UsersServer) error {
  249. mux.Handle("POST", pattern_Users_Register_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  250. ctx, cancel := context.WithCancel(req.Context())
  251. defer cancel()
  252. var stream runtime.ServerTransportStream
  253. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  254. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  255. var err error
  256. var annotatedContext context.Context
  257. annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/users.Users/Register", runtime.WithHTTPPathPattern("/register"))
  258. if err != nil {
  259. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  260. return
  261. }
  262. resp, md, err := local_request_Users_Register_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  263. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  264. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  265. if err != nil {
  266. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  267. return
  268. }
  269. forward_Users_Register_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  270. })
  271. mux.Handle("POST", pattern_Users_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  272. ctx, cancel := context.WithCancel(req.Context())
  273. defer cancel()
  274. var stream runtime.ServerTransportStream
  275. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  276. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  277. var err error
  278. var annotatedContext context.Context
  279. annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/users.Users/Login", runtime.WithHTTPPathPattern("/login"))
  280. if err != nil {
  281. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  282. return
  283. }
  284. resp, md, err := local_request_Users_Login_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  285. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  286. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  287. if err != nil {
  288. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  289. return
  290. }
  291. forward_Users_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  292. })
  293. mux.Handle("POST", pattern_Users_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  294. ctx, cancel := context.WithCancel(req.Context())
  295. defer cancel()
  296. var stream runtime.ServerTransportStream
  297. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  298. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  299. var err error
  300. var annotatedContext context.Context
  301. annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/users.Users/Logout", runtime.WithHTTPPathPattern("/logout"))
  302. if err != nil {
  303. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  304. return
  305. }
  306. resp, md, err := local_request_Users_Logout_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  307. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  308. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  309. if err != nil {
  310. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  311. return
  312. }
  313. forward_Users_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  314. })
  315. mux.Handle("POST", pattern_Users_Authorize_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  316. ctx, cancel := context.WithCancel(req.Context())
  317. defer cancel()
  318. var stream runtime.ServerTransportStream
  319. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  320. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  321. var err error
  322. var annotatedContext context.Context
  323. annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/users.Users/Authorize", runtime.WithHTTPPathPattern("/authorize"))
  324. if err != nil {
  325. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  326. return
  327. }
  328. resp, md, err := local_request_Users_Authorize_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  329. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  330. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  331. if err != nil {
  332. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  333. return
  334. }
  335. forward_Users_Authorize_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  336. })
  337. mux.Handle("POST", pattern_Users_ResetPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  338. ctx, cancel := context.WithCancel(req.Context())
  339. defer cancel()
  340. var stream runtime.ServerTransportStream
  341. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  342. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  343. var err error
  344. var annotatedContext context.Context
  345. annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/users.Users/ResetPassword", runtime.WithHTTPPathPattern("/password/forgot"))
  346. if err != nil {
  347. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  348. return
  349. }
  350. resp, md, err := local_request_Users_ResetPassword_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  351. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  352. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  353. if err != nil {
  354. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  355. return
  356. }
  357. forward_Users_ResetPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  358. })
  359. mux.Handle("POST", pattern_Users_ChangePassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  360. ctx, cancel := context.WithCancel(req.Context())
  361. defer cancel()
  362. var stream runtime.ServerTransportStream
  363. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  364. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  365. var err error
  366. var annotatedContext context.Context
  367. annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/users.Users/ChangePassword", runtime.WithHTTPPathPattern("/password/reset"))
  368. if err != nil {
  369. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  370. return
  371. }
  372. resp, md, err := local_request_Users_ChangePassword_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  373. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  374. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  375. if err != nil {
  376. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  377. return
  378. }
  379. forward_Users_ChangePassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  380. })
  381. mux.Handle("POST", pattern_Users_ListRoles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  382. ctx, cancel := context.WithCancel(req.Context())
  383. defer cancel()
  384. var stream runtime.ServerTransportStream
  385. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  386. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  387. var err error
  388. var annotatedContext context.Context
  389. annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/users.Users/ListRoles", runtime.WithHTTPPathPattern("/roles/list"))
  390. if err != nil {
  391. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  392. return
  393. }
  394. resp, md, err := local_request_Users_ListRoles_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  395. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  396. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  397. if err != nil {
  398. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  399. return
  400. }
  401. forward_Users_ListRoles_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  402. })
  403. mux.Handle("POST", pattern_Users_SetRoles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  404. ctx, cancel := context.WithCancel(req.Context())
  405. defer cancel()
  406. var stream runtime.ServerTransportStream
  407. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  408. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  409. var err error
  410. var annotatedContext context.Context
  411. annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/users.Users/SetRoles", runtime.WithHTTPPathPattern("/roles/set"))
  412. if err != nil {
  413. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  414. return
  415. }
  416. resp, md, err := local_request_Users_SetRoles_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  417. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  418. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  419. if err != nil {
  420. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  421. return
  422. }
  423. forward_Users_SetRoles_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  424. })
  425. return nil
  426. }
  427. // RegisterUsersHandlerFromEndpoint is same as RegisterUsersHandler but
  428. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
  429. func RegisterUsersHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
  430. conn, err := grpc.DialContext(ctx, endpoint, opts...)
  431. if err != nil {
  432. return err
  433. }
  434. defer func() {
  435. if err != nil {
  436. if cerr := conn.Close(); cerr != nil {
  437. grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
  438. }
  439. return
  440. }
  441. go func() {
  442. <-ctx.Done()
  443. if cerr := conn.Close(); cerr != nil {
  444. grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
  445. }
  446. }()
  447. }()
  448. return RegisterUsersHandler(ctx, mux, conn)
  449. }
  450. // RegisterUsersHandler registers the http handlers for service Users to "mux".
  451. // The handlers forward requests to the grpc endpoint over "conn".
  452. func RegisterUsersHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
  453. return RegisterUsersHandlerClient(ctx, mux, NewUsersClient(conn))
  454. }
  455. // RegisterUsersHandlerClient registers the http handlers for service Users
  456. // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UsersClient".
  457. // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UsersClient"
  458. // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
  459. // "UsersClient" to call the correct interceptors.
  460. func RegisterUsersHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UsersClient) error {
  461. mux.Handle("POST", pattern_Users_Register_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  462. ctx, cancel := context.WithCancel(req.Context())
  463. defer cancel()
  464. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  465. var err error
  466. var annotatedContext context.Context
  467. annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/users.Users/Register", runtime.WithHTTPPathPattern("/register"))
  468. if err != nil {
  469. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  470. return
  471. }
  472. resp, md, err := request_Users_Register_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  473. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  474. if err != nil {
  475. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  476. return
  477. }
  478. forward_Users_Register_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  479. })
  480. mux.Handle("POST", pattern_Users_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  481. ctx, cancel := context.WithCancel(req.Context())
  482. defer cancel()
  483. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  484. var err error
  485. var annotatedContext context.Context
  486. annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/users.Users/Login", runtime.WithHTTPPathPattern("/login"))
  487. if err != nil {
  488. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  489. return
  490. }
  491. resp, md, err := request_Users_Login_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  492. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  493. if err != nil {
  494. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  495. return
  496. }
  497. forward_Users_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  498. })
  499. mux.Handle("POST", pattern_Users_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  500. ctx, cancel := context.WithCancel(req.Context())
  501. defer cancel()
  502. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  503. var err error
  504. var annotatedContext context.Context
  505. annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/users.Users/Logout", runtime.WithHTTPPathPattern("/logout"))
  506. if err != nil {
  507. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  508. return
  509. }
  510. resp, md, err := request_Users_Logout_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  511. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  512. if err != nil {
  513. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  514. return
  515. }
  516. forward_Users_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  517. })
  518. mux.Handle("POST", pattern_Users_Authorize_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  519. ctx, cancel := context.WithCancel(req.Context())
  520. defer cancel()
  521. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  522. var err error
  523. var annotatedContext context.Context
  524. annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/users.Users/Authorize", runtime.WithHTTPPathPattern("/authorize"))
  525. if err != nil {
  526. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  527. return
  528. }
  529. resp, md, err := request_Users_Authorize_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  530. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  531. if err != nil {
  532. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  533. return
  534. }
  535. forward_Users_Authorize_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  536. })
  537. mux.Handle("POST", pattern_Users_ResetPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  538. ctx, cancel := context.WithCancel(req.Context())
  539. defer cancel()
  540. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  541. var err error
  542. var annotatedContext context.Context
  543. annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/users.Users/ResetPassword", runtime.WithHTTPPathPattern("/password/forgot"))
  544. if err != nil {
  545. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  546. return
  547. }
  548. resp, md, err := request_Users_ResetPassword_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  549. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  550. if err != nil {
  551. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  552. return
  553. }
  554. forward_Users_ResetPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  555. })
  556. mux.Handle("POST", pattern_Users_ChangePassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  557. ctx, cancel := context.WithCancel(req.Context())
  558. defer cancel()
  559. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  560. var err error
  561. var annotatedContext context.Context
  562. annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/users.Users/ChangePassword", runtime.WithHTTPPathPattern("/password/reset"))
  563. if err != nil {
  564. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  565. return
  566. }
  567. resp, md, err := request_Users_ChangePassword_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  568. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  569. if err != nil {
  570. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  571. return
  572. }
  573. forward_Users_ChangePassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  574. })
  575. mux.Handle("POST", pattern_Users_ListRoles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  576. ctx, cancel := context.WithCancel(req.Context())
  577. defer cancel()
  578. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  579. var err error
  580. var annotatedContext context.Context
  581. annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/users.Users/ListRoles", runtime.WithHTTPPathPattern("/roles/list"))
  582. if err != nil {
  583. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  584. return
  585. }
  586. resp, md, err := request_Users_ListRoles_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  587. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  588. if err != nil {
  589. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  590. return
  591. }
  592. forward_Users_ListRoles_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  593. })
  594. mux.Handle("POST", pattern_Users_SetRoles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  595. ctx, cancel := context.WithCancel(req.Context())
  596. defer cancel()
  597. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  598. var err error
  599. var annotatedContext context.Context
  600. annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/users.Users/SetRoles", runtime.WithHTTPPathPattern("/roles/set"))
  601. if err != nil {
  602. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  603. return
  604. }
  605. resp, md, err := request_Users_SetRoles_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  606. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  607. if err != nil {
  608. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  609. return
  610. }
  611. forward_Users_SetRoles_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  612. })
  613. return nil
  614. }
  615. var (
  616. pattern_Users_Register_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"register"}, ""))
  617. pattern_Users_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"login"}, ""))
  618. pattern_Users_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"logout"}, ""))
  619. pattern_Users_Authorize_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"authorize"}, ""))
  620. pattern_Users_ResetPassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"password", "forgot"}, ""))
  621. pattern_Users_ChangePassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"password", "reset"}, ""))
  622. pattern_Users_ListRoles_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"roles", "list"}, ""))
  623. pattern_Users_SetRoles_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"roles", "set"}, ""))
  624. )
  625. var (
  626. forward_Users_Register_0 = runtime.ForwardResponseMessage
  627. forward_Users_Login_0 = runtime.ForwardResponseMessage
  628. forward_Users_Logout_0 = runtime.ForwardResponseMessage
  629. forward_Users_Authorize_0 = runtime.ForwardResponseMessage
  630. forward_Users_ResetPassword_0 = runtime.ForwardResponseMessage
  631. forward_Users_ChangePassword_0 = runtime.ForwardResponseMessage
  632. forward_Users_ListRoles_0 = runtime.ForwardResponseMessage
  633. forward_Users_SetRoles_0 = runtime.ForwardResponseMessage
  634. )