Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Commit

Permalink
Fix IDE0060 Remove unused parameter 'cancellationToken' if it is not …
Browse files Browse the repository at this point in the history
…part of a shipped public API
  • Loading branch information
Jericho committed May 29, 2019
1 parent 43c835e commit c1e5eea
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 117 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var mergeData = new Dictionary<string, object>
{
{ "gender", "Male" }
};
var sent = await client.Relays.SendWithoutTrackingAsync(userKey, "recipient@example.com", subject, html, text, "you@yourcompany.com", "Your name", mergeData, null, null, clientId).ConfigureAwait(false);
var sent = await client.Relays.SendWithoutTrackingAsync(userKey, "recipient@example.com", subject, html, text, "you@yourcompany.com", "Your name", mergeData, null, null, clientId, cancellationToken).ConfigureAwait(false);
```

+ **7.0**
Expand All @@ -68,7 +68,7 @@ var mergeData = new Dictionary<string, object>
{ "firstname", "Bob" },
{ "lastname", "Smith" }
};
var sent = await client.Relays.SendWithoutTrackingAsync(userKey, "recipient@example.com", subject, html, text, "you@yourcompany.com", "Your name", mergeData, null, null, clientId).ConfigureAwait(false);
var sent = await client.Relays.SendWithoutTrackingAsync(userKey, "recipient@example.com", subject, html, text, "you@yourcompany.com", "Your name", mergeData, null, null, clientId, cancellationToken).ConfigureAwait(false);
```

