public async Task<AddIpAddressWhitelistResponse> Add(AddIpAddressWhitelistRequest request, AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return await api.IpAddressWhitelist.Add(request); } }
public async static Task <AddIpAddressWhitelistResponse> Add(GetAddesssApi api, AddIpAddressWhitelistRequest request, string path, AdminKey adminKey) { if (api == null) { throw new ArgumentNullException(nameof(api)); } if (request == null) { throw new ArgumentNullException(nameof(request)); } api.SetAuthorizationKey(adminKey); var response = await api.Post(path, request); var body = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { var messageAndId = GetMessageAndId(body); return(new AddIpAddressWhitelistResponse.Success((int)response.StatusCode, response.ReasonPhrase, body, messageAndId.Message, messageAndId.Id)); } return(new AddIpAddressWhitelistResponse.Failed((int)response.StatusCode, response.ReasonPhrase, body)); }
public async Task <AddIpAddressWhitelistResponse> Add(AddIpAddressWhitelistRequest request) { return(await Add(Api, request, Path, AdminKey)); }