'Capture the a snapshot of a room. If user is currently a member of
the room this will be what is currently in the room. If the user left
the room this will be what was in the room when they left.
Args:
requester(Requester): The user to get a snapshot for.
room_id(str): The room to get a snapshot of.
pagin_config(synapse.streams.config.PaginationConfig):
The pagination config used to determine how many messages to
return.
Raises:
AuthError if the user wasn\'t in the room.
Returns:
A JSON serialisable dict with the snapshot of the room.'

@defer.inlineCallbacks
def room_initial_sync(self, requester, room_id, pagin_config=None):

    user_id = requester.user.to_string()
    (membership, member_event_id) = (yield self._check_in_room_or_world_readable(room_id, user_id))
    is_peeking = (member_event_id is None)
    if (membership == Membership.JOIN):
        result = (yield self._room_initial_sync_joined(user_id, room_id, pagin_config, membership, is_peeking))
    elif (membership == Membership.LEAVE):
        result = (yield self._room_initial_sync_parted(user_id, room_id, pagin_config, membership, member_event_id, is_peeking))
    account_data_events = []
    tags = (yield self.store.get_tags_for_room(user_id, room_id))
    if tags:
        account_data_events.append({'type': 'm.tag', 'content': {'tags': tags}})
    account_data = (yield self.store.get_account_data_for_room(user_id, room_id))
    for (account_data_type, content) in account_data.items():
        account_data_events.append({'type': account_data_type, 'content': content})
    result['account_data'] = account_data_events
    defer.returnValue(result)
