feat: add support for "Get Contacts by Emails" endpoint
Fixes
Makes the Get contacts by emails endpoint usable by adding the relative phpDoc method.
Checklist
- [x] I acknowledge that all my contributions will be made under the project's license
- [x] I have made a material change to the repo (functionality, testing, spelling, grammar)
- [x] I have read the Contribution Guidelines and my PR follows them
- [x] I have titled the PR appropriately
- [x] 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
- [x] I have added inline documentation to the code I modified
@twilio-dx any news about this PR? Thanks
Hi @funder7! We have added this to our list and looking into it. Thanks!
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 - [email protected]. 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 '<PATH TO>/sendgrid-php.php';
$apiKey = getenv('SENDGRID_API_KEY'); $sg = new \SendGrid($apiKey); $request_body = json_decode('{ "emails": [ "[email protected]" ] }');
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?
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