Created
April 7, 2016 12:59
-
-
Save prionkor/65e75f32dfc832bb9621eb05b3359b05 to your computer and use it in GitHub Desktop.
SendGrid Global Supressions PHP Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class GlobalSuppressions extends ASMSuppressions{ | |
| public function __construct($client, $options=NULL){ | |
| parent::__construct($client, $options); | |
| $this->base_endpoint = "/v3/asm/suppressions"; | |
| $this->endpoint = "/v3/asm/suppressions"; | |
| } | |
| public function get_list($args){ | |
| $this->endpoint = $this->base_endpoint . '/unsubscribes?' . http_build_query($args); | |
| return $this->client->getRequest($this); | |
| } | |
| public function get($email){ | |
| $this->endpoint = $this->base_endpoint . "/global/" . $email; | |
| return $this->client->getRequest($this); | |
| } | |
| public function post( $email = null ){ | |
| if ( !is_array($email) ) { | |
| $email = array($email); | |
| } | |
| $this->endpoint = $this->base_endpoint . '/global'; | |
| $data = array( | |
| 'recipient_emails' => $email, | |
| ); | |
| return $this->client->postRequest( $this, $data ); | |
| } | |
| public function delete( $email = null ){ | |
| $this->endpoint = $this->base_endpoint . "/global/" . $email; | |
| return $this->client->deleteRequest($this); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment