Exemple #1
0
        /// <summary>
        /// Gets the <typeparamref name="T"/> resources that have changed since
        /// your application's last request.
        /// </summary>
        /// <param name="nextLink">The <see cref="Link"/> that was stored from
        /// your last request.</param>
        public static Task <ChangedResources <T> > GetChangedResourcesAsync <T>(
            this IHalClient client,
            Link nextLink,
            IDictionary <string, string> parameters,
            IDictionary <string, IEnumerable <string> > headers,
            CancellationToken cancellationToken) where T : Resource
        {
            var parametersWithResourceVersionSort
                = new Dictionary <string, string>(parameters ?? new Dictionary <string, string>());

            if (parametersWithResourceVersionSort.ContainsKey("sort"))
            {
                parametersWithResourceVersionSort["sort"] = "resource_version";
            }
            else
            {
                parametersWithResourceVersionSort.Add("sort", "resource_version");
            }

            return(client.GetChangedResourcesInternalAsync <T>(
                       nextLink,
                       parametersWithResourceVersionSort,
                       headers,
                       cancellationToken));
        }
Exemple #2
0
        public static async Task <IReadOnlyList <T> > GetAllPagesAsync <T>(
            this IHalClient client,
            Link link,
            IDictionary <string, string> parameters,
            IDictionary <string, IEnumerable <string> > headers,
            CancellationToken cancellationToken) where T : Resource
        {
            var changedResources = await client.GetChangedResourcesInternalAsync <T>(
                link,
                parameters,
                headers,
                cancellationToken).ConfigureAwait(client);

            return(changedResources.NewOrUpdatedResources);
        }