/// <summary> /// /// </summary> /// <param name="campaignId"></param> /// <param name="mailingListId"></param> /// <param name="subListUnsubscriptions"></param> /// <param name="timestampSince"></param> /// <returns></returns> public async Task <List <UnsubscriptionType> > UnsubscriptionsAsync(string campaignId = null, string mailingListId = null, bool subListUnsubscriptions = false, string timestampSince = null) { try { if (_unsubscriptions == null) { var req = new GetUnsubscriptionsReq() { header = Client.RequestHeader }; if (!string.IsNullOrWhiteSpace(campaignId)) { req.campaignId = int.Parse(campaignId); } req.campaignIdSpecified = true; if (!string.IsNullOrWhiteSpace(mailingListId)) { req.mailingListId = int.Parse(mailingListId); } req.mailingListIdSpecified = true; req.subListUnsubscriptions = subListUnsubscriptions; req.subListUnsubscriptionsSpecified = true; if (!string.IsNullOrWhiteSpace(timestampSince)) { req.timestampSince = timestampSince; } GetUnsubscriptionsResponse response = await _client.API.GetUnsubscriptionsAsync(req); _unsubscriptions = response.GetUnsubscriptionsResp; } if (_unsubscriptions.errorCode == (int)errorCode.No_error) { return(_unsubscriptions.unsubscriptionTypeItems.ToList <UnsubscriptionType>()); } throw new FlexMailException(_subscriptions.errorMessage, _subscriptions.errorCode); } catch (Exception ex) { ////telemetry.TrackException(ex, new Dictionary<string, string> { { "Flexmail", "Account.Unsubscriptions" } }); if (ex is FlexMailException) { throw (ex); } } finally { _unsubscriptions = null; } return(new List <UnsubscriptionType>()); }
private bool disposedValue = false; // To detect redundant calls /// <summary> /// /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { } _balance = null; _bounces = null; _profileUpdates = null; _subscriptions = null; _unsubscriptions = null; disposedValue = true; } }