public async Task <CustomerRequestResult> GetCustomerRequestByIdOrKeyAsync(string issueIdOrKey, Expand?expand = null)
 {
     return(await GetRequestUrl(issueIdOrKey)
            .SetQueryParam("expand", ExpandConverter.NullableValueToString(expand))
            .GetJsonAsync <CustomerRequestResult>()
            .ConfigureAwait(false));
 }
        public async Task <IEnumerable <CustomerRequestResult> > GetCustomerRequestsAsync(string searchTerm = null,
                                                                                          RequestOwnership?requestOwnership = null,
                                                                                          RequestStatus?requestStatus       = null,
                                                                                          int?serviceDeskId = null,
                                                                                          int?requestTypeId = null,
                                                                                          Expand?expand     = null,
                                                                                          int?maxPages      = null,
                                                                                          int?limit         = null,
                                                                                          int?start         = null)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                ["searchTerm"]       = searchTerm,
                ["requestOwnership"] = RequestOwnershipConverter.NullableValueToString(requestOwnership),
                ["requestStatus"]    = RequestStatusConverter.NullableValueToString(requestStatus),
                ["serviceDeskId"]    = serviceDeskId,
                ["requestTypeId"]    = requestTypeId,
                ["expand"]           = ExpandConverter.NullableValueToString(expand),
                ["limit"]            = limit,
                ["start"]            = start
            };

            return(await GetPagedResultsAsync(maxPages, queryParamValues, async qpv =>
                                              await GetRequestUrl()
                                              .SetQueryParams(qpv)
                                              .GetJsonAsync <PagedResults <CustomerRequestResult> >()
                                              .ConfigureAwait(false))
                   .ConfigureAwait(false));
        }