/
IMemberLogic.cs
199 lines (180 loc) · 9 KB
/
IMemberLogic.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IMemberLogic.cs" company="Brandon Seydel">
// N/A
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MailChimp.Net.Core;
using MailChimp.Net.Core.Responses;
using MailChimp.Net.Models;
namespace MailChimp.Net.Interfaces;
/// <summary>
/// The MemberLogic interface.
/// </summary>
public interface IMemberLogic
{
/// <summary>
/// The add or update async.
/// </summary>
/// <param name="listId">
/// The list id.
/// </param>
/// <param name="member">
/// The member.
/// </param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task<Member> AddOrUpdateAsync(string listId, Member member, IList<MarketingPermissionText> marketingPermissions = null, CancellationToken cancellationToken = default);
/// <summary>
/// Search the account or a specific list for members that match the specified query terms.
/// </summary>
/// <param name="request"></param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task<MemberSearchResult> SearchAsync(MemberSearchRequest request, CancellationToken cancellationToken = default);
/// <summary>
/// The delete async.
/// </summary>
/// <param name="listId">
/// The list id.
/// </param>
/// <param name="emailAddressOrHash">
/// The email address.
/// </param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task DeleteAsync(string listId, string emailAddressOrHash, CancellationToken cancellationToken = default);
/// <summary>
/// The permanent delete async.
/// </summary>
/// <param name="listId">
/// The list id.
/// </param>
/// <param name="emailAddressOrHash">
/// The email address.
/// </param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task PermanentDeleteAsync(string listId, string emailAddressOrHash, CancellationToken cancellationToken = default);
/// <summary>
/// Retrieves the repsonse for the events for the member on the specific list
/// </summary>
/// <param name="listId"></param>
/// <param name="emailAddressOrHash"></param>
/// <param name="request"></param>
/// <returns></returns>
Task<ListEventResponse> GetMemberEventResponseAsync(string listId, string emailAddressOrHash, QueryableBaseRequest request = null, CancellationToken cancellationToken = default);
/// <summary>
/// Adds a new event for the list member
/// </summary>
/// <param name="listId"></param>
/// <param name="emailAddressOrHash"></param>
/// <param name="list"></param>
/// <returns></returns>
Task AddEventAsync(string listId, string emailAddressOrHash, ListEvent list, CancellationToken cancellationToken = default);
/// <summary>
/// Retrieves the events for the member on the specific list
/// </summary>
/// <param name="listId"></param>
/// <param name="emailAddressOrHash"></param>
/// <param name="request"></param>
/// <returns></returns>
Task<IEnumerable<ListEvent>> GetMemberEventsAsync(string listId, string emailAddressOrHash, QueryableBaseRequest request = null, CancellationToken cancellationToken = default);
/// <summary>
/// Gets the activities for a specific list
/// </summary>
/// <param name="listId"></param>
/// <param name="emailAddressOrHash"></param>
/// <param name="request"></param>
/// <returns></returns>
Task<IEnumerable<Activity>> GetActivitiesAsync(string listId, string emailAddressOrHash, BaseRequest request = null, CancellationToken cancellationToken = default);
/// <summary>
/// Gets the tags asynchronous.
/// </summary>
/// <param name="listId">The list identifier.</param>
/// <param name="emailAddressOrHash">The email address or hash.</param>
/// <param name="request">The request.</param>
/// <returns></returns>
Task<IEnumerable<MemberTag>> GetTagsAsync(string listId, string emailAddressOrHash, BaseRequest request = null, CancellationToken cancellationToken = default);
/// <summary>
/// Adds member tags asynchronous.
/// </summary>
/// <param name="listId">The list identifier.</param>
/// <param name="emailAddressOrHash">The email address or hash.</param>
/// <param name="request">The request.</param>
/// <returns></returns>
Task AddTagsAsync(string listId, string emailAddressOrHash, Tags tags, BaseRequest request = null, CancellationToken cancellationToken = default);
/// <summary>
/// The get all async.
/// </summary>
/// <param name="listId">
/// The list id.
/// </param>
/// <param name="memberRequest"></param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task<IEnumerable<Member>> GetAllAsync(string listId, MemberRequest memberRequest = null, CancellationToken cancellationToken = default);
/// <summary>
/// Get the total number of members in the list
/// </summary>
/// <param name="listId"></param>
/// <param name="status"></param>
/// <returns></returns>
Task<int> GetTotalItems(string listId, Status? status, CancellationToken cancellationToken = default);
/// <summary>
/// Get the total number of members in a list based on a MemberRequest model
/// </summary>
/// <param name="listId"></param>
/// <param name="memberRequest"></param>
/// <returns></returns>
Task<int> GetTotalItemsByRequest(string listId, MemberRequest memberRequest, CancellationToken cancellationToken = default);
/// <summary>
/// The get async.
/// </summary>
/// <param name="listId">
/// The list id.
/// </param>
/// <param name="emailAddressOrHash">
/// The email address.
/// </param>
/// <param name="request"></param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task<Member> GetAsync(string listId, string emailAddressOrHash, BaseRequest request = null, CancellationToken cancellationToken = default);
/// <summary>
/// The check if exists async.
/// </summary>
/// <param name="listId">
/// The list id.
/// </param>
/// <param name="emailAddressOrHash">
/// </param>
/// <param name="request"></param>
/// The email address.
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task<bool> ExistsAsync(string listId, string emailAddressOrHash, BaseRequest request = null, bool falseIfUnsubscribed = true, CancellationToken cancellationToken = default);
/// <exception cref="ArgumentNullException"><paramref>
/// <name>uriString</name>
/// </paramref>
/// is null. </exception>
/// <exception cref="UriFormatException">In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, <see cref="T:System.FormatException" />, instead.<paramref name="uriString" /> is empty.-or- The scheme specified in <paramref name="uriString" /> is not correctly formed. See <see cref="M:System.Uri.CheckSchemeName(System.String)" />.-or- <paramref name="uriString" /> contains too many slashes.-or- The password specified in <paramref name="uriString" /> is not valid.-or- The host name specified in <paramref name="uriString" /> is not valid.-or- The file name specified in <paramref name="uriString" /> is not valid. -or- The user name specified in <paramref name="uriString" /> is not valid.-or- The host or authority name specified in <paramref name="uriString" /> cannot be terminated by backslashes.-or- The port number specified in <paramref name="uriString" /> is not valid or cannot be parsed.-or- The length of <paramref name="uriString" /> exceeds 65519 characters.-or- The length of the scheme specified in <paramref name="uriString" /> exceeds 1023 characters.-or- There is an invalid character sequence in <paramref name="uriString" />.-or- The MS-DOS path specified in <paramref name="uriString" /> must start with c:\\.</exception>
/// <exception cref="InvalidOperationException">This member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection-Only Context.</exception>
/// <exception cref="MailChimpException">
/// Custom Mail Chimp Exception
/// </exception>
/// <exception cref="NotSupportedException"><paramref name="element" /> is not a constructor, method, property, event, type, or field. </exception>
/// <exception cref="TypeLoadException">A custom attribute type cannot be loaded. </exception>
/// <exception cref="ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
Task<MemberResponse> GetResponseAsync(string listId, MemberRequest memberRequest = null, CancellationToken cancellationToken = default);
string Hash(string emailAddress);
}