/// <summary>
 /// View all tickets applying the required filters.
 ///
 /// Note that this is a terrible API with a limit of 300 pages (and
 /// further pages take exponentially longer to return!
 ///
 /// c.f. https://developers.freshdesk.com/api/#list_all_tickets
 /// </summary>
 ///
 /// <param name="listAllTicketsRequest">
 /// A request object with required filters filled in.
 /// </param>
 ///
 /// <param name="cancellationToken"></param>
 ///
 /// <returns>
 /// A list of matching tickets as an <seealso cref="IAsyncEnumerable{Ticket}"/>,
 /// therefore if there are multiple pages of results iterating to the next item
 /// may cause an API call.
 /// </returns>
 public async IAsyncEnumerable <Ticket> ListAllTicketsAsync(
     ListAllTicketsRequest listAllTicketsRequest,
     [EnumeratorCancellation] CancellationToken cancellationToken = default)
 {
     await foreach (var ticket in _freshdeskClient.GetPagedResults <Ticket>(listAllTicketsRequest.UrlWithQueryString, false, cancellationToken).ConfigureAwait(false))
     {
         yield return(ticket);
     }
 }
Esempio n. 2
0
        public void TestBlankQueryStringGeneration()
        {
            var listAllTicketsRequest = new ListAllTicketsRequest();

            Assert.Equal("/api/v2/tickets", listAllTicketsRequest.UrlWithQueryString);
        }