Exemplo n.º 1
0
 /// <inheritdoc />
 public async IAsyncEnumerable <Company> ListAllCompaniesAsync(
     IPaginationConfiguration?pagingConfiguration = null,
     [EnumeratorCancellation] CancellationToken cancellationToken = default)
 {
     await foreach (var company in _freshdeskClient
                    .GetPagedResults <Company>("/api/v2/companies", pagingConfiguration, false, cancellationToken)
                    .ConfigureAwait(false))
     {
         yield return(company);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// List all available categories translated into the required language
        ///
        /// c.f. https://developers.freshdesk.com/api/#solution_category_attributes
        /// </summary>
        ///
        /// <param name="languageCode">
        /// The language code of the language to translate the categories into.
        ///
        /// Defaults to null which means don't translate.
        /// </param>
        ///
        /// <param name="pagingConfiguration"></param>
        /// <param name="cancellationToken"></param>
        ///
        /// <returns>
        /// The full set of categories, this request is paged and iterating to the
        /// next entry may cause a new API call to get the next page.
        /// </returns>
        public async IAsyncEnumerable <Category> ListAllCategoriesAsync(
            string?languageCode = null,
            IPaginationConfiguration?pagingConfiguration = null,
            [EnumeratorCancellation] CancellationToken cancellationToken = default)
        {
            var url = string.IsNullOrWhiteSpace(languageCode)
                ? "/api/v2/solutions/categories"
                : $"/api/v2/solutions/categories/{languageCode}";

            await foreach (var category in _freshdeskClient
                           .GetPagedResults <Category>(url, pagingConfiguration, false, cancellationToken)
                           .ConfigureAwait(false))
            {
                yield return(category);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// List all available products
 ///
 /// c.f. https://developers.freshdesk.com/api/#list_all_products
 /// </summary>
 ///
 /// <param name="pagingConfiguration"></param>
 /// <param name="cancellationToken"></param>
 ///
 /// <returns>
 /// The full set of products, this request is paged and iterating to the
 /// next entry may cause a new API call to get the next page.
 /// </returns>
 public async IAsyncEnumerable <Product> ListAllProductsAsync(
     IPaginationConfiguration?pagingConfiguration = null,
     [EnumeratorCancellation] CancellationToken cancellationToken = default)
 {
     await foreach (var product in _freshdeskClient
                    .GetPagedResults <Product>("/api/v2/products", pagingConfiguration, false, cancellationToken)
                    .ConfigureAwait(false))
     {
         yield return(product);
     }
 }
 /// <summary>
 /// List all available groups
 ///
 /// c.f. https://developers.freshdesk.com/api/#list_all_groups
 /// </summary>
 ///
 /// <param name="pagingConfiguration"></param>
 /// <param name="cancellationToken"></param>
 ///
 /// <returns>
 /// The full set of groups, this request is paged and iterating to the
 /// next entry may cause a new API call to get the next page.
 /// </returns>
 public async IAsyncEnumerable <Group> ListAllGroupsAsync(
     IPaginationConfiguration?pagingConfiguration = null,
     [EnumeratorCancellation] CancellationToken cancellationToken = default)
 {
     await foreach (var group in _freshdeskClient
                    .GetPagedResults <Group>("/api/v2/groups", pagingConfiguration, false, cancellationToken)
                    .ConfigureAwait(false))
     {
         yield return(group);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Filter the list of agents according to a set of predefined filters.
 ///
 /// c.f. https://developers.freshdesk.com/api/#list_all_agents
 /// </summary>
 ///
 /// <param name="request">
 /// A <seealso cref="ListAllAgentsRequest"/> object which contains
 /// the filters that we want to apply. By default will include all
 /// agents.
 /// </param>
 ///
 /// <param name="pagingConfiguration"></param>
 /// <param name="cancellationToken"></param>
 ///
 /// <returns>
 /// The full set of agents matching the filters supplied, this
 /// request is paged and iterating to the next entry may cause a new
 /// API call to get the next page.
 /// </returns>
 public async IAsyncEnumerable <Agent> ListAllAgentsAsync(
     ListAllAgentsRequest request,
     IPaginationConfiguration?pagingConfiguration = null,
     [EnumeratorCancellation] CancellationToken cancellationToken = default)
 {
     await foreach (var agent in _freshdeskClient
                    .GetPagedResults <Agent>(request.UrlWithQueryString, pagingConfiguration, false, cancellationToken)
                    .ConfigureAwait(false))
     {
         yield return(agent);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Filter the list of contacts according to a set of predefined filters.
        ///
        /// c.f. https://developers.freshdesk.com/api/#list_all_contacts
        /// </summary>
        ///
        /// <param name="request">
        /// A <seealso cref="ListAllContactsRequest"/> object which contains
        /// the filters that we want to apply. By default will include all
        /// unblocked/undeleted contacts.
        /// </param>
        ///
        /// <param name="pagingConfiguration"></param>
        /// <param name="cancellationToken"></param>
        ///
        /// <returns>
        /// The full set of contacts matching the filters supplied, this
        /// request is paged and iterating to the next entry may cause a new
        /// API call to get the next page.
        /// </returns>
        public async IAsyncEnumerable <ListContact> ListAllContactsAsync(
            ListAllContactsRequest request,
            IPaginationConfiguration?pagingConfiguration = null,
            [EnumeratorCancellation] CancellationToken cancellationToken = default)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request), "Request must not be null");
            }

            await foreach (var contact in _freshdeskClient
                           .GetPagedResults <ListContact>(request.UrlWithQueryString, pagingConfiguration, false, cancellationToken)
                           .ConfigureAwait(false))
            {
                yield return(contact);
            }
        }