/// <summary> /// Churn a subscriptionNote: This request's fields are query parameters in the URL. There is no body to this reqeust. /// </summary> public async Task <ChurnSubscriptionResponseModel> ChurnSubscriptionAsync(ChurnSubscriptionRequestModel model) { try { if (string.IsNullOrEmpty(model.SubscriptionId) && string.IsNullOrEmpty(model.SubscriptionAlias)) { throw new MissingMemberException("Either you need to set 'SubscriptionId' or 'SubscriptionAlias'"); } var result = await client.DeleteAsync("v2/subscriptions/" + (string.IsNullOrEmpty(model.SubscriptionAlias) ? model.SubscriptionId : model.SubscriptionAlias) + "/" + "?effective_date=" + model.EffectiveDate.ToUnixTime() + "&churn_type=" + model.ChurnType.ToString()); var jsonResponse = await result.Content.ReadAsStringAsync(); var response = Newtonsoft.Json.JsonConvert.DeserializeObject <ChurnSubscriptionResponseModel>(jsonResponse); if (response == null) { response = new ChurnSubscriptionResponseModel(); } response.IsSuccessfull = result.IsSuccessStatusCode; return(response); } catch (Exception e) { throw e; } }
/// <summary> /// Churn a subscriptionNote: This request's fields are query parameters in the URL. There is no body to this reqeust. /// </summary> public ChurnSubscriptionResponseModel ChurnSubscription(ChurnSubscriptionRequestModel model) => ChurnSubscriptionAsync(model).ConfigureAwait(false).GetAwaiter().GetResult();