diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-03-04 22:46:36 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-03-04 22:46:36 +0000 |
commit | a3e1b0ff748a71a4f38318cf10d544ff066d74f5 (patch) | |
tree | 477c60d14888cd71c8f4d624c1facf6a6c818d9b | |
parent | bb0d1245239c19a8554794e7463635a1bd2eba76 (diff) | |
download | Post-SMTP-a3e1b0ff748a71a4f38318cf10d544ff066d74f5.zip |
add the sendgrid sdk 6
git-svn-id: https://plugins.svn.wordpress.org/post-smtp/trunk@1833309 b8457f37-d9ea-0310-8a92-e5e31aec5664
81 files changed, 15683 insertions, 0 deletions
diff --git a/Postman/Postman-Mail/sendgrid/.editorconfig b/Postman/Postman-Mail/sendgrid/.editorconfig new file mode 100644 index 0000000..e18928d --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*.php] +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/Postman/Postman-Mail/sendgrid/.gitignore b/Postman/Postman-Mail/sendgrid/.gitignore new file mode 100644 index 0000000..6df0272 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/.gitignore @@ -0,0 +1,7 @@ +test/coverage/* +examples/* +dist/ +composer.lock +vendor +.env* +sendgrid-php.php diff --git a/Postman/Postman-Mail/sendgrid/.travis.yml b/Postman/Postman-Mail/sendgrid/.travis.yml new file mode 100644 index 0000000..11fc944 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/.travis.yml @@ -0,0 +1,35 @@ +language: php +before_script: +- phpenv local 5.4 +- composer install --dev --no-interaction +- phpenv local --unset +- cd test +script: +- "../vendor/bin/phpunit --coverage-clover clover.xml" +after_script: +- cd .. +- phpenv local 5.4 +- phpenv local --unset +- "./scripts/s3upload.sh" +php: +- 5.3 +- 5.4 +- 5.5 +- 5.6 +env: + global: + - S3_POLICY: ewogICJleHBpcmF0aW9uIjogIjIxMDAtMDEtMDFUMTI6MDA6MDAuMDAwWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImFjbCI6ICJwdWJsaWMtcmVhZCIgfSwKICAgIHsiYnVja2V0IjogInNlbmRncmlkLW9wZW4tc291cmNlIiB9LAogICAgWyJzdGFydHMtd2l0aCIsICIka2V5IiwgInNlbmRncmlkLXBocC8iXSwKICAgIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAyMDQ4LCAyNjg0MzU0NTZdLAogICAgWyJlcSIsICIkQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3ppcCJdCiAgXQp9Cgo= + - secure: eUN0huKA436uIkISu6V3yW01/gZHC6slBvlnprMPEhzclU2szH6qhWEXWS5CcOG6EEDBReqLZdNAwu+FC69KGFO9+6oW2GQQLSsfEViqFi/Ig2N0r4EBO4jLRebgq0GOfetPwQvJH27d8BCiloPy8rXBb5pskxSNw4B4bRyXHz4= + - secure: j38xzMNmzYXR/JJdVumPmDoDVxb6FUDF497AuVPHowGh0egFW8XHWCOMeQWqWZI4Gg17pViQNIJ3xC6WBvob70AF8fsNm0+vxF2s7abXDMcbq5flLTS6ydKLgNu+na/RAkOBbTwxJAGIH/fQh8BH8iGKerCwoqf8sDErAge4NMw= + - secure: h3HlxBOsNXBDrIJ0yl467ST6Q8R2TmbL7PltlPcRoHy5gAxn5UiDv5W2+6DSXrwQrTjOUunZ+O9ckcaQGQy1JNhGMwgIkJpyWAHDIHhTYGU289uUIDTHQW/soX0qHJSHSx3iMgDOIc7XnfTz6W7Nv1gYKZFedOMsZ5uBMeGyiXE= + - secure: SKSl/RHFQNhGT7OUj7E0AbrQnuDhhCRI/4jC76mmzvy8EJBDgUNevAKJGtug+LVilHrlbk9fLC8rayPW6SGv0s3PowTGm8NMOc48aRBLOr7QRo/sMikJCmRuU6HWptr0NKuf2fq6lV94WDm/pDdyOSNyLga9/eaIDs/Sacp78sw= +notifications: + hipchat: + rooms: + secure: l4RUOBY44kVhSxx54NU3cmvn598rRMB7Y272Ct/W0fBm1tdGncp42A/rwg7JkiZH9EWXs3tKtoSjqw5xT6QeScUGQDdykS5QVO8lEIkDRGD4WwQ3VDJmRy1+04WtgqFEK8SyYTCcCl4ZJ0rtOcJZgDMvigkOJuLxwGXTDuvfu1k= + template: + - '<a href="https://travis-ci.org/%{repository}/builds/%{build_id}">%{repository} + Build %{build_number}</a> on branch <i>%{branch}</i> by %{author}: <strong>%{message}</strong> + <a href="https://github.com/sendgrid/docs/commits/%{commit}">View on GitHub</a>' + format: html + notify: true diff --git a/Postman/Postman-Mail/sendgrid/composer.json b/Postman/Postman-Mail/sendgrid/composer.json new file mode 100644 index 0000000..dbcdefd --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "sendgrid/sendgrid": "~6.0" + } +} diff --git a/Postman/Postman-Mail/sendgrid/composer.lock b/Postman/Postman-Mail/sendgrid/composer.lock new file mode 100644 index 0000000..22d21cb --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/composer.lock @@ -0,0 +1,117 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "72f70d0a56dace06ee80667ae9467dc2", + "content-hash": "31a416743df03ec89ce9f557ff36c18e", + "packages": [ + { + "name": "sendgrid/php-http-client", + "version": "3.8.0", + "source": { + "type": "git", + "url": "https://github.com/sendgrid/php-http-client.git", + "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/929018c62b7fcd99b3b356216ae75fff4d47b5a1", + "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.4", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "SendGrid\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Bernier", + "email": "dx@sendgrid.com" + }, + { + "name": "Elmer Thomas", + "email": "elmer@thinkingserious.com" + } + ], + "description": "HTTP REST client, simplified for PHP", + "homepage": "http://github.com/sendgrid/php-http-client", + "keywords": [ + "api", + "fluent", + "http", + "rest", + "sendgrid" + ], + "time": "2017-09-13 16:52:38" + }, + { + "name": "sendgrid/sendgrid", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/sendgrid/sendgrid-php.git", + "reference": "8db454e4b5674b545c207a162b64202b0d63259b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/8db454e4b5674b545c207a162b64202b0d63259b", + "reference": "8db454e4b5674b545c207a162b64202b0d63259b", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sendgrid/php-http-client": "~3.7" + }, + "replace": { + "sendgrid/sendgrid-php": "*" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "autoload": { + "files": [ + "lib/SendGrid.php", + "lib/helpers/mail/Mail.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", + "homepage": "http://github.com/sendgrid/sendgrid-php", + "keywords": [ + "email", + "grid", + "send", + "sendgrid" + ], + "time": "2017-07-01 04:30:16" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/Postman/Postman-Mail/sendgrid/sendgrid-php.php b/Postman/Postman-Mail/sendgrid/sendgrid-php.php new file mode 100644 index 0000000..47449d1 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/sendgrid-php.php @@ -0,0 +1,5 @@ +<?php +if ( ! class_exists('\\SendGrid\\Client') ) { + require 'vendor/autoload.php'; +} +?>
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/autoload.php b/Postman/Postman-Mail/sendgrid/vendor/autoload.php new file mode 100644 index 0000000..cb30775 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/autoload.php @@ -0,0 +1,7 @@ +<?php + +// autoload.php @generated by Composer + +require_once __DIR__ . '/composer' . '/autoload_real.php'; + +return ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68::getLoader(); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/ClassLoader.php b/Postman/Postman-Mail/sendgrid/vendor/composer/ClassLoader.php new file mode 100644 index 0000000..ff6ecfb --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/ClassLoader.php @@ -0,0 +1,413 @@ +<?php + +/* + * This file is part of Composer. + * + * (c) Nils Adermann <naderman@naderman.de> + * Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier <fabien@symfony.com> + * @author Jordi Boggiano <j.boggiano@seld.be> + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + + private $classMapAuthoritative = false; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative) { + return false; + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if ($file === null && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if ($file === null) { + // Remember that this class does not exist. + return $this->classMap[$class] = false; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { + if (0 === strpos($class, $prefix)) { + foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/LICENSE b/Postman/Postman-Mail/sendgrid/vendor/composer/LICENSE new file mode 100644 index 0000000..ee274f1 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/LICENSE @@ -0,0 +1,433 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Composer +Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be> +Source: https://github.com/composer/composer + +Files: * +Copyright: 2016, Nils Adermann <naderman@naderman.de> + 2016, Jordi Boggiano <j.boggiano@seld.be> +License: Expat + +Files: res/cacert.pem +Copyright: 2015, Mozilla Foundation +License: MPL-2.0 + +Files: src/Composer/Util/RemoteFilesystem.php + src/Composer/Util/TlsHelper.php +Copyright: 2016, Nils Adermann <naderman@naderman.de> + 2016, Jordi Boggiano <j.boggiano@seld.be> + 2013, Evan Coury <me@evancoury.com> +License: Expat and BSD-2-Clause + +License: BSD-2-Clause + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + . + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + . + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is furnished + to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +License: MPL-2.0 + 1. Definitions + -------------- + . + 1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + . + 1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + . + 1.3. "Contribution" + means Covered Software of a particular Contributor. + . + 1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + . + 1.5. "Incompatible With Secondary Licenses" + means + . + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + . + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + . + 1.6. "Executable Form" + means any form of the work other than Source Code Form. + . + 1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + . + 1.8. "License" + means this document. + . + 1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + . + 1.10. "Modifications" + means any of the following: + . + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + . + (b) any new file in Source Code Form that contains any Covered + Software. + . + 1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + . + 1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + . + 1.13. "Source Code Form" + means the form of the work preferred for making modifications. + . + 1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + . + 2. License Grants and Conditions + -------------------------------- + . + 2.1. Grants + . + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + . + (a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + . + (b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + . + 2.2. Effective Date + . + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + . + 2.3. Limitations on Grant Scope + . + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + . + (a) for any code that a Contributor has removed from Covered Software; + or + . + (b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + . + (c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + . + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + . + 2.4. Subsequent Licenses + . + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + . + 2.5. Representation + . + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights + to grant the rights to its Contributions conveyed by this License. + . + 2.6. Fair Use + . + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + . + 2.7. Conditions + . + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted + in Section 2.1. + . + 3. Responsibilities + ------------------- + . + 3.1. Distribution of Source Form + . + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + . + 3.2. Distribution of Executable Form + . + If You distribute Covered Software in Executable Form then: + . + (a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + . + (b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + . + 3.3. Distribution of a Larger Work + . + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + . + 3.4. Notices + . + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, + or limitations of liability) contained within the Source Code Form of + the Covered Software, except that You may alter any license notices to + the extent required to remedy known factual inaccuracies. + . + 3.5. Application of Additional Terms + . + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + . + 4. Inability to Comply Due to Statute or Regulation + --------------------------------------------------- + . + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Software due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description must + be placed in a text file included with all distributions of the Covered + Software under this License. Except to the extent prohibited by statute + or regulation, such description must be sufficiently detailed for a + recipient of ordinary skill to be able to understand it. + . + 5. Termination + -------------- + . + 5.1. The rights granted under this License will terminate automatically + if You fail to comply with any of its terms. However, if You become + compliant, then the rights granted under this License from a particular + Contributor are reinstated (a) provisionally, unless and until such + Contributor explicitly and finally terminates Your grants, and (b) on an + ongoing basis, if such Contributor fails to notify You of the + non-compliance by some reasonable means prior to 60 days after You have + come back into compliance. Moreover, Your grants from a particular + Contributor are reinstated on an ongoing basis if such Contributor + notifies You of the non-compliance by some reasonable means, this is the + first time You have received notice of non-compliance with this License + from such Contributor, and You become compliant prior to 30 days after + Your receipt of the notice. + . + 5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + . + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all + end user license agreements (excluding distributors and resellers) which + have been validly granted by You or Your distributors under this License + prior to termination shall survive termination. + . + ************************************************************************ + * * + * 6. Disclaimer of Warranty * + * ------------------------- * + * * + * Covered Software is provided under this License on an "as is" * + * basis, without warranty of any kind, either expressed, implied, or * + * statutory, including, without limitation, warranties that the * + * Covered Software is free of defects, merchantable, fit for a * + * particular purpose or non-infringing. The entire risk as to the * + * quality and performance of the Covered Software is with You. * + * Should any Covered Software prove defective in any respect, You * + * (not any Contributor) assume the cost of any necessary servicing, * + * repair, or correction. This disclaimer of warranty constitutes an * + * essential part of this License. No use of any Covered Software is * + * authorized under this License except under this disclaimer. * + * * + ************************************************************************ + . + ************************************************************************ + * * + * 7. Limitation of Liability * + * -------------------------- * + * * + * Under no circumstances and under no legal theory, whether tort * + * (including negligence), contract, or otherwise, shall any * + * Contributor, or anyone who distributes Covered Software as * + * permitted above, be liable to You for any direct, indirect, * + * special, incidental, or consequential damages of any character * + * including, without limitation, damages for lost profits, loss of * + * goodwill, work stoppage, computer failure or malfunction, or any * + * and all other commercial damages or losses, even if such party * + * shall have been informed of the possibility of such damages. This * + * limitation of liability shall not apply to liability for death or * + * personal injury resulting from such party's negligence to the * + * extent applicable law prohibits such limitation. Some * + * jurisdictions do not allow the exclusion or limitation of * + * incidental or consequential damages, so this exclusion and * + * limitation may not apply to You. * + * * + ************************************************************************ + . + 8. Litigation + ------------- + . + Any litigation relating to this License may be brought only in the + courts of a jurisdiction where the defendant maintains its principal + place of business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. + Nothing in this Section shall prevent a party's ability to bring + cross-claims or counter-claims. + . + 9. Miscellaneous + ---------------- + . + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides + that the language of a contract shall be construed against the drafter + shall not be used to construe this License against a Contributor. + . + 10. Versions of the License + --------------------------- + . + 10.1. New Versions + . + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + . + 10.2. Effect of New Versions + . + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + . + 10.3. Modified Versions + . + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + . + 10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses + . + If You choose to distribute Source Code Form that is Incompatible With + Secondary Licenses under the terms of this version of the License, the + notice described in Exhibit B of this License must be attached. + . + Exhibit A - Source Code Form License Notice + ------------------------------------------- + . + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + . + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to look + for such a notice. + . + You may add additional accurate notices of copyright ownership. + . + Exhibit B - "Incompatible With Secondary Licenses" Notice + --------------------------------------------------------- + . + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_classmap.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..7a91153 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ +<?php + +// autoload_classmap.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( +); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php new file mode 100644 index 0000000..c6a74bd --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php @@ -0,0 +1,11 @@ +<?php + +// autoload_files.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( + '3f8bdd3b35094c73a26f0106e3c0f8b2' => $vendorDir . '/sendgrid/sendgrid/lib/SendGrid.php', + '9dda55337a76a24e949fbcc5d905a2c7' => $vendorDir . '/sendgrid/sendgrid/lib/helpers/mail/Mail.php', +); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_namespaces.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..b7fc012 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ +<?php + +// autoload_namespaces.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( +); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php new file mode 100644 index 0000000..89751b9 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php @@ -0,0 +1,10 @@ +<?php + +// autoload_psr4.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( + 'SendGrid\\' => array($vendorDir . '/sendgrid/php-http-client/lib'), +); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php new file mode 100644 index 0000000..81518bf --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php @@ -0,0 +1,59 @@ +<?php + +// autoload_real.php @generated by Composer + +class ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68 +{ + private static $loader; + + public static function loadClassLoader($class) + { + if ('Composer\Autoload\ClassLoader' === $class) { + require __DIR__ . '/ClassLoader.php'; + } + } + + public static function getLoader() + { + if (null !== self::$loader) { + return self::$loader; + } + + spl_autoload_register(array('ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68', 'loadClassLoader'), true, true); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + spl_autoload_unregister(array('ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68', 'loadClassLoader')); + + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + + $loader->register(true); + + $includeFiles = require __DIR__ . '/autoload_files.php'; + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire31a2dc55ed2dc338fb6b79b1af891c68($fileIdentifier, $file); + } + + return $loader; + } +} + +function composerRequire31a2dc55ed2dc338fb6b79b1af891c68($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json b/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json new file mode 100644 index 0000000..b3d9001 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json @@ -0,0 +1,104 @@ +[ + { + "name": "sendgrid/php-http-client", + "version": "3.8.0", + "version_normalized": "3.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/sendgrid/php-http-client.git", + "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/929018c62b7fcd99b3b356216ae75fff4d47b5a1", + "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.4", + "squizlabs/php_codesniffer": "~2.0" + }, + "time": "2017-09-13 16:52:38", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "SendGrid\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Bernier", + "email": "dx@sendgrid.com" + }, + { + "name": "Elmer Thomas", + "email": "elmer@thinkingserious.com" + } + ], + "description": "HTTP REST client, simplified for PHP", + "homepage": "http://github.com/sendgrid/php-http-client", + "keywords": [ + "api", + "fluent", + "http", + "rest", + "sendgrid" + ] + }, + { + "name": "sendgrid/sendgrid", + "version": "6.0.0", + "version_normalized": "6.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sendgrid/sendgrid-php.git", + "reference": "8db454e4b5674b545c207a162b64202b0d63259b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/8db454e4b5674b545c207a162b64202b0d63259b", + "reference": "8db454e4b5674b545c207a162b64202b0d63259b", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sendgrid/php-http-client": "~3.7" + }, + "replace": { + "sendgrid/sendgrid-php": "*" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "squizlabs/php_codesniffer": "2.*" + }, + "time": "2017-07-01 04:30:16", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "lib/SendGrid.php", + "lib/helpers/mail/Mail.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", + "homepage": "http://github.com/sendgrid/sendgrid-php", + "keywords": [ + "email", + "grid", + "send", + "sendgrid" + ] + } +] diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE new file mode 100644 index 0000000..f6eac95 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE @@ -0,0 +1,17 @@ +#### Issue Summary + +A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples. + + +#### Steps to Reproduce + +1. This is the first step +2. This is the second step +3. Further steps, etc. + +Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead? + +#### Technical details: + +* php-http-client Version: master (latest commit: [commit number]) +* PHP Version: 5.x diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore new file mode 100644 index 0000000..bc9ed87 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore @@ -0,0 +1,6 @@ +.env +*.lock +vendor/ +*.old +.idea/ +*.phar diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml new file mode 100644 index 0000000..c9ad9ca --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml @@ -0,0 +1,25 @@ +language: php +before_script: +- composer install --dev --no-interaction +- cd test/unit +script: +- ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* --coverage-clover clover.xml +php: +- 5.6 +- 7.0 +env: + global: + - secure: eUN0huKA436uIkISu6V3yW01/gZHC6slBvlnprMPEhzclU2szH6qhWEXWS5CcOG6EEDBReqLZdNAwu+FC69KGFO9+6oW2GQQLSsfEViqFi/Ig2N0r4EBO4jLRebgq0GOfetPwQvJH27d8BCiloPy8rXBb5pskxSNw4B4bRyXHz4= + - secure: j38xzMNmzYXR/JJdVumPmDoDVxb6FUDF497AuVPHowGh0egFW8XHWCOMeQWqWZI4Gg17pViQNIJ3xC6WBvob70AF8fsNm0+vxF2s7abXDMcbq5flLTS6ydKLgNu+na/RAkOBbTwxJAGIH/fQh8BH8iGKerCwoqf8sDErAge4NMw= + - secure: h3HlxBOsNXBDrIJ0yl467ST6Q8R2TmbL7PltlPcRoHy5gAxn5UiDv5W2+6DSXrwQrTjOUunZ+O9ckcaQGQy1JNhGMwgIkJpyWAHDIHhTYGU289uUIDTHQW/soX0qHJSHSx3iMgDOIc7XnfTz6W7Nv1gYKZFedOMsZ5uBMeGyiXE= + - secure: SKSl/RHFQNhGT7OUj7E0AbrQnuDhhCRI/4jC76mmzvy8EJBDgUNevAKJGtug+LVilHrlbk9fLC8rayPW6SGv0s3PowTGm8NMOc48aRBLOr7QRo/sMikJCmRuU6HWptr0NKuf2fq6lV94WDm/pDdyOSNyLga9/eaIDs/Sacp78sw= +notifications: + hipchat: + rooms: + secure: EFEaChRQCOLvxAvmxJe357CbfJ/wpW7ddhU0dqUljawSKbdeTkoF0Ja2NbtnIPVpJrqN9qT8BXTK3fmsJ7OJO+QCLi0R2FPnI7r+GpmjFqkxHO0KJ/Oiv1kB9jL1UcKuwhSsPubWPRvt4TKuDhEefuZb1X2xSFZZAzqROrLKtqUmy9vgpRYZtxmGRTGLfLmih8DJP96yvIOE/7/lp8lEdmXw4xF1NZtshnOiOLYrahY4pcOSl3y7eepzaGA33wWS/truH0Rh/IgTOYP2Z/ujIZE9Eg6nSwwOI8U2XzK/BEwEhrHCeyj3oAoBoGbO/m9ydaM6QM8/VT3JdVHPIWFpIhCioClwrIs3m1KsoMVeqEbuWF3h+ju6RMve5fCNvGV8tUyKpZ8GEVlEc7WdwkSKXeINgRLv7AykybZ6EkCRPkQ61/h+cNQlwKqtfeUaoBwjGAnfMQMQX5qApUn/ow8TbULnveqswhkV1fBsydiPBJxdlDe8x54GclCmgU5wnd283THUecP+8dznU+xVgfHqBnf2k9wirSEnYXh2T228kYUmEWKfhRq/7e86K2DAQAO5Vw/6HgL7e1ZVDccH6hx3lTGyjlUskkZvzktwi6gZ9gxOihQ8Yzkc1IQANr8ckQJvOZjMTQxJqgFWgXJWgRxWlpPiISLauaegcH2eNwGPRmY= + template: + - '<a href="https://travis-ci.org/%{repository}/builds/%{build_id}">%{repository} + Build %{build_number}</a> on branch <i>%{branch}</i> by %{author}: <strong>%{message}</strong> + <a href="https://github.com/%{repository}/commits/%{commit}">View on GitHub</a>' + format: html + notify: true
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md new file mode 100644 index 0000000..fb45f8d --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md @@ -0,0 +1,64 @@ +# Change Log +All notable changes to this project will be documented in this file. + +This project adheres to [Semantic Versioning](http://semver.org/). + +## [3.8.0] - 2017-09-13 +### Added +- Pull request #23: [Automatically retry when rate limit is reached](https://github.com/sendgrid/php-http-client/pull/23) +- Thanks to [Budi Chandra](https://github.com/budirec) for the pull request! + +## [3.7.0] - 2017-05-04 +### Added +- Pull request #19: [Added ability to get headers as associative array](https://github.com/sendgrid/php-http-client/pull/19) +- Solves issue #361: [https://github.com/sendgrid/sendgrid-php/issues/361](https://github.com/sendgrid/sendgrid-php/issues/361) +- Thanks to [Alexander](https://github.com/mazanax) for the pull request! + +## [3.6.0] - 2017-03-01 +### Added +- Pull request #16: [Pass the curlOptions to the client in buildClient](https://github.com/sendgrid/php-http-client/pull/16) +- Thanks to [Baptiste Clavié](https://github.com/Taluu) for the pull request! + +## [3.5.1] - 2016-11-17 +### Fixed +- Pull request #13, fixed issue #12: [Change from to php union operator to combine curl options](https://github.com/sendgrid/php-http-client/pull/13) +- Thanks to [emil](https://github.com/emilva) for the pull request! + +## [3.5.0] - 2016-10-18 +### Added +- Pull request #11: [Added curlOptions property to customize curl instance](https://github.com/sendgrid/php-http-client/pull/11) +- Thanks to [Alain Tiemblo](https://github.com/ninsuo) for the pull request! + +## [3.4.0] - 2016-09-27 +### Added +- Pull request #9: [Add getters for certain properties](https://github.com/sendgrid/php-http-client/pull/9) +- Thanks to [Arjan Keeman](https://github.com/akeeman) for the pull request! + +## [3.3.0] - 2016-09-13 +### Added +- Pull request #6: [Library refactoring around PSR-2 / PSR-4 code standards](https://github.com/sendgrid/php-http-client/pull/6) +- Thanks to [Alexandr Ivanov](https://github.com/misantron) for the pull request! + +## [3.1.0] - 2016-06-10 +### Added +- Automatically add Content-Type: application/json when there is a request body + +## [3.0.0] - 2016-06-06 +### Changed +- Made the Request and Response variables non-redundant. e.g. request.requestBody becomes request.body + +## [2.0.2] - 2016-02-29 +### Fixed +- Renaming files to conform to PSR-0, git ignored the case in 2.0.1 + +## [2.0.1] - 2016-02-29 +### Fixed +- Renaming files to conform to PSR-0 + +## [1.0.1] - 2016-02-29 +### Fixed +- Composer/Packagist install issues resolved + +## [1.0.0] - 2016-02-29 +### Added +- We are live! diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md new file mode 100644 index 0000000..6350054 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md @@ -0,0 +1,194 @@ +Hello! Thank you for choosing to help contribute to one of the SendGrid open source projects. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies. + +- [CLAs and CCLAs](#cla) +- [Roadmap & Milestones](#roadmap) +- [Feature Request](#feature_request) +- [Submit a Bug Report](#submit_a_bug_report) +- [Improvements to the Codebase](#improvements_to_the_codebase) +- [Understanding the Code Base](#understanding_the_codebase) +- [Testing](#testing) +- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions) +- [Creating a Pull Request](#creating_a_pull_request) + +<a name="roadmap"></a> +We use [Milestones](https://github.com/sendgrid/php-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged. + +<a name="cla"></a> +## CLAs and CCLAs + +Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) be filled out by every contributor to a SendGrid open source project. + +Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution. + +SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA. Copies of the CLA are available [here](https://gist.github.com/SendGridDX/98b42c0a5d500058357b80278fde3be8#file-sendgrid_cla). + +When you create a Pull Request, after a few seconds, a comment will appear with a link to the CLA. Click the link and fill out the brief form and then click the "I agree" button and you are all set. You will not be asked to re-sign the CLA unless we make a change. + +There are a few ways to contribute, which we'll enumerate below: + +<a name="feature_request"></a> +## Feature Request + +If you'd like to make a feature request, please read this section. + +The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions: + +- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests. +- Please be respectful and considerate of others when commenting on issues + +<a name="submit_a_bug_report"></a> +## Submit a Bug Report + +Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public. + +A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report. + +Before you decide to create a new issue, please try the following: + +1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post. +2. Update to the latest version of this code and check if issue has already been fixed +3. Copy and fill in the Bug Report Template we have provided below + +### Please use our Bug Report Template + +In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/php-http-client/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting. + +<a name="improvements_to_the_codebase"></a> +## Improvements to the Codebase + +We welcome direct contributions to the php-http-client code base. Thank you! + +### Development Environment ### + +#### Install and Run Locally #### + +##### Prerequisites ##### + +- PHP 5.6 or 7.0 +- [Composer](https://getcomposer.org/) + +##### Initial setup: ##### + +```bash +git clone https://github.com/sendgrid/php-http-client.git +cd php-http-client +``` + +## Environment Variables + +First, get your free SendGrid account [here](https://sendgrid.com/free?source=php-http-client). + +Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys). + +```bash +echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env +echo "sendgrid.env" >> .gitignore +source ./sendgrid.env +``` + +##### Execute: ##### + +See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples +<a name="understanding_the_codebase"></a> +## Understanding the Code Base + +**/examples** + +Working examples that demonstrate usage. + +**/test/unit** + +Unit tests. + +**/lib/SendGrid/Client.php** + +An HTTP client with a fluent interface using method chaining and reflection. By returning self on [__call](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L212) and [_()](https://github.com/sendgrid/php-http-client/blob/master/lib/client.pph#L198), we can dynamically build the URL using method chaining and [__call](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L212) allows us to dynamically receive the method calls to achieve reflection. + +This allows for the following mapping from a URL to a method chain: + +`/api_client/{api_key_id}/version` maps to `client->api_client().->_($api_key_id)->version-><method>()` where <method> is a [HTTP verb](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L94). + +**/lib/SendGrid/Config.php** + +Loads the environment variables. + +<a name="testing"></a> +## Testing + +All PRs require passing tests before the PR will be reviewed. + +All test files are in the [`/test/unit`](https://github.com/sendgrid/php-http-client/tree/master/test/unit) directory. + +For the purposes of contributing to this repo, please update the [`ClientTest.php`](https://github.com/sendgrid/php-http-client/blob/master/test/unit/ClientTest.php) file with unit tests as you modify the code. + +```bash +composer install +cd test/unit +../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* +``` + +<a name="style_guidelines_and_naming_conventions"></a> +## Style Guidelines & Naming Conventions + +Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning. + +- [pear coding standards](https://pear.php.net/manual/en/standards.php) + +Please run your code through: + +- [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) + +## Creating a Pull Request<a name="creating_a_pull_request"></a> + +1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork, + and configure the remotes: + + ```bash + # Clone your fork of the repo into the current directory + git clone https://github.com/sendgrid/php-http-client + # Navigate to the newly cloned directory + cd sendgrid-python + # Assign the original repo to a remote called "upstream" + git remote add upstream https://github.com/sendgrid/php-http-client + ``` + +2. If you cloned a while ago, get the latest changes from upstream: + + ```bash + git checkout <dev-branch> + git pull upstream <dev-branch> + ``` + +3. Create a new topic branch (off the main project development branch) to + contain your feature, change, or fix: + + ```bash + git checkout -b <topic-branch-name> + ``` + +4. Commit your changes in logical chunks. Please adhere to these [git commit + message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) + or your code is unlikely be merged into the main project. Use Git's + [interactive rebase](https://help.github.com/articles/interactive-rebase) + feature to tidy up your commits before making them public. + +4a. Create tests. + +4b. Create or update the example code that demonstrates the functionality of this change to the code. + +5. Locally merge (or rebase) the upstream development branch into your topic branch: + + ```bash + git pull [--rebase] upstream master + ``` + +6. Push your topic branch up to your fork: + + ```bash + git push origin <topic-branch-name> + ``` + +7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) + with a clear title and description against the `master` branch. All tests must be passing before we will review the PR. + +If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo. diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt new file mode 100644 index 0000000..c1631d6 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2016 SendGrid, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md new file mode 100644 index 0000000..0eb7ce8 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md @@ -0,0 +1,103 @@ +[![Travis Badge](https://travis-ci.org/sendgrid/php-http-client.svg?branch=master)](https://travis-ci.org/sendgrid/php-http-client) + +**Quickly and easily access any RESTful or RESTful-like API.** + +If you are looking for the SendGrid API client library, please see [this repo](https://github.com/sendgrid/sendgrid-php). + +# Announcements + +All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/php-http-client/blob/master/CHANGELOG.md). + +# Installation + +## Prerequisites + +- PHP version 5.6 or 7.0 + +## Install with Composer + +Add php-http-client to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application. + +```json +{ + "require": { + "sendgrid/php-http-client": "~3.8" + } +} +``` + +Then at the top of your PHP script require the autoloader: + +```php +require __DIR__ . '/vendor/autoload.php'; +``` + +Then from the command line: + +```bash +composer install +``` + +# Quick Start + +Here is a quick example: + +`GET /your/api/{param}/call` + +```php +require 'vendor/autoload.php'; +$global_headers = array(Authorization: Basic XXXXXXX); +$client = SendGrid\Client('base_url', global_headers); +$response = $client->your()->api()->_($param)->call()->get(); +print $response->statusCode(); +print $response->headers(); +print $response->body(); +``` + +`POST /your/api/{param}/call` with headers, query parameters and a request body with versioning. + +```php +require 'vendor/autoload.php'; +$global_headers = array(Authorization: Basic XXXXXXX); +$client = SendGrid\Client('base_url', global_headers); +$query_params = array('hello' => 0, 'world' => 1); +$request_headers = array('X-Test' => 'test'); +$data = array('some' => 1, 'awesome' => 2, 'data' => 3); +$response = $client->your()->api()->_($param)->call()->post('data', + 'query_params', + 'request_headers'); +print $response->statusCode(); +print $response->headers(); +print $response->body(); +``` + +# Usage + +- [Example Code](https://github.com/sendgrid/php-http-client/tree/master/examples) + +## Roadmap + +If you are intersted in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/php-http-client/milestones). We would love to hear your feedback. + +## How to Contribute + +We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)) guide for details. + +Quick links: + +- [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#feature_request) +- [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#submit_a_bug_report) +- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#cla) +- [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#improvements_to_the_codebase) + +# Thanks + +We were inspired by the work done on [birdy](https://github.com/inueni/birdy) and [universalclient](https://github.com/dgreisen/universalclient). + +# About + +php-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). + +php-http-client is maintained and funded by SendGrid, Inc. The names and logos for php-http-client are trademarks of SendGrid, Inc. + +![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json new file mode 100644 index 0000000..80b219b --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json @@ -0,0 +1,36 @@ +{ + "name": "sendgrid/php-http-client", + "description": "HTTP REST client, simplified for PHP", + "type": "library", + "version": "3.8.0", + "require-dev": { + "phpunit/phpunit": "~4.4", + "squizlabs/php_codesniffer": "~2.0" + }, + "homepage": "http://github.com/sendgrid/php-http-client", + "keywords": ["SendGrid", "HTTP", "REST", "API", "Fluent"], + "license": "MIT", + "authors": [ + { + "name": "Matt Bernier", + "email": "dx@sendgrid.com" + }, + { + "name": "Elmer Thomas", + "email": "elmer@thinkingserious.com" + } + ], + "require": { + "php": ">=5.6" + }, + "autoload": { + "psr-4": { + "SendGrid\\": "lib/" + } + }, + "autoload-dev": { + "psr-4": { + "SendGrid\\Test\\": "test/unit/" + } + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/examples/example.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/examples/example.php new file mode 100644 index 0000000..4ec9c73 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/examples/example.php @@ -0,0 +1,78 @@ +<?php + +// If running this outside of this context, use the following include and +// comment out the two includes below +// require __DIR__ . '/vendor/autoload.php'; +include(dirname(__DIR__) . '/lib/Client.php'); +// This gets the parent directory, for your current directory use getcwd() +$path_to_config = dirname(__DIR__); +$apiKey = getenv('SENDGRID_API_KEY'); +$headers = ['Authorization: Bearer ' . $apiKey]; +$client = new SendGrid\Client('https://api.sendgrid.com', $headers, '/v3'); + +// GET Collection +$query_params = ['limit' => 100, 'offset' => 0]; +$request_headers = ['X-Mock: 200']; +$response = $client->api_keys()->get(null, $query_params, $request_headers); +echo $response->statusCode(); +echo $response->body(); +echo $response->headers(); + +// GET with auto retry on rate limit +$query_params = ['limit' => 100, 'offset' => 0]; +$request_headers = ['X-Mock: 200']; +$retryOnLimit = true; +$response = $client->api_keys()->get(null, $query_params, $request_headers, $retryOnLimit); +echo $response->statusCode(); +echo $response->body(); +echo $response->headers(); + +// POST +$request_body = [ + 'name' => 'My PHP API Key', + 'scopes' => [ + 'mail.send', + 'alerts.create', + 'alerts.read' + ] +]; +$response = $client->api_keys()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +echo $response->headers(); +$response_body = json_decode($response->body()); +$api_key_id = $response_body->api_key_id; + +// GET Single +$response = $client->version('/v3')->api_keys()->_($api_key_id)->get(); +echo $response->statusCode(); +echo $response->body(); +echo $response->headers(); + +// PATCH +$request_body = [ + 'name' => 'A New Hope' +]; +$response = $client->api_keys()->_($api_key_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +echo $response->headers(); + +// PUT +$request_body = [ + 'name' => 'A New Hope', + 'scopes' => [ + 'user.profile.read', + 'user.profile.update' + ] +]; +$response = $client->api_keys()->_($api_key_id)->put($request_body); +echo $response->statusCode(); +echo $response->body(); +echo $response->headers(); + +// DELETE +$response = $client->api_keys()->_($api_key_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +echo $response->headers(); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php new file mode 100644 index 0000000..d3ca94d --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php @@ -0,0 +1,235 @@ +<?php + +/** + * HTTP Client library + * + * PHP version 5.4 + * + * @author Matt Bernier <dx@sendgrid.com> + * @author Elmer Thomas <dx@sendgrid.com> + * @copyright 2016 SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: <git_id> + * @link http://packagist.org/packages/sendgrid/php-http-client + */ + +namespace SendGrid; + +/** + * Quickly and easily access any REST or REST-like API. + */ +class Client +{ + /** @var string */ + protected $host; + /** @var array */ + protected $headers; + /** @var string */ + protected $version; + /** @var array */ + protected $path; + /** @var array */ + protected $curlOptions; + /** @var array */ + private $methods; + /** @var bool */ + private $retryOnLimit; + + /** + * Initialize the client + * + * @param string $host the base url (e.g. https://api.sendgrid.com) + * @param array $headers global request headers + * @param string $version api version (configurable) + * @param array $path holds the segments of the url path + * @param array $curlOptions extra options to set during curl initialization + * @param bool $retryOnLimit set default retry on limit flag + */ + public function __construct($host, $headers = null, $version = null, $path = null, $curlOptions = null, $retryOnLimit = false) + { + $this->host = $host; + $this->headers = $headers ?: []; + $this->version = $version; + $this->path = $path ?: []; + $this->curlOptions = $curlOptions ?: []; + // These are the supported HTTP verbs + $this->methods = ['delete', 'get', 'patch', 'post', 'put']; + + $this->retryOnLimit = $retryOnLimit; + } + + /** + * @return string + */ + public function getHost() + { + return $this->host; + } + + /** + * @return array + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * @return string|null + */ + public function getVersion() + { + return $this->version; + } + + /** + * @return array + */ + public function getPath() + { + return $this->path; + } + + /** + * @return array + */ + public function getCurlOptions() + { + return $this->curlOptions; + } + + /** + * Make a new Client object + * + * @param string $name name of the url segment + * + * @return Client object + */ + private function buildClient($name = null) + { + if (isset($name)) { + $this->path[] = $name; + } + $client = new Client($this->host, $this->headers, $this->version, $this->path, $this->curlOptions); + $this->path = []; + return $client; + } + + /** + * Build the final URL to be passed + * + * @param array $queryParams an array of all the query parameters + * + * @return string + */ + private function buildUrl($queryParams = null) + { + $path = '/' . implode('/', $this->path); + if (isset($queryParams)) { + $path .= '?' . http_build_query($queryParams); + } + return sprintf('%s%s%s', $this->host, $this->version ?: '', $path); + } + + /** + * Make the API call and return the response. This is separated into + * it's own function, so we can mock it easily for testing. + * + * @param string $method the HTTP verb + * @param string $url the final url to call + * @param array $body request body + * @param array $headers any additional request headers + * @param bool $retryOnLimit should retry if rate limit is reach? + * + * @return Response object + */ + public function makeRequest($method, $url, $body = null, $headers = null, $retryOnLimit = false) + { + $curl = curl_init($url); + + curl_setopt_array($curl, [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => 1, + CURLOPT_CUSTOMREQUEST => strtoupper($method), + CURLOPT_SSL_VERIFYPEER => false, + ] + $this->curlOptions); + + if (isset($headers)) { + $this->headers = array_merge($this->headers, $headers); + } + if (isset($body)) { + $encodedBody = json_encode($body); + curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedBody); + $this->headers = array_merge($this->headers, ['Content-Type: application/json']); + } + curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers); + + $response = curl_exec($curl); + $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); + $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + + $responseBody = substr($response, $headerSize); + $responseHeaders = substr($response, 0, $headerSize); + + $responseHeaders = explode("\n", $responseHeaders); + $responseHeaders = array_map('trim', $responseHeaders); + + curl_close($curl); + + $response = new Response($statusCode, $responseBody, $responseHeaders); + + if ($statusCode == 429 && $retryOnLimit) { + $headers = $response->headers(true); + $sleepDurations = $headers['X-Ratelimit-Reset'] - time(); + sleep($sleepDurations > 0 ? $sleepDurations : 0); + return $this->makeRequest($method, $url, $body, $headers, false); + } + + return $response; + } + + /** + * Add variable values to the url. + * (e.g. /your/api/{variable_value}/call) + * Another example: if you have a PHP reserved word, such as and, + * in your url, you must use this method. + * + * @param string $name name of the url segment + * + * @return Client object + */ + public function _($name = null) + { + return $this->buildClient($name); + } + + /** + * Dynamically add method calls to the url, then call a method. + * (e.g. client.name.name.method()) + * + * @param string $name name of the dynamic method call or HTTP verb + * @param array $args parameters passed with the method call + * + * @return Client|Response object + */ + public function __call($name, $args) + { + $name = strtolower($name); + + if ($name === 'version') { + $this->version = $args[0]; + return $this->_(); + } + + if (in_array($name, $this->methods, true)) { + $body = isset($args[0]) ? $args[0] : null; + $queryParams = isset($args[1]) ? $args[1] : null; + $url = $this->buildUrl($queryParams); + $headers = isset($args[2]) ? $args[2] : null; + $retryOnLimit = isset($args[3]) ? $args[3] : $this->retryOnLimit; + return $this->makeRequest($name, $url, $body, $headers, $retryOnLimit); + } + + return $this->_($name); + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php new file mode 100644 index 0000000..29720f0 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php @@ -0,0 +1,116 @@ +<?php + +/** + * HTTP Client library + * + * PHP version 5.4 + * + * @author Matt Bernier <dx@sendgrid.com> + * @author Elmer Thomas <dx@sendgrid.com> + * @copyright 2016 SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: <git_id> + * @link http://packagist.org/packages/sendgrid/php-http-client + */ + +namespace SendGrid; + +/** + * Holds the response from an API call. + */ +class Response +{ + /** @var int */ + protected $statusCode; + /** @var string */ + protected $body; + /** @var array */ + protected $headers; + + /** + * Setup the response data + * + * @param int $statusCode the status code. + * @param string $body the response body. + * @param array $headers an array of response headers. + */ + public function __construct($statusCode = null, $body = null, $headers = null) + { + $this->statusCode = $statusCode; + $this->body = $body; + $this->headers = $headers; + } + + /** + * The status code + * + * @return int + */ + public function statusCode() + { + return $this->statusCode; + } + + /** + * The response body + * + * @return string + */ + public function body() + { + return $this->body; + } + + /** + * The response headers + * + * @param bool $assoc + * + * @return array + */ + public function headers($assoc = false) + { + if (!$assoc) { + return $this->headers; + } + + return $this->prettifyHeaders($this->headers); + } + + /** + * Returns response headers as associative array + * + * @param array $headers + * + * @return array + * + * @throws \InvalidArgumentException + */ + private function prettifyHeaders($headers) + { + if (!is_array($headers)) { + throw new \InvalidArgumentException('$headers should be array'); + } + + return array_reduce( + array_filter($headers), + function ($result, $header) { + if (empty($header)) { + return $result; + } + + if (false === strpos($header, ':')) { + $result['Status'] = trim($header); + + return $result; + } + + list ($key, $value) = explode(':', $header, 2); + $result[trim($key)] = trim($value); + + return $result; + }, + [] + ); + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/ClientTest.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/ClientTest.php new file mode 100644 index 0000000..676f600 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/ClientTest.php @@ -0,0 +1,112 @@ +<?php + +namespace SendGrid\Test; + +use SendGrid\Client; + +class ClientTest extends \PHPUnit_Framework_TestCase +{ + /** @var MockClient */ + private $client; + /** @var string */ + private $host; + /** @var array */ + private $headers; + + protected function setUp() + { + $this->host = 'https://localhost:4010'; + $this->headers = [ + 'Content-Type: application/json', + 'Authorization: Bearer SG.XXXX' + ]; + $this->client = new MockClient($this->host, $this->headers, '/v3', null, null); + } + + public function testConstructor() + { + $this->assertAttributeEquals($this->host, 'host', $this->client); + $this->assertAttributeEquals($this->headers, 'headers', $this->client); + $this->assertAttributeEquals('/v3', 'version', $this->client); + $this->assertAttributeEquals([], 'path', $this->client); + $this->assertAttributeEquals([], 'curlOptions', $this->client); + $this->assertAttributeEquals(['delete', 'get', 'patch', 'post', 'put'], 'methods', $this->client); + } + + public function test_() + { + $client = new MockClient($this->host, $this->headers, '/v3', null, ['foo' => 'bar']); + $client = $client->_('test'); + + $this->assertAttributeEquals(['test'], 'path', $client); + $this->assertAttributeEquals(['foo' => 'bar'], 'curlOptions', $client); + } + + public function test__call() + { + $client = $this->client->get(); + $this->assertAttributeEquals('https://localhost:4010/v3/', 'url', $client); + + $queryParams = ['limit' => 100, 'offset' => 0]; + $client = $this->client->get(null, $queryParams); + $this->assertAttributeEquals('https://localhost:4010/v3/?limit=100&offset=0', 'url', $client); + + $requestBody = ['name' => 'A New Hope']; + $client = $this->client->get($requestBody); + $this->assertAttributeEquals($requestBody, 'requestBody', $client); + + $requestHeaders = ['X-Mock: 200']; + $client = $this->client->get(null, null, $requestHeaders); + $this->assertAttributeEquals($requestHeaders, 'requestHeaders', $client); + + $client = $this->client->version('/v4'); + $this->assertAttributeEquals('/v4', 'version', $client); + + $client = $this->client->path_to_endpoint(); + $this->assertAttributeEquals(['path_to_endpoint'], 'path', $client); + $client = $client->one_more_segment(); + $this->assertAttributeEquals(['path_to_endpoint', 'one_more_segment'], 'path', $client); + } + + public function testGetHost() + { + $client = new Client('https://localhost:4010'); + $this->assertSame('https://localhost:4010', $client->getHost()); + } + + public function testGetHeaders() + { + $client = new Client('https://localhost:4010', ['Content-Type: application/json', 'Authorization: Bearer SG.XXXX']); + $this->assertSame(['Content-Type: application/json', 'Authorization: Bearer SG.XXXX'], $client->getHeaders()); + + $client2 = new Client('https://localhost:4010', null); + $this->assertSame([], $client2->getHeaders()); + } + + public function testGetVersion() + { + $client = new Client('https://localhost:4010', null, '/v3'); + $this->assertSame('/v3', $client->getVersion()); + + $client = new Client('https://localhost:4010', null, null); + $this->assertSame(null, $client->getVersion()); + } + + public function testGetPath() + { + $client = new Client('https://localhost:4010', null, null, ['/foo/bar']); + $this->assertSame(['/foo/bar'], $client->getPath()); + + $client = new Client('https://localhost:4010', null, null, null); + $this->assertSame([], $client->getPath()); + } + + public function testGetCurlOptions() + { + $client = new Client('https://localhost:4010', null, null, null, [CURLOPT_PROXY => '127.0.0.1:8080']); + $this->assertSame([CURLOPT_PROXY => '127.0.0.1:8080'], $client->getCurlOptions()); + + $client = new Client('https://localhost:4010', null, null, null, null); + $this->assertSame([], $client->getCurlOptions()); + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/MockClient.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/MockClient.php new file mode 100644 index 0000000..ae7ed79 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/MockClient.php @@ -0,0 +1,20 @@ +<?php + +namespace SendGrid\Test; + +use SendGrid\Client; + +class MockClient extends Client +{ + protected $requestBody; + protected $requestHeaders; + protected $url; + + public function makeRequest($method, $url, $requestBody = null, $requestHeaders = null, $retryOnLimit = false) + { + $this->requestBody = $requestBody; + $this->requestHeaders = $requestHeaders; + $this->url = $url; + return $this; + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/ResponseTest.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/ResponseTest.php new file mode 100644 index 0000000..45660e2 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/ResponseTest.php @@ -0,0 +1,51 @@ +<?php + +namespace SendGrid\Test; + +use SendGrid\Response; + +class ResponseTest extends \PHPUnit_Framework_TestCase +{ + public function testConstructor() + { + $response = new Response(); + + $this->assertAttributeEquals(null, 'statusCode', $response); + $this->assertAttributeEquals(null, 'body', $response); + $this->assertAttributeEquals(null, 'headers', $response); + + $response = new Response(200, 'test', ['Content-Encoding: gzip']); + + $this->assertAttributeEquals(200, 'statusCode', $response); + $this->assertAttributeEquals('test', 'body', $response); + $this->assertAttributeEquals(['Content-Encoding: gzip'], 'headers', $response); + } + + public function testStatusCode() + { + $response = new Response(404); + + $this->assertEquals(404, $response->statusCode()); + } + + public function testBody() + { + $response = new Response(null, 'foo'); + + $this->assertEquals('foo', $response->body()); + } + + public function testHeaders() + { + $response = new Response(null, null, ['Content-Type: text/html']); + + $this->assertEquals(['Content-Type: text/html'], $response->headers()); + } + + public function testAssociativeHeaders() + { + $response = new Response(null, null, ['Content-Type: text/html', 'HTTP/1.1 200 OK']); + + $this->assertEquals(['Content-Type' => 'text/html', 'Status' => 'HTTP/1.1 200 OK'], $response->headers(true)); + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/bootstrap.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/bootstrap.php new file mode 100644 index 0000000..19d4b20 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/test/unit/bootstrap.php @@ -0,0 +1,3 @@ +<?php + +require __DIR__ . '/../../vendor/autoload.php'; diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.editorconfig b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.editorconfig new file mode 100644 index 0000000..e18928d --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*.php] +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE new file mode 100644 index 0000000..8e2d043 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE @@ -0,0 +1,17 @@ +#### Issue Summary + +A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples. + + +#### Steps to Reproduce + +1. This is the first step +2. This is the second step +3. Further steps, etc. + +Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead? + +#### Technical details: + +* sendgrid-php Version: master (latest commit: [commit number]) +* PHP Version: 5.x
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore new file mode 100644 index 0000000..8f8f4f1 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore @@ -0,0 +1,10 @@ +test/coverage/* +dist/ +composer.lock +vendor +.env* +sendgrid.env +composer.phar +.editorconfig +test.php +.idea/
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml new file mode 100644 index 0000000..068c594 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml @@ -0,0 +1,34 @@ +language: php +before_script: +before_script: +- mkdir prism +- mkdir prism/bin +- export PATH=$PATH:$PWD/prism/bin/ +- ./test/prism.sh +- composer install +- cd test/unit +script: +- "../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test*" +after_script: +- cd ../.. +- ./scripts/s3upload.sh +php: +- 5.6 +- 7.0 +env: + global: + - S3_POLICY: ewogICJleHBpcmF0aW9uIjogIjIxMDAtMDEtMDFUMTI6MDA6MDAuMDAwWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImFjbCI6ICJwdWJsaWMtcmVhZCIgfSwKICAgIHsiYnVja2V0IjogInNlbmRncmlkLW9wZW4tc291cmNlIiB9LAogICAgWyJzdGFydHMtd2l0aCIsICIka2V5IiwgInNlbmRncmlkLXBocC8iXSwKICAgIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAyMDQ4LCAyNjg0MzU0NTZdLAogICAgWyJlcSIsICIkQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3ppcCJdCiAgXQp9Cgo= + - secure: eUN0huKA436uIkISu6V3yW01/gZHC6slBvlnprMPEhzclU2szH6qhWEXWS5CcOG6EEDBReqLZdNAwu+FC69KGFO9+6oW2GQQLSsfEViqFi/Ig2N0r4EBO4jLRebgq0GOfetPwQvJH27d8BCiloPy8rXBb5pskxSNw4B4bRyXHz4= + - secure: j38xzMNmzYXR/JJdVumPmDoDVxb6FUDF497AuVPHowGh0egFW8XHWCOMeQWqWZI4Gg17pViQNIJ3xC6WBvob70AF8fsNm0+vxF2s7abXDMcbq5flLTS6ydKLgNu+na/RAkOBbTwxJAGIH/fQh8BH8iGKerCwoqf8sDErAge4NMw= + - secure: h3HlxBOsNXBDrIJ0yl467ST6Q8R2TmbL7PltlPcRoHy5gAxn5UiDv5W2+6DSXrwQrTjOUunZ+O9ckcaQGQy1JNhGMwgIkJpyWAHDIHhTYGU289uUIDTHQW/soX0qHJSHSx3iMgDOIc7XnfTz6W7Nv1gYKZFedOMsZ5uBMeGyiXE= + - secure: SKSl/RHFQNhGT7OUj7E0AbrQnuDhhCRI/4jC76mmzvy8EJBDgUNevAKJGtug+LVilHrlbk9fLC8rayPW6SGv0s3PowTGm8NMOc48aRBLOr7QRo/sMikJCmRuU6HWptr0NKuf2fq6lV94WDm/pDdyOSNyLga9/eaIDs/Sacp78sw= +notifications: + hipchat: + rooms: + secure: l4RUOBY44kVhSxx54NU3cmvn598rRMB7Y272Ct/W0fBm1tdGncp42A/rwg7JkiZH9EWXs3tKtoSjqw5xT6QeScUGQDdykS5QVO8lEIkDRGD4WwQ3VDJmRy1+04WtgqFEK8SyYTCcCl4ZJ0rtOcJZgDMvigkOJuLxwGXTDuvfu1k= + template: + - '<a href="https://travis-ci.org/%{repository}/builds/%{build_id}">%{repository} + Build %{build_number}</a> on branch <i>%{branch}</i> by %{author}: <strong>%{message}</strong> + <a href="https://github.com/%{repository}/commits/%{commit}">View on GitHub</a>' + format: html + notify: true diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/CHANGELOG.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/CHANGELOG.md new file mode 100644 index 0000000..dd55517 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/CHANGELOG.md @@ -0,0 +1,207 @@ +# Change Log +All notable changes to this project will be documented in this file. + +This project adheres to [Semantic Versioning](http://semver.org/). + +## [6.0.0] - 2017-06-30 ## +### BREAKING CHANGE +- PR #408: Update Mail constructor to signify which parameters are required for sending all email +- The `Mail()` constructor now requires `$from`, `$subject`, `$to` and `$content` parameters like so: `Mail($from, $subject, $to, $content)`. Those are the minimaly required paramaters to send an email. +- Thanks to [Casey Wilson](https://github.com/caseyw) for the PR! + +## [5.6.2] - 2017-06-29 ## +### Fix +- PR #410: Adding name for ReplyTo for issue #390 +- Thanks to [Casey Wilson](https://github.com/caseyw) for the PR! + +## [5.6.1] - 2017-06-26 ## +### Fix +- Versioning mistake (forgot the .0 at the end) + +## [5.6.0] - 2017-06-26 ## +### Added +- Pull #405: Updating docs and non-composer includes +- Thanks to [Casey Wilson](https://github.com/caseyw) for the PR! + +## [5.5.1] - 2017-05-18 ## +### Fixed +- Pull #396: Use `print_r` instead of `echo` on Arrays +- Thanks to [Ryan P.C. McQuen](https://github.com/ryanpcmcquen) for the PR! + +## [5.5.0] - 2017-05-04 ## +### Added +- Pull #393: Update [php-http-client](https://github.com/sendgrid/php-http-client) dependency +- [v3.6](https://github.com/sendgrid/php-http-client/releases/tag/v3.6.0): Pass the curlOptions to the client in buildClient +- [v3.7](https://github.com/sendgrid/php-http-client/releases/tag/v3.7.0): Added ability to get headers as associative array + +## [5.4.2] - 2017-04-18 ## +### Fixes +- Fixes #292 +- Removes Prism file in sendgrid-php.zip + +## [5.4.1] - 2017-04-04 ## +### Added +- Pull #373 +- PSR1 & PSR2 Conversion +- Thanks to [Braunson Yager](https://github.com/Braunson) for the PR! + +## [5.4.0] - 2017-03-16 ## +### Added +- Pull #337 +- API level addressing of the string-only custom arg rule +- Thanks to [Chris Schuld](https://github.com/cbschuld) for the PR! + +## [5.3.0] - 2017-03-15 ## +### Added +- Pull #367 +- UTF8 encoding forced for content value and message subject +- Thanks to [Chris Schuld](https://github.com/cbschuld) for the PR! + +## [5.2.3] - 2017-03-03 ## +### Fixed +- Pull #334 +- Fixed serialization of empty JSON objects, fixes #332 & #314 +- Thanks to [Matthew Dreyer](https://github.com/Dreyer) for the PR! + +## [5.2.2] - 2017-03-03 ## +### Fixed +- Pull #323 +- Typo 'user' for 'usr' +- Thanks to [Mike Ralphson](https://github.com/MikeRalphson) for the PR! + +## [5.2.1] - 2017-03-01 ## +### Fixed +- Pull #353 +- Fixed Issue #352 +- Relative path fix for background jobs +- Thanks to [TarcÃsio Zotelli Ferraz](https://github.com/tarcisiozf) for the PR! + +## [5.2.0] - 2017-02-23 ## +### Added +- Pull #346 +- Allow passing curlOptions to the client +- Thanks to [Taluu](https://github.com/sendgrid/sendgrid-php/pull/346) for the PR! + +## [5.1.2] - 2016-10-11 ## +### Added +- Pull #330, Fixes #320 +- Delete subaccounts returns 200 issue resolved +- The fix happened at the [php-http-client](https://github.com/sendgrid/php-http-client/releases/tag/v3.5.1) dependency. +- Thanks to [emil](https://github.com/emilva) for the PR! + +## [5.1.1] - 2016-10-11 ## +### Added +- Pull #307, Fixes #276 +- Adds phpdoc and style fixes +- Thanks to [Avishkar Autar](https://github.com/aautar) for the PR! + +## [5.1.0] - 2016-09-29 ## +### Fixed +- Pull #295: [Upgrade sendgrid/php-http-client](https://github.com/sendgrid/sendgrid-php/pull/295/files) +- This adds getters for certain properties, please see [this pull request](https://github.com/sendgrid/php-http-client/pull/9) for details +- Thanks to [Arjan Keeman](https://github.com/akeeman) for the pull request! + +## [5.0.9] - 2016-09-13 ## +### Fixed +- Pull request #289: [Replace "\jsonSerializable" with "\JsonSerializable" ](https://github.com/sendgrid/sendgrid-php/pull/289) +- Thanks to [Issei.M](https://github.com/issei-m) for the pull request! + +## [5.0.8] - 2016-08-24 ## +### Added +- Table of Contents in the README +- Added a [USE_CASES.md](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md) section, with the first use case example for transactional templates + +## [5.0.7] - 2016-07-25 ## +### Added +- [Troubleshooting](https://github.com/sendgrid/sendgrid-php/blob/master/TROUBLESHOOTING.md) section + +## [5.0.6] - 2016-07-20 ## +### Added +- README updates +- Update introduction blurb to include information regarding our forward path +- Update the v3 /mail/send example to include non-helper usage +- Update the generic v3 example to include non-fluent interface usage + +## [5.0.5] - 2016-07-12 ## +### Added +- Update docs, unit tests and examples to include Sender ID + +## [5.0.4] - 2016-07-07 ## +### Added +- Tests now mocked automatically against [prism](https://stoplight.io/prism/) + +## [5.0.3] - 2016-07-05 ## +### Updated +- Content based on our updated [Swagger/OAI doc](https://github.com/sendgrid/sendgrid-oai) + +## [5.0.2] - 2016-07-05 ## +### Added +- Accept: application/json header per https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/requests.html + +### Updated +- Content based on our updated [Swagger/OAI doc](https://github.com/sendgrid/sendgrid-oai) + +## [5.0.1] - 2016-06-17 ## +### Fixed +- Issue with packaged version for non-composer uses + +## [5.0.0] - 2016-06-13 ## +### Added +- Breaking change to support the v3 Web API +- New HTTP client +- v3 Mail Send helper + +## [v4.0.4] - (2016-02-18) ## +### Added +- Ability to add scopes to API Keys endpoint [POST] + +## [v4.0.3] - (2016-02-18) ## +### Added +- API Keys endpoint [PUT] + +## [v4.0.2] - (2015-12-15) ## +### Added +- Tests for API Keys endpoint [POST, PATCH, DELETE] + +## [v4.0.1] - (2015-12-03) ## +### Fixed +- HTTP 406 Not Acceptable Errors [#177](https://github.com/sendgrid/sendgrid-php/issues/177) + +## [v4.0.0] - (2015-10-16) ## +### Added +- Added support for accessing the [SendGrid Web API v3 endpoints](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) +- Implemented part of the /api_keys, /groups and /suppressions endpoints + +## [v3.2.0] - (2015-05-13) ## + +### Added +- Specify Guzzle proxy via [#149](https://github.com/sendgrid/sendgrid-php/pull/149) +- Option to disable exception raising + +## [v3.1.0] - (2015-04-27) +### Added +- Support for API keys + +## [v3.0.0] - (2015-04-14) +### Fixed +- CC and BCC not working with SMTPAPI To + +### Changed +- **Breaking:** A `\SendGrid\Exception` is now raised when response is not 200 +- **Breaking:** `addTo` now uses the Web API parameter as opposed to the SMTPAPI Header. Substitutions will most likely break unless you update to use `addSmtpapiTo` +- The library now depends on Guzzle3 +- Major refactoring + +### Added +- **Breaking:** `send()` now returns an instance of `\SendGrid\Response` +- Numerous missing methods for new functionality +- `addSmtpapiTo` for using the SMTPAPI To + +## [v2.2.1] - (2014-01-29) +### Fixed +- Fix turn_off_ssl_verification option via [#123](https://github.com/sendgrid/sendgrid-php/pull/123) + +## [v2.2.0] - (2014-01-12) +### Changed +- Remove [Unirest](https://github.com/Mashape/unirest-php/) and replace with native cURL +- Add CHANGELOG.md diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/CONTRIBUTING.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/CONTRIBUTING.md new file mode 100644 index 0000000..60a06c4 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/CONTRIBUTING.md @@ -0,0 +1,193 @@ +Hello! Thank you for choosing to help contribute to one of the SendGrid open source libraries. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies. + +- [CLAs and CCLAs](#cla) +- [Roadmap & Milestones](#roadmap) +- [Feature Request](#feature_request) +- [Submit a Bug Report](#submit_a_bug_report) +- [Improvements to the Codebase](#improvements_to_the_codebase) +- [Understanding the Code Base](#understanding_the_codebase) +- [Testing](#testing) +- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions) +- [Creating a Pull Request](#creating_a_pull_request) + +<a name="roadmap"></a> +We use [Milestones](https://github.com/sendgrid/sendgrid-php/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged. + +<a name="cla"></a> +## CLAs and CCLAs + +Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) be filled out by every contributor to a SendGrid open source project. + +Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution. + +SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA. Copies of the CLA are available [here](https://gist.github.com/SendGridDX/98b42c0a5d500058357b80278fde3be8#file-sendgrid_cla). + +When you create a Pull Request, after a few seconds, a comment will appear with a link to the CLA. Click the link and fill out the brief form and then click the "I agree" button and you are all set. You will not be asked to re-sign the CLA unless we make a change. + +There are a few ways to contribute, which we'll enumerate below: + +<a name="feature_request"></a> +## Feature Request + +If you'd like to make a feature request, please read this section. + +The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions: + +- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests. +- Please be respectful and considerate of others when commenting on issues + +<a name="submit_a_bug_report"></a> +## Submit a Bug Report + +Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public. + +A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report. + +Before you decide to create a new issue, please try the following: + +1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post. +2. Update to the latest version of this code and check if issue has already been fixed +3. Copy and fill in the Bug Report Template we have provided below + +### Please use our Bug Report Template + +In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/sendgrid-php/blob/master/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting. + +<a name="improvements_to_the_codebase"></a> +## Improvements to the Codebase + +We welcome direct contributions to the sendgrid-php code base. Thank you! + +### Development Environment ### + +#### Install and Run Locally #### + +##### Prerequisites ##### + +- PHP 5.6 or 7.0 + +##### Initial setup: ##### + +```bash +git clone https://github.com/sendgrid/sendgrid-php.git +cd sendgrid-php +composer install +``` + +## Environment Variables + +First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-php). + +Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys). + +```bash +echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env +echo "sendgrid.env" >> .gitignore +source ./sendgrid.env +``` + +##### Execute: ##### + +See the [examples folder](https://github.com/sendgrid/sendgrid-php/tree/master/examples) to get started quickly. + +If you are using composer, replace <PATH_TO> with the path to your `vendor/autoload.php`. Otherwise, include lib/loader.php. + +<a name="understanding_the_codebase"></a> +## Understanding the Code Base + +**/examples** + +Working examples that demonstrate usage. + +```bash +php examples/example.php +``` + +**/test/unit** + +Unit tests for the HTTP client. + +**/lib** + +The interface to the SendGrid API. + +<a name="testing"></a> +## Testing + +All PRs require passing tests before the PR will be reviewed. + +All test files are in the [`/test/unit`](https://github.com/sendgrid/sendgrid-php/tree/master/test/unit) directory. + +For the purposes of contributing to this repo, please update the [`SendGridTest.php`](https://github.com/sendgrid/sendgrid-php/tree/master/test/unit/SendGridTest.php) file with unit tests as you modify the code. + +```bash +composer install +cd test/unit +../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* +``` + +<a name="style_guidelines_and_naming_conventions"></a> +## Style Guidelines & Naming Conventions + +Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning. + +- [PSR2 Coding Standards](http://www.php-fig.org/psr/psr-2/) + +Please run your code through: + +- [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) + +## Creating a Pull Request<a name="creating_a_pull_request"></a> + +1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork, + and configure the remotes: + + ```bash + # Clone your fork of the repo into the current directory + git clone https://github.com/sendgrid/sendgrid-php + # Navigate to the newly cloned directory + cd sendgrid-php + # Assign the original repo to a remote called "upstream" + git remote add upstream https://github.com/sendgrid/sendgrid-php + ``` + +2. If you cloned a while ago, get the latest changes from upstream: + + ```bash + git checkout <dev-branch> + git pull upstream <dev-branch> + ``` + +3. Create a new topic branch (off the main project development branch) to + contain your feature, change, or fix: + + ```bash + git checkout -b <topic-branch-name> + ``` + +4. Commit your changes in logical chunks. Please adhere to these [git commit + message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) + or your code is unlikely be merged into the main project. Use Git's + [interactive rebase](https://help.github.com/articles/interactive-rebase) + feature to tidy up your commits before making them public. + +4a. Create tests. + +4b. Create or update the example code that demonstrates the functionality of this change to the code. + +5. Locally merge (or rebase) the upstream development branch into your topic branch: + + ```bash + git pull [--rebase] upstream master + ``` + +6. Push your topic branch up to your fork: + + ```bash + git push origin <topic-branch-name> + ``` + +7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) + with a clear title and description against the `master` branch. All tests must be passing before we will review the PR. + +If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo. diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/LICENSE.txt b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/LICENSE.txt new file mode 100644 index 0000000..7f9d537 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012-2016 SendGrid, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md new file mode 100644 index 0000000..2add305 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md @@ -0,0 +1,237 @@ +[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-php.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-php) + +Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-php/issues/290). Your support is appreciated! + +**This library allows you to quickly and easily use the SendGrid Web API v3 via PHP.** + +Version 5.X.X of this library provides full support for all SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint). + +This library represents the beginning of a new path for SendGrid. We want this library to be community driven and SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests. + +Please browse the rest of this README for further detail. + +We appreciate your continued support, thank you! + +# Table of Contents + +* [Installation](#installation) +* [Quick Start](#quick_start) +* [Usage](#usage) +* [Use Cases](#use_cases) +* [Announcements](#announcements) +* [Roadmap](#roadmap) +* [How to Contribute](#contribute) +* [Troubleshooting](#troubleshooting) +* [About](#about) + +<a name="installation"></a> +# Installation + +## Prerequisites + +- PHP version 5.6 or 7.0 +- The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) + +## Setup Environment Variables + +Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example: + +```bash +echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env +echo "sendgrid.env" >> .gitignore +source ./sendgrid.env +``` + +## Install Package + +Add SendGrid to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application. + +```json +{ + "require": { + "sendgrid/sendgrid": "~6.0" + } +} +``` + +#### Alternative: Install package from zip + +If you are not using Composer, simply download and install the **[latest packaged release of the library as a zip](https://github.com/sendgrid/sendgrid-php/archive/master.zip)**. + +[**⬇︎ Download Packaged Library ⬇︎**](https://github.com/sendgrid/sendgrid-php/archive/master.zip) + +Previous versions of the library can be found in the [version index](https://sendgrid-open-source.s3.amazonaws.com/index.html) or downloaded directly from GitHub. + +## Dependencies + +- The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) +- [php-HTTP-Client](https://github.com/sendgrid/php-http-client) + +<a name="quick_start"></a> +# Quick Start + +## Hello Email + +The following is the minimum needed code to send an email with the [/mail/send Helper](https://github.com/sendgrid/sendgrid-php/tree/master/lib/helpers/mail) ([here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php#L22) is a full example): + +```php +<?php +// If you are using Composer (recommended) +require 'vendor/autoload.php'; + +// If you are not using Composer +// require("path/to/sendgrid-php/sendgrid-php.php"); + +$from = new SendGrid\Email("Example User", "test@example.com"); +$subject = "Sending with SendGrid is Fun"; +$to = new SendGrid\Email("Example User", "test@example.com"); +$content = new SendGrid\Content("text/plain", "and easy to do anywhere, even with PHP"); +$mail = new SendGrid\Mail($from, $subject, $to, $content); + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +$response = $sg->client->mail()->send()->post($mail); +echo $response->statusCode(); +print_r($response->headers()); +echo $response->body(); +``` + +The `SendGrid\Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php#L16) is an example of how to add to it. + +### Without Mail Helper Class + +The following is the minimum needed code to send an email without the /mail/send Helper ([here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/mail/mail.php#L28) is a full example): + +```php +<?php +// If you are using Composer (recommended) +require 'vendor/autoload.php'; + +// If you are not using Composer +// require("path/to/sendgrid-php/sendgrid-php.php"); + +$request_body = json_decode('{ + "personalizations": [ + { + "to": [ + { + "email": "test@example.com" + } + ], + "subject": "Sending with SendGrid is Fun" + } + ], + "from": { + "email": "test@example.com" + }, + "content": [ + { + "type": "text/plain", + "value": "and easy to do anywhere, even with PHP" + } + ] +}'); + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +$response = $sg->client->mail()->send()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` + +## General v3 Web API Usage (With Fluent Interface) + +```php +<?php +// If you are using Composer (recommended) +require 'vendor/autoload.php'; + +// If you are not using Composer +// require("path/to/sendgrid-php/sendgrid-php.php"); + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +$response = $sg->client->suppression()->bounces()->get(); + +print $response->statusCode(); +print $response->headers(); +print $response->body(); +``` + +## General v3 Web API Usage (Without Fluent Interface) + +```php +<?php +// If you are using Composer (recommended) +require 'vendor/autoload.php'; + +// If you are not using Composer +// require("path/to/sendgrid-php/sendgrid-php.php"); + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +$response = $sg->client->_("suppression/bounces")->get(); + +print $response->statusCode(); +print $response->headers(); +print $response->body(); +``` + +<a name="usage"></a> +# Usage + +- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html) +- [Library Usage + Documentation](https://github.com/sendgrid/sendgrid-php/tree/master/USAGE.md) +- [Example Code](https://github.com/sendgrid/sendgrid-php/tree/master/examples) +- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) +- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-php/tree/master/lib/helpers/mail/README.md) - build a request object payload for a v3 /mail/send API call. + +<a name="use_cases"> +# Use Cases + +[Examples of common API use cases](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md), such as how to send an email with a transactional template. + +<a name="announcements"></a> +# Announcements + +Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-php/issues/290). Your support is appreciated! + +All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-php/releases) + +<a name="roadmap"></a> +# Roadmap + +If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/pulls). We would love to hear your feedback. + +<a name="contribute"></a> +# How to Contribute + +We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) guide for details. + +Quick links: + +- [Feature Request](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#feature_request) +- [Bug Reports](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#submit_a_bug_report) +- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#cla) +- [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#improvements_to_the_codebase) + +<a name="troubleshooting"></a> +# Troubleshooting + +Please see our [troubleshooting guide](https://github.com/sendgrid/sendgrid-php/blob/master/TROUBLESHOOTING.md) for common library issues. + +<a name="about"></a> +# About + +sendgrid-php is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). + +sendgrid-php is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-php are trademarks of SendGrid, Inc. + +![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) + diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/TROUBLESHOOTING.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/TROUBLESHOOTING.md new file mode 100644 index 0000000..ec0a293 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/TROUBLESHOOTING.md @@ -0,0 +1,89 @@ +If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com). + +If you can't find a solution below, please open an [issue](https://github.com/sendgrid/sendgrid-php/issues). + + +## Table of Contents + +* [Migrating from v2 to v3](#migrating) +* [Continue Using v2](#v2) +* [Testing v3 /mail/send Calls Directly](#testing) +* [Error Messages](#error) +* [Versions](#versions) +* [Environment Variables and Your SendGrid API Key](#environment) +* [Using the Package Manager](#package-manager) + +<a name="migrating"></a> +## Migrating from v2 to v3 + +Please review [our guide](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) on how to migrate from v2 to v3. + +<a name="v2"></a> +## Continue Using v2 + +[Here](https://github.com/sendgrid/sendgrid-php/tree/75970eb82f5629e66db4d6da08ff7ef0c507e9b0) is the last working version with v2 support. + +Using composer: + +```json +{ + "require": { + "sendgrid/sendgrid": "~3.2" + } +} +``` + +Download packaged zip [here](https://sendgrid-open-source.s3.amazonaws.com/sendgrid-php/versions/sendgrid-php-75970eb.zip). + +<a name="testing"></a> +## Testing v3 /mail/send Calls Directly + +[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases. + +<a name="error"></a> +## Error Messages + +To read the error message returned by SendGrid's API: + +```php +try { + $response = $sendgrid->client->mail()->send()->post($mail); +} catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; +} +``` + +<a name="versions"></a> +## Versions + +We follow the MAJOR.MINOR.PATCH versioning scheme as described by [SemVer.org](http://semver.org). Therefore, we recommend that you always pin (or vendor) the particular version you are working with to your code and never auto-update to the latest version. Especially when there is a MAJOR point release, since that is guarenteed to be a breaking change. Changes are documented in the [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-php/releases) section. + +<a name="environment"></a> +## Environment Variables and Your SendGrid API Key + +All of our examples assume you are using [environment variables](https://github.com/sendgrid/sendgrid-php#setup-environment-variables) to hold your SendGrid API key. + +If you choose to add your SendGrid API key directly (not recommended): + +`$apiKey = getenv('SENDGRID_API_KEY');` + +becomes + +`$apiKey = 'SENDGRID_API_KEY';` + +In the first case SENDGRID_API_KEY is in reference to the name of the environment variable, while the second case references the actual SendGrid API Key. + +<a name="package-manager"></a> +## Using the Package Manager + +We upload this library to [Packagist](https://packagist.org/packages/sendgrid/sendgrid) whenever we make a release. This allows you to use [composer](https://getcomposer.org) for easy installation. + +In most cases we recommend you download the latest version of the library, but if you need a different version, please use: + +```json +{ + "require": { + "sendgrid/sendgrid": "~X.X.X" + } +} +```
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/USAGE.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/USAGE.md new file mode 100644 index 0000000..00a0d0d --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/USAGE.md @@ -0,0 +1,5038 @@ +This documentation is based on our [OAI specification](https://github.com/sendgrid/sendgrid-oai). + +# INITIALIZATION + +```php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); +``` + +# Table of Contents + +* [ACCESS SETTINGS](#access_settings) +* [ALERTS](#alerts) +* [API KEYS](#api_keys) +* [ASM](#asm) +* [BROWSERS](#browsers) +* [CAMPAIGNS](#campaigns) +* [CATEGORIES](#categories) +* [CLIENTS](#clients) +* [CONTACTDB](#contactdb) +* [DEVICES](#devices) +* [GEO](#geo) +* [IPS](#ips) +* [MAIL](#mail) +* [MAIL SETTINGS](#mail_settings) +* [MAILBOX PROVIDERS](#mailbox_providers) +* [PARTNER SETTINGS](#partner_settings) +* [SCOPES](#scopes) +* [SENDERS](#senders) +* [STATS](#stats) +* [SUBUSERS](#subusers) +* [SUPPRESSION](#suppression) +* [TEMPLATES](#templates) +* [TRACKING SETTINGS](#tracking_settings) +* [USER](#user) +* [WHITELABEL](#whitelabel) + + +<a name="access_settings"></a> +# ACCESS SETTINGS + +## Retrieve all recent access attempts + +**This endpoint allows you to retrieve a list of all of the IP addresses that recently attempted to access your account either through the User Interface or the API.** + +IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account. + +For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html). + +### GET /access_settings/activity + + +```php +$query_params = json_decode('{"limit": 1}'); +$response = $sg->client->access_settings()->activity()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add one or more IPs to the whitelist + +**This endpoint allows you to add one or more IP addresses to your IP whitelist.** + +When adding an IP to your whitelist, include the IP address in an array. You can whitelist one IP at a time, or you can whitelist multiple IPs at once. + +IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account. + +For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html). + +### POST /access_settings/whitelist + + +```php +$request_body = json_decode('{ + "ips": [ + { + "ip": "192.168.1.1" + }, + { + "ip": "192.*.*.*" + }, + { + "ip": "192.168.1.3/32" + } + ] +}'); +$response = $sg->client->access_settings()->whitelist()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a list of currently whitelisted IPs + +**This endpoint allows you to retrieve a list of IP addresses that are currently whitelisted.** + +IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account. + +For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html). + +### GET /access_settings/whitelist + + +```php +$response = $sg->client->access_settings()->whitelist()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Remove one or more IPs from the whitelist + +**This endpoint allows you to remove one or more IPs from your IP whitelist.** + +You can remove one IP at a time, or you can remove multiple IP addresses. + +IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account. + +For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html). + +### DELETE /access_settings/whitelist + + +```php +$request_body = json_decode('{ + "ids": [ + 1, + 2, + 3 + ] +}'); +$response = $sg->client->access_settings()->whitelist()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a specific whitelisted IP + +**This endpoint allows you to retreive a specific IP address that has been whitelisted.** + +You must include the ID for the specific IP address you want to retrieve in your call. + +IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account. + +For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html). + +### GET /access_settings/whitelist/{rule_id} + + +```php +$rule_id = "test_url_param"; +$response = $sg->client->access_settings()->whitelist()->_($rule_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Remove a specific IP from the whitelist + +**This endpoint allows you to remove a specific IP address from your IP whitelist.** + +When removing a specific IP address from your whitelist, you must include the ID in your call. + +IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account. + +For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html). + +### DELETE /access_settings/whitelist/{rule_id} + + +```php +$rule_id = "test_url_param"; +$response = $sg->client->access_settings()->whitelist()->_($rule_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="alerts"></a> +# ALERTS + +## Create a new Alert + +**This endpoint allows you to create a new alert.** + +Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics. +* Usage alerts allow you to set the threshold at which an alert will be sent. +* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly". + +For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html). + +### POST /alerts + + +```php +$request_body = json_decode('{ + "email_to": "example@example.com", + "frequency": "daily", + "type": "stats_notification" +}'); +$response = $sg->client->alerts()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all alerts + +**This endpoint allows you to retieve all of your alerts.** + +Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics. +* Usage alerts allow you to set the threshold at which an alert will be sent. +* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly". + +For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html). + +### GET /alerts + + +```php +$response = $sg->client->alerts()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update an alert + +**This endpoint allows you to update an alert.** + +Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics. +* Usage alerts allow you to set the threshold at which an alert will be sent. +* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly". + +For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html). + +### PATCH /alerts/{alert_id} + + +```php +$request_body = json_decode('{ + "email_to": "example@example.com" +}'); +$alert_id = "test_url_param"; +$response = $sg->client->alerts()->_($alert_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a specific alert + +**This endpoint allows you to retrieve a specific alert.** + +Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics. +* Usage alerts allow you to set the threshold at which an alert will be sent. +* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly". + +For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html). + +### GET /alerts/{alert_id} + + +```php +$alert_id = "test_url_param"; +$response = $sg->client->alerts()->_($alert_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete an alert + +**This endpoint allows you to delete an alert.** + +Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics. +* Usage alerts allow you to set the threshold at which an alert will be sent. +* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly". + +For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html). + +### DELETE /alerts/{alert_id} + + +```php +$alert_id = "test_url_param"; +$response = $sg->client->alerts()->_($alert_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="api_keys"></a> +# API KEYS + +## Create API keys + +**This enpoint allows you to create a new random API Key for the user.** + +A JSON request body containing a "name" property is required. If number of maximum keys is reached, HTTP 403 will be returned. + +There is a limit of 100 API Keys on your account. + +The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). + +See the [API Key Permissions List](https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/api_key_permissions_list.html) for a list of all available scopes. + +### POST /api_keys + + +```php +$request_body = json_decode('{ + "name": "My API Key", + "sample": "data", + "scopes": [ + "mail.send", + "alerts.create", + "alerts.read" + ] +}'); +$response = $sg->client->api_keys()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all API Keys belonging to the authenticated user + +**This endpoint allows you to retrieve all API Keys that belong to the authenticated user.** + +The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). + +### GET /api_keys + + +```php +$query_params = json_decode('{"limit": 1}'); +$response = $sg->client->api_keys()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update the name & scopes of an API Key + +**This endpoint allows you to update the name and scopes of a given API key.** + +A JSON request body with a "name" property is required. +Most provide the list of all the scopes an api key should have. + +The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). + + +### PUT /api_keys/{api_key_id} + + +```php +$request_body = json_decode('{ + "name": "A New Hope", + "scopes": [ + "user.profile.read", + "user.profile.update" + ] +}'); +$api_key_id = "test_url_param"; +$response = $sg->client->api_keys()->_($api_key_id)->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update API keys + +**This endpoint allows you to update the name of an existing API Key.** + +A JSON request body with a "name" property is required. + +The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). + +## URI Parameters + +| URI Parameter | Type | Required? | Description | +|---|---|---|---| +|api_key_id |string | required | The ID of the API Key you are updating.| + +### PATCH /api_keys/{api_key_id} + + +```php +$request_body = json_decode('{ + "name": "A New Hope" +}'); +$api_key_id = "test_url_param"; +$response = $sg->client->api_keys()->_($api_key_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve an existing API Key + +**This endpoint allows you to retrieve a single api key.** + +If the API Key ID does not exist an HTTP 404 will be returned. + +### GET /api_keys/{api_key_id} + + +```php +$api_key_id = "test_url_param"; +$response = $sg->client->api_keys()->_($api_key_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete API keys + +**This endpoint allows you to revoke an existing API Key** + +Authentications using this API Key will fail after this request is made, with some small propogation delay.If the API Key ID does not exist an HTTP 404 will be returned. + +The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). + +## URI Parameters + +| URI Parameter | Type | Required? | Description | +|---|---|---|---| +|api_key_id |string | required | The ID of the API Key you are deleting.| + +### DELETE /api_keys/{api_key_id} + + +```php +$api_key_id = "test_url_param"; +$response = $sg->client->api_keys()->_($api_key_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="asm"></a> +# ASM + +## Create a new suppression group + +**This endpoint allows you to create a new suppression group.** + +Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts. + +The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions. + +Each user can create up to 25 different suppression groups. + +### POST /asm/groups + + +```php +$request_body = json_decode('{ + "description": "Suggestions for products our users might like.", + "is_default": true, + "name": "Product Suggestions" +}'); +$response = $sg->client->asm()->groups()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve information about multiple suppression groups + +**This endpoint allows you to retrieve information about multiple suppression groups.** + +This endpoint will return information for each group ID that you include in your request. To add a group ID to your request, simply append `&id=` followed by the group ID. + +Suppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). + +Suppression groups, or [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html), allow you to label a category of content that you regularly send. This gives your recipients the ability to opt out of a specific set of your email. For example, you might define a group for your transactional email, and one for your marketing email so that your users can continue recieving your transactional email witout having to receive your marketing content. + +### GET /asm/groups + + +```php +$query_params = json_decode('{"id": 1}'); +$response = $sg->client->asm()->groups()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a suppression group. + +**This endpoint allows you to update or change a suppression group.** + +Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts. + +The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions. + +Each user can create up to 25 different suppression groups. + +### PATCH /asm/groups/{group_id} + + +```php +$request_body = json_decode('{ + "description": "Suggestions for items our users might like.", + "id": 103, + "name": "Item Suggestions" +}'); +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Get information on a single suppression group. + +**This endpoint allows you to retrieve a single suppression group.** + +Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts. + +The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions. + +Each user can create up to 25 different suppression groups. + +### GET /asm/groups/{group_id} + + +```php +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a suppression group. + +**This endpoint allows you to delete a suppression group.** + +You can only delete groups that have not been attached to sent mail in the last 60 days. If a recipient uses the "one-click unsubscribe" option on an email associated with a deleted group, that recipient will be added to the global suppression list. + +Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts. + +The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions. + +Each user can create up to 25 different suppression groups. + +### DELETE /asm/groups/{group_id} + + +```php +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add suppressions to a suppression group + +**This endpoint allows you to add email addresses to an unsubscribe group.** + +If you attempt to add suppressions to a group that has been deleted or does not exist, the suppressions will be added to the global suppressions list. + +Suppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group. + +### POST /asm/groups/{group_id}/suppressions + + +```php +$request_body = json_decode('{ + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] +}'); +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->suppressions()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all suppressions for a suppression group + +**This endpoint allows you to retrieve all suppressed email addresses belonging to the given group.** + +Suppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group. + +### GET /asm/groups/{group_id}/suppressions + + +```php +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->suppressions()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Search for suppressions within a group + +**This endpoint allows you to search a suppression group for multiple suppressions.** + +When given a list of email addresses and a group ID, this endpoint will return only the email addresses that have been unsubscribed from the given group. + +Suppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). + +### POST /asm/groups/{group_id}/suppressions/search + + +```php +$request_body = json_decode('{ + "recipient_emails": [ + "exists1@example.com", + "exists2@example.com", + "doesnotexists@example.com" + ] +}'); +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->suppressions()->search()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a suppression from a suppression group + +**This endpoint allows you to remove a suppressed email address from the given suppression group.** + +Suppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group. + +### DELETE /asm/groups/{group_id}/suppressions/{email} + + +```php +$group_id = "test_url_param"; +$email = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->suppressions()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all suppressions + +**This endpoint allows you to retrieve a list of all suppressions.** + +Suppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). + +### GET /asm/suppressions + + +```php +$response = $sg->client->asm()->suppressions()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add recipient addresses to the global suppression group. + +**This endpoint allows you to add one or more email addresses to the global suppressions group.** + +A global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html). + +### POST /asm/suppressions/global + + +```php +$request_body = json_decode('{ + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] +}'); +$response = $sg->client->asm()->suppressions()->global()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a Global Suppression + +**This endpoint allows you to retrieve a global suppression. You can also use this endpoint to confirm if an email address is already globally suppresed.** + +If the email address you include in the URL path parameter `{email}` is alreayd globally suppressed, the response will include that email address. If the address you enter for `{email}` is not globally suppressed, an empty JSON object `{}` will be returned. + +A global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html). + +### GET /asm/suppressions/global/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->asm()->suppressions()->global()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a Global Suppression + +**This endpoint allows you to remove an email address from the global suppressions group.** + +A global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html). + +### DELETE /asm/suppressions/global/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->asm()->suppressions()->global()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all suppression groups for an email address + +**This endpoint returns the list of all groups that the given email address has been unsubscribed from.** + +Suppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). + +### GET /asm/suppressions/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->asm()->suppressions()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="browsers"></a> +# BROWSERS + +## Retrieve email statistics by browser. + +**This endpoint allows you to retrieve your email statistics segmented by browser type.** + +**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints. + +Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html). + +### GET /browsers/stats + + +```php +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "browsers": "test_string", "limit": "test_string", "offset": "test_string", "start_date": "2016-01-01"}'); +$response = $sg->client->browsers()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="campaigns"></a> +# CAMPAIGNS + +## Create a Campaign + +**This endpoint allows you to create a campaign.** + +Our Marketing Campaigns API lets you create, manage, send, and schedule campaigns. + +Note: In order to send or schedule the campaign, you will be required to provide a subject, sender ID, content (we suggest both html and plain text), and at least one list or segment ID. This information is not required when you create a campaign. + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### POST /campaigns + + +```php +$request_body = json_decode('{ + "categories": [ + "spring line" + ], + "custom_unsubscribe_url": "", + "html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>", + "ip_pool": "marketing", + "list_ids": [ + 110, + 124 + ], + "plain_content": "Check out our spring line!", + "segment_ids": [ + 110 + ], + "sender_id": 124451, + "subject": "New Products for Spring!", + "suppression_group_id": 42, + "title": "March Newsletter" +}'); +$response = $sg->client->campaigns()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all Campaigns + +**This endpoint allows you to retrieve a list of all of your campaigns.** + +Returns campaigns in reverse order they were created (newest first). + +Returns an empty array if no campaigns exist. + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### GET /campaigns + + +```php +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->campaigns()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a Campaign + +Update a campaign. This is especially useful if you only set up the campaign using POST /campaigns, but didn't set many of the parameters. + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### PATCH /campaigns/{campaign_id} + + +```php +$request_body = json_decode('{ + "categories": [ + "summer line" + ], + "html_content": "<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>", + "plain_content": "Check out our summer line!", + "subject": "New Products for Summer!", + "title": "May Newsletter" +}'); +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a single campaign + +**This endpoint allows you to retrieve a specific campaign.** + +Our Marketing Campaigns API lets you create, manage, send, and schedule campaigns. + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### GET /campaigns/{campaign_id} + + +```php +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a Campaign + +**This endpoint allows you to delete a specific campaign.** + +Our Marketing Campaigns API lets you create, manage, send, and schedule campaigns. + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### DELETE /campaigns/{campaign_id} + + +```php +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a Scheduled Campaign + +**This endpoint allows to you change the scheduled time and date for a campaign to be sent.** + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### PATCH /campaigns/{campaign_id}/schedules + + +```php +$request_body = json_decode('{ + "send_at": 1489451436 +}'); +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Schedule a Campaign + +**This endpoint allows you to schedule a specific date and time for your campaign to be sent.** + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### POST /campaigns/{campaign_id}/schedules + + +```php +$request_body = json_decode('{ + "send_at": 1489771528 +}'); +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## View Scheduled Time of a Campaign + +**This endpoint allows you to retrieve the date and time that the given campaign has been scheduled to be sent.** + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### GET /campaigns/{campaign_id}/schedules + + +```php +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Unschedule a Scheduled Campaign + +**This endpoint allows you to unschedule a campaign that has already been scheduled to be sent.** + +A successful unschedule will return a 204. +If the specified campaign is in the process of being sent, the only option is to cancel (a different method). + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### DELETE /campaigns/{campaign_id}/schedules + + +```php +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Send a Campaign + +**This endpoint allows you to immediately send a campaign at the time you make the API call.** + +Normally a POST would have a request body, but since this endpoint is telling us to send a resource that is already created, a request body is not needed. + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### POST /campaigns/{campaign_id}/schedules/now + + +```php +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->now()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Send a Test Campaign + +**This endpoint allows you to send a test campaign.** + +To send to multiple addresses, use an array for the JSON "to" value ["one@address","two@address"] + +For more information: + +* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) + +### POST /campaigns/{campaign_id}/schedules/test + + +```php +$request_body = json_decode('{ + "to": "your.email@example.com" +}'); +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->test()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="categories"></a> +# CATEGORIES + +## Retrieve all categories + +**This endpoint allows you to retrieve a list of all of your categories.** + +Categories can help organize your email analytics by enabling you to tag emails by type or broad topic. You can define your own custom categories. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html). + +### GET /categories + + +```php +$query_params = json_decode('{"category": "test_string", "limit": 1, "offset": 1}'); +$response = $sg->client->categories()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve Email Statistics for Categories + +**This endpoint allows you to retrieve all of your email statistics for each of your categories.** + +If you do not define any query parameters, this endpoint will return a sum for each category in groups of 10. + +Categories allow you to group your emails together according to broad topics that you define. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html). + +### GET /categories/stats + + +```php +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "categories": "test_string"}'); +$response = $sg->client->categories()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve sums of email stats for each category [Needs: Stats object defined, has category ID?] + +**This endpoint allows you to retrieve the total sum of each email statistic for every category over the given date range.** + +If you do not define any query parameters, this endpoint will return a sum for each category in groups of 10. + +Categories allow you to group your emails together according to broad topics that you define. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html). + +### GET /categories/stats/sums + + +```php +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}'); +$response = $sg->client->categories()->stats()->sums()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="clients"></a> +# CLIENTS + +## Retrieve email statistics by client type. + +**This endpoint allows you to retrieve your email statistics segmented by client type.** + +**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints. + +Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html). + +### GET /clients/stats + + +```php +$query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}'); +$response = $sg->client->clients()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve stats by a specific client type. + +**This endpoint allows you to retrieve your email statistics segmented by a specific client type.** + +**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints. + +## Available Client Types +- phone +- tablet +- webmail +- desktop + +Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html). + +### GET /clients/{client_type}/stats + + +```php +$query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}'); +$client_type = "test_url_param"; +$response = $sg->client->clients()->_($client_type)->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="contactdb"></a> +# CONTACTDB + +## Create a Custom Field + +**This endpoint allows you to create a custom field.** + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### POST /contactdb/custom_fields + + +```php +$request_body = json_decode('{ + "name": "pet", + "type": "text" +}'); +$response = $sg->client->contactdb()->custom_fields()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all custom fields + +**This endpoint allows you to retrieve all custom fields.** + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### GET /contactdb/custom_fields + + +```php +$response = $sg->client->contactdb()->custom_fields()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a Custom Field + +**This endpoint allows you to retrieve a custom field by ID.** + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### GET /contactdb/custom_fields/{custom_field_id} + + +```php +$custom_field_id = "test_url_param"; +$response = $sg->client->contactdb()->custom_fields()->_($custom_field_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a Custom Field + +**This endpoint allows you to delete a custom field by ID.** + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### DELETE /contactdb/custom_fields/{custom_field_id} + + +```php +$custom_field_id = "test_url_param"; +$response = $sg->client->contactdb()->custom_fields()->_($custom_field_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Create a List + +**This endpoint allows you to create a list for your recipients.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### POST /contactdb/lists + + +```php +$request_body = json_decode('{ + "name": "your list name" +}'); +$response = $sg->client->contactdb()->lists()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all lists + +**This endpoint allows you to retrieve all of your recipient lists. If you don't have any lists, an empty array will be returned.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### GET /contactdb/lists + + +```php +$response = $sg->client->contactdb()->lists()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete Multiple lists + +**This endpoint allows you to delete multiple recipient lists.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### DELETE /contactdb/lists + + +```php +$request_body = json_decode('[ + 1, + 2, + 3, + 4 +]'); +$response = $sg->client->contactdb()->lists()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a List + +**This endpoint allows you to update the name of one of your recipient lists.** + + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### PATCH /contactdb/lists/{list_id} + + +```php +$request_body = json_decode('{ + "name": "newlistname" +}'); +$query_params = json_decode('{"list_id": 1}'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->patch($request_body, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a single list + +This endpoint allows you to retrieve a single recipient list. + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### GET /contactdb/lists/{list_id} + + +```php +$query_params = json_decode('{"list_id": 1}'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a List + +**This endpoint allows you to delete a specific recipient list with the given ID.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### DELETE /contactdb/lists/{list_id} + + +```php +$query_params = json_decode('{"delete_contacts": "true"}'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add Multiple Recipients to a List + +**This endpoint allows you to add multiple recipients to a list.** + +Adds existing recipients to a list, passing in the recipient IDs to add. Recipient IDs should be passed exactly as they are returned from recipient endpoints. + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### POST /contactdb/lists/{list_id}/recipients + + +```php +$request_body = json_decode('[ + "recipient_id1", + "recipient_id2" +]'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all recipients on a List + +**This endpoint allows you to retrieve all recipients on the list with the given ID.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### GET /contactdb/lists/{list_id}/recipients + + +```php +$query_params = json_decode('{"page": 1, "page_size": 1}'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add a Single Recipient to a List + +**This endpoint allows you to add a single recipient to a list.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### POST /contactdb/lists/{list_id}/recipients/{recipient_id} + + +```php +$list_id = "test_url_param"; +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->_($recipient_id)->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a Single Recipient from a Single List + +**This endpoint allows you to delete a single recipient from a list.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### DELETE /contactdb/lists/{list_id}/recipients/{recipient_id} + + +```php +$query_params = json_decode('{"recipient_id": 1, "list_id": 1}'); +$list_id = "test_url_param"; +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->_($recipient_id)->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update Recipient + +**This endpoint allows you to update one or more recipients.** + +The body of an API call to this endpoint must include an array of one or more recipient objects. + +It is of note that you can add custom field data as parameters on recipient objects. We have provided an example using some of the default custom fields SendGrid provides. + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### PATCH /contactdb/recipients + + +```php +$request_body = json_decode('[ + { + "email": "jones@example.com", + "first_name": "Guy", + "last_name": "Jones" + } +]'); +$response = $sg->client->contactdb()->recipients()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add recipients + +**This endpoint allows you to add a Marketing Campaigns recipient.** + +It is of note that you can add custom field data as a parameter on this endpoint. We have provided an example using some of the default custom fields SendGrid provides. + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### POST /contactdb/recipients + + +```php +$request_body = json_decode('[ + { + "age": 25, + "email": "example@example.com", + "first_name": "", + "last_name": "User" + }, + { + "age": 25, + "email": "example2@example.com", + "first_name": "Example", + "last_name": "User" + } +]'); +$response = $sg->client->contactdb()->recipients()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve recipients + +**This endpoint allows you to retrieve all of your Marketing Campaigns recipients.** + +Batch deletion of a page makes it possible to receive an empty page of recipients before reaching the end of +the list of recipients. To avoid this issue; iterate over pages until a 404 is retrieved. + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### GET /contactdb/recipients + + +```php +$query_params = json_decode('{"page": 1, "page_size": 1}'); +$response = $sg->client->contactdb()->recipients()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete Recipient + +**This endpoint allows you to deletes one or more recipients.** + +The body of an API call to this endpoint must include an array of recipient IDs of the recipients you want to delete. + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### DELETE /contactdb/recipients + + +```php +$request_body = json_decode('[ + "recipient_id1", + "recipient_id2" +]'); +$response = $sg->client->contactdb()->recipients()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve the count of billable recipients + +**This endpoint allows you to retrieve the number of Marketing Campaigns recipients that you will be billed for.** + +You are billed for marketing campaigns based on the highest number of recipients you have had in your account at one time. This endpoint will allow you to know the current billable count value. + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### GET /contactdb/recipients/billable_count + + +```php +$response = $sg->client->contactdb()->recipients()->billable_count()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a Count of Recipients + +**This endpoint allows you to retrieve the total number of Marketing Campaigns recipients.** + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### GET /contactdb/recipients/count + + +```php +$response = $sg->client->contactdb()->recipients()->count()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve recipients matching search criteria + +**This endpoint allows you to perform a search on all of your Marketing Campaigns recipients.** + +field_name: + +* is a variable that is substituted for your actual custom field name from your recipient. +* Text fields must be url-encoded. Date fields are searchable only by unix timestamp (e.g. 2/2/2015 becomes 1422835200) +* If field_name is a 'reserved' date field, such as created_at or updated_at, the system will internally convert +your epoch time to a date range encompassing the entire day. For example, an epoch time of 1422835600 converts to +Mon, 02 Feb 2015 00:06:40 GMT, but internally the system will search from Mon, 02 Feb 2015 00:00:00 GMT through +Mon, 02 Feb 2015 23:59:59 GMT. + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### GET /contactdb/recipients/search + + +```php +$query_params = json_decode('{"{field_name}": "test_string"}'); +$response = $sg->client->contactdb()->recipients()->search()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a single recipient + +**This endpoint allows you to retrieve a single recipient by ID from your contact database.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### GET /contactdb/recipients/{recipient_id} + + +```php +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->recipients()->_($recipient_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a Recipient + +**This endpoint allows you to delete a single recipient with the given ID from your contact database.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### DELETE /contactdb/recipients/{recipient_id} + + +```php +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->recipients()->_($recipient_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve the lists that a recipient is on + +**This endpoint allows you to retrieve the lists that a given recipient belongs to.** + +Each recipient can be on many lists. This endpoint gives you all of the lists that any one recipient has been added to. + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +### GET /contactdb/recipients/{recipient_id}/lists + + +```php +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->recipients()->_($recipient_id)->lists()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve reserved fields + +**This endpoint allows you to list all fields that are reserved and can't be used for custom field names.** + +The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html). + +### GET /contactdb/reserved_fields + + +```php +$response = $sg->client->contactdb()->reserved_fields()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Create a Segment + +**This endpoint allows you to create a segment.** + +All recipients in your contactdb will be added or removed automatically depending on whether they match the criteria for this segment. + +List Id: + +* Send this to segment from an existing list +* Don't send this in order to segment from your entire contactdb. + +Valid operators for create and update depend on the type of the field you are segmenting: + +* **Dates:** "eq", "ne", "lt" (before), "gt" (after) +* **Text:** "contains", "eq" (is - matches the full field), "ne" (is not - matches any field where the entire field is not the condition value) +* **Numbers:** "eq", "lt", "gt" +* **Email Clicks and Opens:** "eq" (opened), "ne" (not opened) + +Segment conditions using "eq" or "ne" for email clicks and opens should provide a "field" of either *clicks.campaign_identifier* or *opens.campaign_identifier*. The condition value should be a string containing the id of a completed campaign. + +Segments may contain multiple condtions, joined by an "and" or "or" in the "and_or" field. The first condition in the conditions list must have an empty "and_or", and subsequent conditions must all specify an "and_or". + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment). + +### POST /contactdb/segments + + +```php +$request_body = json_decode('{ + "conditions": [ + { + "and_or": "", + "field": "last_name", + "operator": "eq", + "value": "Miller" + }, + { + "and_or": "and", + "field": "last_clicked", + "operator": "gt", + "value": "01/02/2015" + }, + { + "and_or": "or", + "field": "clicks.campaign_identifier", + "operator": "eq", + "value": "513" + } + ], + "list_id": 4, + "name": "Last Name Miller" +}'); +$response = $sg->client->contactdb()->segments()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all segments + +**This endpoint allows you to retrieve all of your segments.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment). + +### GET /contactdb/segments + + +```php +$response = $sg->client->contactdb()->segments()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a segment + +**This endpoint allows you to update a segment.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment). + +### PATCH /contactdb/segments/{segment_id} + + +```php +$request_body = json_decode('{ + "conditions": [ + { + "and_or": "", + "field": "last_name", + "operator": "eq", + "value": "Miller" + } + ], + "list_id": 5, + "name": "The Millers" +}'); +$query_params = json_decode('{"segment_id": "test_string"}'); +$segment_id = "test_url_param"; +$response = $sg->client->contactdb()->segments()->_($segment_id)->patch($request_body, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a segment + +**This endpoint allows you to retrieve a single segment with the given ID.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment). + +### GET /contactdb/segments/{segment_id} + + +```php +$query_params = json_decode('{"segment_id": 1}'); +$segment_id = "test_url_param"; +$response = $sg->client->contactdb()->segments()->_($segment_id)->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a segment + +**This endpoint allows you to delete a segment from your recipients database.** + +You also have the option to delete all the contacts from your Marketing Campaigns recipient database who were in this segment. + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment). + +### DELETE /contactdb/segments/{segment_id} + + +```php +$query_params = json_decode('{"delete_contacts": "true"}'); +$segment_id = "test_url_param"; +$response = $sg->client->contactdb()->segments()->_($segment_id)->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve recipients on a segment + +**This endpoint allows you to retrieve all of the recipients in a segment with the given ID.** + +The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients. + +For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment). + +### GET /contactdb/segments/{segment_id}/recipients + + +```php +$query_params = json_decode('{"page": 1, "page_size": 1}'); +$segment_id = "test_url_param"; +$response = $sg->client->contactdb()->segments()->_($segment_id)->recipients()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="devices"></a> +# DEVICES + +## Retrieve email statistics by device type. + +**This endpoint allows you to retrieve your email statistics segmented by the device type.** + +**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints. + +## Available Device Types +| **Device** | **Description** | **Example** | +|---|---|---| +| Desktop | Email software on desktop computer. | I.E., Outlook, Sparrow, or Apple Mail. | +| Webmail | A web-based email client. | I.E., Yahoo, Google, AOL, or Outlook.com. | +| Phone | A smart phone. | iPhone, Android, Blackberry, etc. +| Tablet | A tablet computer. | iPad, android based tablet, etc. | +| Other | An unrecognized device. | + +Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html). + +### GET /devices/stats + + +```php +$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}'); +$response = $sg->client->devices()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="geo"></a> +# GEO + +## Retrieve email statistics by country and state/province. + +**This endpoint allows you to retrieve your email statistics segmented by country and state/province.** + +**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints. + +Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html). + +### GET /geo/stats + + +```php +$query_params = json_decode('{"end_date": "2016-04-01", "country": "US", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}'); +$response = $sg->client->geo()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="ips"></a> +# IPS + +## Retrieve all IP addresses + +**This endpoint allows you to retrieve a list of all assigned and unassigned IPs.** + +Response includes warm up status, pools, assigned subusers, and whitelabel info. The start_date field corresponds to when warmup started for that IP. + +A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it. + +### GET /ips + + +```php +$query_params = json_decode('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}'); +$response = $sg->client->ips()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all assigned IPs + +**This endpoint allows you to retrieve only assigned IP addresses.** + +A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it. + +### GET /ips/assigned + + +```php +$response = $sg->client->ips()->assigned()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Create an IP pool. + +**This endpoint allows you to create an IP pool.** + +**Each user can create up to 10 different IP pools.** + +IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic. + +IP pools can only be used with whitelabeled IP addresses. + +If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools. + +### POST /ips/pools + + +```php +$request_body = json_decode('{ + "name": "marketing" +}'); +$response = $sg->client->ips()->pools()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all IP pools. + +**This endpoint allows you to retreive all of your IP pools.** + +IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic. + +IP pools can only be used with whitelabeled IP addresses. + +If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools. + +### GET /ips/pools + + +```php +$response = $sg->client->ips()->pools()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update an IP pools name. + +**This endpoint allows you to update the name of an IP pool.** + +IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic. + +IP pools can only be used with whitelabeled IP addresses. + +If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools. + +### PUT /ips/pools/{pool_name} + + +```php +$request_body = json_decode('{ + "name": "new_pool_name" +}'); +$pool_name = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all IPs in a specified pool. + +**This endpoint allows you to list all of the IP addresses that are in a specific IP pool.** + +IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic. + +IP pools can only be used with whitelabeled IP addresses. + +If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools. + +### GET /ips/pools/{pool_name} + + +```php +$pool_name = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete an IP pool. + +**This endpoint allows you to delete an IP pool.** + +IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic. + +IP pools can only be used with whitelabeled IP addresses. + +If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools. + +### DELETE /ips/pools/{pool_name} + + +```php +$pool_name = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add an IP address to a pool + +**This endpoint allows you to add an IP address to an IP pool.** + +You can add the same IP address to multiple pools. It may take up to 60 seconds for your IP address to be added to a pool after your request is made. + +A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it. + +### POST /ips/pools/{pool_name}/ips + + +```php +$request_body = json_decode('{ + "ip": "0.0.0.0" +}'); +$pool_name = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->ips()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Remove an IP address from a pool. + +**This endpoint allows you to remove an IP address from an IP pool.** + +The same IP address can be added to multiple IP pools. + +A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it. + +### DELETE /ips/pools/{pool_name}/ips/{ip} + + +```php +$pool_name = "test_url_param"; +$ip = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->ips()->_($ip)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add an IP to warmup + +**This endpoint allows you to enter an IP address into warmup mode.** + +SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup. + +For more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html). + +### POST /ips/warmup + + +```php +$request_body = json_decode('{ + "ip": "0.0.0.0" +}'); +$response = $sg->client->ips()->warmup()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all IPs currently in warmup + +**This endpoint allows you to retrieve all of your IP addresses that are currently warming up.** + +SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup. + +For more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html). + +### GET /ips/warmup + + +```php +$response = $sg->client->ips()->warmup()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve warmup status for a specific IP address + +**This endpoint allows you to retrieve the warmup status for a specific IP address.** + +SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup. + +For more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html). + +### GET /ips/warmup/{ip_address} + + +```php +$ip_address = "test_url_param"; +$response = $sg->client->ips()->warmup()->_($ip_address)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Remove an IP from warmup + +**This endpoint allows you to remove an IP address from warmup mode.** + +SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup. + +For more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html). + +### DELETE /ips/warmup/{ip_address} + + +```php +$ip_address = "test_url_param"; +$response = $sg->client->ips()->warmup()->_($ip_address)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all IP pools an IP address belongs to + +**This endpoint allows you to see which IP pools a particular IP address has been added to.** + +The same IP address can be added to multiple IP pools. + +A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it. + +### GET /ips/{ip_address} + + +```php +$ip_address = "test_url_param"; +$response = $sg->client->ips()->_($ip_address)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="mail"></a> +# MAIL + +## Create a batch ID + +**This endpoint allows you to generate a new batch ID. This batch ID can be associated with scheduled sends via the mail/send endpoint.** + +If you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at anytime up to 10 minutes before the schedule date, you can cancel all of the mail/send requests that have this batch ID by calling the Cancel Scheduled Send endpoint. + +More Information: + +* [Scheduling Parameters > Batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html) + +### POST /mail/batch + + +```php +$response = $sg->client->mail()->batch()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Validate batch ID + +**This endpoint allows you to validate a batch ID.** + +If you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at anytime up to 10 minutes before the schedule date, you can cancel all of the mail/send requests that have this batch ID by calling the Cancel Scheduled Send endpoint. + +More Information: + +* [Scheduling Parameters > Batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html) + +### GET /mail/batch/{batch_id} + + +```php +$batch_id = "test_url_param"; +$response = $sg->client->mail()->batch()->_($batch_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## v3 Mail Send + +This endpoint allows you to send email over SendGrids v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, please see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). + +* Top level parameters are referred to as "global". +* Individual fields within the personalizations array will override any other global, or message level, parameters that are defined outside of personalizations. + +For an overview of the v3 Mail Send endpoint, please visit our [v3 API Reference](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html) + +For more detailed information about how to use the v3 Mail Send endpoint, please visit our [Classroom](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/index.html). + +### POST /mail/send + +This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-php/blob/master/lib/helpers/mail/README.md). + +```php +$request_body = json_decode('{ + "asm": { + "group_id": 1, + "groups_to_display": [ + 1, + 2, + 3 + ] + }, + "attachments": [ + { + "content": "[BASE64 encoded content block here]", + "content_id": "ii_139db99fdb5c3704", + "disposition": "inline", + "filename": "file1.jpg", + "name": "file1", + "type": "jpg" + } + ], + "batch_id": "[YOUR BATCH ID GOES HERE]", + "categories": [ + "category1", + "category2" + ], + "content": [ + { + "type": "text/html", + "value": "<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>" + } + ], + "custom_args": { + "New Argument 1": "New Value 1", + "activationAttempt": "1", + "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]" + }, + "from": { + "email": "sam.smith@example.com", + "name": "Sam Smith" + }, + "headers": {}, + "ip_pool_name": "[YOUR POOL NAME GOES HERE]", + "mail_settings": { + "bcc": { + "email": "ben.doe@example.com", + "enable": true + }, + "bypass_list_management": { + "enable": true + }, + "footer": { + "enable": true, + "html": "<p>Thanks</br>The SendGrid Team</p>", + "text": "Thanks,/n The SendGrid Team" + }, + "sandbox_mode": { + "enable": false + }, + "spam_check": { + "enable": true, + "post_to_url": "http://example.com/compliance", + "threshold": 3 + } + }, + "personalizations": [ + { + "bcc": [ + { + "email": "sam.doe@example.com", + "name": "Sam Doe" + } + ], + "cc": [ + { + "email": "jane.doe@example.com", + "name": "Jane Doe" + } + ], + "custom_args": { + "New Argument 1": "New Value 1", + "activationAttempt": "1", + "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]" + }, + "headers": { + "X-Accept-Language": "en", + "X-Mailer": "MyApp" + }, + "send_at": 1409348513, + "subject": "Hello, World!", + "substitutions": { + "id": "substitutions", + "type": "object" + }, + "to": [ + { + "email": "john.doe@example.com", + "name": "John Doe" + } + ] + } + ], + "reply_to": { + "email": "sam.smith@example.com", + "name": "Sam Smith" + }, + "sections": { + "section": { + ":sectionName1": "section 1 text", + ":sectionName2": "section 2 text" + } + }, + "send_at": 1409348513, + "subject": "Hello, World!", + "template_id": "[YOUR TEMPLATE ID GOES HERE]", + "tracking_settings": { + "click_tracking": { + "enable": true, + "enable_text": true + }, + "ganalytics": { + "enable": true, + "utm_campaign": "[NAME OF YOUR REFERRER SOURCE]", + "utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]", + "utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]", + "utm_name": "[NAME OF YOUR CAMPAIGN]", + "utm_term": "[IDENTIFY PAID KEYWORDS HERE]" + }, + "open_tracking": { + "enable": true, + "substitution_tag": "%opentrack" + }, + "subscription_tracking": { + "enable": true, + "html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.", + "substitution_tag": "<%click here%>", + "text": "If you would like to unsubscribe and stop receiveing these emails <% click here %>." + } + } +}'); +$response = $sg->client->mail()->send()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="mail_settings"></a> +# MAIL SETTINGS + +## Retrieve all mail settings + +**This endpoint allows you to retrieve a list of all mail settings.** + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings + + +```php +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->mail_settings()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update address whitelist mail settings + +**This endpoint allows you to update your current email address whitelist settings.** + +The address whitelist setting whitelists a specified email address or domain for which mail should never be suppressed. For example, you own the domain example.com, and one or more of your recipients use email@example.com addresses, by placing example.com in the address whitelist setting, all bounces, blocks, and unsubscribes logged for that domain will be ignored and sent as if under normal sending conditions. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/address_whitelist + + +```php +$request_body = json_decode('{ + "enabled": true, + "list": [ + "email1@example.com", + "example.com" + ] +}'); +$response = $sg->client->mail_settings()->address_whitelist()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve address whitelist mail settings + +**This endpoint allows you to retrieve your current email address whitelist settings.** + +The address whitelist setting whitelists a specified email address or domain for which mail should never be suppressed. For example, you own the domain example.com, and one or more of your recipients use email@example.com addresses, by placing example.com in the address whitelist setting, all bounces, blocks, and unsubscribes logged for that domain will be ignored and sent as if under normal sending conditions. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/address_whitelist + + +```php +$response = $sg->client->mail_settings()->address_whitelist()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update BCC mail settings + +**This endpoint allows you to update your current BCC mail settings.** + +When the BCC mail setting is enabled, SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field, if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/bcc + + +```php +$request_body = json_decode('{ + "email": "email@example.com", + "enabled": false +}'); +$response = $sg->client->mail_settings()->bcc()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all BCC mail settings + +**This endpoint allows you to retrieve your current BCC mail settings.** + +When the BCC mail setting is enabled, SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field, if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/bcc + + +```php +$response = $sg->client->mail_settings()->bcc()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update bounce purge mail settings + +**This endpoint allows you to update your current bounce purge settings.** + +This setting allows you to set a schedule for SendGrid to automatically delete contacts from your soft and hard bounce suppression lists. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/bounce_purge + + +```php +$request_body = json_decode('{ + "enabled": true, + "hard_bounces": 5, + "soft_bounces": 5 +}'); +$response = $sg->client->mail_settings()->bounce_purge()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve bounce purge mail settings + +**This endpoint allows you to retrieve your current bounce purge settings.** + +This setting allows you to set a schedule for SendGrid to automatically delete contacts from your soft and hard bounce suppression lists. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/bounce_purge + + +```php +$response = $sg->client->mail_settings()->bounce_purge()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update footer mail settings + +**This endpoint allows you to update your current Footer mail settings.** + +The footer setting will insert a custom footer at the bottom of the text and HTML bodies. Use the embedded HTML editor and plain text entry fields to create the content of the footers to be inserted into your emails. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/footer + + +```php +$request_body = json_decode('{ + "enabled": true, + "html_content": "...", + "plain_content": "..." +}'); +$response = $sg->client->mail_settings()->footer()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve footer mail settings + +**This endpoint allows you to retrieve your current Footer mail settings.** + +The footer setting will insert a custom footer at the bottom of the text and HTML bodies. Use the embedded HTML editor and plain text entry fields to create the content of the footers to be inserted into your emails. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/footer + + +```php +$response = $sg->client->mail_settings()->footer()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update forward bounce mail settings + +**This endpoint allows you to update your current bounce forwarding mail settings.** + +Activating this setting allows you to specify an email address to which bounce reports are forwarded. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/forward_bounce + + +```php +$request_body = json_decode('{ + "email": "example@example.com", + "enabled": true +}'); +$response = $sg->client->mail_settings()->forward_bounce()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve forward bounce mail settings + +**This endpoint allows you to retrieve your current bounce forwarding mail settings.** + +Activating this setting allows you to specify an email address to which bounce reports are forwarded. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/forward_bounce + + +```php +$response = $sg->client->mail_settings()->forward_bounce()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update forward spam mail settings + +**This endpoint allows you to update your current Forward Spam mail settings.** + +Enabling the forward spam setting allows you to specify an email address to which spam reports will be forwarded. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/forward_spam + + +```php +$request_body = json_decode('{ + "email": "", + "enabled": false +}'); +$response = $sg->client->mail_settings()->forward_spam()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve forward spam mail settings + +**This endpoint allows you to retrieve your current Forward Spam mail settings.** + +Enabling the forward spam setting allows you to specify an email address to which spam reports will be forwarded. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/forward_spam + + +```php +$response = $sg->client->mail_settings()->forward_spam()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update plain content mail settings + +**This endpoint allows you to update your current Plain Content mail settings.** + +The plain content setting will automatically convert any plain text emails that you send to HTML before sending. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/plain_content + + +```php +$request_body = json_decode('{ + "enabled": false +}'); +$response = $sg->client->mail_settings()->plain_content()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve plain content mail settings + +**This endpoint allows you to retrieve your current Plain Content mail settings.** + +The plain content setting will automatically convert any plain text emails that you send to HTML before sending. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/plain_content + + +```php +$response = $sg->client->mail_settings()->plain_content()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update spam check mail settings + +**This endpoint allows you to update your current spam checker mail settings.** + +The spam checker filter notifies you when emails are detected that exceed a predefined spam threshold. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/spam_check + + +```php +$request_body = json_decode('{ + "enabled": true, + "max_score": 5, + "url": "url" +}'); +$response = $sg->client->mail_settings()->spam_check()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve spam check mail settings + +**This endpoint allows you to retrieve your current Spam Checker mail settings.** + +The spam checker filter notifies you when emails are detected that exceed a predefined spam threshold. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/spam_check + + +```php +$response = $sg->client->mail_settings()->spam_check()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update template mail settings + +**This endpoint allows you to update your current legacy email template settings.** + +This setting refers to our original email templates. We currently support more fully featured [transactional templates](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + +The legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### PATCH /mail_settings/template + + +```php +$request_body = json_decode('{ + "enabled": true, + "html_content": "<% body %>" +}'); +$response = $sg->client->mail_settings()->template()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve legacy template mail settings + +**This endpoint allows you to retrieve your current legacy email template settings.** + +This setting refers to our original email templates. We currently support more fully featured [transactional templates](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + +The legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages. + +Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). + +### GET /mail_settings/template + + +```php +$response = $sg->client->mail_settings()->template()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="mailbox_providers"></a> +# MAILBOX PROVIDERS + +## Retrieve email statistics by mailbox provider. + +**This endpoint allows you to retrieve your email statistics segmented by recipient mailbox provider.** + +**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints. + +Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html). + +### GET /mailbox_providers/stats + + +```php +$query_params = json_decode('{"end_date": "2016-04-01", "mailbox_providers": "test_string", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}'); +$response = $sg->client->mailbox_providers()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="partner_settings"></a> +# PARTNER SETTINGS + +## Returns a list of all partner settings. + +**This endpoint allows you to retrieve a list of all partner settings that you can enable.** + +Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). + +### GET /partner_settings + + +```php +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->partner_settings()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Updates New Relic partner settings. + +**This endpoint allows you to update or change your New Relic partner settings.** + +Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). + +By integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html). + +### PATCH /partner_settings/new_relic + + +```php +$request_body = json_decode('{ + "enable_subuser_statistics": true, + "enabled": true, + "license_key": "" +}'); +$response = $sg->client->partner_settings()->new_relic()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Returns all New Relic partner settings. + +**This endpoint allows you to retrieve your current New Relic partner settings.** + +Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). + +By integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html). + +### GET /partner_settings/new_relic + + +```php +$response = $sg->client->partner_settings()->new_relic()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="scopes"></a> +# SCOPES + +## Retrieve a list of scopes for which this user has access. + +**This endpoint returns a list of all scopes that this user has access to.** + +API Keys can be used to authenticate the use of [SendGrids v3 Web API](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html), or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). API Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access. For a more detailed explanation of how you can use API Key permissios, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/api_keys.html#-API-Key-Permissions) or [Classroom](https://sendgrid.com/docs/Classroom/Basics/API/api_key_permissions.html). + +### GET /scopes + + +```php +$response = $sg->client->scopes()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="senders"></a> +# SENDERS + +## Create a Sender Identity + +**This endpoint allows you to create a new sender identity.** + +*You may create up to 100 unique sender identities.* + +Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`. + +### POST /senders + + +```php +$request_body = json_decode('{ + "address": "123 Elm St.", + "address_2": "Apt. 456", + "city": "Denver", + "country": "United States", + "from": { + "email": "from@example.com", + "name": "Example INC" + }, + "nickname": "My Sender ID", + "reply_to": { + "email": "replyto@example.com", + "name": "Example INC" + }, + "state": "Colorado", + "zip": "80202" +}'); +$response = $sg->client->senders()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Get all Sender Identities + +**This endpoint allows you to retrieve a list of all sender identities that have been created for your account.** + +Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`. + +### GET /senders + + +```php +$response = $sg->client->senders()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a Sender Identity + +**This endpoint allows you to update a sender identity.** + +Updates to `from.email` require re-verification. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`. + +Partial updates are allowed, but fields that are marked as "required" in the POST (create) endpoint must not be nil if that field is included in the PATCH request. + +### PATCH /senders/{sender_id} + + +```php +$request_body = json_decode('{ + "address": "123 Elm St.", + "address_2": "Apt. 456", + "city": "Denver", + "country": "United States", + "from": { + "email": "from@example.com", + "name": "Example INC" + }, + "nickname": "My Sender ID", + "reply_to": { + "email": "replyto@example.com", + "name": "Example INC" + }, + "state": "Colorado", + "zip": "80202" +}'); +$sender_id = "test_url_param"; +$response = $sg->client->senders()->_($sender_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## View a Sender Identity + +**This endpoint allows you to retrieve a specific sender identity.** + +Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`. + +### GET /senders/{sender_id} + + +```php +$sender_id = "test_url_param"; +$response = $sg->client->senders()->_($sender_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a Sender Identity + +**This endoint allows you to delete one of your sender identities.** + +Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`. + +### DELETE /senders/{sender_id} + + +```php +$sender_id = "test_url_param"; +$response = $sg->client->senders()->_($sender_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Resend Sender Identity Verification + +**This enpdoint allows you to resend a sender identity verification email.** + +Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`. + +### POST /senders/{sender_id}/resend_verification + + +```php +$sender_id = "test_url_param"; +$response = $sg->client->senders()->_($sender_id)->resend_verification()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="stats"></a> +# STATS + +## Retrieve global email statistics + +**This endpoint allows you to retrieve all of your global email statistics between a given date range.** + +Parent accounts will see aggregated stats for their account and all subuser accounts. Subuser accounts will only see their own stats. + +### GET /stats + + +```php +$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}'); +$response = $sg->client->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="subusers"></a> +# SUBUSERS + +## Create Subuser + +This endpoint allows you to retrieve a list of all of your subusers. You can choose to retrieve specific subusers as well as limit the results that come back from the API. + +For more information about Subusers: + +* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html) +* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html) + +### POST /subusers + + +```php +$request_body = json_decode('{ + "email": "John@example.com", + "ips": [ + "1.1.1.1", + "2.2.2.2" + ], + "password": "johns_password", + "username": "John@example.com" +}'); +$response = $sg->client->subusers()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## List all Subusers + +This endpoint allows you to retrieve a list of all of your subusers. You can choose to retrieve specific subusers as well as limit the results that come back from the API. + +For more information about Subusers: + +* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html) +* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html) + +### GET /subusers + + +```php +$query_params = json_decode('{"username": "test_string", "limit": 1, "offset": 1}'); +$response = $sg->client->subusers()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve Subuser Reputations + +Subuser sender reputations give a good idea how well a sender is doing with regards to how recipients and recipient servers react to the mail that is being received. When a bounce, spam report, or other negative action happens on a sent email, it will effect your sender rating. + +This endpoint allows you to request the reputations for your subusers. + +### GET /subusers/reputations + + +```php +$query_params = json_decode('{"usernames": "test_string"}'); +$response = $sg->client->subusers()->reputations()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve email statistics for your subusers. + +**This endpoint allows you to retrieve the email statistics for the given subusers.** + +You may retrieve statistics for up to 10 different subusers by including an additional _subusers_ parameter for each additional subuser. + +While you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings. + +For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html). + +### GET /subusers/stats + + +```php +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "subusers": "test_string"}'); +$response = $sg->client->subusers()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve monthly stats for all subusers + +**This endpoint allows you to retrieve the monthly email statistics for all subusers over the given date range.** + +While you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats for your subusers. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings. + +When using the `sort_by_metric` to sort your stats by a specific metric, you can not sort by the following metrics: +`bounce_drops`, `deferred`, `invalid_emails`, `processed`, `spam_report_drops`, `spam_reports`, or `unsubscribe_drops`. + +For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html). + +### GET /subusers/stats/monthly + + +```php +$query_params = json_decode('{"subuser": "test_string", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "date": "test_string", "sort_by_direction": "asc"}'); +$response = $sg->client->subusers()->stats()->monthly()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve the totals for each email statistic metric for all subusers. + +**This endpoint allows you to retrieve the total sums of each email statistic metric for all subusers over the given date range.** + + +While you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings. + +For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html). + +### GET /subusers/stats/sums + + +```php +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}'); +$response = $sg->client->subusers()->stats()->sums()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Enable/disable a subuser + +This endpoint allows you to enable or disable a subuser. + +For more information about Subusers: + +* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html) +* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html) + +### PATCH /subusers/{subuser_name} + + +```php +$request_body = json_decode('{ + "disabled": false +}'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a subuser + +This endpoint allows you to delete a subuser. This is a permanent action, once deleted a subuser cannot be retrieved. + +For more information about Subusers: + +* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html) +* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html) + +### DELETE /subusers/{subuser_name} + + +```php +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update IPs assigned to a subuser + +Each subuser should be assigned to an IP address, from which all of this subuser's mail will be sent. Often, this is the same IP as the parent account, but each subuser can have their own, or multiple, IP addresses as well. + +More information: + +* [How to request more IPs](https://sendgrid.com/docs/Classroom/Basics/Account/adding_an_additional_dedicated_ip_to_your_account.html) +* [IPs can be whitelabeled](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/ips.html) + +### PUT /subusers/{subuser_name}/ips + + +```php +$request_body = json_decode('[ + "127.0.0.1" +]'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->ips()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update Monitor Settings for a subuser + +Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails. + +### PUT /subusers/{subuser_name}/monitor + + +```php +$request_body = json_decode('{ + "email": "example@example.com", + "frequency": 500 +}'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->monitor()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Create monitor settings + +Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails. + +### POST /subusers/{subuser_name}/monitor + + +```php +$request_body = json_decode('{ + "email": "example@example.com", + "frequency": 50000 +}'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->monitor()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve monitor settings for a subuser + +Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails. + +### GET /subusers/{subuser_name}/monitor + + +```php +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->monitor()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete monitor settings + +Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails. + +### DELETE /subusers/{subuser_name}/monitor + + +```php +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->monitor()->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve the monthly email statistics for a single subuser + +**This endpoint allows you to retrive the monthly email statistics for a specific subuser.** + +While you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats for your subusers. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings. + +When using the `sort_by_metric` to sort your stats by a specific metric, you can not sort by the following metrics: +`bounce_drops`, `deferred`, `invalid_emails`, `processed`, `spam_report_drops`, `spam_reports`, or `unsubscribe_drops`. + +For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html). + +### GET /subusers/{subuser_name}/stats/monthly + + +```php +$query_params = json_decode('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->stats()->monthly()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="suppression"></a> +# SUPPRESSION + +## Retrieve all blocks + +**This endpoint allows you to retrieve a list of all email addresses that are currently on your blocks list.** + +[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html). + +### GET /suppression/blocks + + +```php +$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); +$response = $sg->client->suppression()->blocks()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete blocks + +**This endpoint allows you to delete all email addresses on your blocks list.** + +There are two options for deleting blocked emails: + +1. You can delete all blocked emails by setting `delete_all` to true in the request body. +2. You can delete some blocked emails by specifying the email addresses in an array in the request body. + +[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html). + +### DELETE /suppression/blocks + + +```php +$request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); +$response = $sg->client->suppression()->blocks()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a specific block + +**This endpoint allows you to retrieve a specific email address from your blocks list.** + +[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html). + +### GET /suppression/blocks/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->suppression()->blocks()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a specific block + +**This endpoint allows you to delete a specific email address from your blocks list.** + +[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html). + +### DELETE /suppression/blocks/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->suppression()->blocks()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all bounces + +**This endpoint allows you to retrieve all of your bounces.** + +Bounces are messages that are returned to the server that sent it. + +For more information see: + +* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information +* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html) + +### GET /suppression/bounces + + +```php +$query_params = json_decode('{"start_time": 1, "end_time": 1}'); +$response = $sg->client->suppression()->bounces()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete bounces + +**This endpoint allows you to delete all of your bounces. You can also use this endpoint to remove a specific email address from your bounce list.** + +Bounces are messages that are returned to the server that sent it. + +For more information see: + +* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information +* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html) +* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html) + +Note: the `delete_all` and `emails` parameters should be used independently of each other as they have different purposes. + +### DELETE /suppression/bounces + + +```php +$request_body = json_decode('{ + "delete_all": true, + "emails": [ + "example@example.com", + "example2@example.com" + ] +}'); +$response = $sg->client->suppression()->bounces()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a Bounce + +**This endpoint allows you to retrieve a specific bounce for a given email address.** + +Bounces are messages that are returned to the server that sent it. + +For more information see: + +* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information +* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html) +* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html) + +### GET /suppression/bounces/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->suppression()->bounces()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a bounce + +**This endpoint allows you to remove an email address from your bounce list.** + +Bounces are messages that are returned to the server that sent it. This endpoint allows you to delete a single email addresses from your bounce list. + +For more information see: + +* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information +* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html) +* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html) + +### DELETE /suppression/bounces/{email} + + +```php +$query_params = json_decode('{"email_address": "example@example.com"}'); +$email = "test_url_param"; +$response = $sg->client->suppression()->bounces()->_($email)->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all invalid emails + +**This endpoint allows you to retrieve a list of all invalid email addresses.** + +An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipients mail server. + +Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html). + +### GET /suppression/invalid_emails + + +```php +$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); +$response = $sg->client->suppression()->invalid_emails()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete invalid emails + +**This endpoint allows you to remove email addresses from your invalid email address list.** + +There are two options for deleting invalid email addresses: + +1) You can delete all invalid email addresses by setting `delete_all` to true in the request body. +2) You can delete some invalid email addresses by specifying certain addresses in an array in the request body. + +An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipients mail server. + +Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html). + +### DELETE /suppression/invalid_emails + + +```php +$request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); +$response = $sg->client->suppression()->invalid_emails()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a specific invalid email + +**This endpoint allows you to retrieve a specific invalid email addresses.** + +An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipients mail server. + +Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html). + +### GET /suppression/invalid_emails/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->suppression()->invalid_emails()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a specific invalid email + +**This endpoint allows you to remove a specific email address from the invalid email address list.** + +An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipients mail server. + +Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html). + +### DELETE /suppression/invalid_emails/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->suppression()->invalid_emails()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a specific spam report + +**This endpoint allows you to retrieve a specific spam report.** + +[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html). + +### GET /suppression/spam_report/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->suppression()->spam_report()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a specific spam report + +**This endpoint allows you to delete a specific spam report.** + +[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html). + +### DELETE /suppression/spam_report/{email} + + +```php +$email = "test_url_param"; +$response = $sg->client->suppression()->spam_report()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all spam reports + +**This endpoint allows you to retrieve all spam reports.** + +[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html). + +### GET /suppression/spam_reports + + +```php +$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); +$response = $sg->client->suppression()->spam_reports()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete spam reports + +**This endpoint allows you to delete your spam reports.** + +There are two options for deleting spam reports: + +1) You can delete all spam reports by setting "delete_all" to true in the request body. +2) You can delete some spam reports by specifying the email addresses in an array in the request body. + +[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid. + +For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html). + +### DELETE /suppression/spam_reports + + +```php +$request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); +$response = $sg->client->suppression()->spam_reports()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all global suppressions + +**This endpoint allows you to retrieve a list of all email address that are globally suppressed.** + +A global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html). + +### GET /suppression/unsubscribes + + +```php +$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); +$response = $sg->client->suppression()->unsubscribes()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="templates"></a> +# TEMPLATES + +## Create a transactional template. + +**This endpoint allows you to create a transactional template.** + +Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts. + +Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + +### POST /templates + + +```php +$request_body = json_decode('{ + "name": "example_name" +}'); +$response = $sg->client->templates()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all transactional templates. + +**This endpoint allows you to retrieve all transactional templates.** + +Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts. + +Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + +### GET /templates + + +```php +$response = $sg->client->templates()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Edit a transactional template. + +**This endpoint allows you to edit a transactional template.** + +Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts. + +Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + + +### PATCH /templates/{template_id} + + +```php +$request_body = json_decode('{ + "name": "new_example_name" +}'); +$template_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a single transactional template. + +**This endpoint allows you to retrieve a single transactional template.** + +Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts. + +Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + + +### GET /templates/{template_id} + + +```php +$template_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a template. + +**This endpoint allows you to delete a transactional template.** + +Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts. + +Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + + +### DELETE /templates/{template_id} + + +```php +$template_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Create a new transactional template version. + +**This endpoint allows you to create a new version of a template.** + +Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates. + +For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + + +### POST /templates/{template_id}/versions + + +```php +$request_body = json_decode('{ + "active": 1, + "html_content": "<%body%>", + "name": "example_version_name", + "plain_content": "<%body%>", + "subject": "<%subject%>", + "template_id": "ddb96bbc-9b92-425e-8979-99464621b543" +}'); +$template_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Edit a transactional template version. + +**This endpoint allows you to edit a version of one of your transactional templates.** + +Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates. + +For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| template_id | string | The ID of the original template | +| version_id | string | The ID of the template version | + +### PATCH /templates/{template_id}/versions/{version_id} + + +```php +$request_body = json_decode('{ + "active": 1, + "html_content": "<%body%>", + "name": "updated_example_name", + "plain_content": "<%body%>", + "subject": "<%subject%>" +}'); +$template_id = "test_url_param"; +$version_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a specific transactional template version. + +**This endpoint allows you to retrieve a specific version of a template.** + +Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates. + +For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| template_id | string | The ID of the original template | +| version_id | string | The ID of the template version | + +### GET /templates/{template_id}/versions/{version_id} + + +```php +$template_id = "test_url_param"; +$version_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a transactional template version. + +**This endpoint allows you to delete one of your transactional template versions.** + +Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates. + +For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| template_id | string | The ID of the original template | +| version_id | string | The ID of the template version | + +### DELETE /templates/{template_id}/versions/{version_id} + + +```php +$template_id = "test_url_param"; +$version_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Activate a transactional template version. + +**This endpoint allows you to activate a version of one of your templates.** + +Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates. + + +For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| template_id | string | The ID of the original template | +| version_id | string | The ID of the template version | + +### POST /templates/{template_id}/versions/{version_id}/activate + + +```php +$template_id = "test_url_param"; +$version_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->activate()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="tracking_settings"></a> +# TRACKING SETTINGS + +## Retrieve Tracking Settings + +**This endpoint allows you to retrieve a list of all tracking settings that you can enable on your account.** + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### GET /tracking_settings + + +```php +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->tracking_settings()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update Click Tracking Settings + +**This endpoint allows you to change your current click tracking setting. You can enable, or disable, click tracking using this endpoint.** + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### PATCH /tracking_settings/click + + +```php +$request_body = json_decode('{ + "enabled": true +}'); +$response = $sg->client->tracking_settings()->click()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve Click Track Settings + +**This endpoint allows you to retrieve your current click tracking setting.** + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### GET /tracking_settings/click + + +```php +$response = $sg->client->tracking_settings()->click()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update Google Analytics Settings + +**This endpoint allows you to update your current setting for Google Analytics.** + +For more information about using Google Analytics, please refer to [Googles URL Builder](https://support.google.com/analytics/answer/1033867?hl=en) and their article on ["Best Practices for Campaign Building"](https://support.google.com/analytics/answer/1037445). + +We default the settings to Googles recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/google_analytics_demystified_ga_statistics_vs_sg_statistics.html). + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### PATCH /tracking_settings/google_analytics + + +```php +$request_body = json_decode('{ + "enabled": true, + "utm_campaign": "website", + "utm_content": "", + "utm_medium": "email", + "utm_source": "sendgrid.com", + "utm_term": "" +}'); +$response = $sg->client->tracking_settings()->google_analytics()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve Google Analytics Settings + +**This endpoint allows you to retrieve your current setting for Google Analytics.** + +For more information about using Google Analytics, please refer to [Googles URL Builder](https://support.google.com/analytics/answer/1033867?hl=en) and their article on ["Best Practices for Campaign Building"](https://support.google.com/analytics/answer/1037445). + +We default the settings to Googles recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/google_analytics_demystified_ga_statistics_vs_sg_statistics.html). + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### GET /tracking_settings/google_analytics + + +```php +$response = $sg->client->tracking_settings()->google_analytics()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update Open Tracking Settings + +**This endpoint allows you to update your current settings for open tracking.** + +Open Tracking adds an invisible image at the end of the email which can track email opens. If the email recipient has images enabled on their email client, a request to SendGrids server for the invisible image is executed and an open event is logged. These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook. + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### PATCH /tracking_settings/open + + +```php +$request_body = json_decode('{ + "enabled": true +}'); +$response = $sg->client->tracking_settings()->open()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Get Open Tracking Settings + +**This endpoint allows you to retrieve your current settings for open tracking.** + +Open Tracking adds an invisible image at the end of the email which can track email opens. If the email recipient has images enabled on their email client, a request to SendGrids server for the invisible image is executed and an open event is logged. These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook. + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### GET /tracking_settings/open + + +```php +$response = $sg->client->tracking_settings()->open()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update Subscription Tracking Settings + +**This endpoint allows you to update your current settings for subscription tracking.** + +Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails. + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### PATCH /tracking_settings/subscription + + +```php +$request_body = json_decode('{ + "enabled": true, + "html_content": "html content", + "landing": "landing page html", + "plain_content": "text content", + "replace": "replacement tag", + "url": "url" +}'); +$response = $sg->client->tracking_settings()->subscription()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve Subscription Tracking Settings + +**This endpoint allows you to retrieve your current settings for subscription tracking.** + +Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails. + +You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails. + +For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html). + +### GET /tracking_settings/subscription + + +```php +$response = $sg->client->tracking_settings()->subscription()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="user"></a> +# USER + +## Get a user's account information. + +**This endpoint allows you to retrieve your user account details.** + +Your user's account information includes the user's account type and reputation. + +Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to. + +For more information about your user profile: + +* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html) + +### GET /user/account + + +```php +$response = $sg->client->user()->account()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve your credit balance + +**This endpoint allows you to retrieve the current credit balance for your account.** + +Your monthly credit allotment limits the number of emails you may send before incurring overage charges. For more information about credits and billing, please visit our [Clssroom](https://sendgrid.com/docs/Classroom/Basics/Billing/billing_info_and_faqs.html). + +### GET /user/credits + + +```php +$response = $sg->client->user()->credits()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update your account email address + +**This endpoint allows you to update the email address currently on file for your account.** + +Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to. + +For more information about your user profile: + +* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html) + +### PUT /user/email + + +```php +$request_body = json_decode('{ + "email": "example@example.com" +}'); +$response = $sg->client->user()->email()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve your account email address + +**This endpoint allows you to retrieve the email address currently on file for your account.** + +Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to. + +For more information about your user profile: + +* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html) + +### GET /user/email + + +```php +$response = $sg->client->user()->email()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update your password + +**This endpoint allows you to update your password.** + +Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to. + +For more information about your user profile: + +* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html) + +### PUT /user/password + + +```php +$request_body = json_decode('{ + "new_password": "new_password", + "old_password": "old_password" +}'); +$response = $sg->client->user()->password()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a user's profile + +**This endpoint allows you to update your current profile details.** + +Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to. + +For more information about your user profile: + +* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html) + +It should be noted that any one or more of the parameters can be updated via the PATCH /user/profile endpoint. The only requirement is that you include at least one when you PATCH. + +### PATCH /user/profile + + +```php +$request_body = json_decode('{ + "city": "Orange", + "first_name": "Example", + "last_name": "User" +}'); +$response = $sg->client->user()->profile()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Get a user's profile + +Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to. + +For more information about your user profile: + +* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html) + +### GET /user/profile + + +```php +$response = $sg->client->user()->profile()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Cancel or pause a scheduled send + +**This endpoint allows you to cancel or pause an email that has been scheduled to be sent.** + +If the maximum number of cancellations/pauses are added, HTTP 400 will +be returned. + +The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled. + +### POST /user/scheduled_sends + + +```php +$request_body = json_decode('{ + "batch_id": "YOUR_BATCH_ID", + "status": "pause" +}'); +$response = $sg->client->user()->scheduled_sends()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all scheduled sends + +**This endpoint allows you to retrieve all cancel/paused scheduled send information.** + +The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled. + +### GET /user/scheduled_sends + + +```php +$response = $sg->client->user()->scheduled_sends()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update user scheduled send information + +**This endpoint allows you to update the status of a scheduled send for the given `batch_id`.** + +The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled. + +### PATCH /user/scheduled_sends/{batch_id} + + +```php +$request_body = json_decode('{ + "status": "pause" +}'); +$batch_id = "test_url_param"; +$response = $sg->client->user()->scheduled_sends()->_($batch_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve scheduled send + +**This endpoint allows you to retrieve the cancel/paused scheduled send information for a specific `batch_id`.** + +The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled. + +### GET /user/scheduled_sends/{batch_id} + + +```php +$batch_id = "test_url_param"; +$response = $sg->client->user()->scheduled_sends()->_($batch_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a cancellation or pause of a scheduled send + +**This endpoint allows you to delete the cancellation/pause of a scheduled send.** + +The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled. + +### DELETE /user/scheduled_sends/{batch_id} + + +```php +$batch_id = "test_url_param"; +$response = $sg->client->user()->scheduled_sends()->_($batch_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update Enforced TLS settings + +**This endpoint allows you to update your current Enforced TLS settings.** + +The Enforced TLS settings specify whether or not the recipient is required to support TLS or have a valid certificate. See the [SMTP Ports User Guide](https://sendgrid.com/docs/Classroom/Basics/Email_Infrastructure/smtp_ports.html) for more information on opportunistic TLS. + +**Note:** If either setting is enabled and the recipient does not support TLS or have a valid certificate, we drop the message and send a block event with TLS required but not supported as the description. + +### PATCH /user/settings/enforced_tls + + +```php +$request_body = json_decode('{ + "require_tls": true, + "require_valid_cert": false +}'); +$response = $sg->client->user()->settings()->enforced_tls()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve current Enforced TLS settings. + +**This endpoint allows you to retrieve your current Enforced TLS settings.** + +The Enforced TLS settings specify whether or not the recipient is required to support TLS or have a valid certificate. See the [SMTP Ports User Guide](https://sendgrid.com/docs/Classroom/Basics/Email_Infrastructure/smtp_ports.html) for more information on opportunistic TLS. + +**Note:** If either setting is enabled and the recipient does not support TLS or have a valid certificate, we drop the message and send a block event with TLS required but not supported as the description. + +### GET /user/settings/enforced_tls + + +```php +$response = $sg->client->user()->settings()->enforced_tls()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update your username + +**This endpoint allows you to update the username for your account.** + +Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to. + +For more information about your user profile: + +* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html) + +### PUT /user/username + + +```php +$request_body = json_decode('{ + "username": "test_username" +}'); +$response = $sg->client->user()->username()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve your username + +**This endpoint allows you to retrieve your current account username.** + +Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to. + +For more information about your user profile: + +* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html) + +### GET /user/username + + +```php +$response = $sg->client->user()->username()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update Event Notification Settings + +**This endpoint allows you to update your current event webhook settings.** + +If an event type is marked as `true`, then the event webhook will include information about that event. + +SendGrids Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email. + +Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program. + +### PATCH /user/webhooks/event/settings + + +```php +$request_body = json_decode('{ + "bounce": true, + "click": true, + "deferred": true, + "delivered": true, + "dropped": true, + "enabled": true, + "group_resubscribe": true, + "group_unsubscribe": true, + "open": true, + "processed": true, + "spam_report": true, + "unsubscribe": true, + "url": "url" +}'); +$response = $sg->client->user()->webhooks()->event()->settings()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve Event Webhook settings + +**This endpoint allows you to retrieve your current event webhook settings.** + +If an event type is marked as `true`, then the event webhook will include information about that event. + +SendGrids Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email. + +Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program. + +### GET /user/webhooks/event/settings + + +```php +$response = $sg->client->user()->webhooks()->event()->settings()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Test Event Notification Settings + +**This endpoint allows you to test your event webhook by sending a fake event notification post to the provided URL.** + +SendGrids Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email. + +Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program. + +### POST /user/webhooks/event/test + + +```php +$request_body = json_decode('{ + "url": "url" +}'); +$response = $sg->client->user()->webhooks()->event()->test()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Create a parse setting + +**This endpoint allows you to create a new inbound parse setting.** + +The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the content, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html). + +### POST /user/webhooks/parse/settings + + +```php +$request_body = json_decode('{ + "hostname": "myhostname.com", + "send_raw": false, + "spam_check": true, + "url": "http://email.myhosthame.com" +}'); +$response = $sg->client->user()->webhooks()->parse()->settings()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all parse settings + +**This endpoint allows you to retrieve all of your current inbound parse settings.** + +The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html). + +### GET /user/webhooks/parse/settings + + +```php +$response = $sg->client->user()->webhooks()->parse()->settings()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a parse setting + +**This endpoint allows you to update a specific inbound parse setting.** + +The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html). + +### PATCH /user/webhooks/parse/settings/{hostname} + + +```php +$request_body = json_decode('{ + "send_raw": true, + "spam_check": false, + "url": "http://newdomain.com/parse" +}'); +$hostname = "test_url_param"; +$response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a specific parse setting + +**This endpoint allows you to retrieve a specific inbound parse setting.** + +The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html). + +### GET /user/webhooks/parse/settings/{hostname} + + +```php +$hostname = "test_url_param"; +$response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a parse setting + +**This endpoint allows you to delete a specific inbound parse setting.** + +The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html). + +### DELETE /user/webhooks/parse/settings/{hostname} + + +```php +$hostname = "test_url_param"; +$response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieves Inbound Parse Webhook statistics. + +**This endpoint allows you to retrieve the statistics for your Parse Webhook useage.** + +SendGrid's Inbound Parse Webhook allows you to parse the contents and attachments of incomming emails. The Parse API can then POST the parsed emails to a URL that you specify. The Inbound Parse Webhook cannot parse messages greater than 20MB in size, including all attachments. + +There are a number of pre-made integrations for the SendGrid Parse Webhook which make processing events easy. You can find these integrations in the [Library Index](https://sendgrid.com/docs/Integrate/libraries.html#-Webhook-Libraries). + +### GET /user/webhooks/parse/stats + + +```php +$query_params = json_decode('{"aggregated_by": "day", "limit": "test_string", "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": "test_string"}'); +$response = $sg->client->user()->webhooks()->parse()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +<a name="whitelabel"></a> +# WHITELABEL + +## Create a domain whitelabel. + +**This endpoint allows you to create a whitelabel for one of your domains.** + +If you are creating a domain whitelabel that you would like a subuser to use, you have two options: +1. Use the "username" parameter. This allows you to create a whitelabel on behalf of your subuser. This means the subuser is able to see and modify the created whitelabel. +2. Use the Association workflow (see Associate Domain section). This allows you to assign a whitelabel created by the parent to a subuser. This means the subuser will default to the assigned whitelabel, but will not be able to see or modify that whitelabel. However, if the subuser creates their own whitelabel it will overwrite the assigned whitelabel. + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +### POST /whitelabel/domains + + +```php +$request_body = json_decode('{ + "automatic_security": false, + "custom_spf": true, + "default": true, + "domain": "example.com", + "ips": [ + "192.168.1.1", + "192.168.1.2" + ], + "subdomain": "news", + "username": "john@example.com" +}'); +$response = $sg->client->whitelabel()->domains()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## List all domain whitelabels. + +**This endpoint allows you to retrieve a list of all domain whitelabels you have created.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + + +### GET /whitelabel/domains + + +```php +$query_params = json_decode('{"username": "test_string", "domain": "test_string", "exclude_subusers": "true", "limit": 1, "offset": 1}'); +$response = $sg->client->whitelabel()->domains()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Get the default domain whitelabel. + +**This endpoint allows you to retrieve the default whitelabel for a domain.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| domain | string |The domain to find a default domain whitelabel for. | + +### GET /whitelabel/domains/default + + +```php +$response = $sg->client->whitelabel()->domains()->default()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## List the domain whitelabel associated with the given user. + +**This endpoint allows you to retrieve all of the whitelabels that have been assigned to a specific subuser.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +Domain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| username | string | Username of the subuser to find associated whitelabels for. | + +### GET /whitelabel/domains/subuser + + +```php +$response = $sg->client->whitelabel()->domains()->subuser()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Disassociate a domain whitelabel from a given user. + +**This endpoint allows you to disassociate a specific whitelabel from a subuser.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +Domain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +## URI Parameters +| URI Parameter | Type | Required? | Description | +|---|---|---|---| +| username | string | required | Username for the subuser to find associated whitelabels for. | + +### DELETE /whitelabel/domains/subuser + + +```php +$response = $sg->client->whitelabel()->domains()->subuser()->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a domain whitelabel. + +**This endpoint allows you to update the settings for a domain whitelabel.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +### PATCH /whitelabel/domains/{domain_id} + + +```php +$request_body = json_decode('{ + "custom_spf": true, + "default": false +}'); +$domain_id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($domain_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a domain whitelabel. + +**This endpoint allows you to retrieve a specific domain whitelabel.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + + +### GET /whitelabel/domains/{domain_id} + + +```php +$domain_id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($domain_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a domain whitelabel. + +**This endpoint allows you to delete a domain whitelabel.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +### DELETE /whitelabel/domains/{domain_id} + + +```php +$domain_id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($domain_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Associate a domain whitelabel with a given user. + +**This endpoint allows you to associate a specific domain whitelabel with a subuser.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +Domain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| domain_id | integer | ID of the domain whitelabel to associate with the subuser. | + +### POST /whitelabel/domains/{domain_id}/subuser + + +```php +$request_body = json_decode('{ + "username": "jane@example.com" +}'); +$domain_id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($domain_id)->subuser()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Add an IP to a domain whitelabel. + +**This endpoint allows you to add an IP address to a domain whitelabel.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| id | integer | ID of the domain to which you are adding an IP | + +### POST /whitelabel/domains/{id}/ips + + +```php +$request_body = json_decode('{ + "ip": "192.168.0.1" +}'); +$id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($id)->ips()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Remove an IP from a domain whitelabel. + +**This endpoint allows you to remove a domain's IP address from that domain's whitelabel.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| id | integer | ID of the domain whitelabel to delete the IP from. | +| ip | string | IP to remove from the domain whitelabel. | + +### DELETE /whitelabel/domains/{id}/ips/{ip} + + +```php +$id = "test_url_param"; +$ip = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($id)->ips()->_($ip)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Validate a domain whitelabel. + +**This endpoint allows you to validate a domain whitelabel. If it fails, it will return an error message describing why the whitelabel could not be validated.** + +A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. + +For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) + +## URI Parameters +| URI Parameter | Type | Description | +|---|---|---| +| id | integer |ID of the domain whitelabel to validate. | + +### POST /whitelabel/domains/{id}/validate + + +```php +$id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($id)->validate()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Create an IP whitelabel + +**This endpoint allows you to create an IP whitelabel.** + +When creating an IP whitelable, you should use the same subdomain that you used when you created a domain whitelabel. + +A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html). + +### POST /whitelabel/ips + + +```php +$request_body = json_decode('{ + "domain": "example.com", + "ip": "192.168.1.1", + "subdomain": "email" +}'); +$response = $sg->client->whitelabel()->ips()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all IP whitelabels + +**This endpoint allows you to retrieve all of the IP whitelabels that have been createdy by this account.** + +You may include a search key by using the "ip" parameter. This enables you to perform a prefix search for a given IP segment (e.g. "192."). + +A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html). + +### GET /whitelabel/ips + + +```php +$query_params = json_decode('{"ip": "test_string", "limit": 1, "offset": 1}'); +$response = $sg->client->whitelabel()->ips()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve an IP whitelabel + +**This endpoint allows you to retrieve an IP whitelabel.** + +A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html). + +### GET /whitelabel/ips/{id} + + +```php +$id = "test_url_param"; +$response = $sg->client->whitelabel()->ips()->_($id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete an IP whitelabel + +**This endpoint allows you to delete an IP whitelabel.** + +A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html). + +### DELETE /whitelabel/ips/{id} + + +```php +$id = "test_url_param"; +$response = $sg->client->whitelabel()->ips()->_($id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Validate an IP whitelabel + +**This endpoint allows you to validate an IP whitelabel.** + +A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html). + +### POST /whitelabel/ips/{id}/validate + + +```php +$id = "test_url_param"; +$response = $sg->client->whitelabel()->ips()->_($id)->validate()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Create a Link Whitelabel + +**This endpoint allows you to create a new link whitelabel.** + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### POST /whitelabel/links + + +```php +$request_body = json_decode('{ + "default": true, + "domain": "example.com", + "subdomain": "mail" +}'); +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->whitelabel()->links()->post($request_body, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve all link whitelabels + +**This endpoint allows you to retrieve all link whitelabels.** + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### GET /whitelabel/links + + +```php +$query_params = json_decode('{"limit": 1}'); +$response = $sg->client->whitelabel()->links()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a Default Link Whitelabel + +**This endpoint allows you to retrieve the default link whitelabel.** + +Default link whitelabel is the actual link whitelabel to be used when sending messages. If there are multiple link whitelabels, the default is determined by the following order: +<ul> + <li>Validated link whitelabels marked as "default"</li> + <li>Legacy link whitelabels (migrated from the whitelabel wizard)</li> + <li>Default SendGrid link whitelabel (i.e. 100.ct.sendgrid.net)</li> +</ul> + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### GET /whitelabel/links/default + + +```php +$query_params = json_decode('{"domain": "test_string"}'); +$response = $sg->client->whitelabel()->links()->default()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve Associated Link Whitelabel + +**This endpoint allows you to retrieve the associated link whitelabel for a subuser.** + +Link whitelables can be associated with subusers from the parent account. This functionality allows +subusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account +must first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface. + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### GET /whitelabel/links/subuser + + +```php +$query_params = json_decode('{"username": "test_string"}'); +$response = $sg->client->whitelabel()->links()->subuser()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Disassociate a Link Whitelabel + +**This endpoint allows you to disassociate a link whitelabel from a subuser.** + +Link whitelables can be associated with subusers from the parent account. This functionality allows +subusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account +must first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface. + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### DELETE /whitelabel/links/subuser + + +```php +$query_params = json_decode('{"username": "test_string"}'); +$response = $sg->client->whitelabel()->links()->subuser()->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Update a Link Whitelabel + +**This endpoint allows you to update a specific link whitelabel. You can use this endpoint to change a link whitelabel's default status.** + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### PATCH /whitelabel/links/{id} + + +```php +$request_body = json_decode('{ + "default": true +}'); +$id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Retrieve a Link Whitelabel + +**This endpoint allows you to retrieve a specific link whitelabel.** + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### GET /whitelabel/links/{id} + + +```php +$id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Delete a Link Whitelabel + +**This endpoint allows you to delete a link whitelabel.** + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### DELETE /whitelabel/links/{id} + + +```php +$id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Validate a Link Whitelabel + +**This endpoint allows you to validate a link whitelabel.** + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### POST /whitelabel/links/{id}/validate + + +```php +$id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($id)->validate()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` +## Associate a Link Whitelabel + +**This endpoint allows you to associate a link whitelabel with a subuser account.** + +Link whitelables can be associated with subusers from the parent account. This functionality allows +subusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account +must first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface. + +Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. + +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). + +### POST /whitelabel/links/{link_id}/subuser + + +```php +$request_body = json_decode('{ + "username": "jane@example.com" +}'); +$link_id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($link_id)->subuser()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` + diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/USE_CASES.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/USE_CASES.md new file mode 100644 index 0000000..c7cb0a1 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/USE_CASES.md @@ -0,0 +1,168 @@ +This documentation provides examples for specific use cases. Please [open an issue](https://github.com/sendgrid/sendgrid-php/issues) or make a pull request for any use cases you would like us to document here. Thank you! + +# Table of Contents +* [Attachments](#attachments) +* [Transactional Templates](#transactional_templates) + +<a name="attachments"></a> +# Attachments + +Here is an example of attaching a text file to your email, assuming that text file `my_file.txt` is located in the same directory. + +```php +<?php +// using SendGrid's PHP Library +// https://github.com/sendgrid/sendgrid-php + +// If you are using Composer (recommended) +require 'vendor/autoload.php'; + +// If you are not using Composer +// require("path/to/sendgrid-php/sendgrid-php.php"); + +$from = new SendGrid\Email("Example User", "test@example.com"); +$subject = "Sending with SendGrid is Fun"; +$to = new SendGrid\Email("Example User", "test@example.com"); +$content = new SendGrid\Content("text/plain", "and easy to do anywhere, even with PHP"); +$file = 'my_file.txt'; +$file_encoded = base64_encode(file_get_contents($file)); +$attachment = new SendGrid\Attachment(); +$attachment->setContent($file_encoded); +$attachment->setType("application/text"); +$attachment->setDisposition("attachment"); +$attachment->setFilename("my_file.txt"); + +$mail = new SendGrid\Mail($from, $subject, $to, $content); +$mail->addAttachment($attachment); + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +$response = $sg->client->mail()->send()->post($mail); +echo $response->statusCode(); +print_r($response->headers()); +echo $response->body(); + +?> +``` + +<a name="transactional_templates"></a> +# Transactional Templates + +For this example, we assume you have created a [transactional template](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). Following is the template content we used for testing. + +Template ID (replace with your own): + +```text +13b8f94f-bcae-4ec6-b752-70d6cb59f932 +``` + +Email Subject: + +```text +<%subject%> +``` + +Template Body: + +```html +<html> +<head> + <title></title> +</head> +<body> +Hello -name-, +<br /><br/> +I'm glad you are trying out the template feature! +<br /><br/> +<%body%> +<br /><br/> +I hope you are having a great day in -city- :) +<br /><br/> +</body> +</html> +``` + +## With Mail Helper Class + +```php +<?php +// If you are using Composer +require 'vendor/autoload.php'; + +// If you are not using Composer (recommended) +// require("path/to/sendgrid-php/sendgrid-php.php"); + +$from = new SendGrid\Email(null, "test@example.com"); +$subject = "I'm replacing the subject tag"; +$to = new SendGrid\Email(null, "test@example.com"); +$content = new SendGrid\Content("text/html", "I'm replacing the <strong>body tag</strong>"); +$mail = new SendGrid\Mail($from, $subject, $to, $content); +$mail->personalization[0]->addSubstitution("-name-", "Example User"); +$mail->personalization[0]->addSubstitution("-city-", "Denver"); +$mail->setTemplateId("13b8f94f-bcae-4ec6-b752-70d6cb59f932"); + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +try { + $response = $sg->client->mail()->send()->post($mail); +} catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; +} + +echo $response->statusCode(); +print_r($response->headers()); +echo $response->body(); +``` + +## Without Mail Helper Class + +```php +<?php +// If you are using Composer +require 'vendor/autoload.php'; + +// If you are not using Composer (recommended) +// require("path/to/sendgrid-php/sendgrid-php.php"); + +$request_body = json_decode('{ + "personalizations": [ + { + "to": [ + { + "email": "dx@sendgrid.com" + } + ], + "substitutions": { + "-name-": "Example User", + "-city-": "Denver" + }, + "subject": "I\'m replacing the subject tag" + } + ], + "from": { + "email": "elmer@sendgrid.com" + }, + "content": [ + { + "type": "text/html", + "value": "I\'m replacing the <strong>body tag</strong>" + } + ], + "template_id": "13b8f94f-bcae-4ec6-b752-70d6cb59f932" +}'); + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +try { + $response = $sg->client->mail()->send()->post($request_body); +} catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; +} + +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); +``` diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json new file mode 100644 index 0000000..2e2a398 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json @@ -0,0 +1,23 @@ +{ + "name": "sendgrid/sendgrid", + "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", + "version": "6.0.0", + "homepage": "http://github.com/sendgrid/sendgrid-php", + "license": "MIT", + "keywords": ["SendGrid", "sendgrid", "email", "send", "grid"], + "require": { + "php": ">=5.6", + "sendgrid/php-http-client": "~3.7" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "squizlabs/php_codesniffer": "2.*" + }, + "replace": { + "sendgrid/sendgrid-php": "*" + }, + "type": "library", + "autoload": { + "files": ["lib/SendGrid.php", "lib/helpers/mail/Mail.php"] + } +}
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/accesssettings/accesssettings.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/accesssettings/accesssettings.php new file mode 100644 index 0000000..64ef5f0 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/accesssettings/accesssettings.php @@ -0,0 +1,84 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve all recent access attempts # +// GET /access_settings/activity # + +$query_params = json_decode('{"limit": 1}'); +$response = $sg->client->access_settings()->activity()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add one or more IPs to the whitelist # +// POST /access_settings/whitelist # + +$request_body = json_decode('{ + "ips": [ + { + "ip": "192.168.1.1" + }, + { + "ip": "192.*.*.*" + }, + { + "ip": "192.168.1.3/32" + } + ] +}'); +$response = $sg->client->access_settings()->whitelist()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a list of currently whitelisted IPs # +// GET /access_settings/whitelist # + +$response = $sg->client->access_settings()->whitelist()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Remove one or more IPs from the whitelist # +// DELETE /access_settings/whitelist # + +$request_body = json_decode('{ + "ids": [ + 1, + 2, + 3 + ] +}'); +$response = $sg->client->access_settings()->whitelist()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a specific whitelisted IP # +// GET /access_settings/whitelist/{rule_id} # + +$rule_id = "test_url_param"; +$response = $sg->client->access_settings()->whitelist()->_($rule_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Remove a specific IP from the whitelist # +// DELETE /access_settings/whitelist/{rule_id} # + +$rule_id = "test_url_param"; +$response = $sg->client->access_settings()->whitelist()->_($rule_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/alerts/alerts.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/alerts/alerts.php new file mode 100644 index 0000000..7414200 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/alerts/alerts.php @@ -0,0 +1,63 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create a new Alert # +// POST /alerts # + +$request_body = json_decode('{ + "email_to": "example@example.com", + "frequency": "daily", + "type": "stats_notification" +}'); +$response = $sg->client->alerts()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all alerts # +// GET /alerts # + +$response = $sg->client->alerts()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update an alert # +// PATCH /alerts/{alert_id} # + +$request_body = json_decode('{ + "email_to": "example@example.com" +}'); +$alert_id = "test_url_param"; +$response = $sg->client->alerts()->_($alert_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a specific alert # +// GET /alerts/{alert_id} # + +$alert_id = "test_url_param"; +$response = $sg->client->alerts()->_($alert_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete an alert # +// DELETE /alerts/{alert_id} # + +$alert_id = "test_url_param"; +$response = $sg->client->alerts()->_($alert_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/apikeys/apikeys.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/apikeys/apikeys.php new file mode 100644 index 0000000..7b344f5 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/apikeys/apikeys.php @@ -0,0 +1,85 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create API keys # +// POST /api_keys # + +$request_body = json_decode('{ + "name": "My API Key", + "sample": "data", + "scopes": [ + "mail.send", + "alerts.create", + "alerts.read" + ] +}'); +$response = $sg->client->api_keys()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all API Keys belonging to the authenticated user # +// GET /api_keys # + +$query_params = json_decode('{"limit": 1}'); +$response = $sg->client->api_keys()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update the name & scopes of an API Key # +// PUT /api_keys/{api_key_id} # + +$request_body = json_decode('{ + "name": "A New Hope", + "scopes": [ + "user.profile.read", + "user.profile.update" + ] +}'); +$api_key_id = "test_url_param"; +$response = $sg->client->api_keys()->_($api_key_id)->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update API keys # +// PATCH /api_keys/{api_key_id} # + +$request_body = json_decode('{ + "name": "A New Hope" +}'); +$api_key_id = "test_url_param"; +$response = $sg->client->api_keys()->_($api_key_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve an existing API Key # +// GET /api_keys/{api_key_id} # + +$api_key_id = "test_url_param"; +$response = $sg->client->api_keys()->_($api_key_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete API keys # +// DELETE /api_keys/{api_key_id} # + +$api_key_id = "test_url_param"; +$response = $sg->client->api_keys()->_($api_key_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/asm/asm.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/asm/asm.php new file mode 100644 index 0000000..6edd2cf --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/asm/asm.php @@ -0,0 +1,174 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create a new suppression group # +// POST /asm/groups # + +$request_body = json_decode('{ + "description": "Suggestions for products our users might like.", + "is_default": true, + "name": "Product Suggestions" +}'); +$response = $sg->client->asm()->groups()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve information about multiple suppression groups # +// GET /asm/groups # + +$query_params = json_decode('{"id": 1}'); +$response = $sg->client->asm()->groups()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a suppression group. # +// PATCH /asm/groups/{group_id} # + +$request_body = json_decode('{ + "description": "Suggestions for items our users might like.", + "id": 103, + "name": "Item Suggestions" +}'); +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Get information on a single suppression group. # +// GET /asm/groups/{group_id} # + +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a suppression group. # +// DELETE /asm/groups/{group_id} # + +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add suppressions to a suppression group # +// POST /asm/groups/{group_id}/suppressions # + +$request_body = json_decode('{ + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] +}'); +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->suppressions()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all suppressions for a suppression group # +// GET /asm/groups/{group_id}/suppressions # + +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->suppressions()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Search for suppressions within a group # +// POST /asm/groups/{group_id}/suppressions/search # + +$request_body = json_decode('{ + "recipient_emails": [ + "exists1@example.com", + "exists2@example.com", + "doesnotexists@example.com" + ] +}'); +$group_id = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->suppressions()->search()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a suppression from a suppression group # +// DELETE /asm/groups/{group_id}/suppressions/{email} # + +$group_id = "test_url_param"; +$email = "test_url_param"; +$response = $sg->client->asm()->groups()->_($group_id)->suppressions()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all suppressions # +// GET /asm/suppressions # + +$response = $sg->client->asm()->suppressions()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add recipient addresses to the global suppression group. # +// POST /asm/suppressions/global # + +$request_body = json_decode('{ + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] +}'); +$response = $sg->client->asm()->suppressions()->global()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a Global Suppression # +// GET /asm/suppressions/global/{email} # + +$email = "test_url_param"; +$response = $sg->client->asm()->suppressions()->global()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a Global Suppression # +// DELETE /asm/suppressions/global/{email} # + +$email = "test_url_param"; +$response = $sg->client->asm()->suppressions()->global()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all suppression groups for an email address # +// GET /asm/suppressions/{email} # + +$email = "test_url_param"; +$response = $sg->client->asm()->suppressions()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/browsers/browsers.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/browsers/browsers.php new file mode 100644 index 0000000..fffbbcf --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/browsers/browsers.php @@ -0,0 +1,17 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve email statistics by browser. # +// GET /browsers/stats # + +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "browsers": "test_string", "limit": "test_string", "offset": "test_string", "start_date": "2016-01-01"}'); +$response = $sg->client->browsers()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/campaigns/campaigns.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/campaigns/campaigns.php new file mode 100644 index 0000000..df2732f --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/campaigns/campaigns.php @@ -0,0 +1,154 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create a Campaign # +// POST /campaigns # + +$request_body = json_decode('{ + "categories": [ + "spring line" + ], + "custom_unsubscribe_url": "", + "html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>", + "ip_pool": "marketing", + "list_ids": [ + 110, + 124 + ], + "plain_content": "Check out our spring line!", + "segment_ids": [ + 110 + ], + "sender_id": 124451, + "subject": "New Products for Spring!", + "suppression_group_id": 42, + "title": "March Newsletter" +}'); +$response = $sg->client->campaigns()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all Campaigns # +// GET /campaigns # + +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->campaigns()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a Campaign # +// PATCH /campaigns/{campaign_id} # + +$request_body = json_decode('{ + "categories": [ + "summer line" + ], + "html_content": "<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>", + "plain_content": "Check out our summer line!", + "subject": "New Products for Summer!", + "title": "May Newsletter" +}'); +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a single campaign # +// GET /campaigns/{campaign_id} # + +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a Campaign # +// DELETE /campaigns/{campaign_id} # + +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a Scheduled Campaign # +// PATCH /campaigns/{campaign_id}/schedules # + +$request_body = json_decode('{ + "send_at": 1489451436 +}'); +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Schedule a Campaign # +// POST /campaigns/{campaign_id}/schedules # + +$request_body = json_decode('{ + "send_at": 1489771528 +}'); +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// View Scheduled Time of a Campaign # +// GET /campaigns/{campaign_id}/schedules # + +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Unschedule a Scheduled Campaign # +// DELETE /campaigns/{campaign_id}/schedules # + +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Send a Campaign # +// POST /campaigns/{campaign_id}/schedules/now # + +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->now()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Send a Test Campaign # +// POST /campaigns/{campaign_id}/schedules/test # + +$request_body = json_decode('{ + "to": "your.email@example.com" +}'); +$campaign_id = "test_url_param"; +$response = $sg->client->campaigns()->_($campaign_id)->schedules()->test()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/categories/categories.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/categories/categories.php new file mode 100644 index 0000000..bdc9d21 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/categories/categories.php @@ -0,0 +1,37 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve all categories # +// GET /categories # + +$query_params = json_decode('{"category": "test_string", "limit": 1, "offset": 1}'); +$response = $sg->client->categories()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve Email Statistics for Categories # +// GET /categories/stats # + +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "categories": "test_string"}'); +$response = $sg->client->categories()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve sums of email stats for each category [Needs: Stats object defined, has category ID?] # +// GET /categories/stats/sums # + +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}'); +$response = $sg->client->categories()->stats()->sums()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/clients/clients.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/clients/clients.php new file mode 100644 index 0000000..797fa38 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/clients/clients.php @@ -0,0 +1,28 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve email statistics by client type. # +// GET /clients/stats # + +$query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}'); +$response = $sg->client->clients()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve stats by a specific client type. # +// GET /clients/{client_type}/stats # + +$query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}'); +$client_type = "test_url_param"; +$response = $sg->client->clients()->_($client_type)->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/contactdb/contactdb.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/contactdb/contactdb.php new file mode 100644 index 0000000..277048f --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/contactdb/contactdb.php @@ -0,0 +1,396 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create a Custom Field # +// POST /contactdb/custom_fields # + +$request_body = json_decode('{ + "name": "pet", + "type": "text" +}'); +$response = $sg->client->contactdb()->custom_fields()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all custom fields # +// GET /contactdb/custom_fields # + +$response = $sg->client->contactdb()->custom_fields()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a Custom Field # +// GET /contactdb/custom_fields/{custom_field_id} # + +$custom_field_id = "test_url_param"; +$response = $sg->client->contactdb()->custom_fields()->_($custom_field_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a Custom Field # +// DELETE /contactdb/custom_fields/{custom_field_id} # + +$custom_field_id = "test_url_param"; +$response = $sg->client->contactdb()->custom_fields()->_($custom_field_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Create a List # +// POST /contactdb/lists # + +$request_body = json_decode('{ + "name": "your list name" +}'); +$response = $sg->client->contactdb()->lists()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all lists # +// GET /contactdb/lists # + +$response = $sg->client->contactdb()->lists()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete Multiple lists # +// DELETE /contactdb/lists # + +$request_body = json_decode('[ + 1, + 2, + 3, + 4 +]'); +$response = $sg->client->contactdb()->lists()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a List # +// PATCH /contactdb/lists/{list_id} # + +$request_body = json_decode('{ + "name": "newlistname" +}'); +$query_params = json_decode('{"list_id": 1}'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->patch($request_body, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a single list # +// GET /contactdb/lists/{list_id} # + +$query_params = json_decode('{"list_id": 1}'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a List # +// DELETE /contactdb/lists/{list_id} # + +$query_params = json_decode('{"delete_contacts": "true"}'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add Multiple Recipients to a List # +// POST /contactdb/lists/{list_id}/recipients # + +$request_body = json_decode('[ + "recipient_id1", + "recipient_id2" +]'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all recipients on a List # +// GET /contactdb/lists/{list_id}/recipients # + +$query_params = json_decode('{"page": 1, "page_size": 1, "list_id": 1}'); +$list_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add a Single Recipient to a List # +// POST /contactdb/lists/{list_id}/recipients/{recipient_id} # + +$list_id = "test_url_param"; +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->_($recipient_id)->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a Single Recipient from a Single List # +// DELETE /contactdb/lists/{list_id}/recipients/{recipient_id} # + +$query_params = json_decode('{"recipient_id": 1, "list_id": 1}'); +$list_id = "test_url_param"; +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->_($recipient_id)->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update Recipient # +// PATCH /contactdb/recipients # + +$request_body = json_decode('[ + { + "email": "jones@example.com", + "first_name": "Guy", + "last_name": "Jones" + } +]'); +$response = $sg->client->contactdb()->recipients()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add recipients # +// POST /contactdb/recipients # + +$request_body = json_decode('[ + { + "age": 25, + "email": "example@example.com", + "first_name": "", + "last_name": "User" + }, + { + "age": 25, + "email": "example2@example.com", + "first_name": "Example", + "last_name": "User" + } +]'); +$response = $sg->client->contactdb()->recipients()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve recipients # +// GET /contactdb/recipients # + +$query_params = json_decode('{"page": 1, "page_size": 1}'); +$response = $sg->client->contactdb()->recipients()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete Recipient # +// DELETE /contactdb/recipients # + +$request_body = json_decode('[ + "recipient_id1", + "recipient_id2" +]'); +$response = $sg->client->contactdb()->recipients()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve the count of billable recipients # +// GET /contactdb/recipients/billable_count # + +$response = $sg->client->contactdb()->recipients()->billable_count()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a Count of Recipients # +// GET /contactdb/recipients/count # + +$response = $sg->client->contactdb()->recipients()->count()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve recipients matching search criteria # +// GET /contactdb/recipients/search # + +$query_params = json_decode('{"{field_name}": "test_string"}'); +$response = $sg->client->contactdb()->recipients()->search()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a single recipient # +// GET /contactdb/recipients/{recipient_id} # + +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->recipients()->_($recipient_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a Recipient # +// DELETE /contactdb/recipients/{recipient_id} # + +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->recipients()->_($recipient_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve the lists that a recipient is on # +// GET /contactdb/recipients/{recipient_id}/lists # + +$recipient_id = "test_url_param"; +$response = $sg->client->contactdb()->recipients()->_($recipient_id)->lists()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve reserved fields # +// GET /contactdb/reserved_fields # + +$response = $sg->client->contactdb()->reserved_fields()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Create a Segment # +// POST /contactdb/segments # + +$request_body = json_decode('{ + "conditions": [ + { + "and_or": "", + "field": "last_name", + "operator": "eq", + "value": "Miller" + }, + { + "and_or": "and", + "field": "last_clicked", + "operator": "gt", + "value": "01/02/2015" + }, + { + "and_or": "or", + "field": "clicks.campaign_identifier", + "operator": "eq", + "value": "513" + } + ], + "list_id": 4, + "name": "Last Name Miller" +}'); +$response = $sg->client->contactdb()->segments()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all segments # +// GET /contactdb/segments # + +$response = $sg->client->contactdb()->segments()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a segment # +// PATCH /contactdb/segments/{segment_id} # + +$request_body = json_decode('{ + "conditions": [ + { + "and_or": "", + "field": "last_name", + "operator": "eq", + "value": "Miller" + } + ], + "list_id": 5, + "name": "The Millers" +}'); +$query_params = json_decode('{"segment_id": "test_string"}'); +$segment_id = "test_url_param"; +$response = $sg->client->contactdb()->segments()->_($segment_id)->patch($request_body, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a segment # +// GET /contactdb/segments/{segment_id} # + +$query_params = json_decode('{"segment_id": 1}'); +$segment_id = "test_url_param"; +$response = $sg->client->contactdb()->segments()->_($segment_id)->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a segment # +// DELETE /contactdb/segments/{segment_id} # + +$query_params = json_decode('{"delete_contacts": "true"}'); +$segment_id = "test_url_param"; +$response = $sg->client->contactdb()->segments()->_($segment_id)->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve recipients on a segment # +// GET /contactdb/segments/{segment_id}/recipients # + +$query_params = json_decode('{"page": 1, "page_size": 1}'); +$segment_id = "test_url_param"; +$response = $sg->client->contactdb()->segments()->_($segment_id)->recipients()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/devices/devices.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/devices/devices.php new file mode 100644 index 0000000..8204b16 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/devices/devices.php @@ -0,0 +1,17 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve email statistics by device type. # +// GET /devices/stats # + +$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}'); +$response = $sg->client->devices()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/geo/geo.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/geo/geo.php new file mode 100644 index 0000000..8c4c152 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/geo/geo.php @@ -0,0 +1,17 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve email statistics by country and state/province. # +// GET /geo/stats # + +$query_params = json_decode('{"end_date": "2016-04-01", "country": "US", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}'); +$response = $sg->client->geo()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/helpers/mail/example.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/helpers/mail/example.php new file mode 100644 index 0000000..4c29bcf --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/helpers/mail/example.php @@ -0,0 +1,201 @@ +<?php +namespace SendGrid; + +// If you are using Composer +require __DIR__ . '<PATH_TO>/vendor/autoload.php'; + + +function helloEmail() +{ + $from = new Email(null, "test@example.com"); + $subject = "Hello World from the SendGrid PHP Library"; + $to = new Email(null, "test@example.com"); + $content = new Content("text/plain", "some text here"); + $mail = new Mail($from, $subject, $to, $content); + $to = new Email(null, "test2@example.com"); + $mail->personalization[0]->addTo($to); + + //echo json_encode($mail, JSON_PRETTY_PRINT), "\n"; + return $mail; +} + +function kitchenSink() +{ + $from = new Email("DX", "test@example.com"); + $subject = "Hello World from the SendGrid PHP Library"; + $to = new Email("Example User", "test1@example.com"); + $content = new Content("text/plain", "some text here"); + + $mail = new Mail($from, $subject, $to, $content); + + $email2 = new Email("Example User", "test2@example.com"); + $mail->personalization[0]->addTo($email2); + $email3 = new Email("Example User", "test3@example.com"); + $mail->personalization[0]->addCc($email3); + $email4 = new Email("Example User", "test4@example.com"); + $mail->personalization[0]->addCc($email4); + $email5 = new Email("Example User", "test5@example.com"); + $mail->personalization[0]->addBcc($email5); + $email6 = new Email("Example User", "test6@example.com"); + $mail->personalization[0]->addBcc($email6); + $mail->personalization[0]->setSubject("Hello World from the SendGrid PHP Library"); + $mail->personalization[0]->addHeader("X-Test", "test"); + $mail->personalization[0]->addHeader("X-Mock", "true"); + $mail->personalization[0]->addSubstitution("%name%", "Example User"); + $mail->personalization[0]->addSubstitution("%city%", "Denver"); + $mail->personalization[0]->addCustomArg("user_id", "343"); + $mail->personalization[0]->addCustomArg("type", "marketing"); + $mail->personalization[0]->setSendAt(1443636843); + + $personalization1 = new Personalization(); + $email7 = new Email("Example User", "test7@example.com"); + $personalization1->addTo($email7); + $email8 = new Email("Example User", "test8@example.com"); + $personalization1->addTo($email8); + $email9 = new Email("Example User", "test9@example.com"); + $personalization1->addCc($email9); + $email10 = new Email("Example User", "test10@example.com"); + $personalization1->addCc($email10); + $email11 = new Email("Example User", "test11@example.com"); + $personalization1->addBcc($email11); + $email12 = new Email("Example User", "test12@example.com"); + $personalization1->addBcc($email12); + $personalization1->setSubject("Hello World from the SendGrid PHP Library"); + $personalization1->addHeader("X-Test", "test"); + $personalization1->addHeader("X-Mock", "true"); + $personalization1->addSubstitution("%name%", "Example User"); + $personalization1->addSubstitution("%city%", "Denver"); + $personalization1->addCustomArg("user_id", "343"); + $personalization1->addCustomArg("type", "marketing"); + $personalization1->setSendAt(1443636843); + $mail->addPersonalization($personalization1); + + $content = new Content("text/html", "<html><body>some text here</body></html>"); + $mail->addContent($content); + + $attachment = new Attachment(); + $attachment->setContent("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12"); + $attachment->setType("application/pdf"); + $attachment->setFilename("balance_001.pdf"); + $attachment->setDisposition("attachment"); + $attachment->setContentId("Balance Sheet"); + $mail->addAttachment($attachment); + + $attachment2 = new Attachment(); + $attachment2->setContent("BwdW"); + $attachment2->setType("image/png"); + $attachment2->setFilename("banner.png"); + $attachment2->setDisposition("inline"); + $attachment2->setContentId("Banner"); + $mail->addAttachment($attachment2); + + $mail->setTemplateId("439b6d66-4408-4ead-83de-5c83c2ee313a"); + + # This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html) to work + # $mail->setBatchID("sengrid_batch_id"); + + $mail->addSection("%section1%", "Substitution Text for Section 1"); + $mail->addSection("%section2%", "Substitution Text for Section 2"); + + $mail->addHeader("X-Test1", "1"); + $mail->addHeader("X-Test2", "2"); + + $mail->addCategory("May"); + $mail->addCategory("2016"); + + $mail->addCustomArg("campaign", "welcome"); + $mail->addCustomArg("weekday", "morning"); + + $mail->setSendAt(1443636842); + + $asm = new ASM(); + $asm->setGroupId(99); + $asm->setGroupsToDisplay([4,5,6,7,8]); + $mail->setASM($asm); + + $mail->setIpPoolName("23"); + + $mail_settings = new MailSettings(); + $bcc_settings = new BccSettings(); + $bcc_settings->setEnable(true); + $bcc_settings->setEmail("test@example.com"); + $mail_settings->setBccSettings($bcc_settings); + $sandbox_mode = new SandBoxMode(); + $sandbox_mode->setEnable(true); + $mail_settings->setSandboxMode($sandbox_mode); + $bypass_list_management = new BypassListManagement(); + $bypass_list_management->setEnable(true); + $mail_settings->setBypassListManagement($bypass_list_management); + $footer = new Footer(); + $footer->setEnable(true); + $footer->setText("Footer Text"); + $footer->setHtml("<html><body>Footer Text</body></html>"); + $mail_settings->setFooter($footer); + $spam_check = new SpamCheck(); + $spam_check->setEnable(true); + $spam_check->setThreshold(1); + $spam_check->setPostToUrl("https://spamcatcher.sendgrid.com"); + $mail_settings->setSpamCheck($spam_check); + $mail->setMailSettings($mail_settings); + + $tracking_settings = new TrackingSettings(); + $click_tracking = new ClickTracking(); + $click_tracking->setEnable(true); + $click_tracking->setEnableText(true); + $tracking_settings->setClickTracking($click_tracking); + $open_tracking = new OpenTracking(); + $open_tracking->setEnable(true); + $open_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message"); + $tracking_settings->setOpenTracking($open_tracking); + $subscription_tracking = new SubscriptionTracking(); + $subscription_tracking->setEnable(true); + $subscription_tracking->setText("text to insert into the text/plain portion of the message"); + $subscription_tracking->setHtml("<html><body>html to insert into the text/html portion of the message</body></html>"); + $subscription_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message"); + $tracking_settings->setSubscriptionTracking($subscription_tracking); + $ganalytics = new Ganalytics(); + $ganalytics->setEnable(true); + $ganalytics->setCampaignSource("some source"); + $ganalytics->setCampaignTerm("some term"); + $ganalytics->setCampaignContent("some content"); + $ganalytics->setCampaignName("some name"); + $ganalytics->setCampaignMedium("some medium"); + $tracking_settings->setGanalytics($ganalytics); + $mail->setTrackingSettings($tracking_settings); + + $reply_to = new ReplyTo("test@example.com", "Optional Name"); + $mail->setReplyTo($reply_to); + + //echo json_encode($mail, JSON_PRETTY_PRINT), "\n"; + return $mail; +} + +function sendHelloEmail() +{ + $apiKey = getenv('SENDGRID_API_KEY'); + $sg = new \SendGrid($apiKey); + + $request_body = helloEmail(); + $response = $sg->client->mail()->send()->post($request_body); + echo $response->statusCode(); + echo $response->body(); + print_r($response->headers()); +} + +function sendKitchenSink() +{ + $apiKey = getenv('SENDGRID_API_KEY'); + $sg = new \SendGrid($apiKey); + + $request_body = kitchenSink(); + $response = $sg->client->mail()->send()->post($request_body); + echo $response->statusCode(); + echo $response->body(); + print_r($response->headers()); +} + +sendHelloEmail(); // this will actually send an email +sendKitchenSink(); // this will only send an email if you set SandBox Mode to false +?> + + diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/ips/ips.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/ips/ips.php new file mode 100644 index 0000000..4827955 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/ips/ips.php @@ -0,0 +1,155 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve all IP addresses # +// GET /ips # + +$query_params = json_decode('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}'); +$response = $sg->client->ips()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all assigned IPs # +// GET /ips/assigned # + +$response = $sg->client->ips()->assigned()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Create an IP pool. # +// POST /ips/pools # + +$request_body = json_decode('{ + "name": "marketing" +}'); +$response = $sg->client->ips()->pools()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all IP pools. # +// GET /ips/pools # + +$response = $sg->client->ips()->pools()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update an IP pools name. # +// PUT /ips/pools/{pool_name} # + +$request_body = json_decode('{ + "name": "new_pool_name" +}'); +$pool_name = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all IPs in a specified pool. # +// GET /ips/pools/{pool_name} # + +$pool_name = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete an IP pool. # +// DELETE /ips/pools/{pool_name} # + +$pool_name = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add an IP address to a pool # +// POST /ips/pools/{pool_name}/ips # + +$request_body = json_decode('{ + "ip": "0.0.0.0" +}'); +$pool_name = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->ips()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Remove an IP address from a pool. # +// DELETE /ips/pools/{pool_name}/ips/{ip} # + +$pool_name = "test_url_param"; +$ip = "test_url_param"; +$response = $sg->client->ips()->pools()->_($pool_name)->ips()->_($ip)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add an IP to warmup # +// POST /ips/warmup # + +$request_body = json_decode('{ + "ip": "0.0.0.0" +}'); +$response = $sg->client->ips()->warmup()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all IPs currently in warmup # +// GET /ips/warmup # + +$response = $sg->client->ips()->warmup()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve warmup status for a specific IP address # +// GET /ips/warmup/{ip_address} # + +$ip_address = "test_url_param"; +$response = $sg->client->ips()->warmup()->_($ip_address)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Remove an IP from warmup # +// DELETE /ips/warmup/{ip_address} # + +$ip_address = "test_url_param"; +$response = $sg->client->ips()->warmup()->_($ip_address)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all IP pools an IP address belongs to # +// GET /ips/{ip_address} # + +$ip_address = "test_url_param"; +$response = $sg->client->ips()->_($ip_address)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mail/mail.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mail/mail.php new file mode 100644 index 0000000..69600ff --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mail/mail.php @@ -0,0 +1,174 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create a batch ID # +// POST /mail/batch # + +$response = $sg->client->mail()->batch()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Validate batch ID # +// GET /mail/batch/{batch_id} # + +$batch_id = "test_url_param"; +$response = $sg->client->mail()->batch()->_($batch_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// v3 Mail Send # +// POST /mail/send # +// This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-php/blob/master/lib/helpers/mail/README.md). + +$request_body = json_decode('{ + "asm": { + "group_id": 1, + "groups_to_display": [ + 1, + 2, + 3 + ] + }, + "attachments": [ + { + "content": "[BASE64 encoded content block here]", + "content_id": "ii_139db99fdb5c3704", + "disposition": "inline", + "filename": "file1.jpg", + "name": "file1", + "type": "jpg" + } + ], + "batch_id": "[YOUR BATCH ID GOES HERE]", + "categories": [ + "category1", + "category2" + ], + "content": [ + { + "type": "text/html", + "value": "<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>" + } + ], + "custom_args": { + "New Argument 1": "New Value 1", + "activationAttempt": "1", + "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]" + }, + "from": { + "email": "sam.smith@example.com", + "name": "Sam Smith" + }, + "headers": {}, + "ip_pool_name": "[YOUR POOL NAME GOES HERE]", + "mail_settings": { + "bcc": { + "email": "ben.doe@example.com", + "enable": true + }, + "bypass_list_management": { + "enable": true + }, + "footer": { + "enable": true, + "html": "<p>Thanks</br>The SendGrid Team</p>", + "text": "Thanks,/n The SendGrid Team" + }, + "sandbox_mode": { + "enable": false + }, + "spam_check": { + "enable": true, + "post_to_url": "http://example.com/compliance", + "threshold": 3 + } + }, + "personalizations": [ + { + "bcc": [ + { + "email": "sam.doe@example.com", + "name": "Sam Doe" + } + ], + "cc": [ + { + "email": "jane.doe@example.com", + "name": "Jane Doe" + } + ], + "custom_args": { + "New Argument 1": "New Value 1", + "activationAttempt": "1", + "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]" + }, + "headers": { + "X-Accept-Language": "en", + "X-Mailer": "MyApp" + }, + "send_at": 1409348513, + "subject": "Hello, World!", + "substitutions": { + "id": "substitutions", + "type": "object" + }, + "to": [ + { + "email": "john.doe@example.com", + "name": "John Doe" + } + ] + } + ], + "reply_to": { + "email": "sam.smith@example.com", + "name": "Sam Smith" + }, + "sections": { + "section": { + ":sectionName1": "section 1 text", + ":sectionName2": "section 2 text" + } + }, + "send_at": 1409348513, + "subject": "Hello, World!", + "template_id": "[YOUR TEMPLATE ID GOES HERE]", + "tracking_settings": { + "click_tracking": { + "enable": true, + "enable_text": true + }, + "ganalytics": { + "enable": true, + "utm_campaign": "[NAME OF YOUR REFERRER SOURCE]", + "utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]", + "utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]", + "utm_name": "[NAME OF YOUR CAMPAIGN]", + "utm_term": "[IDENTIFY PAID KEYWORDS HERE]" + }, + "open_tracking": { + "enable": true, + "substitution_tag": "%opentrack" + }, + "subscription_tracking": { + "enable": true, + "html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.", + "substitution_tag": "<%click here%>", + "text": "If you would like to unsubscribe and stop receiveing these emails <% click here %>." + } + } +}'); +$response = $sg->client->mail()->send()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mailboxproviders/mailboxproviders.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mailboxproviders/mailboxproviders.php new file mode 100644 index 0000000..108eecf --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mailboxproviders/mailboxproviders.php @@ -0,0 +1,17 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve email statistics by mailbox provider. # +// GET /mailbox_providers/stats # + +$query_params = json_decode('{"end_date": "2016-04-01", "mailbox_providers": "test_string", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}'); +$response = $sg->client->mailbox_providers()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mailsettings/mailsettings.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mailsettings/mailsettings.php new file mode 100644 index 0000000..bd3cdc8 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/mailsettings/mailsettings.php @@ -0,0 +1,220 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve all mail settings # +// GET /mail_settings # + +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->mail_settings()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update address whitelist mail settings # +// PATCH /mail_settings/address_whitelist # + +$request_body = json_decode('{ + "enabled": true, + "list": [ + "email1@example.com", + "example.com" + ] +}'); +$response = $sg->client->mail_settings()->address_whitelist()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve address whitelist mail settings # +// GET /mail_settings/address_whitelist # + +$response = $sg->client->mail_settings()->address_whitelist()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update BCC mail settings # +// PATCH /mail_settings/bcc # + +$request_body = json_decode('{ + "email": "email@example.com", + "enabled": false +}'); +$response = $sg->client->mail_settings()->bcc()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all BCC mail settings # +// GET /mail_settings/bcc # + +$response = $sg->client->mail_settings()->bcc()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update bounce purge mail settings # +// PATCH /mail_settings/bounce_purge # + +$request_body = json_decode('{ + "enabled": true, + "hard_bounces": 5, + "soft_bounces": 5 +}'); +$response = $sg->client->mail_settings()->bounce_purge()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve bounce purge mail settings # +// GET /mail_settings/bounce_purge # + +$response = $sg->client->mail_settings()->bounce_purge()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update footer mail settings # +// PATCH /mail_settings/footer # + +$request_body = json_decode('{ + "enabled": true, + "html_content": "...", + "plain_content": "..." +}'); +$response = $sg->client->mail_settings()->footer()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve footer mail settings # +// GET /mail_settings/footer # + +$response = $sg->client->mail_settings()->footer()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update forward bounce mail settings # +// PATCH /mail_settings/forward_bounce # + +$request_body = json_decode('{ + "email": "example@example.com", + "enabled": true +}'); +$response = $sg->client->mail_settings()->forward_bounce()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve forward bounce mail settings # +// GET /mail_settings/forward_bounce # + +$response = $sg->client->mail_settings()->forward_bounce()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update forward spam mail settings # +// PATCH /mail_settings/forward_spam # + +$request_body = json_decode('{ + "email": "", + "enabled": false +}'); +$response = $sg->client->mail_settings()->forward_spam()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve forward spam mail settings # +// GET /mail_settings/forward_spam # + +$response = $sg->client->mail_settings()->forward_spam()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update plain content mail settings # +// PATCH /mail_settings/plain_content # + +$request_body = json_decode('{ + "enabled": false +}'); +$response = $sg->client->mail_settings()->plain_content()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve plain content mail settings # +// GET /mail_settings/plain_content # + +$response = $sg->client->mail_settings()->plain_content()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update spam check mail settings # +// PATCH /mail_settings/spam_check # + +$request_body = json_decode('{ + "enabled": true, + "max_score": 5, + "url": "url" +}'); +$response = $sg->client->mail_settings()->spam_check()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve spam check mail settings # +// GET /mail_settings/spam_check # + +$response = $sg->client->mail_settings()->spam_check()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update template mail settings # +// PATCH /mail_settings/template # + +$request_body = json_decode('{ + "enabled": true, + "html_content": "<% body %>" +}'); +$response = $sg->client->mail_settings()->template()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve legacy template mail settings # +// GET /mail_settings/template # + +$response = $sg->client->mail_settings()->template()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/partnersettings/partnersettings.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/partnersettings/partnersettings.php new file mode 100644 index 0000000..b214f0a --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/partnersettings/partnersettings.php @@ -0,0 +1,40 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Returns a list of all partner settings. # +// GET /partner_settings # + +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->partner_settings()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Updates New Relic partner settings. # +// PATCH /partner_settings/new_relic # + +$request_body = json_decode('{ + "enable_subuser_statistics": true, + "enabled": true, + "license_key": "" +}'); +$response = $sg->client->partner_settings()->new_relic()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Returns all New Relic partner settings. # +// GET /partner_settings/new_relic # + +$response = $sg->client->partner_settings()->new_relic()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/scopes/scopes.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/scopes/scopes.php new file mode 100644 index 0000000..c9776df --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/scopes/scopes.php @@ -0,0 +1,16 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve a list of scopes for which this user has access. # +// GET /scopes # + +$response = $sg->client->scopes()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/senders/senders.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/senders/senders.php new file mode 100644 index 0000000..c75d787 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/senders/senders.php @@ -0,0 +1,99 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create a Sender Identity # +// POST /senders # + +$request_body = json_decode('{ + "address": "123 Elm St.", + "address_2": "Apt. 456", + "city": "Denver", + "country": "United States", + "from": { + "email": "from@example.com", + "name": "Example INC" + }, + "nickname": "My Sender ID", + "reply_to": { + "email": "replyto@example.com", + "name": "Example INC" + }, + "state": "Colorado", + "zip": "80202" +}'); +$response = $sg->client->senders()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Get all Sender Identities # +// GET /senders # + +$response = $sg->client->senders()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a Sender Identity # +// PATCH /senders/{sender_id} # + +$request_body = json_decode('{ + "address": "123 Elm St.", + "address_2": "Apt. 456", + "city": "Denver", + "country": "United States", + "from": { + "email": "from@example.com", + "name": "Example INC" + }, + "nickname": "My Sender ID", + "reply_to": { + "email": "replyto@example.com", + "name": "Example INC" + }, + "state": "Colorado", + "zip": "80202" +}'); +$sender_id = "test_url_param"; +$response = $sg->client->senders()->_($sender_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// View a Sender Identity # +// GET /senders/{sender_id} # + +$sender_id = "test_url_param"; +$response = $sg->client->senders()->_($sender_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a Sender Identity # +// DELETE /senders/{sender_id} # + +$sender_id = "test_url_param"; +$response = $sg->client->senders()->_($sender_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Resend Sender Identity Verification # +// POST /senders/{sender_id}/resend_verification # + +$sender_id = "test_url_param"; +$response = $sg->client->senders()->_($sender_id)->resend_verification()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/stats/stats.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/stats/stats.php new file mode 100644 index 0000000..795c016 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/stats/stats.php @@ -0,0 +1,17 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve global email statistics # +// GET /stats # + +$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}'); +$response = $sg->client->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/subusers/subusers.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/subusers/subusers.php new file mode 100644 index 0000000..0e96f8b --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/subusers/subusers.php @@ -0,0 +1,170 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create Subuser # +// POST /subusers # + +$request_body = json_decode('{ + "email": "John@example.com", + "ips": [ + "1.1.1.1", + "2.2.2.2" + ], + "password": "johns_password", + "username": "John@example.com" +}'); +$response = $sg->client->subusers()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// List all Subusers # +// GET /subusers # + +$query_params = json_decode('{"username": "test_string", "limit": 1, "offset": 1}'); +$response = $sg->client->subusers()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve Subuser Reputations # +// GET /subusers/reputations # + +$query_params = json_decode('{"usernames": "test_string"}'); +$response = $sg->client->subusers()->reputations()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve email statistics for your subusers. # +// GET /subusers/stats # + +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "subusers": "test_string"}'); +$response = $sg->client->subusers()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve monthly stats for all subusers # +// GET /subusers/stats/monthly # + +$query_params = json_decode('{"subuser": "test_string", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "date": "test_string", "sort_by_direction": "asc"}'); +$response = $sg->client->subusers()->stats()->monthly()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve the totals for each email statistic metric for all subusers. # +// GET /subusers/stats/sums # + +$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}'); +$response = $sg->client->subusers()->stats()->sums()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Enable/disable a subuser # +// PATCH /subusers/{subuser_name} # + +$request_body = json_decode('{ + "disabled": false +}'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a subuser # +// DELETE /subusers/{subuser_name} # + +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update IPs assigned to a subuser # +// PUT /subusers/{subuser_name}/ips # + +$request_body = json_decode('[ + "127.0.0.1" +]'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->ips()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update Monitor Settings for a subuser # +// PUT /subusers/{subuser_name}/monitor # + +$request_body = json_decode('{ + "email": "example@example.com", + "frequency": 500 +}'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->monitor()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Create monitor settings # +// POST /subusers/{subuser_name}/monitor # + +$request_body = json_decode('{ + "email": "example@example.com", + "frequency": 50000 +}'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->monitor()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve monitor settings for a subuser # +// GET /subusers/{subuser_name}/monitor # + +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->monitor()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete monitor settings # +// DELETE /subusers/{subuser_name}/monitor # + +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->monitor()->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve the monthly email statistics for a single subuser # +// GET /subusers/{subuser_name}/stats/monthly # + +$query_params = json_decode('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}'); +$subuser_name = "test_url_param"; +$response = $sg->client->subusers()->_($subuser_name)->stats()->monthly()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/suppression/suppression.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/suppression/suppression.php new file mode 100644 index 0000000..9b40e37 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/suppression/suppression.php @@ -0,0 +1,202 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve all blocks # +// GET /suppression/blocks # + +$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); +$response = $sg->client->suppression()->blocks()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete blocks # +// DELETE /suppression/blocks # + +$request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); +$response = $sg->client->suppression()->blocks()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a specific block # +// GET /suppression/blocks/{email} # + +$email = "test_url_param"; +$response = $sg->client->suppression()->blocks()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a specific block # +// DELETE /suppression/blocks/{email} # + +$email = "test_url_param"; +$response = $sg->client->suppression()->blocks()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all bounces # +// GET /suppression/bounces # + +$query_params = json_decode('{"start_time": 1, "end_time": 1}'); +$response = $sg->client->suppression()->bounces()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete bounces # +// DELETE /suppression/bounces # + +$request_body = json_decode('{ + "delete_all": true, + "emails": [ + "example@example.com", + "example2@example.com" + ] +}'); +$response = $sg->client->suppression()->bounces()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a Bounce # +// GET /suppression/bounces/{email} # + +$email = "test_url_param"; +$response = $sg->client->suppression()->bounces()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a bounce # +// DELETE /suppression/bounces/{email} # + +$query_params = json_decode('{"email_address": "example@example.com"}'); +$email = "test_url_param"; +$response = $sg->client->suppression()->bounces()->_($email)->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all invalid emails # +// GET /suppression/invalid_emails # + +$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); +$response = $sg->client->suppression()->invalid_emails()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete invalid emails # +// DELETE /suppression/invalid_emails # + +$request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); +$response = $sg->client->suppression()->invalid_emails()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a specific invalid email # +// GET /suppression/invalid_emails/{email} # + +$email = "test_url_param"; +$response = $sg->client->suppression()->invalid_emails()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a specific invalid email # +// DELETE /suppression/invalid_emails/{email} # + +$email = "test_url_param"; +$response = $sg->client->suppression()->invalid_emails()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a specific spam report # +// GET /suppression/spam_report/{email} # + +$email = "test_url_param"; +$response = $sg->client->suppression()->spam_report()->_($email)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a specific spam report # +// DELETE /suppression/spam_report/{email} # + +$email = "test_url_param"; +$response = $sg->client->suppression()->spam_report()->_($email)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all spam reports # +// GET /suppression/spam_reports # + +$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); +$response = $sg->client->suppression()->spam_reports()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete spam reports # +// DELETE /suppression/spam_reports # + +$request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); +$response = $sg->client->suppression()->spam_reports()->delete($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all global suppressions # +// GET /suppression/unsubscribes # + +$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); +$response = $sg->client->suppression()->unsubscribes()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/templates/templates.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/templates/templates.php new file mode 100644 index 0000000..e7d82bd --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/templates/templates.php @@ -0,0 +1,130 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create a transactional template. # +// POST /templates # + +$request_body = json_decode('{ + "name": "example_name" +}'); +$response = $sg->client->templates()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all transactional templates. # +// GET /templates # + +$response = $sg->client->templates()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Edit a transactional template. # +// PATCH /templates/{template_id} # + +$request_body = json_decode('{ + "name": "new_example_name" +}'); +$template_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a single transactional template. # +// GET /templates/{template_id} # + +$template_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a template. # +// DELETE /templates/{template_id} # + +$template_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Create a new transactional template version. # +// POST /templates/{template_id}/versions # + +$request_body = json_decode('{ + "active": 1, + "html_content": "<%body%>", + "name": "example_version_name", + "plain_content": "<%body%>", + "subject": "<%subject%>", + "template_id": "ddb96bbc-9b92-425e-8979-99464621b543" +}'); +$template_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Edit a transactional template version. # +// PATCH /templates/{template_id}/versions/{version_id} # + +$request_body = json_decode('{ + "active": 1, + "html_content": "<%body%>", + "name": "updated_example_name", + "plain_content": "<%body%>", + "subject": "<%subject%>" +}'); +$template_id = "test_url_param"; +$version_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a specific transactional template version. # +// GET /templates/{template_id}/versions/{version_id} # + +$template_id = "test_url_param"; +$version_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a transactional template version. # +// DELETE /templates/{template_id}/versions/{version_id} # + +$template_id = "test_url_param"; +$version_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Activate a transactional template version. # +// POST /templates/{template_id}/versions/{version_id}/activate # + +$template_id = "test_url_param"; +$version_id = "test_url_param"; +$response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->activate()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/trackingsettings/trackingsettings.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/trackingsettings/trackingsettings.php new file mode 100644 index 0000000..851966f --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/trackingsettings/trackingsettings.php @@ -0,0 +1,111 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Retrieve Tracking Settings # +// GET /tracking_settings # + +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->tracking_settings()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update Click Tracking Settings # +// PATCH /tracking_settings/click # + +$request_body = json_decode('{ + "enabled": true +}'); +$response = $sg->client->tracking_settings()->click()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve Click Track Settings # +// GET /tracking_settings/click # + +$response = $sg->client->tracking_settings()->click()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update Google Analytics Settings # +// PATCH /tracking_settings/google_analytics # + +$request_body = json_decode('{ + "enabled": true, + "utm_campaign": "website", + "utm_content": "", + "utm_medium": "email", + "utm_source": "sendgrid.com", + "utm_term": "" +}'); +$response = $sg->client->tracking_settings()->google_analytics()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve Google Analytics Settings # +// GET /tracking_settings/google_analytics # + +$response = $sg->client->tracking_settings()->google_analytics()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update Open Tracking Settings # +// PATCH /tracking_settings/open # + +$request_body = json_decode('{ + "enabled": true +}'); +$response = $sg->client->tracking_settings()->open()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Get Open Tracking Settings # +// GET /tracking_settings/open # + +$response = $sg->client->tracking_settings()->open()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update Subscription Tracking Settings # +// PATCH /tracking_settings/subscription # + +$request_body = json_decode('{ + "enabled": true, + "html_content": "html content", + "landing": "landing page html", + "plain_content": "text content", + "replace": "replacement tag", + "url": "url" +}'); +$response = $sg->client->tracking_settings()->subscription()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve Subscription Tracking Settings # +// GET /tracking_settings/subscription # + +$response = $sg->client->tracking_settings()->subscription()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/user/user.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/user/user.php new file mode 100644 index 0000000..fa275a0 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/user/user.php @@ -0,0 +1,294 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Get a user's account information. # +// GET /user/account # + +$response = $sg->client->user()->account()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve your credit balance # +// GET /user/credits # + +$response = $sg->client->user()->credits()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update your account email address # +// PUT /user/email # + +$request_body = json_decode('{ + "email": "example@example.com" +}'); +$response = $sg->client->user()->email()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve your account email address # +// GET /user/email # + +$response = $sg->client->user()->email()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update your password # +// PUT /user/password # + +$request_body = json_decode('{ + "new_password": "new_password", + "old_password": "old_password" +}'); +$response = $sg->client->user()->password()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a user's profile # +// PATCH /user/profile # + +$request_body = json_decode('{ + "city": "Orange", + "first_name": "Example", + "last_name": "User" +}'); +$response = $sg->client->user()->profile()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Get a user's profile # +// GET /user/profile # + +$response = $sg->client->user()->profile()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Cancel or pause a scheduled send # +// POST /user/scheduled_sends # + +$request_body = json_decode('{ + "batch_id": "YOUR_BATCH_ID", + "status": "pause" +}'); +$response = $sg->client->user()->scheduled_sends()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all scheduled sends # +// GET /user/scheduled_sends # + +$response = $sg->client->user()->scheduled_sends()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update user scheduled send information # +// PATCH /user/scheduled_sends/{batch_id} # + +$request_body = json_decode('{ + "status": "pause" +}'); +$batch_id = "test_url_param"; +$response = $sg->client->user()->scheduled_sends()->_($batch_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve scheduled send # +// GET /user/scheduled_sends/{batch_id} # + +$batch_id = "test_url_param"; +$response = $sg->client->user()->scheduled_sends()->_($batch_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a cancellation or pause of a scheduled send # +// DELETE /user/scheduled_sends/{batch_id} # + +$batch_id = "test_url_param"; +$response = $sg->client->user()->scheduled_sends()->_($batch_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update Enforced TLS settings # +// PATCH /user/settings/enforced_tls # + +$request_body = json_decode('{ + "require_tls": true, + "require_valid_cert": false +}'); +$response = $sg->client->user()->settings()->enforced_tls()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve current Enforced TLS settings. # +// GET /user/settings/enforced_tls # + +$response = $sg->client->user()->settings()->enforced_tls()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update your username # +// PUT /user/username # + +$request_body = json_decode('{ + "username": "test_username" +}'); +$response = $sg->client->user()->username()->put($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve your username # +// GET /user/username # + +$response = $sg->client->user()->username()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update Event Notification Settings # +// PATCH /user/webhooks/event/settings # + +$request_body = json_decode('{ + "bounce": true, + "click": true, + "deferred": true, + "delivered": true, + "dropped": true, + "enabled": true, + "group_resubscribe": true, + "group_unsubscribe": true, + "open": true, + "processed": true, + "spam_report": true, + "unsubscribe": true, + "url": "url" +}'); +$response = $sg->client->user()->webhooks()->event()->settings()->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve Event Webhook settings # +// GET /user/webhooks/event/settings # + +$response = $sg->client->user()->webhooks()->event()->settings()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Test Event Notification Settings # +// POST /user/webhooks/event/test # + +$request_body = json_decode('{ + "url": "url" +}'); +$response = $sg->client->user()->webhooks()->event()->test()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Create a parse setting # +// POST /user/webhooks/parse/settings # + +$request_body = json_decode('{ + "hostname": "myhostname.com", + "send_raw": false, + "spam_check": true, + "url": "http://email.myhosthame.com" +}'); +$response = $sg->client->user()->webhooks()->parse()->settings()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all parse settings # +// GET /user/webhooks/parse/settings # + +$response = $sg->client->user()->webhooks()->parse()->settings()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a parse setting # +// PATCH /user/webhooks/parse/settings/{hostname} # + +$request_body = json_decode('{ + "send_raw": true, + "spam_check": false, + "url": "http://newdomain.com/parse" +}'); +$hostname = "test_url_param"; +$response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a specific parse setting # +// GET /user/webhooks/parse/settings/{hostname} # + +$hostname = "test_url_param"; +$response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a parse setting # +// DELETE /user/webhooks/parse/settings/{hostname} # + +$hostname = "test_url_param"; +$response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieves Inbound Parse Webhook statistics. # +// GET /user/webhooks/parse/stats # + +$query_params = json_decode('{"aggregated_by": "day", "limit": "test_string", "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": "test_string"}'); +$response = $sg->client->user()->webhooks()->parse()->stats()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/whitelabel/whitelabel.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/whitelabel/whitelabel.php new file mode 100644 index 0000000..18dcdf8 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/examples/whitelabel/whitelabel.php @@ -0,0 +1,311 @@ +<?php +// If you are using Composer +require 'vendor/autoload.php'; + + +$apiKey = getenv('SENDGRID_API_KEY'); +$sg = new \SendGrid($apiKey); + +//////////////////////////////////////////////////// +// Create a domain whitelabel. # +// POST /whitelabel/domains # + +$request_body = json_decode('{ + "automatic_security": false, + "custom_spf": true, + "default": true, + "domain": "example.com", + "ips": [ + "192.168.1.1", + "192.168.1.2" + ], + "subdomain": "news", + "username": "john@example.com" +}'); +$response = $sg->client->whitelabel()->domains()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// List all domain whitelabels. # +// GET /whitelabel/domains # + +$query_params = json_decode('{"username": "test_string", "domain": "test_string", "exclude_subusers": "true", "limit": 1, "offset": 1}'); +$response = $sg->client->whitelabel()->domains()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Get the default domain whitelabel. # +// GET /whitelabel/domains/default # + +$response = $sg->client->whitelabel()->domains()->default()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// List the domain whitelabel associated with the given user. # +// GET /whitelabel/domains/subuser # + +$response = $sg->client->whitelabel()->domains()->subuser()->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Disassociate a domain whitelabel from a given user. # +// DELETE /whitelabel/domains/subuser # + +$response = $sg->client->whitelabel()->domains()->subuser()->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a domain whitelabel. # +// PATCH /whitelabel/domains/{domain_id} # + +$request_body = json_decode('{ + "custom_spf": true, + "default": false +}'); +$domain_id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($domain_id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a domain whitelabel. # +// GET /whitelabel/domains/{domain_id} # + +$domain_id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($domain_id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a domain whitelabel. # +// DELETE /whitelabel/domains/{domain_id} # + +$domain_id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($domain_id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Associate a domain whitelabel with a given user. # +// POST /whitelabel/domains/{domain_id}/subuser # + +$request_body = json_decode('{ + "username": "jane@example.com" +}'); +$domain_id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($domain_id)->subuser()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Add an IP to a domain whitelabel. # +// POST /whitelabel/domains/{id}/ips # + +$request_body = json_decode('{ + "ip": "192.168.0.1" +}'); +$id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($id)->ips()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Remove an IP from a domain whitelabel. # +// DELETE /whitelabel/domains/{id}/ips/{ip} # + +$id = "test_url_param"; +$ip = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($id)->ips()->_($ip)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Validate a domain whitelabel. # +// POST /whitelabel/domains/{id}/validate # + +$id = "test_url_param"; +$response = $sg->client->whitelabel()->domains()->_($id)->validate()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Create an IP whitelabel # +// POST /whitelabel/ips # + +$request_body = json_decode('{ + "domain": "example.com", + "ip": "192.168.1.1", + "subdomain": "email" +}'); +$response = $sg->client->whitelabel()->ips()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all IP whitelabels # +// GET /whitelabel/ips # + +$query_params = json_decode('{"ip": "test_string", "limit": 1, "offset": 1}'); +$response = $sg->client->whitelabel()->ips()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve an IP whitelabel # +// GET /whitelabel/ips/{id} # + +$id = "test_url_param"; +$response = $sg->client->whitelabel()->ips()->_($id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete an IP whitelabel # +// DELETE /whitelabel/ips/{id} # + +$id = "test_url_param"; +$response = $sg->client->whitelabel()->ips()->_($id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Validate an IP whitelabel # +// POST /whitelabel/ips/{id}/validate # + +$id = "test_url_param"; +$response = $sg->client->whitelabel()->ips()->_($id)->validate()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Create a Link Whitelabel # +// POST /whitelabel/links # + +$request_body = json_decode('{ + "default": true, + "domain": "example.com", + "subdomain": "mail" +}'); +$query_params = json_decode('{"limit": 1, "offset": 1}'); +$response = $sg->client->whitelabel()->links()->post($request_body, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve all link whitelabels # +// GET /whitelabel/links # + +$query_params = json_decode('{"limit": 1}'); +$response = $sg->client->whitelabel()->links()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a Default Link Whitelabel # +// GET /whitelabel/links/default # + +$query_params = json_decode('{"domain": "test_string"}'); +$response = $sg->client->whitelabel()->links()->default()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve Associated Link Whitelabel # +// GET /whitelabel/links/subuser # + +$query_params = json_decode('{"username": "test_string"}'); +$response = $sg->client->whitelabel()->links()->subuser()->get(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Disassociate a Link Whitelabel # +// DELETE /whitelabel/links/subuser # + +$query_params = json_decode('{"username": "test_string"}'); +$response = $sg->client->whitelabel()->links()->subuser()->delete(null, $query_params); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Update a Link Whitelabel # +// PATCH /whitelabel/links/{id} # + +$request_body = json_decode('{ + "default": true +}'); +$id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($id)->patch($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Retrieve a Link Whitelabel # +// GET /whitelabel/links/{id} # + +$id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($id)->get(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Delete a Link Whitelabel # +// DELETE /whitelabel/links/{id} # + +$id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($id)->delete(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Validate a Link Whitelabel # +// POST /whitelabel/links/{id}/validate # + +$id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($id)->validate()->post(); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); + +//////////////////////////////////////////////////// +// Associate a Link Whitelabel # +// POST /whitelabel/links/{link_id}/subuser # + +$request_body = json_decode('{ + "username": "jane@example.com" +}'); +$link_id = "test_url_param"; +$response = $sg->client->whitelabel()->links()->_($link_id)->subuser()->post($request_body); +echo $response->statusCode(); +echo $response->body(); +print_r($response->headers()); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php new file mode 100644 index 0000000..0bda1b5 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php @@ -0,0 +1,55 @@ +<?php +/** + * This library allows you to quickly and easily send emails through SendGrid using PHP. + * + * @author Elmer Thomas <dx@sendgrid.com> + * @copyright 2017 SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: <git_id> + * @link http://packagist.org/packages/sendgrid/sendgrid + */ + +/** + * Interface to the SendGrid Web API + */ +class SendGrid +{ + const VERSION = '6.0.0'; + + /** + * + * @var string + */ + protected $namespace = 'SendGrid'; + + /** + * @var \SendGrid\Client + */ + public $client; + + /** + * @var string + */ + public $version = self::VERSION; + + /** + * Setup the HTTP Client + * + * @param string $apiKey your SendGrid API Key. + * @param array $options an array of options, currently only "host" and "curl" are implemented. + */ + public function __construct($apiKey, $options = array()) + { + $headers = array( + 'Authorization: Bearer '.$apiKey, + 'User-Agent: sendgrid/' . $this->version . ';php', + 'Accept: application/json' + ); + + $host = isset($options['host']) ? $options['host'] : 'https://api.sendgrid.com'; + + $curlOptions = isset($options['curl']) ? $options['curl'] : null; + + $this->client = new \SendGrid\Client($host, $headers, '/v3', null, $curlOptions); + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/helpers/mail/Mail.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/helpers/mail/Mail.php new file mode 100644 index 0000000..ef4d8db --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/helpers/mail/Mail.php @@ -0,0 +1,1172 @@ +<?php +/** + * This helper builds the request body for a /mail/send API call. + * + * PHP version 5.6, 7 + * + * @author Elmer Thomas <dx@sendgrid.com> + * @copyright 2017 SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: <git_id> + * @link http://packagist.org/packages/sendgrid/sendgrid + */ +namespace SendGrid; + +class ReplyTo implements \JsonSerializable +{ + private $email; + private $name; + + public function __construct($email, $name = null) + { + $this->email = $email; + + if (!is_null($name)) { + $this->name = $name; + } + } + + public function setEmail($email) + { + $this->email = $email; + } + + public function getEmail() + { + return $this->email; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'email' => $this->getEmail(), + 'name' => $this->getName(), + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class ClickTracking implements \JsonSerializable +{ + private $enable; + private $enable_text; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + + public function setEnableText($enable_text) + { + $this->enable_text = $enable_text; + } + + public function getEnableText() + { + return $this->enable_text; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable(), + 'enable_text' => $this->getEnableText() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class OpenTracking implements \JsonSerializable +{ + private $enable; + private $substitution_tag; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + + public function setSubstitutionTag($substitution_tag) + { + $this->substitution_tag = $substitution_tag; + } + + public function getSubstitutionTag() + { + return $this->substitution_tag; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable(), + 'substitution_tag' => $this->getSubstitutionTag() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class SubscriptionTracking implements \JsonSerializable +{ + private $enable; + private $text; + private $html; + private $substitution_tag; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + + public function setText($text) + { + $this->text = $text; + } + + public function getText() + { + return $this->text; + } + + public function setHtml($html) + { + $this->html = $html; + } + + public function getHtml() + { + return $this->html; + } + + public function setSubstitutionTag($substitution_tag) + { + $this->substitution_tag = $substitution_tag; + } + + public function getSubstitutionTag() + { + return $this->substitution_tag; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable(), + 'text' => $this->getText(), + 'html' => $this->getHtml(), + 'substitution_tag' => $this->getSubstitutionTag() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class Ganalytics implements \JsonSerializable +{ + private $enable; + private $utm_source; + private $utm_medium; + private $utm_term; + private $utm_content; + private $utm_campaign; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + + public function setCampaignSource($utm_source) + { + $this->utm_source = $utm_source; + } + + public function getCampaignSource() + { + return $this->utm_source; + } + + public function setCampaignMedium($utm_medium) + { + $this->utm_medium = $utm_medium; + } + + public function getCampaignMedium() + { + return $this->utm_medium; + } + + public function setCampaignTerm($utm_term) + { + $this->utm_term = $utm_term; + } + + public function getCampaignTerm() + { + return $this->utm_term; + } + + public function setCampaignContent($utm_content) + { + $this->utm_content = $utm_content; + } + + public function getCampaignContent() + { + return $this->utm_content; + } + + public function setCampaignName($utm_campaign) + { + $this->utm_campaign = $utm_campaign; + } + + public function getCampaignName() + { + return $this->utm_campaign; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable(), + 'utm_source' => $this->getCampaignSource(), + 'utm_medium' => $this->getCampaignMedium(), + 'utm_term' => $this->getCampaignTerm(), + 'utm_content' => $this->getCampaignContent(), + 'utm_campaign' => $this->getCampaignName() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class TrackingSettings implements \JsonSerializable +{ + private $click_tracking; + private $open_tracking; + private $subscription_tracking; + private $ganalytics; + + public function setClickTracking($click_tracking) + { + $this->click_tracking = $click_tracking; + } + + public function getClickTracking() + { + return $this->click_tracking; + } + + public function setOpenTracking($open_tracking) + { + $this->open_tracking = $open_tracking; + } + + public function getOpenTracking() + { + return $this->open_tracking; + } + + public function setSubscriptionTracking($subscription_tracking) + { + $this->subscription_tracking = $subscription_tracking; + } + + public function getSubscriptionTracking() + { + return $this->subscription_tracking; + } + + public function setGanalytics($ganalytics) + { + $this->ganalytics = $ganalytics; + } + + public function getGanalytics() + { + return $this->ganalytics; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'click_tracking' => $this->getClickTracking(), + 'open_tracking' => $this->getOpenTracking(), + 'subscription_tracking' => $this->getSubscriptionTracking(), + 'ganalytics' => $this->getGanalytics() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class BccSettings implements \JsonSerializable +{ + private $enable; + private $email; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + + public function setEmail($email) + { + $this->email = $email; + } + + public function getEmail() + { + return $this->email; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable(), + 'email' => $this->getEmail() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class BypassListManagement implements \JsonSerializable +{ + private $enable; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class Footer implements \JsonSerializable +{ + private $enable; + private $text; + private $html; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + + public function setText($text) + { + $this->text = $text; + } + + public function getText() + { + return $this->text; + } + + public function setHtml($html) + { + $this->html = $html; + } + + public function getHtml() + { + return $this->html; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable(), + 'text' => $this->getText(), + 'html' => $this->getHtml() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class SandBoxMode implements \JsonSerializable +{ + private $enable; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class SpamCheck implements \JsonSerializable +{ + private $enable; + private $threshold; + private $post_to_url; + + public function setEnable($enable) + { + $this->enable = $enable; + } + + public function getEnable() + { + return $this->enable; + } + + public function setThreshold($threshold) + { + $this->threshold = $threshold; + } + + public function getThreshold() + { + return $this->threshold; + } + + public function setPostToUrl($post_to_url) + { + $this->post_to_url = $post_to_url; + } + + public function getPostToUrl() + { + return $this->post_to_url; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'enable' => $this->getEnable(), + 'threshold' => $this->getThreshold(), + 'post_to_url' => $this->getPostToUrl() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class MailSettings implements \JsonSerializable +{ + private $bcc; + private $bypass_list_management; + private $footer; + private $sandbox_mode; + private $spam_check; + + public function setBccSettings($bcc) + { + $this->bcc = $bcc; + } + + public function getBccSettings() + { + return $this->bcc; + } + + public function setBypassListManagement($bypass_list_management) + { + $this->bypass_list_management = $bypass_list_management; + } + + public function getBypassListManagement() + { + return $this->bypass_list_management; + } + + public function setFooter($footer) + { + $this->footer = $footer; + } + + public function getFooter() + { + return $this->footer; + } + + public function setSandboxMode($sandbox_mode) + { + $this->sandbox_mode = $sandbox_mode; + } + + public function getSandboxMode() + { + return $this->sandbox_mode; + } + + public function setSpamCheck($spam_check) + { + $this->spam_check = $spam_check; + } + + public function getSpamCheck() + { + return $this->spam_check; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'bcc' => $this->getBccSettings(), + 'bypass_list_management' => $this->getBypassListManagement(), + 'footer' => $this->getFooter(), + 'sandbox_mode' => $this->getSandboxMode(), + 'spam_check' => $this->getSpamCheck() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class ASM implements \JsonSerializable +{ + private $group_id; + private $groups_to_display; + + public function setGroupId($group_id) + { + $this->group_id = $group_id; + } + + public function getGroupId() + { + return $this->group_id; + } + + public function setGroupsToDisplay($group_ids) + { + $this->groups_to_display = $group_ids; + } + + public function getGroupsToDisplay() + { + return $this->groups_to_display; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'group_id' => $this->getGroupId(), + 'groups_to_display' => $this->getGroupsToDisplay() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class Attachment implements \JsonSerializable +{ + private $content; + private $type; + private $filename; + private $disposition; + private $content_id; + + public function setContent($content) + { + $this->content = $content; + } + + public function getContent() + { + return $this->content; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } + + public function setFilename($filename) + { + $this->filename = $filename; + } + + public function getFilename() + { + return $this->filename; + } + + public function setDisposition($disposition) + { + $this->disposition = $disposition; + } + + public function getDisposition() + { + return $this->disposition; + } + + public function setContentID($content_id) + { + $this->content_id = $content_id; + } + + public function getContentID() + { + return $this->content_id; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'content' => $this->getContent(), + 'type' => $this->getType(), + 'filename' => $this->getFilename(), + 'disposition' => $this->getDisposition(), + 'content_id' => $this->getContentID() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class Content implements \JsonSerializable +{ + private $type; + private $value; + + public function __construct($type, $value) + { + $this->type = $type; + $this->value = mb_convert_encoding($value, 'UTF-8', 'UTF-8'); + } + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } + + public function setValue($value) + { + $this->value = mb_convert_encoding($value, 'UTF-8', 'UTF-8'); + } + + public function getValue() + { + return $this->value; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'type' => $this->getType(), + 'value' => $this->getValue() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class Personalization implements \JsonSerializable +{ + private $tos; + private $ccs; + private $bccs; + private $subject; + private $headers; + private $substitutions; + private $custom_args; + private $send_at; + + public function addTo($email) + { + $this->tos[] = $email; + } + + public function getTos() + { + return $this->tos; + } + + public function addCc($email) + { + $this->ccs[] = $email; + } + + public function getCcs() + { + return $this->ccs; + } + + public function addBcc($email) + { + $this->bccs[] = $email; + } + + public function getBccs() + { + return $this->bccs; + } + + public function setSubject($subject) + { + $this->subject = mb_convert_encoding($subject, 'UTF-8', 'UTF-8'); + } + + public function getSubject() + { + return $this->subject; + } + + public function addHeader($key, $value) + { + $this->headers[$key] = $value; + } + + public function getHeaders() + { + return $this->headers; + } + + public function addSubstitution($key, $value) + { + $this->substitutions[$key] = $value; + } + + public function getSubstitutions() + { + return $this->substitutions; + } + + public function addCustomArg($key, $value) + { + $this->custom_args[$key] = (string)$value; + } + + public function getCustomArgs() + { + return $this->custom_args; + } + + public function setSendAt($send_at) + { + $this->send_at = $send_at; + } + + public function getSendAt() + { + return $this->send_at; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'to' => $this->getTos(), + 'cc' => $this->getCcs(), + 'bcc' => $this->getBccs(), + 'subject' => $this->subject, + 'headers' => $this->getHeaders(), + 'substitutions' => $this->getSubstitutions(), + 'custom_args' => $this->getCustomArgs(), + 'send_at' => $this->getSendAt() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +class Email implements \JsonSerializable +{ + private $name; + private $email; + + public function __construct($name, $email) + { + $this->name = $name; + $this->email = $email; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function setEmail($email) + { + $this->email = $email; + } + + public function getEmail() + { + return $this->email; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'name' => $this->getName(), + 'email' => $this->getEmail() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} + +/** + * The final request body object + */ +class Mail implements \JsonSerializable +{ + const VERSION = '1.0.0'; + + protected $namespace = 'SendGrid'; + + public $from; + public $personalization; + public $subject; + public $contents; + public $attachments; + public $template_id; + public $sections; + public $headers; + public $categories; + public $custom_args; + public $send_at; + public $batch_id; + public $asm; + public $ip_pool_name; + public $mail_settings; + public $tracking_settings; + public $reply_to; + + public function __construct($from, $subject, $to, $content) + { + $this->setFrom($from); + $this->setSubject($subject); + $personalization = new Personalization(); + $personalization->addTo($to); + $this->addPersonalization($personalization); + $this->addContent($content); + } + + public function setFrom($email) + { + $this->from = $email; + } + + public function getFrom() + { + return $this->from; + } + + public function addPersonalization($personalization) + { + $this->personalization[] = $personalization; + } + + public function getPersonalizations() + { + return $this->personalization; + } + + public function setSubject($subject) + { + $this->subject = $subject; + } + + public function getSubject() + { + return $this->subject; + } + + public function addContent($content) + { + $this->contents[] = $content; + } + + public function getContents() + { + return $this->contents; + } + + public function addAttachment($attachment) + { + $this->attachments[] = $attachment; + } + + public function getAttachments() + { + return $this->attachments; + } + + public function setTemplateId($template_id) + { + $this->template_id = $template_id; + } + + public function getTemplateId() + { + return $this->template_id; + } + + public function addSection($key, $value) + { + $this->sections[$key] = $value; + } + + public function getSections() + { + return $this->sections; + } + + public function addHeader($key, $value) + { + $this->headers[$key] = $value; + } + + public function getHeaders() + { + return $this->headers; + } + + public function addCategory($category) + { + $this->categories[] = $category; + } + + public function getCategories() + { + return $this->categories; + } + + public function addCustomArg($key, $value) + { + $this->custom_args[$key] = (string)$value; + } + + public function getCustomArgs() + { + return $this->custom_args; + } + + public function setSendAt($send_at) + { + $this->send_at = $send_at; + } + + public function getSendAt() + { + return $this->send_at; + } + + public function setBatchId($batch_id) + { + $this->batch_id = $batch_id; + } + + public function getBatchId() + { + return $this->batch_id; + } + + public function setASM($asm) + { + $this->asm = $asm; + } + + public function getASM() + { + return $this->asm; + } + + public function setIpPoolName($ip_pool_name) + { + $this->ip_pool_name = $ip_pool_name; + } + + public function getIpPoolName() + { + return $this->ip_pool_name; + } + + public function setMailSettings($mail_settings) + { + $this->mail_settings = $mail_settings; + } + + public function getMailSettings() + { + return $this->mail_settings; + } + + public function setTrackingSettings($tracking_settings) + { + $this->tracking_settings = $tracking_settings; + } + + public function getTrackingSettings() + { + return $this->tracking_settings; + } + + public function setReplyTo($reply_to) + { + $this->reply_to = $reply_to; + } + + public function getReplyTo() + { + return $this->reply_to; + } + + public function jsonSerialize() + { + return array_filter( + [ + 'from' => $this->getFrom(), + 'personalizations' => $this->getPersonalizations(), + 'subject' => $this->getSubject(), + 'content' => $this->getContents(), + 'attachments' => $this->getAttachments(), + 'template_id' => $this->getTemplateId(), + 'sections' => $this->getSections(), + 'headers' => $this->getHeaders(), + 'categories' => $this->getCategories(), + 'custom_args' => $this->getCustomArgs(), + 'send_at' => $this->getSendAt(), + 'batch_id' => $this->getBatchId(), + 'asm' => $this->getASM(), + 'ip_pool_name' => $this->getIpPoolName(), + 'mail_settings' => $this->getMailSettings(), + 'tracking_settings' => $this->getTrackingSettings(), + 'reply_to' => $this->getReplyTo() + ], + function ($value) { + return $value !== null; + } + ) ?: null; + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/helpers/mail/README.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/helpers/mail/README.md new file mode 100644 index 0000000..fec01c6 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/helpers/mail/README.md @@ -0,0 +1,14 @@ +**This helper allows you to quickly and easily build a Mail object for sending email through SendGrid.** + +# Quick Start + +Run the [example](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php) (make sure you have set your environment variable to include your SENDGRID_API_KEY). + +```bash +php examples/helpers/mail/example.php +``` + +## Usage + +- See this complete working [example](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php). +- [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/overview.html) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php new file mode 100644 index 0000000..ed17dfe --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php @@ -0,0 +1,6 @@ +<?php +/** + * Allows us to include one file instead of two when working without composer. + */ +require_once __DIR__ . '/SendGrid.php'; +require_once __DIR__ . '/helpers/mail/Mail.php'; diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/generate_upload_policy.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/generate_upload_policy.php new file mode 100755 index 0000000..94ede40 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/generate_upload_policy.php @@ -0,0 +1,63 @@ +#!/usr/bin/env php +<?php + +/* + * From: http://raamdev.com/2008/amazon-s3-hmac-signatures-without-pear-or-php5/ + */ + +/* + * Calculate HMAC-SHA1 according to RFC2104 + * See http://www.faqs.org/rfcs/rfc2104.html + */ +function hmacsha1($key, $data) +{ + $blocksize = 64; + $hashfunc = 'sha1'; + if (strlen($key) > $blocksize) { + $key = pack('H*', $hashfunc($key)); + } + $key = str_pad($key, $blocksize, chr(0x00)); + $ipad = str_repeat(chr(0x36), $blocksize); + $opad = str_repeat(chr(0x5c), $blocksize); + $hmac = pack( + 'H*', $hashfunc( + ($key ^ $opad).pack( + 'H*', $hashfunc( + ($key ^ $ipad).$data + ) + ) + ) + ); + return bin2hex($hmac); +} + +/* + * Used to encode a field for Amazon Auth + * (taken from the Amazon S3 PHP example library) + */ +function hex2b64($str) +{ + $raw = ''; + for ($i = 0; $i < strlen($str); $i += 2) { + $raw .= chr(hexdec(substr($str, $i, 2))); + } + return base64_encode($raw); +} + +if (count($argv) != 3) { + echo "Usage: " . $argv[0] . " <S3 Policy File> <S3 secret key>\n"; + exit(1); +} + +$policy = file_get_contents($argv[1]); +$secret = $argv[2]; + +/* + * Base64 encode the Policy Document and then + * create HMAC SHA-1 signature of the base64 encoded policy + * using the secret key. Finally, encode it for Amazon Authentication. + */ +$base64_policy = base64_encode($policy); +$signature = hex2b64(hmacsha1($secret, $base64_policy)); +echo "S3_POLICY=\"" . $base64_policy . "\"\nS3_SIGNATURE=\"" . $signature . "\"\n" +?> diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/s3policy.json b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/s3policy.json new file mode 100755 index 0000000..735e0b1 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/s3policy.json @@ -0,0 +1,11 @@ +{ + "expiration": "2100-01-01T12:00:00.000Z", + "conditions": [ + {"acl": "public-read" }, + {"bucket": "sendgrid-open-source" }, + ["starts-with", "$key", "sendgrid-php/"], + ["content-length-range", 2048, 268435456], + ["eq", "$Content-Type", "application/zip"] + ] +} + diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/s3upload.sh b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/s3upload.sh new file mode 100755 index 0000000..5d4a605 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/s3upload.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# From: +# http://raamdev.com/2008/using-curl-to-upload-files-via-post-to-amazon-s3/ + +GIT_VERSION=`git rev-parse --short HEAD` + +rm -rf vendor composer.lock +composer install --no-dev +printf "<?php\nrequire __DIR__ . '/vendor/autoload.php';\n?>" > sendgrid-php.php +cd .. +zip -r sendgrid-php.zip sendgrid-php -x \*.git\* \*composer.json\* \*scripts\* \*test\* \*.travis.yml\* \*prism\* + +curl -X POST \ + -F "key=sendgrid-php/versions/sendgrid-php-$GIT_VERSION.zip" \ + -F "acl=public-read" \ + -F "AWSAccessKeyId=$S3_ACCESS_KEY" \ + -F "Policy=$S3_POLICY" \ + -F "Signature=$S3_SIGNATURE" \ + -F "Content-Type=application/zip" \ + -F "file=@./sendgrid-php.zip" \ + https://s3.amazonaws.com/$S3_BUCKET + +if [ "$TRAVIS_BRANCH" = "master" ] +then + curl -X POST \ + -F "key=sendgrid-php/sendgrid-php.zip" \ + -F "acl=public-read" \ + -F "AWSAccessKeyId=$S3_ACCESS_KEY" \ + -F "Policy=$S3_POLICY" \ + -F "Signature=$S3_SIGNATURE" \ + -F "Content-Type=application/zip" \ + -F "file=@./sendgrid-php.zip" \ + https://s3.amazonaws.com/$S3_BUCKET +fi + +exit 0 diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/sendgrid-php.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/sendgrid-php.php new file mode 100644 index 0000000..a17aebb --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/sendgrid-php.php @@ -0,0 +1,3 @@ +<?php +require __DIR__ . '/vendor/autoload.php'; +?>
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/prism.sh b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/prism.sh new file mode 100755 index 0000000..5d9d300 --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/prism.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +install () { + +set -eu + +UNAME=$(uname) +ARCH=$(uname -m) +if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then + echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases" + exit 1 +fi + +if [ "$UNAME" = "Darwin" ] ; then + OSX_ARCH=$(uname -m) + if [ "${OSX_ARCH}" = "x86_64" ] ; then + PLATFORM="darwin_amd64" + fi +elif [ "$UNAME" = "Linux" ] ; then + LINUX_ARCH=$(uname -m) + if [ "${LINUX_ARCH}" = "i686" ] ; then + PLATFORM="linux_386" + elif [ "${LINUX_ARCH}" = "x86_64" ] ; then + PLATFORM="linux_amd64" + fi +fi + +#LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2) +LATEST="v0.1.5" +URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM" +DEST=./prism/bin/prism + +if [ -z $LATEST ] ; then + echo "Error requesting. Download binary from ${URL}" + exit 1 +else + curl -L $URL -o $DEST + chmod +x $DEST +fi +} + +install
\ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SendGridTest.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SendGridTest.php new file mode 100644 index 0000000..ad340bf --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SendGridTest.php @@ -0,0 +1,2498 @@ +<?php +class SendGridTest_SendGrid extends \PHPUnit_Framework_TestCase +{ + protected static $apiKey; + protected static $sg; + protected static $pid; + + public static function setUpBeforeClass() + { + self::$apiKey = "SENDGRID_API_KEY"; + $host = array('host' => 'http://localhost:4010'); + self::$sg = new SendGrid(self::$apiKey, $host); + if (file_exists('/usr/local/bin/prism') == false) { + if (strtoupper(substr(php_uname('s'), 0, 3)) != 'WIN') { + try { + $proc_ls = proc_open("curl https://raw.githubusercontent.com/stoplightio/prism/master/install.sh", + array( + array("pipe","r"), //stdin + array("pipe","w"), //stdout + array("pipe","w") //stderr + ), + $pipes); + $output_ls = stream_get_contents($pipes[1]); + fclose($pipes[0]); + fclose($pipes[1]); + fclose($pipes[2]); + $return_value_ls = proc_close($proc_ls); + $proc_grep = proc_open("sh", + array( + array("pipe","r"), //stdin + array("pipe","w"), //stdout + array("pipe","w") //stderr + ), + $pipes); + + fwrite($pipes[0], $output_ls); + fclose($pipes[0]); + $output_grep = stream_get_contents($pipes[1]); + + fclose($pipes[1]); + fclose($pipes[2]); + proc_close($proc_grep); + } catch (Exception $e) { + print("Error downloading the prism binary, you can try downloading directly here (https://github.com/stoplightio/prism/releases) and place in your /usr/local/bin directory: " . $e->getMessage() . "\n"); + exit(); + } + } else { + print("Please download the Windows binary (https://github.com/stoplightio/prism/releases) and place it in your /usr/local/bin directory"); + exit(); + } + } + print("Activating Prism (~20 seconds)\n"); + $command = 'nohup prism run -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json > /dev/null 2>&1 & echo $!'; + exec($command, $op); + self::$pid = (int)$op[0]; + sleep(15); + print("\nPrism Started\n\n"); + } + + public function testHelloWorld() + { + $from = new SendGrid\Email("Example User", "test@example.com"); + $subject = "Sending with SendGrid is Fun"; + $to = new SendGrid\Email("Example User", "test@example.com"); + $content = new SendGrid\Content("text/plain", "and easy to do anywhere, even with PHP"); + $mail = new SendGrid\Mail($from, $subject, $to, $content); + $json = json_encode($mail->jsonSerialize()); + $this->assertEquals($json, '{"from":{"name":"Example User","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"}]}],"subject":"Sending with SendGrid is Fun","content":[{"type":"text\/plain","value":"and easy to do anywhere, even with PHP"}]}'); + } + + public function testVersion() + { + $this->assertEquals(SendGrid::VERSION, '6.0.0'); + $this->assertEquals(json_decode(file_get_contents(__DIR__ . '/../../composer.json'))->version, SendGrid::VERSION); + } + + public function testSendGrid() + { + $apiKey = 'SENDGRID_API_KEY'; + $sg = new SendGrid($apiKey); + $headers = array( + 'Authorization: Bearer '.$apiKey, + 'User-Agent: sendgrid/' . $sg->version . ';php', + 'Accept: application/json' + ); + + $this->assertEquals($sg->client->getHost(), 'https://api.sendgrid.com'); + $this->assertEquals($sg->client->getHeaders(), $headers); + $this->assertEquals($sg->client->getVersion(), '/v3'); + + $apiKey = 'SENDGRID_API_KEY'; + $sg2 = new SendGrid($apiKey, array('host' => 'https://api.test.com')); + $this->assertEquals($sg2->client->getHost(), 'https://api.test.com'); + + $sg3 = new SendGrid($apiKey, array('curl' => array('foo' => 'bar'))); + $this->assertEquals(array('foo' => 'bar'), $sg3->client->getCurlOptions()); + + $sg4 = new SendGrid($apiKey, ['curl' => [CURLOPT_PROXY => '127.0.0.1:8000']]); + $this->assertEquals($sg4->client->getCurlOptions(), [10004 => '127.0.0.1:8000']); + } + + public function test_access_settings_activity_get() + { + $query_params = json_decode('{"limit": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->access_settings()->activity()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_access_settings_whitelist_post() + { + $request_body = json_decode('{ + "ips": [ + { + "ip": "192.168.1.1" + }, + { + "ip": "192.*.*.*" + }, + { + "ip": "192.168.1.3/32" + } + ] +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->access_settings()->whitelist()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_access_settings_whitelist_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->access_settings()->whitelist()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_access_settings_whitelist_delete() + { + $request_body = json_decode('{ + "ids": [ + 1, + 2, + 3 + ] +}'); + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->access_settings()->whitelist()->delete($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_access_settings_whitelist__rule_id__get() + { + $rule_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->access_settings()->whitelist()->_($rule_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_access_settings_whitelist__rule_id__delete() + { + $rule_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->access_settings()->whitelist()->_($rule_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_alerts_post() + { + $request_body = json_decode('{ + "email_to": "example@example.com", + "frequency": "daily", + "type": "stats_notification" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->alerts()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_alerts_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->alerts()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_alerts__alert_id__patch() + { + $request_body = json_decode('{ + "email_to": "example@example.com" +}'); + $alert_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->alerts()->_($alert_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_alerts__alert_id__get() + { + $alert_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->alerts()->_($alert_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_alerts__alert_id__delete() + { + $alert_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->alerts()->_($alert_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_api_keys_post() + { + $request_body = json_decode('{ + "name": "My API Key", + "sample": "data", + "scopes": [ + "mail.send", + "alerts.create", + "alerts.read" + ] +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->api_keys()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_api_keys_get() + { + $query_params = json_decode('{"limit": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->api_keys()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_api_keys__api_key_id__put() + { + $request_body = json_decode('{ + "name": "A New Hope", + "scopes": [ + "user.profile.read", + "user.profile.update" + ] +}'); + $api_key_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->api_keys()->_($api_key_id)->put($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_api_keys__api_key_id__patch() + { + $request_body = json_decode('{ + "name": "A New Hope" +}'); + $api_key_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->api_keys()->_($api_key_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_api_keys__api_key_id__get() + { + $api_key_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->api_keys()->_($api_key_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_api_keys__api_key_id__delete() + { + $api_key_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->api_keys()->_($api_key_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_asm_groups_post() + { + $request_body = json_decode('{ + "description": "Suggestions for products our users might like.", + "is_default": true, + "name": "Product Suggestions" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->asm()->groups()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_asm_groups_get() + { + $query_params = json_decode('{"id": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->asm()->groups()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_asm_groups__group_id__patch() + { + $request_body = json_decode('{ + "description": "Suggestions for items our users might like.", + "id": 103, + "name": "Item Suggestions" +}'); + $group_id = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->asm()->groups()->_($group_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_asm_groups__group_id__get() + { + $group_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->asm()->groups()->_($group_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_asm_groups__group_id__delete() + { + $group_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->asm()->groups()->_($group_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_asm_groups__group_id__suppressions_post() + { + $request_body = json_decode('{ + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] +}'); + $group_id = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_asm_groups__group_id__suppressions_get() + { + $group_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_asm_groups__group_id__suppressions_search_post() + { + $request_body = json_decode('{ + "recipient_emails": [ + "exists1@example.com", + "exists2@example.com", + "doesnotexists@example.com" + ] +}'); + $group_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->search()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_asm_groups__group_id__suppressions__email__delete() + { + $group_id = "test_url_param"; + $email = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->_($email)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_asm_suppressions_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->asm()->suppressions()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_asm_suppressions_global_post() + { + $request_body = json_decode('{ + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->asm()->suppressions()->global()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_asm_suppressions_global__email__get() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->asm()->suppressions()->global()->_($email)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_asm_suppressions_global__email__delete() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->asm()->suppressions()->global()->_($email)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_asm_suppressions__email__get() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->asm()->suppressions()->_($email)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_browsers_stats_get() + { + $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "browsers": "test_string", "limit": "test_string", "offset": "test_string", "start_date": "2016-01-01"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->browsers()->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_campaigns_post() + { + $request_body = json_decode('{ + "categories": [ + "spring line" + ], + "custom_unsubscribe_url": "", + "html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>", + "ip_pool": "marketing", + "list_ids": [ + 110, + 124 + ], + "plain_content": "Check out our spring line!", + "segment_ids": [ + 110 + ], + "sender_id": 124451, + "subject": "New Products for Spring!", + "suppression_group_id": 42, + "title": "March Newsletter" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->campaigns()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_campaigns_get() + { + $query_params = json_decode('{"limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->campaigns()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_campaigns__campaign_id__patch() + { + $request_body = json_decode('{ + "categories": [ + "summer line" + ], + "html_content": "<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>", + "plain_content": "Check out our summer line!", + "subject": "New Products for Summer!", + "title": "May Newsletter" +}'); + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->campaigns()->_($campaign_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_campaigns__campaign_id__get() + { + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->campaigns()->_($campaign_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_campaigns__campaign_id__delete() + { + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->campaigns()->_($campaign_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_campaigns__campaign_id__schedules_patch() + { + $request_body = json_decode('{ + "send_at": 1489451436 +}'); + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_campaigns__campaign_id__schedules_post() + { + $request_body = json_decode('{ + "send_at": 1489771528 +}'); + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_campaigns__campaign_id__schedules_get() + { + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_campaigns__campaign_id__schedules_delete() + { + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_campaigns__campaign_id__schedules_now_post() + { + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->now()->post(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_campaigns__campaign_id__schedules_test_post() + { + $request_body = json_decode('{ + "to": "your.email@example.com" +}'); + $campaign_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->test()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_categories_get() + { + $query_params = json_decode('{"category": "test_string", "limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->categories()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_categories_stats_get() + { + $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "categories": "test_string"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->categories()->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_categories_stats_sums_get() + { + $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->categories()->stats()->sums()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_clients_stats_get() + { + $query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->clients()->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_clients__client_type__stats_get() + { + $query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}'); + $client_type = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->clients()->_($client_type)->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_custom_fields_post() + { + $request_body = json_decode('{ + "name": "pet", + "type": "text" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->contactdb()->custom_fields()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_contactdb_custom_fields_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->custom_fields()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_custom_fields__custom_field_id__get() + { + $custom_field_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->custom_fields()->_($custom_field_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_custom_fields__custom_field_id__delete() + { + $custom_field_id = "test_url_param"; + $request_headers = array("X-Mock: 202"); + $response = self::$sg->client->contactdb()->custom_fields()->_($custom_field_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 202); + } + + public function test_contactdb_lists_post() + { + $request_body = json_decode('{ + "name": "your list name" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->contactdb()->lists()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_contactdb_lists_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->lists()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_lists_delete() + { + $request_body = json_decode('[ + 1, + 2, + 3, + 4 +]'); + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->contactdb()->lists()->delete($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_contactdb_lists__list_id__patch() + { + $request_body = json_decode('{ + "name": "newlistname" +}'); + $query_params = json_decode('{"list_id": 1}'); + $list_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->lists()->_($list_id)->patch($request_body, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_lists__list_id__get() + { + $query_params = json_decode('{"list_id": 1}'); + $list_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->lists()->_($list_id)->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_lists__list_id__delete() + { + $query_params = json_decode('{"delete_contacts": "true"}'); + $list_id = "test_url_param"; + $request_headers = array("X-Mock: 202"); + $response = self::$sg->client->contactdb()->lists()->_($list_id)->delete(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 202); + } + + public function test_contactdb_lists__list_id__recipients_post() + { + $request_body = json_decode('[ + "recipient_id1", + "recipient_id2" +]'); + $list_id = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->contactdb()->lists()->_($list_id)->recipients()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_contactdb_lists__list_id__recipients_get() + { + $query_params = json_decode('{"page": 1, "page_size": 1, "list_id": 1}'); + $list_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->lists()->_($list_id)->recipients()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_lists__list_id__recipients__recipient_id__post() + { + $list_id = "test_url_param"; + $recipient_id = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->contactdb()->lists()->_($list_id)->recipients()->_($recipient_id)->post(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_contactdb_lists__list_id__recipients__recipient_id__delete() + { + $query_params = json_decode('{"recipient_id": 1, "list_id": 1}'); + $list_id = "test_url_param"; + $recipient_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->contactdb()->lists()->_($list_id)->recipients()->_($recipient_id)->delete(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_contactdb_recipients_patch() + { + $request_body = json_decode('[ + { + "email": "jones@example.com", + "first_name": "Guy", + "last_name": "Jones" + } +]'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->contactdb()->recipients()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_contactdb_recipients_post() + { + $request_body = json_decode('[ + { + "age": 25, + "email": "example@example.com", + "first_name": "", + "last_name": "User" + }, + { + "age": 25, + "email": "example2@example.com", + "first_name": "Example", + "last_name": "User" + } +]'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->contactdb()->recipients()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_contactdb_recipients_get() + { + $query_params = json_decode('{"page": 1, "page_size": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->recipients()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_recipients_delete() + { + $request_body = json_decode('[ + "recipient_id1", + "recipient_id2" +]'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->recipients()->delete($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_recipients_billable_count_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->recipients()->billable_count()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_recipients_count_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->recipients()->count()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_recipients_search_get() + { + $query_params = json_decode('{"{field_name}": "test_string"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->recipients()->search()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_recipients__recipient_id__get() + { + $recipient_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->recipients()->_($recipient_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_recipients__recipient_id__delete() + { + $recipient_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->contactdb()->recipients()->_($recipient_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_contactdb_recipients__recipient_id__lists_get() + { + $recipient_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->recipients()->_($recipient_id)->lists()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_reserved_fields_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->reserved_fields()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_segments_post() + { + $request_body = json_decode('{ + "conditions": [ + { + "and_or": "", + "field": "last_name", + "operator": "eq", + "value": "Miller" + }, + { + "and_or": "and", + "field": "last_clicked", + "operator": "gt", + "value": "01/02/2015" + }, + { + "and_or": "or", + "field": "clicks.campaign_identifier", + "operator": "eq", + "value": "513" + } + ], + "list_id": 4, + "name": "Last Name Miller" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->segments()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_segments_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->segments()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_segments__segment_id__patch() + { + $request_body = json_decode('{ + "conditions": [ + { + "and_or": "", + "field": "last_name", + "operator": "eq", + "value": "Miller" + } + ], + "list_id": 5, + "name": "The Millers" +}'); + $query_params = json_decode('{"segment_id": "test_string"}'); + $segment_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->segments()->_($segment_id)->patch($request_body, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_segments__segment_id__get() + { + $query_params = json_decode('{"segment_id": 1}'); + $segment_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->segments()->_($segment_id)->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_contactdb_segments__segment_id__delete() + { + $query_params = json_decode('{"delete_contacts": "true"}'); + $segment_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->contactdb()->segments()->_($segment_id)->delete(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_contactdb_segments__segment_id__recipients_get() + { + $query_params = json_decode('{"page": 1, "page_size": 1}'); + $segment_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->contactdb()->segments()->_($segment_id)->recipients()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_devices_stats_get() + { + $query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->devices()->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_geo_stats_get() + { + $query_params = json_decode('{"end_date": "2016-04-01", "country": "US", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->geo()->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_get() + { + $query_params = json_decode('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_assigned_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->assigned()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_pools_post() + { + $request_body = json_decode('{ + "name": "marketing" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->pools()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_pools_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->pools()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_pools__pool_name__put() + { + $request_body = json_decode('{ + "name": "new_pool_name" +}'); + $pool_name = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->pools()->_($pool_name)->put($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_pools__pool_name__get() + { + $pool_name = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->pools()->_($pool_name)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_pools__pool_name__delete() + { + $pool_name = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->ips()->pools()->_($pool_name)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_ips_pools__pool_name__ips_post() + { + $request_body = json_decode('{ + "ip": "0.0.0.0" +}'); + $pool_name = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->ips()->pools()->_($pool_name)->ips()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_ips_pools__pool_name__ips__ip__delete() + { + $pool_name = "test_url_param"; + $ip = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->ips()->pools()->_($pool_name)->ips()->_($ip)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_ips_warmup_post() + { + $request_body = json_decode('{ + "ip": "0.0.0.0" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->warmup()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_warmup_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->warmup()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_warmup__ip_address__get() + { + $ip_address = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->warmup()->_($ip_address)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_ips_warmup__ip_address__delete() + { + $ip_address = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->ips()->warmup()->_($ip_address)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_ips__ip_address__get() + { + $ip_address = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->ips()->_($ip_address)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_batch_post() + { + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->mail()->batch()->post(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_mail_batch__batch_id__get() + { + $batch_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail()->batch()->_($batch_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_send_post() + { + $request_body = json_decode('{ + "asm": { + "group_id": 1, + "groups_to_display": [ + 1, + 2, + 3 + ] + }, + "attachments": [ + { + "content": "[BASE64 encoded content block here]", + "content_id": "ii_139db99fdb5c3704", + "disposition": "inline", + "filename": "file1.jpg", + "name": "file1", + "type": "jpg" + } + ], + "batch_id": "[YOUR BATCH ID GOES HERE]", + "categories": [ + "category1", + "category2" + ], + "content": [ + { + "type": "text/html", + "value": "<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>" + } + ], + "custom_args": { + "New Argument 1": "New Value 1", + "activationAttempt": "1", + "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]" + }, + "from": { + "email": "sam.smith@example.com", + "name": "Sam Smith" + }, + "headers": {}, + "ip_pool_name": "[YOUR POOL NAME GOES HERE]", + "mail_settings": { + "bcc": { + "email": "ben.doe@example.com", + "enable": true + }, + "bypass_list_management": { + "enable": true + }, + "footer": { + "enable": true, + "html": "<p>Thanks</br>The SendGrid Team</p>", + "text": "Thanks,/n The SendGrid Team" + }, + "sandbox_mode": { + "enable": false + }, + "spam_check": { + "enable": true, + "post_to_url": "http://example.com/compliance", + "threshold": 3 + } + }, + "personalizations": [ + { + "bcc": [ + { + "email": "sam.doe@example.com", + "name": "Sam Doe" + } + ], + "cc": [ + { + "email": "jane.doe@example.com", + "name": "Jane Doe" + } + ], + "custom_args": { + "New Argument 1": "New Value 1", + "activationAttempt": "1", + "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]" + }, + "headers": { + "X-Accept-Language": "en", + "X-Mailer": "MyApp" + }, + "send_at": 1409348513, + "subject": "Hello, World!", + "substitutions": { + "id": "substitutions", + "type": "object" + }, + "to": [ + { + "email": "john.doe@example.com", + "name": "John Doe" + } + ] + } + ], + "reply_to": { + "email": "sam.smith@example.com", + "name": "Sam Smith" + }, + "sections": { + "section": { + ":sectionName1": "section 1 text", + ":sectionName2": "section 2 text" + } + }, + "send_at": 1409348513, + "subject": "Hello, World!", + "template_id": "[YOUR TEMPLATE ID GOES HERE]", + "tracking_settings": { + "click_tracking": { + "enable": true, + "enable_text": true + }, + "ganalytics": { + "enable": true, + "utm_campaign": "[NAME OF YOUR REFERRER SOURCE]", + "utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]", + "utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]", + "utm_name": "[NAME OF YOUR CAMPAIGN]", + "utm_term": "[IDENTIFY PAID KEYWORDS HERE]" + }, + "open_tracking": { + "enable": true, + "substitution_tag": "%opentrack" + }, + "subscription_tracking": { + "enable": true, + "html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.", + "substitution_tag": "<%click here%>", + "text": "If you would like to unsubscribe and stop receiveing these emails <% click here %>." + } + } +}'); + $request_headers = array("X-Mock: 202"); + $response = self::$sg->client->mail()->send()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 202); + } + + public function test_mail_settings_get() + { + $query_params = json_decode('{"limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_address_whitelist_patch() + { + $request_body = json_decode('{ + "enabled": true, + "list": [ + "email1@example.com", + "example.com" + ] +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->address_whitelist()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_address_whitelist_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->address_whitelist()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_bcc_patch() + { + $request_body = json_decode('{ + "email": "email@example.com", + "enabled": false +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->bcc()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_bcc_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->bcc()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_bounce_purge_patch() + { + $request_body = json_decode('{ + "enabled": true, + "hard_bounces": 5, + "soft_bounces": 5 +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->bounce_purge()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_bounce_purge_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->bounce_purge()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_footer_patch() + { + $request_body = json_decode('{ + "enabled": true, + "html_content": "...", + "plain_content": "..." +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->footer()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_footer_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->footer()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_forward_bounce_patch() + { + $request_body = json_decode('{ + "email": "example@example.com", + "enabled": true +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->forward_bounce()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_forward_bounce_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->forward_bounce()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_forward_spam_patch() + { + $request_body = json_decode('{ + "email": "", + "enabled": false +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->forward_spam()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_forward_spam_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->forward_spam()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_plain_content_patch() + { + $request_body = json_decode('{ + "enabled": false +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->plain_content()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_plain_content_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->plain_content()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_spam_check_patch() + { + $request_body = json_decode('{ + "enabled": true, + "max_score": 5, + "url": "url" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->spam_check()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_spam_check_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->spam_check()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_template_patch() + { + $request_body = json_decode('{ + "enabled": true, + "html_content": "<% body %>" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->template()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mail_settings_template_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mail_settings()->template()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_mailbox_providers_stats_get() + { + $query_params = json_decode('{"end_date": "2016-04-01", "mailbox_providers": "test_string", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->mailbox_providers()->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_partner_settings_get() + { + $query_params = json_decode('{"limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->partner_settings()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_partner_settings_new_relic_patch() + { + $request_body = json_decode('{ + "enable_subuser_statistics": true, + "enabled": true, + "license_key": "" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->partner_settings()->new_relic()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_partner_settings_new_relic_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->partner_settings()->new_relic()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_scopes_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->scopes()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_senders_post() + { + $request_body = json_decode('{ + "address": "123 Elm St.", + "address_2": "Apt. 456", + "city": "Denver", + "country": "United States", + "from": { + "email": "from@example.com", + "name": "Example INC" + }, + "nickname": "My Sender ID", + "reply_to": { + "email": "replyto@example.com", + "name": "Example INC" + }, + "state": "Colorado", + "zip": "80202" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->senders()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_senders_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->senders()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_senders__sender_id__patch() + { + $request_body = json_decode('{ + "address": "123 Elm St.", + "address_2": "Apt. 456", + "city": "Denver", + "country": "United States", + "from": { + "email": "from@example.com", + "name": "Example INC" + }, + "nickname": "My Sender ID", + "reply_to": { + "email": "replyto@example.com", + "name": "Example INC" + }, + "state": "Colorado", + "zip": "80202" +}'); + $sender_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->senders()->_($sender_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_senders__sender_id__get() + { + $sender_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->senders()->_($sender_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_senders__sender_id__delete() + { + $sender_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->senders()->_($sender_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_senders__sender_id__resend_verification_post() + { + $sender_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->senders()->_($sender_id)->resend_verification()->post(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_stats_get() + { + $query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers_post() + { + $request_body = json_decode('{ + "email": "John@example.com", + "ips": [ + "1.1.1.1", + "2.2.2.2" + ], + "password": "johns_password", + "username": "John@example.com" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers_get() + { + $query_params = json_decode('{"username": "test_string", "limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers_reputations_get() + { + $query_params = json_decode('{"usernames": "test_string"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->reputations()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers_stats_get() + { + $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "subusers": "test_string"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers_stats_monthly_get() + { + $query_params = json_decode('{"subuser": "test_string", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "date": "test_string", "sort_by_direction": "asc"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->stats()->monthly()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers_stats_sums_get() + { + $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->stats()->sums()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers__subuser_name__patch() + { + $request_body = json_decode('{ + "disabled": false +}'); + $subuser_name = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->subusers()->_($subuser_name)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_subusers__subuser_name__delete() + { + $subuser_name = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->subusers()->_($subuser_name)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_subusers__subuser_name__ips_put() + { + $request_body = json_decode('[ + "127.0.0.1" +]'); + $subuser_name = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->_($subuser_name)->ips()->put($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers__subuser_name__monitor_put() + { + $request_body = json_decode('{ + "email": "example@example.com", + "frequency": 500 +}'); + $subuser_name = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->_($subuser_name)->monitor()->put($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers__subuser_name__monitor_post() + { + $request_body = json_decode('{ + "email": "example@example.com", + "frequency": 50000 +}'); + $subuser_name = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->_($subuser_name)->monitor()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers__subuser_name__monitor_get() + { + $subuser_name = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->_($subuser_name)->monitor()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_subusers__subuser_name__monitor_delete() + { + $subuser_name = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->subusers()->_($subuser_name)->monitor()->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_subusers__subuser_name__stats_monthly_get() + { + $query_params = json_decode('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}'); + $subuser_name = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->subusers()->_($subuser_name)->stats()->monthly()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_blocks_get() + { + $query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->blocks()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_blocks_delete() + { + $request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->suppression()->blocks()->delete($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_suppression_blocks__email__get() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->blocks()->_($email)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_blocks__email__delete() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->suppression()->blocks()->_($email)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_suppression_bounces_get() + { + $query_params = json_decode('{"start_time": 1, "end_time": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->bounces()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_bounces_delete() + { + $request_body = json_decode('{ + "delete_all": true, + "emails": [ + "example@example.com", + "example2@example.com" + ] +}'); + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->suppression()->bounces()->delete($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_suppression_bounces__email__get() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->bounces()->_($email)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_bounces__email__delete() + { + $query_params = json_decode('{"email_address": "example@example.com"}'); + $email = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->suppression()->bounces()->_($email)->delete(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_suppression_invalid_emails_get() + { + $query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->invalid_emails()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_invalid_emails_delete() + { + $request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->suppression()->invalid_emails()->delete($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_suppression_invalid_emails__email__get() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->invalid_emails()->_($email)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_invalid_emails__email__delete() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->suppression()->invalid_emails()->_($email)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_suppression_spam_report__email__get() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->spam_report()->_($email)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_spam_report__email__delete() + { + $email = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->suppression()->spam_report()->_($email)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_suppression_spam_reports_get() + { + $query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->spam_reports()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_suppression_spam_reports_delete() + { + $request_body = json_decode('{ + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] +}'); + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->suppression()->spam_reports()->delete($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_suppression_unsubscribes_get() + { + $query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->suppression()->unsubscribes()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_templates_post() + { + $request_body = json_decode('{ + "name": "example_name" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->templates()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_templates_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->templates()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_templates__template_id__patch() + { + $request_body = json_decode('{ + "name": "new_example_name" +}'); + $template_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->templates()->_($template_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_templates__template_id__get() + { + $template_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->templates()->_($template_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_templates__template_id__delete() + { + $template_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->templates()->_($template_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_templates__template_id__versions_post() + { + $request_body = json_decode('{ + "active": 1, + "html_content": "<%body%>", + "name": "example_version_name", + "plain_content": "<%body%>", + "subject": "<%subject%>", + "template_id": "ddb96bbc-9b92-425e-8979-99464621b543" +}'); + $template_id = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->templates()->_($template_id)->versions()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_templates__template_id__versions__version_id__patch() + { + $request_body = json_decode('{ + "active": 1, + "html_content": "<%body%>", + "name": "updated_example_name", + "plain_content": "<%body%>", + "subject": "<%subject%>" +}'); + $template_id = "test_url_param"; + $version_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_templates__template_id__versions__version_id__get() + { + $template_id = "test_url_param"; + $version_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_templates__template_id__versions__version_id__delete() + { + $template_id = "test_url_param"; + $version_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_templates__template_id__versions__version_id__activate_post() + { + $template_id = "test_url_param"; + $version_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)->activate()->post(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_get() + { + $query_params = json_decode('{"limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_click_patch() + { + $request_body = json_decode('{ + "enabled": true +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->click()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_click_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->click()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_google_analytics_patch() + { + $request_body = json_decode('{ + "enabled": true, + "utm_campaign": "website", + "utm_content": "", + "utm_medium": "email", + "utm_source": "sendgrid.com", + "utm_term": "" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->google_analytics()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_google_analytics_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->google_analytics()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_open_patch() + { + $request_body = json_decode('{ + "enabled": true +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->open()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_open_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->open()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_subscription_patch() + { + $request_body = json_decode('{ + "enabled": true, + "html_content": "html content", + "landing": "landing page html", + "plain_content": "text content", + "replace": "replacement tag", + "url": "url" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->subscription()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_tracking_settings_subscription_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->tracking_settings()->subscription()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_account_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->account()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_credits_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->credits()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_email_put() + { + $request_body = json_decode('{ + "email": "example@example.com" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->email()->put($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_email_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->email()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_password_put() + { + $request_body = json_decode('{ + "new_password": "new_password", + "old_password": "old_password" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->password()->put($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_profile_patch() + { + $request_body = json_decode('{ + "city": "Orange", + "first_name": "Example", + "last_name": "User" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->profile()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_profile_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->profile()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_scheduled_sends_post() + { + $request_body = json_decode('{ + "batch_id": "YOUR_BATCH_ID", + "status": "pause" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->user()->scheduled_sends()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_user_scheduled_sends_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->scheduled_sends()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_scheduled_sends__batch_id__patch() + { + $request_body = json_decode('{ + "status": "pause" +}'); + $batch_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_user_scheduled_sends__batch_id__get() + { + $batch_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_scheduled_sends__batch_id__delete() + { + $batch_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_user_settings_enforced_tls_patch() + { + $request_body = json_decode('{ + "require_tls": true, + "require_valid_cert": false +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->settings()->enforced_tls()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_settings_enforced_tls_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->settings()->enforced_tls()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_username_put() + { + $request_body = json_decode('{ + "username": "test_username" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->username()->put($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_username_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->username()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_webhooks_event_settings_patch() + { + $request_body = json_decode('{ + "bounce": true, + "click": true, + "deferred": true, + "delivered": true, + "dropped": true, + "enabled": true, + "group_resubscribe": true, + "group_unsubscribe": true, + "open": true, + "processed": true, + "spam_report": true, + "unsubscribe": true, + "url": "url" +}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->webhooks()->event()->settings()->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_webhooks_event_settings_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->webhooks()->event()->settings()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_webhooks_event_test_post() + { + $request_body = json_decode('{ + "url": "url" +}'); + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->user()->webhooks()->event()->test()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_user_webhooks_parse_settings_post() + { + $request_body = json_decode('{ + "hostname": "myhostname.com", + "send_raw": false, + "spam_check": true, + "url": "http://email.myhosthame.com" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->user()->webhooks()->parse()->settings()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_user_webhooks_parse_settings_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->webhooks()->parse()->settings()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_webhooks_parse_settings__hostname__patch() + { + $request_body = json_decode('{ + "send_raw": true, + "spam_check": false, + "url": "http://newdomain.com/parse" +}'); + $hostname = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_webhooks_parse_settings__hostname__get() + { + $hostname = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_user_webhooks_parse_settings__hostname__delete() + { + $hostname = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_user_webhooks_parse_stats_get() + { + $query_params = json_decode('{"aggregated_by": "day", "limit": "test_string", "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": "test_string"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->user()->webhooks()->parse()->stats()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_domains_post() + { + $request_body = json_decode('{ + "automatic_security": false, + "custom_spf": true, + "default": true, + "domain": "example.com", + "ips": [ + "192.168.1.1", + "192.168.1.2" + ], + "subdomain": "news", + "username": "john@example.com" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->whitelabel()->domains()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_whitelabel_domains_get() + { + $query_params = json_decode('{"username": "test_string", "domain": "test_string", "exclude_subusers": "true", "limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->domains()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_domains_default_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->domains()->default()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_domains_subuser_get() + { + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->domains()->subuser()->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_domains_subuser_delete() + { + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->whitelabel()->domains()->subuser()->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_whitelabel_domains__domain_id__patch() + { + $request_body = json_decode('{ + "custom_spf": true, + "default": false +}'); + $domain_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->domains()->_($domain_id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_domains__domain_id__get() + { + $domain_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->domains()->_($domain_id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_domains__domain_id__delete() + { + $domain_id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->whitelabel()->domains()->_($domain_id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_whitelabel_domains__domain_id__subuser_post() + { + $request_body = json_decode('{ + "username": "jane@example.com" +}'); + $domain_id = "test_url_param"; + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->whitelabel()->domains()->_($domain_id)->subuser()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_whitelabel_domains__id__ips_post() + { + $request_body = json_decode('{ + "ip": "192.168.0.1" +}'); + $id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->domains()->_($id)->ips()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_domains__id__ips__ip__delete() + { + $id = "test_url_param"; + $ip = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->domains()->_($id)->ips()->_($ip)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_domains__id__validate_post() + { + $id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->domains()->_($id)->validate()->post(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_ips_post() + { + $request_body = json_decode('{ + "domain": "example.com", + "ip": "192.168.1.1", + "subdomain": "email" +}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->whitelabel()->ips()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_whitelabel_ips_get() + { + $query_params = json_decode('{"ip": "test_string", "limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->ips()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_ips__id__get() + { + $id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->ips()->_($id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_ips__id__delete() + { + $id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->whitelabel()->ips()->_($id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_whitelabel_ips__id__validate_post() + { + $id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->ips()->_($id)->validate()->post(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_links_post() + { + $request_body = json_decode('{ + "default": true, + "domain": "example.com", + "subdomain": "mail" +}'); + $query_params = json_decode('{"limit": 1, "offset": 1}'); + $request_headers = array("X-Mock: 201"); + $response = self::$sg->client->whitelabel()->links()->post($request_body, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 201); + } + + public function test_whitelabel_links_get() + { + $query_params = json_decode('{"limit": 1}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->links()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_links_default_get() + { + $query_params = json_decode('{"domain": "test_string"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->links()->default()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_links_subuser_get() + { + $query_params = json_decode('{"username": "test_string"}'); + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->links()->subuser()->get(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_links_subuser_delete() + { + $query_params = json_decode('{"username": "test_string"}'); + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->whitelabel()->links()->subuser()->delete(null, $query_params, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_whitelabel_links__id__patch() + { + $request_body = json_decode('{ + "default": true +}'); + $id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->links()->_($id)->patch($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_links__id__get() + { + $id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->links()->_($id)->get(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_links__id__delete() + { + $id = "test_url_param"; + $request_headers = array("X-Mock: 204"); + $response = self::$sg->client->whitelabel()->links()->_($id)->delete(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 204); + } + + public function test_whitelabel_links__id__validate_post() + { + $id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->links()->_($id)->validate()->post(null, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public function test_whitelabel_links__link_id__subuser_post() + { + $request_body = json_decode('{ + "username": "jane@example.com" +}'); + $link_id = "test_url_param"; + $request_headers = array("X-Mock: 200"); + $response = self::$sg->client->whitelabel()->links()->_($link_id)->subuser()->post($request_body, null, $request_headers); + $this->assertEquals($response->statusCode(), 200); + } + + public static function tearDownAfterClass() + { + $command = 'kill '.self::$pid; + exec($command); + print("\nPrism shut down"); + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/bootstrap.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/bootstrap.php new file mode 100644 index 0000000..d04672a --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/bootstrap.php @@ -0,0 +1,2 @@ +<?php +//include(dirname(dirname(__FILE__)) . '/../lib/loader.php'); diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/helpers/mail/MailTest.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/helpers/mail/MailTest.php new file mode 100644 index 0000000..cb4a71e --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/helpers/mail/MailTest.php @@ -0,0 +1,183 @@ +<?php +namespace SendGrid; + +class MailTest_Mail extends \PHPUnit_Framework_TestCase +{ + public function testBaseLineExample() + { + $from = new Email(null, "test@example.com"); + $to = new Email(null, "test@example.com"); + $subject = "Hello World from the SendGrid PHP Library"; + $content = new Content("text/plain", "some text here"); + $mail = new Mail($from, $subject, $to, $content); + + $content = new Content("text/html", "<html><body>some text here</body></html>"); + $mail->addContent($content); + + $json = json_encode($mail); + + $this->assertEquals($json, '{"from":{"email":"test@example.com"},"personalizations":[{"to":[{"email":"test@example.com"}]}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\/plain","value":"some text here"},{"type":"text\/html","value":"<html><body>some text here<\/body><\/html>"}]}'); + } + + public function testKitchenSinkExample() + { + $from = new Email("DX", "test@example.com"); + $subject = "Hello World from the SendGrid PHP Library"; + $to = new Email("Example User", "test@example.com"); + $content = new Content("text/plain", "some text here"); + $mail = new Mail($from, $subject, $to, $content); + + $email = new Email("Example User", "test@example.com"); + $mail->personalization[0]->addTo($email); + $email = new Email("Example User", "test@example.com"); + $mail->personalization[0]->addCc($email); + $email = new Email("Example User", "test@example.com"); + $mail->personalization[0]->addCc($email); + $email = new Email("Example User", "test@example.com"); + $mail->personalization[0]->addBcc($email); + $email = new Email("Example User", "test@example.com"); + $mail->personalization[0]->addBcc($email); + $mail->personalization[0]->setSubject("Hello World from the SendGrid PHP Library"); + $mail->personalization[0]->addHeader("X-Test", "test"); + $mail->personalization[0]->addHeader("X-Mock", "true"); + $mail->personalization[0]->addSubstitution("%name%", "Example User"); + $mail->personalization[0]->addSubstitution("%city%", "Denver"); + $mail->personalization[0]->addCustomArg("user_id", "343"); + $mail->personalization[0]->addCustomArg("type", "marketing"); + $mail->personalization[0]->setSendAt(1443636843); + + $personalization1 = new Personalization(); + $email = new Email("Example User", "test@example.com"); + $personalization1->addTo($email); + $email = new Email("Example User", "test@example.com"); + $personalization1->addTo($email); + $email = new Email("Example User", "test@example.com"); + $personalization1->addCc($email); + $email = new Email("Example User", "test@example.com"); + $personalization1->addCc($email); + $email = new Email("Example User", "test@example.com"); + $personalization1->addBcc($email); + $email = new Email("Example User", "test@example.com"); + $personalization1->addBcc($email); + $personalization1->setSubject("Hello World from the SendGrid PHP Library"); + $personalization1->addHeader("X-Test", "test"); + $personalization1->addHeader("X-Mock", "true"); + $personalization1->addSubstitution("%name%", "Example User"); + $personalization1->addSubstitution("%city%", "Denver"); + $personalization1->addCustomArg("user_id", "343"); + $personalization1->addCustomArg("type", "marketing"); + $personalization1->setSendAt(1443636843); + $mail->addPersonalization($personalization1); + + $content = new Content("text/html", "<html><body>some text here</body></html>"); + $mail->addContent($content); + + $attachment = new Attachment(); + $attachment->setContent("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12"); + $attachment->setType("application/pdf"); + $attachment->setFilename("balance_001.pdf"); + $attachment->setDisposition("attachment"); + $attachment->setContentId("Balance Sheet"); + $mail->addAttachment($attachment); + + $attachment2 = new Attachment(); + $attachment2->setContent("BwdW"); + $attachment2->setType("image/png"); + $attachment2->setFilename("banner.png"); + $attachment2->setDisposition("inline"); + $attachment2->setContentId("Banner"); + $mail->addAttachment($attachment2); + + $mail->setTemplateId("439b6d66-4408-4ead-83de-5c83c2ee313a"); + + $mail->addSection("%section1%", "Substitution Text for Section 1"); + $mail->addSection("%section2%", "Substitution Text for Section 2"); + + $mail->addHeader("X-Test1", "1"); + $mail->addHeader("X-Test2", "2"); + + $mail->addCategory("May"); + $mail->addCategory("2016"); + + $mail->addCustomArg("campaign", "welcome"); + $mail->addCustomArg("weekday", "morning"); + + $mail->setSendAt(1443636842); + + $asm = new ASM(); + $asm->setGroupId(99); + $asm->setGroupsToDisplay([4,5,6,7,8]); + $mail->setASM($asm); + + $mail->setIpPoolName("23"); + + $mail_settings = new MailSettings(); + $bcc_settings = new BccSettings(); + $bcc_settings->setEnable(true); + $bcc_settings->setEmail("test@example.com"); + $mail_settings->setBccSettings($bcc_settings); + $sandbox_mode = new SandBoxMode(); + $sandbox_mode->setEnable(true); + $mail_settings->setSandboxMode($sandbox_mode); + $bypass_list_management = new BypassListManagement(); + $bypass_list_management->setEnable(true); + $mail_settings->setBypassListManagement($bypass_list_management); + $footer = new Footer(); + $footer->setEnable(true); + $footer->setText("Footer Text"); + $footer->setHtml("<html><body>Footer Text</body></html>"); + $mail_settings->setFooter($footer); + $spam_check = new SpamCheck(); + $spam_check->setEnable(true); + $spam_check->setThreshold(1); + $spam_check->setPostToUrl("https://spamcatcher.sendgrid.com"); + $mail_settings->setSpamCheck($spam_check); + $mail->setMailSettings($mail_settings); + + $tracking_settings = new TrackingSettings(); + $click_tracking = new ClickTracking(); + $click_tracking->setEnable(true); + $click_tracking->setEnableText(true); + $tracking_settings->setClickTracking($click_tracking); + $open_tracking = new OpenTracking(); + $open_tracking->setEnable(true); + $open_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message"); + $tracking_settings->setOpenTracking($open_tracking); + $subscription_tracking = new SubscriptionTracking(); + $subscription_tracking->setEnable(true); + $subscription_tracking->setText("text to insert into the text/plain portion of the message"); + $subscription_tracking->setHtml("<html><body>html to insert into the text/html portion of the message</body></html>"); + $subscription_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message"); + $tracking_settings->setSubscriptionTracking($subscription_tracking); + $ganalytics = new Ganalytics(); + $ganalytics->setEnable(true); + $ganalytics->setCampaignSource("some source"); + $ganalytics->setCampaignTerm("some term"); + $ganalytics->setCampaignContent("some content"); + $ganalytics->setCampaignName("some name"); + $ganalytics->setCampaignMedium("some medium"); + $tracking_settings->setGanalytics($ganalytics); + $mail->setTrackingSettings($tracking_settings); + + $reply_to = new ReplyTo("test@example.com", "Optional Name"); + $mail->setReplyTo($reply_to); + + $json = json_encode($mail); + + $this->assertEquals($json, '{"from":{"name":"DX","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843},{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\/plain","value":"some text here"},{"type":"text\/html","value":"<html><body>some text here<\/body><\/html>"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application\/pdf","filename":"balance_001.pdf","disposition":"attachment","content_id":"Balance Sheet"},{"content":"BwdW","type":"image\/png","filename":"banner.png","disposition":"inline","content_id":"Banner"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Substitution Text for Section 1","%section2%":"Substitution Text for Section 2"},"headers":{"X-Test1":"1","X-Test2":"2"},"categories":["May","2016"],"custom_args":{"campaign":"welcome","weekday":"morning"},"send_at":1443636842,"asm":{"group_id":99,"groups_to_display":[4,5,6,7,8]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"test@example.com"},"bypass_list_management":{"enable":true},"footer":{"enable":true,"text":"Footer Text","html":"<html><body>Footer Text<\/body><\/html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https:\/\/spamcatcher.sendgrid.com"}},"tracking_settings":{"click_tracking":{"enable":true,"enable_text":true},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text\/plain portion of the message","html":"<html><body>html to insert into the text\/html portion of the message<\/body><\/html>","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some source","utm_medium":"some medium","utm_term":"some term","utm_content":"some content","utm_campaign":"some name"}},"reply_to":{"email":"test@example.com","name":"Optional Name"}}'); + + $reply_to = new ReplyTo("test@example.com"); + $mail->setReplyTo($reply_to); + + $json = json_encode($mail); + + $this->assertEquals($json, '{"from":{"name":"DX","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843},{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\/plain","value":"some text here"},{"type":"text\/html","value":"<html><body>some text here<\/body><\/html>"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application\/pdf","filename":"balance_001.pdf","disposition":"attachment","content_id":"Balance Sheet"},{"content":"BwdW","type":"image\/png","filename":"banner.png","disposition":"inline","content_id":"Banner"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Substitution Text for Section 1","%section2%":"Substitution Text for Section 2"},"headers":{"X-Test1":"1","X-Test2":"2"},"categories":["May","2016"],"custom_args":{"campaign":"welcome","weekday":"morning"},"send_at":1443636842,"asm":{"group_id":99,"groups_to_display":[4,5,6,7,8]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"test@example.com"},"bypass_list_management":{"enable":true},"footer":{"enable":true,"text":"Footer Text","html":"<html><body>Footer Text<\/body><\/html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https:\/\/spamcatcher.sendgrid.com"}},"tracking_settings":{"click_tracking":{"enable":true,"enable_text":true},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text\/plain portion of the message","html":"<html><body>html to insert into the text\/html portion of the message<\/body><\/html>","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some source","utm_medium":"some medium","utm_term":"some term","utm_content":"some content","utm_campaign":"some name"}},"reply_to":{"email":"test@example.com"}}'); + + $reply_to = new ReplyTo("test@example.com", null); + $mail->setReplyTo($reply_to); + + $json = json_encode($mail); + + $this->assertEquals($json, '{"from":{"name":"DX","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843},{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\/plain","value":"some text here"},{"type":"text\/html","value":"<html><body>some text here<\/body><\/html>"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application\/pdf","filename":"balance_001.pdf","disposition":"attachment","content_id":"Balance Sheet"},{"content":"BwdW","type":"image\/png","filename":"banner.png","disposition":"inline","content_id":"Banner"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Substitution Text for Section 1","%section2%":"Substitution Text for Section 2"},"headers":{"X-Test1":"1","X-Test2":"2"},"categories":["May","2016"],"custom_args":{"campaign":"welcome","weekday":"morning"},"send_at":1443636842,"asm":{"group_id":99,"groups_to_display":[4,5,6,7,8]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"test@example.com"},"bypass_list_management":{"enable":true},"footer":{"enable":true,"text":"Footer Text","html":"<html><body>Footer Text<\/body><\/html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https:\/\/spamcatcher.sendgrid.com"}},"tracking_settings":{"click_tracking":{"enable":true,"enable_text":true},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text\/plain portion of the message","html":"<html><body>html to insert into the text\/html portion of the message<\/body><\/html>","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some source","utm_medium":"some medium","utm_term":"some term","utm_content":"some content","utm_campaign":"some name"}},"reply_to":{"email":"test@example.com"}}'); + } +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/phpunit.xml.dist b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/phpunit.xml.dist new file mode 100644 index 0000000..f216f0f --- /dev/null +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/phpunit.xml.dist @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit bootstrap="bootstrap.php"> + <testsuites> + <testsuite name="General"> + <file>./SendGrid.php</file> + <file>./helpers/mail/Mail.php</file> + </testsuite> + </testsuites> +</phpunit> |