| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- # -*- coding: utf-8 -*-
- # Generated by https://github.com/connectrpc/connect-python. DO NOT EDIT!
- # source: chatto/api/v1/threads.proto
- from collections.abc import AsyncGenerator, AsyncIterator, Iterable, Iterator, Mapping
- from typing import Protocol
- from connectrpc.client import ConnectClient, ConnectClientSync
- from connectrpc.code import Code
- from connectrpc.compression import Compression
- from connectrpc.errors import ConnectError
- from connectrpc.interceptor import Interceptor, InterceptorSync
- from connectrpc.method import IdempotencyLevel, MethodInfo
- from connectrpc.request import Headers, RequestContext
- from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, Endpoint, EndpointSync
- import chatto.api.v1.read_state_pb2 as chatto_dot_api_dot_v1_dot_read__state__pb2
- import chatto.api.v1.room_timeline_pb2 as chatto_dot_api_dot_v1_dot_room__timeline__pb2
- import chatto.api.v1.threads_pb2 as chatto_dot_api_dot_v1_dot_threads__pb2
- class ThreadService(Protocol):
- async def list_followed_threads(self, request: chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- async def follow_thread(self, request: chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- async def unfollow_thread(self, request: chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- async def get_thread_events(self, request: chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- async def get_thread_events_around(self, request: chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- async def mark_thread_as_read(self, request: chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- class ThreadServiceASGIApplication(ConnectASGIApplication[ThreadService]):
- def __init__(self, service: ThreadService | AsyncGenerator[ThreadService], *, interceptors: Iterable[Interceptor]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
- super().__init__(
- service=service,
- endpoints=lambda svc: {
- "/chatto.api.v1.ThreadService/ListFollowedThreads": Endpoint.unary(
- method=MethodInfo(
- name="ListFollowedThreads",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=svc.list_followed_threads,
- ),
- "/chatto.api.v1.ThreadService/FollowThread": Endpoint.unary(
- method=MethodInfo(
- name="FollowThread",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=svc.follow_thread,
- ),
- "/chatto.api.v1.ThreadService/UnfollowThread": Endpoint.unary(
- method=MethodInfo(
- name="UnfollowThread",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=svc.unfollow_thread,
- ),
- "/chatto.api.v1.ThreadService/GetThreadEvents": Endpoint.unary(
- method=MethodInfo(
- name="GetThreadEvents",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsRequest,
- output=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=svc.get_thread_events,
- ),
- "/chatto.api.v1.ThreadService/GetThreadEventsAround": Endpoint.unary(
- method=MethodInfo(
- name="GetThreadEventsAround",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundRequest,
- output=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=svc.get_thread_events_around,
- ),
- "/chatto.api.v1.ThreadService/MarkThreadAsRead": Endpoint.unary(
- method=MethodInfo(
- name="MarkThreadAsRead",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadRequest,
- output=chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=svc.mark_thread_as_read,
- ),
- },
- interceptors=interceptors,
- read_max_bytes=read_max_bytes,
- compressions=compressions,
- )
- @property
- def path(self) -> str:
- """Returns the URL path to mount the application to when serving multiple applications."""
- return "/chatto.api.v1.ThreadService"
- class ThreadServiceClient(ConnectClient):
- async def list_followed_threads(
- self,
- request: chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsResponse:
- return await self.execute_unary(
- request=request,
- method=MethodInfo(
- name="ListFollowedThreads",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- async def follow_thread(
- self,
- request: chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadResponse:
- return await self.execute_unary(
- request=request,
- method=MethodInfo(
- name="FollowThread",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- async def unfollow_thread(
- self,
- request: chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadResponse:
- return await self.execute_unary(
- request=request,
- method=MethodInfo(
- name="UnfollowThread",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- async def get_thread_events(
- self,
- request: chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsResponse:
- return await self.execute_unary(
- request=request,
- method=MethodInfo(
- name="GetThreadEvents",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsRequest,
- output=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- async def get_thread_events_around(
- self,
- request: chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundResponse:
- return await self.execute_unary(
- request=request,
- method=MethodInfo(
- name="GetThreadEventsAround",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundRequest,
- output=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- async def mark_thread_as_read(
- self,
- request: chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadResponse:
- return await self.execute_unary(
- request=request,
- method=MethodInfo(
- name="MarkThreadAsRead",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadRequest,
- output=chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- class ThreadServiceSync(Protocol):
- def list_followed_threads(self, request: chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- def follow_thread(self, request: chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- def unfollow_thread(self, request: chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- def get_thread_events(self, request: chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- def get_thread_events_around(self, request: chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- def mark_thread_as_read(self, request: chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadResponse:
- raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
- class ThreadServiceWSGIApplication(ConnectWSGIApplication):
- def __init__(self, service: ThreadServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
- super().__init__(
- endpoints={
- "/chatto.api.v1.ThreadService/ListFollowedThreads": EndpointSync.unary(
- method=MethodInfo(
- name="ListFollowedThreads",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=service.list_followed_threads,
- ),
- "/chatto.api.v1.ThreadService/FollowThread": EndpointSync.unary(
- method=MethodInfo(
- name="FollowThread",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=service.follow_thread,
- ),
- "/chatto.api.v1.ThreadService/UnfollowThread": EndpointSync.unary(
- method=MethodInfo(
- name="UnfollowThread",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=service.unfollow_thread,
- ),
- "/chatto.api.v1.ThreadService/GetThreadEvents": EndpointSync.unary(
- method=MethodInfo(
- name="GetThreadEvents",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsRequest,
- output=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=service.get_thread_events,
- ),
- "/chatto.api.v1.ThreadService/GetThreadEventsAround": EndpointSync.unary(
- method=MethodInfo(
- name="GetThreadEventsAround",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundRequest,
- output=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=service.get_thread_events_around,
- ),
- "/chatto.api.v1.ThreadService/MarkThreadAsRead": EndpointSync.unary(
- method=MethodInfo(
- name="MarkThreadAsRead",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadRequest,
- output=chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- function=service.mark_thread_as_read,
- ),
- },
- interceptors=interceptors,
- read_max_bytes=read_max_bytes,
- compressions=compressions,
- )
- @property
- def path(self) -> str:
- """Returns the URL path to mount the application to when serving multiple applications."""
- return "/chatto.api.v1.ThreadService"
- class ThreadServiceClientSync(ConnectClientSync):
- def list_followed_threads(
- self,
- request: chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsResponse:
- return self.execute_unary(
- request=request,
- method=MethodInfo(
- name="ListFollowedThreads",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.ListFollowedThreadsResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- def follow_thread(
- self,
- request: chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadResponse:
- return self.execute_unary(
- request=request,
- method=MethodInfo(
- name="FollowThread",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.FollowThreadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- def unfollow_thread(
- self,
- request: chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadResponse:
- return self.execute_unary(
- request=request,
- method=MethodInfo(
- name="UnfollowThread",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadRequest,
- output=chatto_dot_api_dot_v1_dot_threads__pb2.UnfollowThreadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- def get_thread_events(
- self,
- request: chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsResponse:
- return self.execute_unary(
- request=request,
- method=MethodInfo(
- name="GetThreadEvents",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsRequest,
- output=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- def get_thread_events_around(
- self,
- request: chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundResponse:
- return self.execute_unary(
- request=request,
- method=MethodInfo(
- name="GetThreadEventsAround",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundRequest,
- output=chatto_dot_api_dot_v1_dot_room__timeline__pb2.GetThreadEventsAroundResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
- def mark_thread_as_read(
- self,
- request: chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadRequest,
- *,
- headers: Headers | Mapping[str, str] | None = None,
- timeout_ms: int | None = None,
- ) -> chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadResponse:
- return self.execute_unary(
- request=request,
- method=MethodInfo(
- name="MarkThreadAsRead",
- service_name="chatto.api.v1.ThreadService",
- input=chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadRequest,
- output=chatto_dot_api_dot_v1_dot_read__state__pb2.MarkThreadAsReadResponse,
- idempotency_level=IdempotencyLevel.UNKNOWN,
- ),
- headers=headers,
- timeout_ms=timeout_ms,
- )
|