示例#1
0
    def delete_conversation(self, delete_conversation_request):
        """Leave a one-to-one conversation.

        One-to-one conversations are "sticky"; they can't actually be deleted.
        This API clears the event history of the specified conversation up to
        ``delete_upper_bound_timestamp``, hiding it if no events remain.
        """
        response = hangouts_pb2.DeleteConversationResponse()
        yield from self._pb_request('conversations/deleteconversation',
                                    delete_conversation_request, response)
        return response
示例#2
0
    def deleteconversation(self, conversation_id):
        """Delete one-to-one conversation.

        One-to-one conversations are "sticky"; they can't actually be deleted.
        This API clears the event history of the specified conversation up to
        delete_upper_bound_timestamp, hiding it if no events remain.

        conversation_id must be a valid conversation ID.

        Raises hangups.NetworkError if the request fails.
        """
        timestamp = parsers.to_timestamp(
            datetime.datetime.now(tz=datetime.timezone.utc)
        )
        request = hangouts_pb2.DeleteConversationRequest(
            request_header=self._get_request_header_pb(),
            conversation_id=hangouts_pb2.ConversationId(id=conversation_id),
            delete_upper_bound_timestamp=timestamp
        )
        response = hangouts_pb2.DeleteConversationResponse()
        yield from self._pb_request('conversations/deleteconversation',
                                    request, response)
        return response