You are here

public function SendinblueApiV2::getAccount in SendinBlue 7.2

Get the details of an account.

Return value

GetAccount An array of account detail.

Overrides SendInBlueApiInterface::getAccount

File

includes/Api/SendinblueApiV2.php, line 41

Class

SendinblueApiV2
Sendinblue REST client.

Code

public function getAccount() {
  $account = $this->sIBHttpClient
    ->get("account", "");
  $accountData = $account['data'];
  return new GetAccount([
    'firstName' => $accountData[2]['first_name'],
    'lastName' => $accountData[2]['last_name'],
    'email' => $accountData[2]['email'],
    'companyName' => $accountData[2]['company'],
    'address' => [
      'city' => $accountData[2]['city'],
      'zipCode' => $accountData[2]['zip_code'],
      'country' => $accountData[2]['country'],
      'street' => $accountData[2]['address'],
    ],
    'plan' => [
      [
        'type' => $accountData[0]['plan_type'],
        'credits' => $accountData[0]['credits'],
        'creditsType' => $accountData[0]['credit_type'],
      ],
      [
        'type' => $accountData[1]['plan_type'],
        'credits' => $accountData[1]['credits'],
        'creditsType' => $accountData[1]['credit_type'],
      ],
    ],
  ]);
}