Skip to content

Add Async suffix #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Src/Notion.Client/Api/Comments/Create/CommentsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Notion.Client
{
public partial class CommentsClient
{
public async Task<CreateCommentResponse> Create(CreateCommentParameters parameters)
public async Task<CreateCommentResponse> CreateAsync(CreateCommentParameters parameters)
{
var body = (ICreateCommentsBodyParameters)parameters;

Expand Down
6 changes: 3 additions & 3 deletions Src/Notion.Client/Api/Comments/ICommentsClient.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Threading.Tasks;
using System.Threading.Tasks;

namespace Notion.Client
{
public interface ICommentsClient
{
Task<CreateCommentResponse> Create(CreateCommentParameters createCommentParameters);
Task<CreateCommentResponse> CreateAsync(CreateCommentParameters createCommentParameters);

Task<RetrieveCommentsResponse> Retrieve(RetrieveCommentsParameters parameters);
Task<RetrieveCommentsResponse> RetrieveAsync(RetrieveCommentsParameters parameters);
}
}
2 changes: 1 addition & 1 deletion Src/Notion.Client/Api/Comments/Retrieve/CommentsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Notion.Client
public partial class CommentsClient
{
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public async Task<RetrieveCommentsResponse> Retrieve(RetrieveCommentsParameters parameters)
public async Task<RetrieveCommentsResponse> RetrieveAsync(RetrieveCommentsParameters parameters)
{
var qp = (IRetrieveCommentsQueryParameters)parameters;

Expand Down
2 changes: 1 addition & 1 deletion Src/Notion.Client/Api/Pages/IPagesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Task<Page> UpdatePropertiesAsync(
/// <returns>
/// <see cref="IPropertyItemObject" />
/// </returns>
Task<IPropertyItemObject> RetrievePagePropertyItem(
Task<IPropertyItemObject> RetrievePagePropertyItemAsync(
RetrievePropertyItemParameters retrievePropertyItemParameters);
}
}
2 changes: 1 addition & 1 deletion Src/Notion.Client/Api/Pages/PagesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task<Page> RetrieveAsync(string pageId)
return await _client.GetAsync<Page>(url);
}

public async Task<IPropertyItemObject> RetrievePagePropertyItem(
public async Task<IPropertyItemObject> RetrievePagePropertyItemAsync(
RetrievePropertyItemParameters retrievePropertyItemParameters)
{
var pathParameters = (IRetrievePropertyItemPathParameters)retrievePropertyItemParameters;
Expand Down
6 changes: 3 additions & 3 deletions Test/Notion.IntegrationTests/CommentsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task ShouldCreatePageComment()
);

// Act
var response = await _client.Comments.Create(parameters);
var response = await _client.Comments.CreateAsync(parameters);

// Arrange

Expand All @@ -64,7 +64,7 @@ public async Task ShouldCreatePageComment()
public async Task ShouldCreateADiscussionComment()
{
// Arrange
var comment = await _client.Comments.Create(
var comment = await _client.Comments.CreateAsync(
CreateCommentParameters.CreatePageComment(
new ParentPageInput { PageId = _page.Id },
new List<RichTextBaseInput>
Expand All @@ -75,7 +75,7 @@ public async Task ShouldCreateADiscussionComment()
);

// Act
var response = await _client.Comments.Create(
var response = await _client.Comments.CreateAsync(
CreateCommentParameters.CreateDiscussionComment(
comment.DiscussionId,
new List<RichTextBaseInput>
Expand Down
24 changes: 13 additions & 11 deletions Test/Notion.IntegrationTests/IPageClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task CreateAsync_CreatesANewPage()
var pageProperty = page.Properties["Name"].Should().BeOfType<PropertyValue>().Subject;

var titleProperty
= (ListPropertyItem)await _client.Pages.RetrievePagePropertyItem(
= (ListPropertyItem)await _client.Pages.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand Down Expand Up @@ -87,7 +87,7 @@ public async Task Bug_unable_to_create_page_with_select_property()
var pageProperty = page.Properties["Name"].Should().BeOfType<PropertyValue>().Subject;

var titleProperty
= (ListPropertyItem)await _client.Pages.RetrievePagePropertyItem(
= (ListPropertyItem)await _client.Pages.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand Down Expand Up @@ -116,7 +116,7 @@ public async Task Test_RetrievePagePropertyItemAsync()

var page = await _client.Pages.CreateAsync(pagesCreateParameters);

var property = await _client.Pages.RetrievePagePropertyItem(new RetrievePropertyItemParameters
var property = await _client.Pages.RetrievePagePropertyItemAsync(new RetrievePropertyItemParameters
{
PageId = page.Id,
PropertyId = "title"
Expand Down Expand Up @@ -185,11 +185,13 @@ public async Task Test_UpdatePageProperty_with_date_as_null()

var page = await _client.Pages.CreateAsync(pagesCreateParameters);

var setDate = (DatePropertyItem)await _client.Pages.RetrievePagePropertyItem(new RetrievePropertyItemParameters
{
PageId = page.Id,
PropertyId = page.Properties[DatePropertyName].Id
});
var setDate = (DatePropertyItem)await _client.Pages.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
PropertyId = page.Properties[DatePropertyName].Id
}
);

setDate?.Date?.Start.Should().Be(Convert.ToDateTime("2020-12-08T12:00:00Z"));

Expand All @@ -201,7 +203,7 @@ public async Task Test_UpdatePageProperty_with_date_as_null()
var updatedPage =
await _client.Pages.UpdateAsync(page.Id, new PagesUpdateParameters { Properties = testProps });

var verifyDate = (DatePropertyItem)await _client.Pages.RetrievePagePropertyItem(
var verifyDate = (DatePropertyItem)await _client.Pages.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand Down Expand Up @@ -236,7 +238,7 @@ public async Task Bug_Unable_To_Parse_NumberPropertyItem()
var pageParent = Assert.IsType<DatabaseParent>(page.Parent);
Assert.Equal(_databaseId, pageParent.DatabaseId);

var titleProperty = (ListPropertyItem)await _client.Pages.RetrievePagePropertyItem(
var titleProperty = (ListPropertyItem)await _client.Pages.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand All @@ -245,7 +247,7 @@ public async Task Bug_Unable_To_Parse_NumberPropertyItem()

Assert.Equal("Test Page Title", titleProperty.Results.First().As<TitlePropertyItem>().Title.PlainText);

var numberProperty = (NumberPropertyItem)await _client.Pages.RetrievePagePropertyItem(
var numberProperty = (NumberPropertyItem)await _client.Pages.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand Down
2 changes: 1 addition & 1 deletion Test/Notion.UnitTests/DatabasesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ var jsonData
"{\"object\":\"property_item\",\"id\":\"JwY^\",\"type\":\"formula\",\"formula\":{\"type\":\"date\",\"date\":{\"start\":\"2021-06-28\",\"end\":null}}}")
);

var formulaPropertyValue = (FormulaPropertyItem)await _pagesClient.RetrievePagePropertyItem(
var formulaPropertyValue = (FormulaPropertyItem)await _pagesClient.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand Down
6 changes: 3 additions & 3 deletions Test/Notion.UnitTests/PagesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public async Task UpdatePropertiesAsync()
page.Properties.Should().HaveCount(2);
var updatedProperty = page.Properties.First(x => x.Key == "In stock");

var checkboxPropertyValue = (CheckboxPropertyItem)await _client.RetrievePagePropertyItem(
var checkboxPropertyValue = (CheckboxPropertyItem)await _client.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand Down Expand Up @@ -176,7 +176,7 @@ public async Task UpdatePageAsync()
page.Properties.Should().HaveCount(2);
var updatedProperty = page.Properties.First(x => x.Key == "In stock");

var checkboxPropertyValue = (CheckboxPropertyItem)await _client.RetrievePagePropertyItem(
var checkboxPropertyValue = (CheckboxPropertyItem)await _client.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand Down Expand Up @@ -225,7 +225,7 @@ public async Task ArchivePageAsync()
page.Properties.Should().HaveCount(2);
var updatedProperty = page.Properties.First(x => x.Key == "In stock");

var checkboxPropertyValue = (CheckboxPropertyItem)await _client.RetrievePagePropertyItem(
var checkboxPropertyValue = (CheckboxPropertyItem)await _client.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = page.Id,
Expand Down