public async Task<string> GetDownloadUrl(int expiryTimeInMinutes = 5) { var request = new GetDownloadUrlRequest { FileName = this.FileName, ExpiryInMinutes = expiryTimeInMinutes }; IFileService fileService = ObjectFactory.Build<IFileService>(); var response = await fileService.GetDownloadUrlAsync(request); return response.Url; }
public async Task<GetDownloadUrlResponse> GetDownloadUrlAsync(GetDownloadUrlRequest request) { var bytes = await HttpOperation .WithUrl(Urls.For.GetDownloadUrl(request.FileName, request.ExpiryInMinutes)) .WithAppacitiveSession(request.SessionToken) .WithEnvironment(request.Environment) .WithUserToken(request.UserToken) .GetAsync(); var response = GetDownloadUrlResponse.Parse(bytes); return response; }
/// <summary> /// Returns a limited time validity download url for the file associated with this FileDownload object. /// </summary> /// <param name="expiryTimeInMinutes">The validity interval for the download url (in minutes)."</param> /// <param name="cacheControlMaxAgeInSeconds">The value to be returned in the cache-control header for the file.</param> /// <returns>Download url.</returns> public async Task<string> GetDownloadUrlAsync(int expiryTimeInMinutes = 5, long cacheControlMaxAgeInSeconds = 2592000) { var request = new GetDownloadUrlRequest { FileName = this.FileName, ExpiryInMinutes = expiryTimeInMinutes, CacheControlMaxAge = cacheControlMaxAgeInSeconds }; ApiOptions.Apply(request, this.Options); var response = await request.ExecuteAsync(); return response.Url; }