Exemplo n.º 1
0
    def createconversation(self, chat_id_list, force_group=False):
        """Create new one-to-one or group conversation.

        chat_id_list is list of other users to invite to the conversation.

        Raises hangups.NetworkError if the request fails.
        """
        is_group = len(chat_id_list) > 1 or force_group
        request = hangouts_pb2.CreateConversationRequest(
            request_header=self._get_request_header_pb(),
            type=(hangouts_pb2.CONVERSATION_TYPE_GROUP if is_group else
                  hangouts_pb2.CONVERSATION_TYPE_ONE_TO_ONE),
            client_generated_id=self.get_client_generated_id(),
            invitee_id=[hangouts_pb2.InviteeID(gaia_id=chat_id)
                        for chat_id in chat_id_list],
        )
        response = hangouts_pb2.CreateConversationResponse()
        yield from self._pb_request('conversations/createconversation',
                                    request, response)
        return response
Exemplo n.º 2
0
 def create_conversation(self, create_conversation_request):
     """Create a new conversation."""
     response = hangouts_pb2.CreateConversationResponse()
     yield from self._pb_request('conversations/createconversation',
                                 create_conversation_request, response)
     return response