public async Task <ZsHostedPage> BuyOneTimeAddonAsync(string apiBaseUrl, string authToken, string organizationId, ZsHostedPageBuyAddonInput hostedPageBuyAddon) { apiBaseUrl.CheckConfigApiBaseUrl(); authToken.CheckConfigAuthToken(); organizationId.CheckConfigOrganizationId(); var validationResult = hostedPageBuyAddon.Validate(); if (!string.IsNullOrWhiteSpace(validationResult)) { throw new ArgumentException(validationResult); } using (var httpClient = new HttpClient()) { httpClient.Configure(apiBaseUrl, organizationId, authToken); var content = new StringContent( JsonConvert.SerializeObject( hostedPageBuyAddon, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }), Encoding.UTF8, "application/json"); var response = await httpClient.PostAsync(ApiResources.ZsPostHostedPageBuyAddon, content); var processResult = await response.ProcessResponse <ZsHostedPageJson>(); if (null != processResult.Error) { throw processResult.Error; } return(processResult.Data.HostedPage); } }
public async Task <ZsHostedPage> BuyOneTimeAddonAsync(ZsHostedPageBuyAddonInput hostedPageBuyAddon) { this.client.Configuration.CheckConfig(); return(await this.BuyOneTimeAddonAsync(this.client.Configuration.ApiBaseUrl, this.client.Configuration.AuthToken, this.client.Configuration.OrganizationId, hostedPageBuyAddon)); }