예제 #1
0
 /**
  * Determine if an API key is valid
  *
  * @throws InvalidApiKey
  * @throws \Exception
  */
 public function validateKey()
 {
     try {
         $this->api->get('');
     } catch (\Exception $e) {
         if (starts_with($e->getMessage(), '{')) {
             $json = json_decode($e->getMessage());
             if ($json->status == 401) {
                 throw new InvalidApiKey($json->detail);
             }
         }
         throw $e;
     }
 }
예제 #2
0
 /**
  * @throws \Exception
  */
 public function interests(string $interestCategoryId) : array
 {
     $result = $this->api->get('lists/' . $this->id() . '/interest-categories/' . $interestCategoryId . '/interests');
     return $result->get('interests');
 }
 /**
  * @param $mailchimpListId
  *
  * @return \Illuminate\Support\Collection
  */
 protected function getListInfo($mailchimpListId)
 {
     return $this->mc->get("/lists/{$mailchimpListId}");
 }