-
Notifications
You must be signed in to change notification settings - Fork 1
Disable Contacts::GetAll method from .NET client #167
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
base: main
Are you sure you want to change the base?
Conversation
… backend implementation is complete
WalkthroughThis pull request removes the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
examples/Mailtrap.Example.ContactEvents/Program.cs (1)
36-37: Consider enhancing the TODO comment with additional context.The workaround is functional, but note that using an empty list will cause the example to always create a new contact on each run rather than reusing existing ones. Consider adding a brief explanation about the backend limitation to help users understand why GetAll is temporarily unavailable.
Apply this diff to provide more context:
- // TODO: Enable when GetAll is implemented + // TODO: Enable when GetAll is implemented (backend support pending) + // Note: Currently creates a new contact on each run IList<Contact> contacts = /*await contactsResource.GetAll()*/ [];examples/Mailtrap.Example.Contact/Program.cs (1)
35-36: Consider enhancing the TODO comment with additional context.The empty list workaround means the example will always create a new contact (line 42-52) instead of finding and reusing an existing one. Adding context about the backend limitation would help users understand this temporary behavior.
Apply this diff to provide more context:
- // TODO: Enable when GetAll is implemented + // TODO: Enable when GetAll is implemented (backend support pending) + // Note: Currently creates a new contact on each run instead of reusing existing ones IList<Contact> contacts = /*await contactsResource.GetAll()*/ [];tests/Mailtrap.IntegrationTests/Contacts/ContactsIntegrationTests.cs (1)
32-71: Prefer [Ignore] attribute over commenting out the test.While commenting out the test is functional, using the
[Ignore("Backend support pending")]attribute would be more maintainable. This approach:
- Keeps the test visible in test runners and reports
- Makes it clear the test is temporarily disabled
- Prevents the test from being forgotten when GetAll is re-implemented
- Maintains test count metrics
Apply this diff to use the Ignore attribute:
- // TODO: Enable when GetAll is implemented - // [Test] - // public async Task GetAll_Success() - // { - // // Arrange - // var httpMethod = HttpMethod.Get; - // var requestUri = _resourceUri.AbsoluteUri; - - // using var responseContent = await Feature.LoadFileToStringContent(); - - // using var mockHttp = new MockHttpMessageHandler(); - // mockHttp - // .Expect(httpMethod, requestUri) - // .WithHeaders("Authorization", $"Bearer {_clientConfig.ApiToken}") - // .WithHeaders("Accept", MimeTypes.Application.Json) - // .WithHeaders("User-Agent", HeaderValues.UserAgent.ToString()) - // .Respond(HttpStatusCode.OK, responseContent); - - // using var serviceCollection = new ServiceCollection(); - // serviceCollection - // .AddMailtrapClient(_clientConfig) - // .ConfigurePrimaryHttpMessageHandler(() => mockHttp); - - // using var services = serviceCollection.BuildServiceProvider(); - // var client = services.GetRequiredService<IMailtrapClient>(); - - // // Act - // var result = await client - // .Account(_accountId) - // .Contacts() - // .GetAll() - // .ConfigureAwait(false); - - // // Assert - // mockHttp.VerifyNoOutstandingExpectation(); - - // result.Should() - // .NotBeNull().And - // .HaveCount(3); - // } + [Test] + [Ignore("GetAll not yet implemented - backend support pending (issue #126)")] + public async Task GetAll_Success() + { + // Arrange + var httpMethod = HttpMethod.Get; + var requestUri = _resourceUri.AbsoluteUri; + + using var responseContent = await Feature.LoadFileToStringContent(); + + using var mockHttp = new MockHttpMessageHandler(); + mockHttp + .Expect(httpMethod, requestUri) + .WithHeaders("Authorization", $"Bearer {_clientConfig.ApiToken}") + .WithHeaders("Accept", MimeTypes.Application.Json) + .WithHeaders("User-Agent", HeaderValues.UserAgent.ToString()) + .Respond(HttpStatusCode.OK, responseContent); + + using var serviceCollection = new ServiceCollection(); + serviceCollection + .AddMailtrapClient(_clientConfig) + .ConfigurePrimaryHttpMessageHandler(() => mockHttp); + + using var services = serviceCollection.BuildServiceProvider(); + var client = services.GetRequiredService<IMailtrapClient>(); + + // Act + var result = await client + .Account(_accountId) + .Contacts() + .GetAll() + .ConfigureAwait(false); + + // Assert + mockHttp.VerifyNoOutstandingExpectation(); + + result.Should() + .NotBeNull().And + .HaveCount(3); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
examples/Mailtrap.Example.Contact/Program.cs(1 hunks)examples/Mailtrap.Example.ContactEvents/Program.cs(1 hunks)src/Mailtrap.Abstractions/Contacts/IContactCollectionResource.cs(1 hunks)tests/Mailtrap.IntegrationTests/Contacts/ContactsIntegrationTests.cs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: dr-3lo
PR: railsware/mailtrap-dotnet#152
File: src/Mailtrap.Abstractions/ContactEvents/IContactsEventsCollectionResource.cs:6-6
Timestamp: 2025-09-23T10:44:34.331Z
Learning: The Contact Events API backend does not provide a GetAll/list method - only Create is supported. The ContactsEventCollectionResource implementation should not include a GetAll method.
📚 Learning: 2025-09-23T10:44:34.331Z
Learnt from: dr-3lo
PR: railsware/mailtrap-dotnet#152
File: src/Mailtrap.Abstractions/ContactEvents/IContactsEventsCollectionResource.cs:6-6
Timestamp: 2025-09-23T10:44:34.331Z
Learning: The Contact Events API backend does not provide a GetAll/list method - only Create is supported. The ContactsEventCollectionResource implementation should not include a GetAll method.
Applied to files:
src/Mailtrap.Abstractions/Contacts/IContactCollectionResource.cs
🔇 Additional comments (1)
src/Mailtrap.Abstractions/Contacts/IContactCollectionResource.cs (1)
108-108: LGTM!The cancellationToken parameter documentation has been appropriately updated to be self-contained following the removal of the GetAll method.
Disable Contacts::GetAll method temporary because backend implementation is not complete
Motivation
Backend still doesn't support GetAll for Contatcs API, so need to temporary remove it from .NET client
This update for issue #126
Changes
How to test
Summary by CodeRabbit