Get file information

 @param room_id [Integer] ID of chat room
 @param file_id [Integer] ID of file
 @param params [Hash] Hash of optional parameter
 @option params [Boolean] :create_download_url (false)
   Create URL for download
973015
def room_file(room_id, file_id, params = {})
      unless (value = params[:create_download_url]).nil?
        params[:create_download_url] = boolean_to_integer(value)
      end
      get("rooms/#{room_id}/files/#{file_id}", params)
    end
879280
async def _download_web_document(cls, web, file, progress_callback):
        
        if not aiohttp:
            raise ValueError(
                'Cannot download web documents without the aiohttp '
                'dependency install it (pip install aiohttp)'
            )

        # TODO Better way to get opened handles of files and auto-close
        in_memory = file is bytes
        if in_memory:
            f = io.BytesIO()
        elif isinstance(file, str):
            kind, possible_names = cls._get_kind_and_names(web.attributes)
            file = cls._get_proper_filename(
                file, kind, utils.get_extension(web),
                possible_names=possible_names
            )
            f = open(file, 'wb')
        else:
            f = file

        try:
            with aiohttp.ClientSession() as session:
                # TODO Use progress_callback; get content length from response
                # https://github.com/telegramdesktop/tdesktop/blob/c7e773dd9aeba94e2be48c032edc9a78bb50234e/Telegram/SourceFiles/ui/images.cpp#L1318-L1319
                async with session.get(web.url) as response:
                    while True:
                        chunk = await response.content.read(128 * 1024)
                        if not chunk:
                            break
                        f.write(chunk)
        finally:
            if isinstance(file, str) or file is bytes:
                f.close()

        return f.getvalue() if in_memory else file
1260827
def file_download
      if !model.edgarj_file?(params[:column])
        flash[:error] = t('edgarj_file.no_assoc')
        return
      end

      file_info_id = user_scoped.find(params[:id]).send(params[:column])
      if file_info_id
        file_info = FileInfo.find(file_info_id)
        if file_info
          send_file(file_info.full_filename, :filename => file_info.filename)
          return
        end
      end
      logger.warn 'invalid file_info'
    end
260348
public function b2_download_file_by_id($download_url, $file_id, $auth_token = NULL)
        {
            $call_url     = $download_url."/b2api/v1/b2_download_file_by_id?fileId=".$file_id;
            $auth_token   = $auth_token; // Obtained from the b2_authorize_account call
            $download_url = $download_url; // Obtained from the b2_authorize_account call
            $file_id      = $file_id; // The ID of the file you wish to download

            // Add headers
            $headers = array(
                "Authorization: {$auth_token}"
            );

            $result = b2_call($call_url, $headers);
            return $result; // Return the result
        }
505143
def get_download(self, id):
        
        assert isinstance(id, (int, long)), id
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/downloads/" + str(id)
        )
        return github.Download.Download(self._requester, headers, data, completed=True)
16022
def create(request):
    
    name = request.POST.get("name")
    if name:
        room, created = ChatRoom.objects.get_or_create(name=name)
        return redirect(room)
    return redirect(rooms)
165531
protected String getUploadSessionForNewFileVersionUrl(final String id) {
        return String.format(Locale.ENGLISH, "%s/files/%s/upload_sessions", getBaseUploadUri(), id);
    }
1319777
async def download_file(self, file_id, dest):
        
        f = await self.getFile(file_id)

        try:
            d = dest if isinstance(dest, io.IOBase) else open(dest, 'wb')

            session, request = api.download((self._token, f['file_path']))

            async with session:
                async with request as r:
                    while 1:
                        chunk = await r.content.read(self._file_chunk_size)
                        if not chunk:
                            break
                        d.write(chunk)
                        d.flush()
        finally:
            if not isinstance(dest, io.IOBase) and 'd' in locals():
                d.close()
1007850
def update_room(self, stream_id, room_definition):
        '''  '''
        req_hook = 'pod/v2/room/' + str(stream_id) + '/update'
        req_args = json.dumps(room_definition)
        status_code, response = self.__rest__.POST_query(req_hook, req_args)
        self.logger.debug('%s: %s' % (status_code, response))
        return status_code, response
367455
def get_chat_from_id(self, chat_id):
        
        chat = self.wapi_functions.getChatById(chat_id)
        if chat:
            return factory_chat(chat, self)

        raise ChatNotFoundError("Chat {0} not found".format(chat_id))
355561
public function room($room_id)
    {
        $url          = $this->url.'chatrooms/'.$room_id;
        $option       = [];
        $access_token = $this->getToken();
        $header []    = 'Authorization: Bearer '.$access_token;

        return Http::postCurl($url, $option, $header, 'GET');
    }
734381
public ChatRoomListResult getBatchChatRoomInfo(long... roomIds) throws APIConnectionException, APIRequestException {
        Preconditions.checkArgument(roomIds != null && roomIds.length > 0, "Room ids should not be null");
        JsonArray array = new JsonArray();
        for (long id : roomIds) {
            array.add(new JsonPrimitive(id));
        }
        ResponseWrapper responseWrapper = _httpClient.sendPost(_baseUrl + mChatRoomPath + "/batch", array.toString());
        return ChatRoomListResult.fromResponse(responseWrapper);
    }
1302708
@RequestMapping(value = "/get.action", method = RequestMethod.GET)
    public ResponseEntity<?> getFile(@RequestParam Integer id) {

        final HttpHeaders responseHeaders = new HttpHeaders();
        Map<String, Object> responseMap = new HashMap<String, Object>();

        try {
            File file = service.findById(id);

            if (file == null) {
                throw new Exception("Could not find the file with id " + id);
            }

            byte[] fileBytes = file.getFile();

            responseHeaders.setContentType(
                MediaType.parseMediaType(file.getFileType()));

            LOG.info("Successfully got the file " + file.getFileName());

            responseMap = ResultSet.success(file);
            return new ResponseEntity<byte[]>(
                fileBytes, responseHeaders, HttpStatus.OK);
        } catch (Exception e) {
            LOG.error("Could not get the file: " + e.getMessage());
            responseMap = ResultSet.error("Could not get the file: " +
                e.getMessage());

            responseHeaders.setContentType(MediaType.APPLICATION_JSON);

            return new ResponseEntity<Map<String, Object>>(
                responseMap, responseHeaders, HttpStatus.OK);
        }
    }
332310
def file_url(self, entity_id, filename, channel=None):
        '''
        '''
        url = '{}/{}/archive/{}'.format(self.url, _get_path(entity_id),
                                        filename)
        return _add_channel(url, channel)
571036
def info(self, file, **kwargs):
        
        self.params.update({
            'file': file,
            })
        if kwargs:
            self.params.update(kwargs)
        return FromUrl('', self._requests)(data=self.params).get()
1337782
def get_message_urls(self, message_id, order="total_clicks desc"):
        
        req_data = [ { "message_id": str(message_id) }, order, None ]
        return self.request("query:Message_Url", req_data)
1048858
async def getFile(self, file_id):
        
        p = _strip(locals())
        return await self._api_request('getFile', _rectify(p))