コード例 #1
0
        public async Task <ZsHostedPage> UpdateCardAsync(string apiBaseUrl, string authToken, string organizationId, ZsHostedPageUpdateCardInput hostedPageUpdateCard)
        {
            apiBaseUrl.CheckConfigApiBaseUrl();
            authToken.CheckConfigAuthToken();
            organizationId.CheckConfigOrganizationId();

            var validationResult = hostedPageUpdateCard.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(
                        hostedPageUpdateCard,
                        Formatting.None,
                        new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                }),
                    Encoding.UTF8,
                    "application/json");
                var response = await httpClient.PostAsync(ApiResources.ZsPostHostedPageUpdateCard, content);

                var processResult = await response.ProcessResponse <ZsHostedPageJson>();

                if (null != processResult.Error)
                {
                    throw processResult.Error;
                }

                return(processResult.Data.HostedPage);
            }
        }
コード例 #2
0
 public async Task <ZsHostedPage> UpdateCardAsync(ZsHostedPageUpdateCardInput hostedPageUpdateCard)
 {
     this.client.Configuration.CheckConfig();
     return(await this.UpdateCardAsync(this.client.Configuration.ApiBaseUrl, this.client.Configuration.AuthToken, this.client.Configuration.OrganizationId, hostedPageUpdateCard));
 }