diagnostics_connect.py 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # -*- coding: utf-8 -*-
  2. # Generated by https://github.com/connectrpc/connect-python. DO NOT EDIT!
  3. # source: chatto/admin/v1/diagnostics.proto
  4. from collections.abc import AsyncGenerator, AsyncIterator, Iterable, Iterator, Mapping
  5. from typing import Protocol
  6. from connectrpc.client import ConnectClient, ConnectClientSync
  7. from connectrpc.code import Code
  8. from connectrpc.compression import Compression
  9. from connectrpc.errors import ConnectError
  10. from connectrpc.interceptor import Interceptor, InterceptorSync
  11. from connectrpc.method import IdempotencyLevel, MethodInfo
  12. from connectrpc.request import Headers, RequestContext
  13. from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, Endpoint, EndpointSync
  14. import chatto.admin.v1.diagnostics_pb2 as chatto_dot_admin_dot_v1_dot_diagnostics__pb2
  15. class AdminDiagnosticsService(Protocol):
  16. async def get_system_info(self, request: chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoRequest, ctx: RequestContext) -> chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoResponse:
  17. raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
  18. class AdminDiagnosticsServiceASGIApplication(ConnectASGIApplication[AdminDiagnosticsService]):
  19. def __init__(self, service: AdminDiagnosticsService | AsyncGenerator[AdminDiagnosticsService], *, interceptors: Iterable[Interceptor]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
  20. super().__init__(
  21. service=service,
  22. endpoints=lambda svc: {
  23. "/chatto.admin.v1.AdminDiagnosticsService/GetSystemInfo": Endpoint.unary(
  24. method=MethodInfo(
  25. name="GetSystemInfo",
  26. service_name="chatto.admin.v1.AdminDiagnosticsService",
  27. input=chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoRequest,
  28. output=chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoResponse,
  29. idempotency_level=IdempotencyLevel.UNKNOWN,
  30. ),
  31. function=svc.get_system_info,
  32. ),
  33. },
  34. interceptors=interceptors,
  35. read_max_bytes=read_max_bytes,
  36. compressions=compressions,
  37. )
  38. @property
  39. def path(self) -> str:
  40. """Returns the URL path to mount the application to when serving multiple applications."""
  41. return "/chatto.admin.v1.AdminDiagnosticsService"
  42. class AdminDiagnosticsServiceClient(ConnectClient):
  43. async def get_system_info(
  44. self,
  45. request: chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoRequest,
  46. *,
  47. headers: Headers | Mapping[str, str] | None = None,
  48. timeout_ms: int | None = None,
  49. ) -> chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoResponse:
  50. return await self.execute_unary(
  51. request=request,
  52. method=MethodInfo(
  53. name="GetSystemInfo",
  54. service_name="chatto.admin.v1.AdminDiagnosticsService",
  55. input=chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoRequest,
  56. output=chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoResponse,
  57. idempotency_level=IdempotencyLevel.UNKNOWN,
  58. ),
  59. headers=headers,
  60. timeout_ms=timeout_ms,
  61. )
  62. class AdminDiagnosticsServiceSync(Protocol):
  63. def get_system_info(self, request: chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoRequest, ctx: RequestContext) -> chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoResponse:
  64. raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
  65. class AdminDiagnosticsServiceWSGIApplication(ConnectWSGIApplication):
  66. def __init__(self, service: AdminDiagnosticsServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
  67. super().__init__(
  68. endpoints={
  69. "/chatto.admin.v1.AdminDiagnosticsService/GetSystemInfo": EndpointSync.unary(
  70. method=MethodInfo(
  71. name="GetSystemInfo",
  72. service_name="chatto.admin.v1.AdminDiagnosticsService",
  73. input=chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoRequest,
  74. output=chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoResponse,
  75. idempotency_level=IdempotencyLevel.UNKNOWN,
  76. ),
  77. function=service.get_system_info,
  78. ),
  79. },
  80. interceptors=interceptors,
  81. read_max_bytes=read_max_bytes,
  82. compressions=compressions,
  83. )
  84. @property
  85. def path(self) -> str:
  86. """Returns the URL path to mount the application to when serving multiple applications."""
  87. return "/chatto.admin.v1.AdminDiagnosticsService"
  88. class AdminDiagnosticsServiceClientSync(ConnectClientSync):
  89. def get_system_info(
  90. self,
  91. request: chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoRequest,
  92. *,
  93. headers: Headers | Mapping[str, str] | None = None,
  94. timeout_ms: int | None = None,
  95. ) -> chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoResponse:
  96. return self.execute_unary(
  97. request=request,
  98. method=MethodInfo(
  99. name="GetSystemInfo",
  100. service_name="chatto.admin.v1.AdminDiagnosticsService",
  101. input=chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoRequest,
  102. output=chatto_dot_admin_dot_v1_dot_diagnostics__pb2.GetSystemInfoResponse,
  103. idempotency_level=IdempotencyLevel.UNKNOWN,
  104. ),
  105. headers=headers,
  106. timeout_ms=timeout_ms,
  107. )