public async Task <GetDomainWhitelistResponse> Get(GetDomainWhitelistRequest request, AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.DomainWhitelist.Get(request)); } }
public async static Task <GetDomainWhitelistResponse> Get(GetAddesssApi api, string path, AdminKey adminKey, GetDomainWhitelistRequest request) { if (api == null) { throw new ArgumentNullException(nameof(api)); } if (path == null) { throw new ArgumentNullException(nameof(path)); } if (adminKey == null) { throw new ArgumentNullException(nameof(adminKey)); } if (request == null) { throw new ArgumentNullException(nameof(request)); } var fullPath = path + request.Id; api.SetAuthorizationKey(adminKey); var response = await api.Get(fullPath); var body = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { var nameAndId = GetDomainWhitelist(body); return(new GetDomainWhitelistResponse.Success((int)response.StatusCode, response.ReasonPhrase, body, nameAndId.Id, nameAndId.Name)); } return(new GetDomainWhitelistResponse.Failed((int)response.StatusCode, response.ReasonPhrase, body)); }
public async Task <GetDomainWhitelistResponse> Get(GetDomainWhitelistRequest request) { return(await Get(Api, Path, AdminKey, request)); }