Пример #1
0
        public async Task <FreshdeskTicket <TCustomFieldObject> > GetAsync <TCustomFieldObject>(ulong id) where TCustomFieldObject : class
        {
            var requestUri = $"{_apiBaseUri}/tickets/{id}";

            using (var response = await _httpClient.GetAsync(requestUri).ConfigureAwait(false))
            {
                return(await GetResponseAsync <FreshdeskTicket <TCustomFieldObject> >(response).ConfigureAwait(false));
            }
        }
Пример #2
0
        public async Task <List <FreshdeskCompany <TCustomFieldObject> > > GetListAsync <TCustomFieldObject>(FreshdeskCompaniesListOptions options = null) where TCustomFieldObject : class
        {
            var query      = GetListQueryString(options);
            var requestUri = $"{_apiBaseUri}/companies{query}";

            using (var response = await _httpClient.GetAsync(requestUri).ConfigureAwait(false))
            {
                return(await GetResponseAsync <List <FreshdeskCompany <TCustomFieldObject> > >(response).ConfigureAwait(false));
            }
        }
Пример #3
0
        public async Task <List <FreshdeskContact <TCustomFieldObject> > > GetListAsync <TCustomFieldObject>(FreshdeskContactListOptions options = null) where TCustomFieldObject : class
        {
            var query      = GetListQueryString(options);
            var requestUri = $"{_apiBaseUri}/contacts{query}";

            using (var response = await _httpClient.GetAsync(requestUri).ConfigureAwait(false))
            {
                var result = await GetResponseAsync <List <FreshdeskContactInternal <TCustomFieldObject> > >(response).ConfigureAwait(false);

                return(result.Select(contact => contact.ToContact()).ToList());
            }
        }