# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: wechaty/puppet.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import AsyncIterable, AsyncIterator, Iterable, Optional, Union, List

import betterproto
import grpclib


class PuppetStub(betterproto.ServiceStub):
    async def start(self) -> "puppet.StartResponse":
        """* Base"""

        request = puppet.StartRequest()

        return await self._unary_unary(
            "/wechaty.Puppet/Start", request, puppet.StartResponse
        )

    async def stop(self) -> "puppet.StopResponse":

        request = puppet.StopRequest()

        return await self._unary_unary(
            "/wechaty.Puppet/Stop", request, puppet.StopResponse
        )

    async def logout(self) -> "puppet.LogoutResponse":

        request = puppet.LogoutRequest()

        return await self._unary_unary(
            "/wechaty.Puppet/Logout", request, puppet.LogoutResponse
        )

    async def ding(self, *, data: str = "") -> "puppet.DingResponse":

        request = puppet.DingRequest()
        request.data = data

        return await self._unary_unary(
            "/wechaty.Puppet/Ding", request, puppet.DingResponse
        )

    async def version(self) -> "puppet.VersionResponse":

        request = puppet.VersionRequest()

        return await self._unary_unary(
            "/wechaty.Puppet/Version", request, puppet.VersionResponse
        )

    async def event(self) -> AsyncIterator["puppet.EventResponse"]:
        """* Event - Server Stream"""

        request = puppet.EventRequest()

        async for response in self._unary_stream(
            "/wechaty.Puppet/Event",
            request,
            puppet.EventResponse,
        ):
            yield response

    async def dirty_payload(
        self, *, type: "PayloadType" = None, id: str = ""
    ) -> "puppet.DirtyPayloadResponse":

        request = puppet.DirtyPayloadRequest()
        request.type = type
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/DirtyPayload", request, puppet.DirtyPayloadResponse
        )

    async def contact_self_qr_code(self) -> "puppet.ContactSelfQrCodeResponse":
        """* Contact Self"""

        request = puppet.ContactSelfQrCodeRequest()

        return await self._unary_unary(
            "/wechaty.Puppet/ContactSelfQRCode",
            request,
            puppet.ContactSelfQrCodeResponse,
        )

    async def contact_self_name(
        self, *, name: str = ""
    ) -> "puppet.ContactSelfNameResponse":

        request = puppet.ContactSelfNameRequest()
        request.name = name

        return await self._unary_unary(
            "/wechaty.Puppet/ContactSelfName", request, puppet.ContactSelfNameResponse
        )

    async def contact_self_signature(
        self, *, signature: str = ""
    ) -> "puppet.ContactSelfSignatureResponse":

        request = puppet.ContactSelfSignatureRequest()
        request.signature = signature

        return await self._unary_unary(
            "/wechaty.Puppet/ContactSelfSignature",
            request,
            puppet.ContactSelfSignatureResponse,
        )

    async def contact_payload(self, *, id: str = "") -> "puppet.ContactPayloadResponse":
        """* Contact"""

        request = puppet.ContactPayloadRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/ContactPayload", request, puppet.ContactPayloadResponse
        )

    async def contact_alias(
        self, *, id: str = "", alias: Optional[str] = None
    ) -> "puppet.ContactAliasResponse":

        request = puppet.ContactAliasRequest()
        request.id = id
        if alias is not None:
            request.alias = alias

        return await self._unary_unary(
            "/wechaty.Puppet/ContactAlias", request, puppet.ContactAliasResponse
        )

    async def contact_avatar(
        self, *, id: str = "", filebox: Optional[str] = None
    ) -> "puppet.ContactAvatarResponse":

        request = puppet.ContactAvatarRequest()
        request.id = id
        if filebox is not None:
            request.filebox = filebox

        return await self._unary_unary(
            "/wechaty.Puppet/ContactAvatar", request, puppet.ContactAvatarResponse
        )

    async def contact_phone(
        self, *, contact_id: str = "", phone_list: Optional[List[str]] = None
    ) -> "puppet.ContactPhoneResponse":
        phone_list = phone_list or []

        request = puppet.ContactPhoneRequest()
        request.contact_id = contact_id
        request.phone_list = phone_list

        return await self._unary_unary(
            "/wechaty.Puppet/ContactPhone", request, puppet.ContactPhoneResponse
        )

    async def contact_corporation_remark(
        self, *, contact_id: str = "", corporation_remark: Optional[str] = None
    ) -> "puppet.ContactCorporationRemarkResponse":

        request = puppet.ContactCorporationRemarkRequest()
        request.contact_id = contact_id
        if corporation_remark is not None:
            request.corporation_remark = corporation_remark

        return await self._unary_unary(
            "/wechaty.Puppet/ContactCorporationRemark",
            request,
            puppet.ContactCorporationRemarkResponse,
        )

    async def contact_description(
        self, *, contact_id: str = "", description: Optional[str] = None
    ) -> "puppet.ContactDescriptionResponse":

        request = puppet.ContactDescriptionRequest()
        request.contact_id = contact_id
        if description is not None:
            request.description = description

        return await self._unary_unary(
            "/wechaty.Puppet/ContactDescription",
            request,
            puppet.ContactDescriptionResponse,
        )

    async def contact_list(self) -> "puppet.ContactListResponse":
        """
        * Huan(202002): consider changing response to a stream in the future
        for better performance
        """

        request = puppet.ContactListRequest()

        return await self._unary_unary(
            "/wechaty.Puppet/ContactList", request, puppet.ContactListResponse
        )

    async def friendship_payload(
        self, *, id: str = "", payload: Optional[str] = None
    ) -> "puppet.FriendshipPayloadResponse":
        """* Friendship"""

        request = puppet.FriendshipPayloadRequest()
        request.id = id
        if payload is not None:
            request.payload = payload

        return await self._unary_unary(
            "/wechaty.Puppet/FriendshipPayload",
            request,
            puppet.FriendshipPayloadResponse,
        )

    async def friendship_search_phone(
        self, *, phone: str = ""
    ) -> "puppet.FriendshipSearchPhoneResponse":

        request = puppet.FriendshipSearchPhoneRequest()
        request.phone = phone

        return await self._unary_unary(
            "/wechaty.Puppet/FriendshipSearchPhone",
            request,
            puppet.FriendshipSearchPhoneResponse,
        )

    async def friendship_search_weixin(
        self, *, weixin: str = ""
    ) -> "puppet.FriendshipSearchWeixinResponse":

        request = puppet.FriendshipSearchWeixinRequest()
        request.weixin = weixin

        return await self._unary_unary(
            "/wechaty.Puppet/FriendshipSearchWeixin",
            request,
            puppet.FriendshipSearchWeixinResponse,
        )

    async def friendship_add(
        self, *, contact_id: str = "", hello: str = ""
    ) -> "puppet.FriendshipAddResponse":

        request = puppet.FriendshipAddRequest()
        request.contact_id = contact_id
        request.hello = hello

        return await self._unary_unary(
            "/wechaty.Puppet/FriendshipAdd", request, puppet.FriendshipAddResponse
        )

    async def friendship_accept(
        self, *, id: str = ""
    ) -> "puppet.FriendshipAcceptResponse":

        request = puppet.FriendshipAcceptRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/FriendshipAccept", request, puppet.FriendshipAcceptResponse
        )

    async def message_file(self, *, id: str = "") -> "puppet.MessageFileResponse":
        """
        * @deprecated: using MessageFileStream to transfer files Huan(202010):
        will be removed (replaced by MessageFileStream) after Dec 31, 2021
        """

        request = puppet.MessageFileRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/MessageFile", request, puppet.MessageFileResponse
        )

    async def message_image(
        self, *, id: str = "", type: "ImageType" = None
    ) -> "puppet.MessageImageResponse":
        """
        * @deprecated: using MessageImageStream to transfer images
        Huan(202010): will be removed (replaced by MessageImageStream) after
        Dec 31, 2021
        """

        request = puppet.MessageImageRequest()
        request.id = id
        request.type = type

        return await self._unary_unary(
            "/wechaty.Puppet/MessageImage", request, puppet.MessageImageResponse
        )

    async def message_send_file(
        self, *, conversation_id: str = "", filebox: str = ""
    ) -> "puppet.MessageSendFileResponse":
        """
        * @deprecated: using MesageSendFileStream to transfer file message to
        server Huan(202010): will be removed (replaced by
        MessageSendFileStream) after Dec 31, 2021
        """

        request = puppet.MessageSendFileRequest()
        request.conversation_id = conversation_id
        request.filebox = filebox

        return await self._unary_unary(
            "/wechaty.Puppet/MessageSendFile", request, puppet.MessageSendFileResponse
        )

    async def message_payload(self, *, id: str = "") -> "puppet.MessagePayloadResponse":

        request = puppet.MessagePayloadRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/MessagePayload", request, puppet.MessagePayloadResponse
        )

    async def message_contact(self, *, id: str = "") -> "puppet.MessageContactResponse":

        request = puppet.MessageContactRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/MessageContact", request, puppet.MessageContactResponse
        )

    async def message_file_stream(
        self, *, id: str = ""
    ) -> AsyncIterator["puppet.MessageFileStreamResponse"]:

        request = puppet.MessageFileStreamRequest()
        request.id = id

        async for response in self._unary_stream(
            "/wechaty.Puppet/MessageFileStream",
            request,
            puppet.MessageFileStreamResponse,
        ):
            yield response

    async def message_image_stream(
        self, *, id: str = "", type: "ImageType" = None
    ) -> AsyncIterator["puppet.MessageImageStreamResponse"]:

        request = puppet.MessageImageStreamRequest()
        request.id = id
        request.type = type

        async for response in self._unary_stream(
            "/wechaty.Puppet/MessageImageStream",
            request,
            puppet.MessageImageStreamResponse,
        ):
            yield response

    async def message_mini_program(
        self, *, id: str = ""
    ) -> "puppet.MessageMiniProgramResponse":

        request = puppet.MessageMiniProgramRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/MessageMiniProgram",
            request,
            puppet.MessageMiniProgramResponse,
        )

    async def message_url(self, *, id: str = "") -> "puppet.MessageUrlResponse":

        request = puppet.MessageUrlRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/MessageUrl", request, puppet.MessageUrlResponse
        )

    async def message_recall(self, *, id: str = "") -> "puppet.MessageRecallResponse":

        request = puppet.MessageRecallRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/MessageRecall", request, puppet.MessageRecallResponse
        )

    async def message_forward(
        self, *, message_id: str = "", conversation_id: str = ""
    ) -> "puppet.MessageForwardResponse":

        request = puppet.MessageForwardRequest()
        request.message_id = message_id
        request.conversation_id = conversation_id

        return await self._unary_unary(
            "/wechaty.Puppet/MessageForward", request, puppet.MessageForwardResponse
        )

    async def message_send_contact(
        self, *, conversation_id: str = "", contact_id: str = ""
    ) -> "puppet.MessageSendContactResponse":

        request = puppet.MessageSendContactRequest()
        request.conversation_id = conversation_id
        request.contact_id = contact_id

        return await self._unary_unary(
            "/wechaty.Puppet/MessageSendContact",
            request,
            puppet.MessageSendContactResponse,
        )

    async def message_send_file_stream(
        self,
        request_iterator: Union[
            AsyncIterable["puppet.MessageSendFileStreamRequest"],
            Iterable["puppet.MessageSendFileStreamRequest"],
        ],
    ) -> "puppet.MessageSendFileStreamResponse":

        return await self._stream_unary(
            "/wechaty.Puppet/MessageSendFileStream",
            request_iterator,
            puppet.MessageSendFileStreamRequest,
            puppet.MessageSendFileStreamResponse,
        )

    async def message_send_text(
        self,
        *,
        conversation_id: str = "",
        text: str = "",
        mentonal_ids: Optional[List[str]] = None,
    ) -> "puppet.MessageSendTextResponse":
        mentonal_ids = mentonal_ids or []

        request = puppet.MessageSendTextRequest()
        request.conversation_id = conversation_id
        request.text = text
        request.mentonal_ids = mentonal_ids

        return await self._unary_unary(
            "/wechaty.Puppet/MessageSendText", request, puppet.MessageSendTextResponse
        )

    async def message_send_mini_program(
        self, *, conversation_id: str = "", mini_program: str = ""
    ) -> "puppet.MessageSendMiniProgramResponse":

        request = puppet.MessageSendMiniProgramRequest()
        request.conversation_id = conversation_id
        request.mini_program = mini_program

        return await self._unary_unary(
            "/wechaty.Puppet/MessageSendMiniProgram",
            request,
            puppet.MessageSendMiniProgramResponse,
        )

    async def message_send_url(
        self, *, conversation_id: str = "", url_link: str = ""
    ) -> "puppet.MessageSendUrlResponse":

        request = puppet.MessageSendUrlRequest()
        request.conversation_id = conversation_id
        request.url_link = url_link

        return await self._unary_unary(
            "/wechaty.Puppet/MessageSendUrl", request, puppet.MessageSendUrlResponse
        )

    async def room_payload(self, *, id: str = "") -> "puppet.RoomPayloadResponse":
        """* Room"""

        request = puppet.RoomPayloadRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/RoomPayload", request, puppet.RoomPayloadResponse
        )

    async def room_list(self) -> "puppet.RoomListResponse":

        request = puppet.RoomListRequest()

        return await self._unary_unary(
            "/wechaty.Puppet/RoomList", request, puppet.RoomListResponse
        )

    async def room_add(
        self, *, id: str = "", contact_id: str = ""
    ) -> "puppet.RoomAddResponse":

        request = puppet.RoomAddRequest()
        request.id = id
        request.contact_id = contact_id

        return await self._unary_unary(
            "/wechaty.Puppet/RoomAdd", request, puppet.RoomAddResponse
        )

    async def room_avatar(self, *, id: str = "") -> "puppet.RoomAvatarResponse":

        request = puppet.RoomAvatarRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/RoomAvatar", request, puppet.RoomAvatarResponse
        )

    async def room_create(
        self, *, contact_ids: Optional[List[str]] = None, topic: str = ""
    ) -> "puppet.RoomCreateResponse":
        contact_ids = contact_ids or []

        request = puppet.RoomCreateRequest()
        request.contact_ids = contact_ids
        request.topic = topic

        return await self._unary_unary(
            "/wechaty.Puppet/RoomCreate", request, puppet.RoomCreateResponse
        )

    async def room_del(
        self, *, id: str = "", contact_id: str = ""
    ) -> "puppet.RoomDelResponse":

        request = puppet.RoomDelRequest()
        request.id = id
        request.contact_id = contact_id

        return await self._unary_unary(
            "/wechaty.Puppet/RoomDel", request, puppet.RoomDelResponse
        )

    async def room_quit(self, *, id: str = "") -> "puppet.RoomQuitResponse":

        request = puppet.RoomQuitRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/RoomQuit", request, puppet.RoomQuitResponse
        )

    async def room_topic(
        self, *, id: str = "", topic: Optional[str] = None
    ) -> "puppet.RoomTopicResponse":

        request = puppet.RoomTopicRequest()
        request.id = id
        if topic is not None:
            request.topic = topic

        return await self._unary_unary(
            "/wechaty.Puppet/RoomTopic", request, puppet.RoomTopicResponse
        )

    async def room_qr_code(self) -> "puppet.RoomQrCodeResponse":

        request = puppet.RoomQrCodeRequest()

        return await self._unary_unary(
            "/wechaty.Puppet/RoomQRCode", request, puppet.RoomQrCodeResponse
        )

    async def room_announce(
        self, *, id: str = "", text: Optional[str] = None
    ) -> "puppet.RoomAnnounceResponse":

        request = puppet.RoomAnnounceRequest()
        request.id = id
        if text is not None:
            request.text = text

        return await self._unary_unary(
            "/wechaty.Puppet/RoomAnnounce", request, puppet.RoomAnnounceResponse
        )

    async def room_member_payload(
        self, *, id: str = "", member_id: str = ""
    ) -> "puppet.RoomMemberPayloadResponse":
        """* Room Member"""

        request = puppet.RoomMemberPayloadRequest()
        request.id = id
        request.member_id = member_id

        return await self._unary_unary(
            "/wechaty.Puppet/RoomMemberPayload",
            request,
            puppet.RoomMemberPayloadResponse,
        )

    async def room_member_list(
        self, *, id: str = ""
    ) -> "puppet.RoomMemberListResponse":

        request = puppet.RoomMemberListRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/RoomMemberList", request, puppet.RoomMemberListResponse
        )

    async def room_invitation_payload(
        self, *, id: str = "", payload: Optional[str] = None
    ) -> "puppet.RoomInvitationPayloadResponse":
        """* Room Invitation"""

        request = puppet.RoomInvitationPayloadRequest()
        request.id = id
        if payload is not None:
            request.payload = payload

        return await self._unary_unary(
            "/wechaty.Puppet/RoomInvitationPayload",
            request,
            puppet.RoomInvitationPayloadResponse,
        )

    async def room_invitation_accept(
        self, *, id: str = ""
    ) -> "puppet.RoomInvitationAcceptResponse":

        request = puppet.RoomInvitationAcceptRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/RoomInvitationAccept",
            request,
            puppet.RoomInvitationAcceptResponse,
        )

    async def tag_contact_add(
        self, *, id: str = "", contact_id: str = ""
    ) -> "puppet.TagContactAddResponse":
        """* Tag"""

        request = puppet.TagContactAddRequest()
        request.id = id
        request.contact_id = contact_id

        return await self._unary_unary(
            "/wechaty.Puppet/TagContactAdd", request, puppet.TagContactAddResponse
        )

    async def tag_contact_remove(
        self, *, id: str = "", contact_id: str = ""
    ) -> "puppet.TagContactRemoveResponse":

        request = puppet.TagContactRemoveRequest()
        request.id = id
        request.contact_id = contact_id

        return await self._unary_unary(
            "/wechaty.Puppet/TagContactRemove", request, puppet.TagContactRemoveResponse
        )

    async def tag_contact_delete(
        self, *, id: str = ""
    ) -> "puppet.TagContactDeleteResponse":
        """
        * Operate Sub-Collections
        https://cloud.google.com/apis/design/design_patterns#list_sub-
        collections
        """

        request = puppet.TagContactDeleteRequest()
        request.id = id

        return await self._unary_unary(
            "/wechaty.Puppet/TagContactDelete", request, puppet.TagContactDeleteResponse
        )

    async def tag_contact_list(
        self, *, contact_id: Optional[str] = None
    ) -> "puppet.TagContactListResponse":

        request = puppet.TagContactListRequest()
        if contact_id is not None:
            request.contact_id = contact_id

        return await self._unary_unary(
            "/wechaty.Puppet/TagContactList", request, puppet.TagContactListResponse
        )


from . import puppet
