-
Notifications
You must be signed in to change notification settings - Fork 1
Feature- Contacts API #153
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
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6f58752
Feature - Contacts API (Issue 96)
dr-3lo 8c80488
Feature - Contacts API (Issue 96)
dr-3lo 6a9ccbc
- Updated example project files to remove leftover Dependabot changes.
dr-3lo 3854107
Feature - Contacts API (Issue 96)
dr-3lo 325831c
Refactor contact model documentation to clarify property accessors
dr-3lo 07d3291
Correction in xml doc for UpdateContactFieldRequest
dr-3lo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,8 +31,8 @@ | |
| // Get resource for contacts collection | ||
| IContactCollectionResource contactsResource = accountResource.Contacts(); | ||
|
|
||
| //Get resource for contact imports collection | ||
| IContactsImportCollectionResource contactsImportsResource = contactsResource.Imports(); | ||
| //Get resource for contact import collection | ||
| IContactImportCollectionResource contactImportsResource = contactsResource.Imports(); | ||
|
|
||
| // Prepare list of contacts to import | ||
| var contactImportList = new List<ContactImportRequest> | ||
|
|
@@ -42,21 +42,25 @@ | |
| new("[email protected]"), | ||
| }; | ||
|
|
||
| // Create contacts import request | ||
| var importRequest = new ContactsImportRequest(contactImportList); | ||
| // Create contact import request | ||
| var importRequest = new CreateContactImportRequest(contactImportList); | ||
|
|
||
| // Import contacts in bulk | ||
| ContactsImport importResponse = await contactsImportsResource.Create(importRequest); | ||
| logger.LogInformation("Created contact import: {Import}", importResponse); | ||
| ContactImport importResponse = await contactImportsResource.Create(importRequest); | ||
| logger.LogInformation("Created contact import, Id: {ImportId}", importResponse.Id); | ||
|
|
||
| // Get resource for specific contact import | ||
| IContactsImportResource contactsImportResource = contactsResource.Import(importResponse.Id); | ||
| IContactImportResource contactImportResource = contactsResource.Import(importResponse.Id); | ||
|
|
||
| // Get details of specific contact import | ||
| ContactsImport contactsImportDetails = await contactsImportResource.GetDetails(); | ||
| logger.LogInformation("Contacts Import Details: {Details}", contactsImportDetails); | ||
|
|
||
| if (contactsImportDetails.Status == ContactsImportStatus.Failed) | ||
| ContactImport contactImportDetails = await contactImportResource.GetDetails(); | ||
| logger.LogInformation("Contact Import Details: {Id}", contactImportDetails.Id); | ||
| logger.LogInformation("Contact Import Details: {Status}", contactImportDetails.Status); | ||
| logger.LogInformation("Contact Import Details: {CreatedContactsCount}", contactImportDetails.CreatedContactsCount); | ||
| logger.LogInformation("Contact Import Details: {UpdatedContactsCount}", contactImportDetails.UpdatedContactsCount); | ||
| logger.LogInformation("Contact Import Details: {ContactsOverLimitCount}", contactImportDetails.ContactsOverLimitCount); | ||
|
|
||
| if (contactImportDetails.Status == ContactImportStatus.Failed) | ||
| { | ||
| logger.LogWarning("Import failed!"); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/Mailtrap.Abstractions/ContactEvents/IContactEventCollectionResource.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| namespace Mailtrap.ContactEvents; | ||
|
|
||
| /// <summary> | ||
| /// Represents contact event collection resource. | ||
| /// </summary> | ||
| public interface IContactEventCollectionResource : IRestResource | ||
| { | ||
| /// <summary> | ||
| /// Creates a new contact event with details specified by <paramref name="request"/>. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="request"> | ||
| /// Request containing contact event details for creation. | ||
| /// </param> | ||
| /// | ||
| /// <param name="cancellationToken"> | ||
| /// Token to control operation cancellation. | ||
| /// </param> | ||
| /// | ||
| /// <returns> | ||
| /// Created contact event details. | ||
| /// </returns> | ||
| public Task<ContactEvent> Create(CreateContactEventRequest request, CancellationToken cancellationToken = default); | ||
| } |
24 changes: 0 additions & 24 deletions
24
src/Mailtrap.Abstractions/ContactEvents/IContactsEventCollectionResource.cs
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.