+ **6.0**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ public static async Task ExecuteAllMethods(ICakeMailRestClient client, string us
{
await log.WriteLineAsync("\n***** CAMPAIGNS *****").ConfigureAwait(false);

var campaigns = await client.Campaigns.GetListAsync(userKey, CampaignStatus.Ongoing, null, CampaignsSortBy.Name, SortDirection.Ascending, null, null, clientId).ConfigureAwait(false);
var campaigns = await client.Campaigns.GetListAsync(userKey, CampaignStatus.Ongoing, null, CampaignsSortBy.Name, SortDirection.Ascending, null, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"All campaigns retrieved. Count = {campaigns.Count()}").ConfigureAwait(false);

var campaignsCount = await client.Campaigns.GetCountAsync(userKey, CampaignStatus.Ongoing, null, clientId).ConfigureAwait(false);
var campaignsCount = await client.Campaigns.GetCountAsync(userKey, CampaignStatus.Ongoing, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Campaigns count = {campaignsCount}").ConfigureAwait(false);

var campaignId = await client.Campaigns.CreateAsync(userKey, "Dummy campaign", clientId).ConfigureAwait(false);
var campaignId = await client.Campaigns.CreateAsync(userKey, "Dummy campaign", clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"New campaign created. Id: {campaignId}").ConfigureAwait(false);

var updated = await client.Campaigns.UpdateAsync(userKey, campaignId, CampaignStatus.Ongoing, "Updated name", clientId).ConfigureAwait(false);
var updated = await client.Campaigns.UpdateAsync(userKey, campaignId, CampaignStatus.Ongoing, "Updated name", clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Campaign updated: {(updated ? "success" : "failed")}").ConfigureAwait(false);

var campaign = await client.Campaigns.GetAsync(userKey, campaignId, clientId).ConfigureAwait(false);
var campaign = await client.Campaigns.GetAsync(userKey, campaignId, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Campaign retrieved: Name = {campaign.Name}").ConfigureAwait(false);

var deleted = await client.Campaigns.DeleteAsync(userKey, campaignId, clientId).ConfigureAwait(false);
var deleted = await client.Campaigns.DeleteAsync(userKey, campaignId, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Campaign deleted: {(deleted ? "success" : "failed")}").ConfigureAwait(false);
}
}
Expand Down
20 changes: 10 additions & 10 deletions Source/CakeMail.RestClient.IntegrationTests/Tests/ClientsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,35 @@ public static async Task ExecuteAllMethods(ICakeMailRestClient client, string us
{
await log.WriteLineAsync("\n***** CLIENT *****").ConfigureAwait(false);

var clientsCount = await client.Clients.GetCountAsync(userKey, null, null, clientId).ConfigureAwait(false);
var clientsCount = await client.Clients.GetCountAsync(userKey, null, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Clients count = {clientsCount}").ConfigureAwait(false);

var adminEmail = string.Format("admin{0:00}+{1:0000}@integrationtesting.com", clientsCount, (new Random()).Next(9999));
var confirmation = await client.Clients.CreateAsync(clientId, "_Integration Testing", "123 1st Street", "Suite 123", "Atlanta", "GA", "12345", "us", "www.company.com", "1-888-myphone", "1-888myfax", adminEmail, "Admin", "Integration Testing", "Super Administrator", "1-888-AdminPhone", "1-888-AdminMobile", "en_US", UTC_TIMEZONE_ID, "adminpassword", true).ConfigureAwait(false);
var confirmation = await client.Clients.CreateAsync(clientId, "_Integration Testing", "123 1st Street", "Suite 123", "Atlanta", "GA", "12345", "us", "www.company.com", "1-888-myphone", "1-888myfax", adminEmail, "Admin", "Integration Testing", "Super Administrator", "1-888-AdminPhone", "1-888-AdminMobile", "en_US", UTC_TIMEZONE_ID, "adminpassword", true, cancellationToken: cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"New client created. Confirmation code: {confirmation}").ConfigureAwait(false);

var unconfirmedClient = await client.Clients.GetAsync(userKey, confirmation).ConfigureAwait(false);
var unconfirmedClient = await client.Clients.GetAsync(userKey, confirmation, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Information about this unconfirmed client: Name = {unconfirmedClient.Name}").ConfigureAwait(false);

var registrationInfo = await client.Clients.ConfirmAsync(confirmation).ConfigureAwait(false);
var registrationInfo = await client.Clients.ConfirmAsync(confirmation, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Client has been confirmed. Id = {registrationInfo.ClientId}").ConfigureAwait(false);

var clients = await client.Clients.GetListAsync(userKey, null, null, ClientsSortBy.CompanyName, SortDirection.Ascending, null, null, clientId).ConfigureAwait(false);
var clients = await client.Clients.GetListAsync(userKey, null, null, ClientsSortBy.CompanyName, SortDirection.Ascending, null, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"All clients retrieved. Count = {clients.Count()}").ConfigureAwait(false);

var updated = await client.Clients.UpdateAsync(userKey, registrationInfo.ClientId, name: "Fictitious Company").ConfigureAwait(false);
var updated = await client.Clients.UpdateAsync(userKey, registrationInfo.ClientId, name: "Fictitious Company", cancellationToken: cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Client updated: {(updated ? "success" : "failed")}").ConfigureAwait(false);

var myClient = await client.Clients.GetAsync(userKey, registrationInfo.ClientId).ConfigureAwait(false);
var myClient = await client.Clients.GetAsync(userKey, registrationInfo.ClientId, cancellationToken: cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Client retrieved: Name = {myClient.Name}").ConfigureAwait(false);

var suspended = await client.Clients.SuspendAsync(userKey, myClient.Id).ConfigureAwait(false);
var suspended = await client.Clients.SuspendAsync(userKey, myClient.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Client suspended: {(suspended ? "success" : "failed")}").ConfigureAwait(false);

var reactivated = await client.Clients.ActivateAsync(userKey, myClient.Id).ConfigureAwait(false);
var reactivated = await client.Clients.ActivateAsync(userKey, myClient.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Client re-activated: {(reactivated ? "success" : "failed")}").ConfigureAwait(false);

var deleted = await client.Clients.DeleteAsync(userKey, myClient.Id).ConfigureAwait(false);
var deleted = await client.Clients.DeleteAsync(userKey, myClient.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Client deleted: {(deleted ? "success" : "failed")}").ConfigureAwait(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ public static async Task ExecuteAllMethods(ICakeMailRestClient client, string us
{
await log.WriteLineAsync("\n***** COUNTRIES *****").ConfigureAwait(false);

var countries = await client.Countries.GetListAsync().ConfigureAwait(false);
var countries = await client.Countries.GetListAsync(cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Retrieved all countries. There are {countries.Count()} countries.").ConfigureAwait(false);

var canada = countries.Single(country => country.EnglishName == "Canada");
await log.WriteLineAsync($"Canada --> Id: {canada.Id}").ConfigureAwait(false);

var canadianProvinces = await client.Countries.GetProvincesAsync(canada.Id).ConfigureAwait(false);
var canadianProvinces = await client.Countries.GetProvincesAsync(canada.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"There are {canadianProvinces.Count()} canadian provinces/territories/etc.").ConfigureAwait(false);

var quebec = canadianProvinces.Single(province => province.EnglishName == "Quebec");
Expand All @@ -26,7 +26,7 @@ public static async Task ExecuteAllMethods(ICakeMailRestClient client, string us
var usa = countries.Single(country => country.EnglishName == "United States");
await log.WriteLineAsync($"USA --> Id: {usa.Id}").ConfigureAwait(false);

var americanStates = await client.Countries.GetProvincesAsync(usa.Id).ConfigureAwait(false);
var americanStates = await client.Countries.GetProvincesAsync(usa.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"There are {americanStates.Count()} american states/territories/etc.").ConfigureAwait(false);

var georgia = americanStates.Single(province => province.EnglishName == "Georgia");
Expand Down
48 changes: 24 additions & 24 deletions Source/CakeMail.RestClient.IntegrationTests/Tests/ListsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ public static async Task ExecuteAllMethods(ICakeMailRestClient client, string us
{
await log.WriteLineAsync("\n***** LISTS *****").ConfigureAwait(false);

var lists = await client.Lists.GetListsAsync(userKey, ListStatus.Active, null, ListsSortBy.Name, SortDirection.Descending, null, null, clientId).ConfigureAwait(false);
var lists = await client.Lists.GetListsAsync(userKey, ListStatus.Active, null, ListsSortBy.Name, SortDirection.Descending, null, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"All lists retrieved. Count = {lists.Count()}").ConfigureAwait(false);

var listsCount = await client.Lists.GetCountAsync(userKey, ListStatus.Active, null, clientId).ConfigureAwait(false);
var listsCount = await client.Lists.GetCountAsync(userKey, ListStatus.Active, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Lists count = {listsCount}").ConfigureAwait(false);

var listId = await client.Lists.CreateAsync(userKey, "Dummy list", "Bob Smith", "bobsmith@fictitiouscomapny.com", true, clientId).ConfigureAwait(false);
var listId = await client.Lists.CreateAsync(userKey, "Dummy list", "Bob Smith", "bobsmith@fictitiouscomapny.com", true, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"New list created. Id: {listId}").ConfigureAwait(false);

var updated = await client.Lists.UpdateAsync(userKey, listId, name: "Updated name", clientId: clientId).ConfigureAwait(false);
var updated = await client.Lists.UpdateAsync(userKey, listId, name: "Updated name", clientId: clientId, cancellationToken: cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"List updated: {(updated ? "success" : "failed")}").ConfigureAwait(false);

var list = await client.Lists.GetAsync(userKey, listId, false, false, clientId).ConfigureAwait(false);
var list = await client.Lists.GetAsync(userKey, listId, false, false, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"List retrieved: Name = {list.Name}").ConfigureAwait(false);

await client.Lists.AddFieldAsync(userKey, listId, "MyCustomField1", FieldType.Integer, clientId).ConfigureAwait(false);
await client.Lists.AddFieldAsync(userKey, listId, "MyCustomField2", FieldType.DateTime, clientId).ConfigureAwait(false);
await client.Lists.AddFieldAsync(userKey, listId, "MyCustomField3", FieldType.Text, clientId).ConfigureAwait(false);
await client.Lists.AddFieldAsync(userKey, listId, "MyCustomField4", FieldType.Memo, clientId).ConfigureAwait(false);
await client.Lists.AddFieldAsync(userKey, listId, "MyCustomField1", FieldType.Integer, clientId, cancellationToken).ConfigureAwait(false);
await client.Lists.AddFieldAsync(userKey, listId, "MyCustomField2", FieldType.DateTime, clientId, cancellationToken).ConfigureAwait(false);
await client.Lists.AddFieldAsync(userKey, listId, "MyCustomField3", FieldType.Text, clientId, cancellationToken).ConfigureAwait(false);
await client.Lists.AddFieldAsync(userKey, listId, "MyCustomField4", FieldType.Memo, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Custom fields added to the list").ConfigureAwait(false);

var fields = await client.Lists.GetFieldsAsync(userKey, listId, clientId).ConfigureAwait(false);
var fields = await client.Lists.GetFieldsAsync(userKey, listId, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"List contains the following fields: {string.Join(", ", fields.Select(f => f.Name))}").ConfigureAwait(false);

var subscriberCustomFields = new Dictionary<string, object>()
Expand All @@ -44,14 +44,14 @@ public static async Task ExecuteAllMethods(ICakeMailRestClient client, string us
{ "MyCustomField2", DateTime.UtcNow },
{ "MyCustomField3", "qwerty" }
};
var listMemberId = await client.Lists.SubscribeAsync(userKey, listId, "integration@testing.com", true, true, subscriberCustomFields, clientId).ConfigureAwait(false);
var listMemberId = await client.Lists.SubscribeAsync(userKey, listId, "integration@testing.com", true, true, subscriberCustomFields, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("One member added to the list").ConfigureAwait(false);

var query = "`email`=\"integration@testing.com\"";
var subscribers = await client.Lists.GetMembersAsync(userKey, listId, query: query, clientId: clientId).ConfigureAwait(false);
var subscribers = await client.Lists.GetMembersAsync(userKey, listId, query: query, clientId: clientId, cancellationToken: cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Subscribers retrieved: {subscribers.Count()}").ConfigureAwait(false);

var subscriber = await client.Lists.GetMemberAsync(userKey, listId, listMemberId, clientId).ConfigureAwait(false);
var subscriber = await client.Lists.GetMemberAsync(userKey, listId, listMemberId, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Subscriber retrieved: {subscriber.Email}").ConfigureAwait(false);

var member1 = new ListMember
Expand All @@ -74,40 +74,40 @@ public static async Task ExecuteAllMethods(ICakeMailRestClient client, string us
{ "MyCustomField3", "azerty" }
}
};
var importResult = await client.Lists.ImportAsync(userKey, listId, new[] { member1, member2 }, false, false, clientId).ConfigureAwait(false);
var importResult = await client.Lists.ImportAsync(userKey, listId, new[] { member1, member2 }, false, false, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("Two members imported into the list").ConfigureAwait(false);

var members = await client.Lists.GetMembersAsync(userKey, listId, null, null, null, null, null, null, clientId).ConfigureAwait(false);
var members = await client.Lists.GetMembersAsync(userKey, listId, null, null, null, null, null, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"All list members retrieved. Count = {members.Count()}").ConfigureAwait(false);

var membersCount = await client.Lists.GetMembersCountAsync(userKey, listId, null, clientId).ConfigureAwait(false);
var membersCount = await client.Lists.GetMembersCountAsync(userKey, listId, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Members count = {membersCount}").ConfigureAwait(false);

var customFieldsToUpdate = new Dictionary<string, object>
{
{ "MyCustomField1", 555555 },
{ "MyCustomField3", "zzzzzzzzzzzzzzzzzzzzzzzzzz" }
};
var memberUpdated = await client.Lists.UpdateMemberAsync(userKey, listId, 1, customFieldsToUpdate, clientId).ConfigureAwait(false);
var memberUpdated = await client.Lists.UpdateMemberAsync(userKey, listId, 1, customFieldsToUpdate, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Member updated: {(memberUpdated ? "success" : "failed")}").ConfigureAwait(false);

var logs = await client.Lists.GetLogsAsync(userKey, listId, LogType.Open, false, false, null, null, null, null, clientId).ConfigureAwait(false);
var logs = await client.Lists.GetLogsAsync(userKey, listId, LogType.Open, false, false, null, null, null, null, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Retrieved 'Opens'. Count = {logs.Count()}").ConfigureAwait(false);

var firstSegmentId = await client.Segments.CreateAsync(userKey, listId, "Segment #1", "(`email` LIKE \"aa%\")", clientId).ConfigureAwait(false);
var secondSegmentId = await client.Segments.CreateAsync(userKey, listId, "Segment #2", "(`email` LIKE \"bb%\")", clientId).ConfigureAwait(false);
var firstSegmentId = await client.Segments.CreateAsync(userKey, listId, "Segment #1", "(`email` LIKE \"aa%\")", clientId, cancellationToken).ConfigureAwait(false);
var secondSegmentId = await client.Segments.CreateAsync(userKey, listId, "Segment #2", "(`email` LIKE \"bb%\")", clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("Two segments created").ConfigureAwait(false);

var segments = await client.Segments.GetSegmentsAsync(userKey, listId, 0, 0, true, clientId).ConfigureAwait(false);
var segments = await client.Segments.GetSegmentsAsync(userKey, listId, 0, 0, true, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Segments retrieved. Count = {segments.Count()}").ConfigureAwait(false);

var firstSegmentDeleted = await client.Segments.DeleteAsync(userKey, firstSegmentId, clientId).ConfigureAwait(false);
var firstSegmentDeleted = await client.Segments.DeleteAsync(userKey, firstSegmentId, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("First segment deleted").ConfigureAwait(false);

var secondSegmentDeleted = await client.Segments.DeleteAsync(userKey, secondSegmentId, clientId).ConfigureAwait(false);
var secondSegmentDeleted = await client.Segments.DeleteAsync(userKey, secondSegmentId, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("Second segment deleted").ConfigureAwait(false);

var deleted = await client.Lists.DeleteAsync(userKey, listId, clientId).ConfigureAwait(false);
var deleted = await client.Lists.DeleteAsync(userKey, listId, clientId, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"List deleted: {(deleted ? "success" : "failed")}").ConfigureAwait(false);
}
}
Expand Down

0 comments on commit c1e5eea

Please sign in to comment.