示例#1
0
        /// <summary>
        /// Downloads the metadata of a File, without actually downloading the file.
        /// </summary>
        /// <param name="fileId">The _id of the file's metadata to download. </param>
        /// <param name="ct">[optional] The cancellation token.  If cancellation is requested, an OperationCancelledException will be thrown.</param>
        public async Task <FileMetaData> downloadMetadataAsync(string fileId, CancellationToken ct = default(CancellationToken))
        {
            DownloadMetaDataRequest downloadMetadataRequest = buildDownloadMetaDataRequest(fileId);

            ct.ThrowIfCancellationRequested();
            FileMetaData fmd = await downloadMetadataRequest.ExecuteAsync();

            return(fmd);
        }
示例#2
0
        // Build download request for the metadata of a specific file
        private DownloadMetaDataRequest buildDownloadMetaDataRequest(String fileId)
        {
            if (fileId == null)
            {
                throw new KinveyException(EnumErrorCategory.ERROR_FILE, EnumErrorCode.ERROR_FILE_MISSING_FILE_ID, "");
            }

            var urlParameters = new Dictionary <string, string>();

            urlParameters.Add("appKey", ((KinveyClientRequestInitializer)client.RequestInitializer).AppKey);
            urlParameters.Add("fileID", fileId);

            DownloadMetaDataRequest downloadMetaDataRequest = new DownloadMetaDataRequest(urlParameters, this.client);

            client.InitializeRequest(downloadMetaDataRequest);
            downloadMetaDataRequest.customRequestHeaders = this.GetCustomRequestProperties();

            return(downloadMetaDataRequest);
        }