Skip to content

Instantly share code, notes, and snippets.

@prionkor
Created April 7, 2016 12:59
Show Gist options
  • Select an option

  • Save prionkor/65e75f32dfc832bb9621eb05b3359b05 to your computer and use it in GitHub Desktop.

Select an option

Save prionkor/65e75f32dfc832bb9621eb05b3359b05 to your computer and use it in GitHub Desktop.
SendGrid Global Supressions PHP Class
<?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