Beispiel #1
0
            public Task <Uri> GetPreviewAsync(uint id, PreviewPlatform?platform, bool retina, CancellationToken cancellationToken)
            {
                var parameters = new Dictionary <string, object> {
                    { "file_id", id }, { "platform", platform }, { "size", retina ? "retina" : "nonretina" }
                };

                return(client.GetDynamicAsync("previews", parameters, cancellationToken)
                       .ContinueWith(t => new Uri(t.Result.Value <string>("url")), TaskContinuationOptions.OnlyOnRanToCompletion));
            }
Beispiel #2
0
 public Task <int> GetRootAsync(CancellationToken cancellationToken)
 {
     return(client.GetDynamicAsync("root", null, cancellationToken)
            .ContinueWith(t => (int)t.Result.Value <int>("id"), TaskContinuationOptions.OnlyOnRanToCompletion));
 }