Ejemplo n.º 1
0
        internal static IDictionary <string, string> Setup(IDictionary <string, string> parameters, ApiOptions options)
        {
            parameters = parameters ?? new Dictionary <string, string>();

            if (options.PageSize.HasValue)
            {
                parameters.Add("limit", options.PageSize.Value.ToString(CultureInfo.InvariantCulture));
            }

            if (options.StartPage.HasValue)
            {
                parameters.Add("start", options.StartPage.Value.ToString(CultureInfo.InvariantCulture));
            }

            return(parameters);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets all API resources in the list at the specified URI.
 /// </summary>
 /// <typeparam name="T">Type of the API resource in the list.</typeparam>
 /// <param name="uri">URI of the API resource to get</param>
 /// <param name="parameters">Parameters to add to the API request</param>
 /// <param name="options">Options for changing the API response</param>
 /// <returns><see cref="IReadOnlyList{T}"/> of the The API resources in the list.</returns>
 /// <exception cref="ApiException">Thrown when an API error occurs.</exception>
 public Task <IReadOnlyList <T> > GetAll <T>(Uri uri, IDictionary <string, string> parameters, ApiOptions options)
 {
     return(GetAll <T>(uri, parameters, null, options));
 }
Ejemplo n.º 3
0
        public Task <IReadOnlyList <T> > GetAll <T>(Uri uri, IDictionary <string, string> parameters, string accepts, ApiOptions options)
        {
            Ensure.ArgumentNotNull(uri, nameof(uri));
            Ensure.ArgumentNotNull(options, nameof(options));

            parameters = Pagination.Setup(parameters, options);

            return(_pagination.GetAllPages(async() => await GetPage <T>(uri, parameters, accepts, options).ConfigureAwait(false), uri));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets all API resources in the list at the specified URI.
 /// </summary>
 /// <typeparam name="T">Type of the API resource in the list.</typeparam>
 /// <param name="uri">URI of the API resource to get</param>
 /// <param name="options">Options for changing the API response</param>
 /// <returns><see cref="IReadOnlyList{T}"/> of the The API resources in the list.</returns>
 /// <exception cref="ApiException">Thrown when an API error occurs.</exception>
 public Task <IReadOnlyList <T> > GetAll <T>(Uri uri, ApiOptions options)
 {
     return(GetAll <T>(uri, null, null, options));
 }