Skip to content
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

feat: add support for "Get Contacts by Emails" endpoint #159

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

funder7
Copy link

@funder7 funder7 commented Oct 27, 2023

Fixes

Makes the Get contacts by emails endpoint usable by adding the relative phpDoc method.

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

- Add missing endpoint support
- Fix typos in CONTRIBUTING.md example
@funder7 funder7 changed the title Add support for "Get Contacts by Emails" endpoint feat: add support for "Get Contacts by Emails" endpoint Oct 27, 2023
@funder7
Copy link
Author

funder7 commented Oct 30, 2023

@twilio-dx any news about this PR? Thanks

@tiwarishubham635
Copy link
Contributor

Hi @funder7! We have added this to our list and looking into it. Thanks!

@tiwarishubham635
Copy link
Contributor

Hi @funder7! I just check this one. The endpoint is already accessible if you have your contacts added. It throws 404 when there are no contacts previously added. I firstly created a contact with my sendgrid account with some email id say - test@example.com. Then I executed this script and it wokred for me giving a 200 response and fetched the required contact.

`<?php
// Uncomment next line if you're not using a dependency loader (such as Composer)
// require_once '/sendgrid-php.php';

$apiKey = getenv('SENDGRID_API_KEY');
$sg = new \SendGrid($apiKey);
$request_body = json_decode('{
"emails": [
"test@example.com"
]
}');

try {
$response = $sg->client->marketing()->contacts()->search()->emails()->post($request_body);
print $response->statusCode() . "\n";
print_r($response->headers());
print $response->body() . "\n";
} catch (Exception $ex) {
echo 'Caught exception: '. $ex->getMessage();
}`
So I don't think this change is required. Can you check?

@funder7
Copy link
Author

funder7 commented Sep 20, 2024

Hi @tiwarishubham635, some time passed since my PR :-)
As far as I can remember, I only added the emails() method into Client.php, which enables correct autocompletion while writing code.
I was implementing what is written in Sendgrid's documentation and realized that emails was present there, but not in the code, so I added it.

Being something related to phpDoc only, and not an actual implementation, the update is totally transparent regarding how the API works, the only purpose is to help during development.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants