/** * @param string $accessKey * @param Common\HttpClient $httpClient */ public function __construct($accessKey = null, Common\HttpClient $httpClient = null) { if ($httpClient === null) { $this->ChatAPIHttpClient = new Common\HttpClient(self::CHATAPI_ENDPOINT); $this->HttpClient = new Common\HttpClient(self::ENDPOINT); } else { $this->ChatAPIHttpClient = $httpClient; $this->HttpClient = $httpClient; } $this->HttpClient->addUserAgentString('MessageBird/ApiClient/' . self::CLIENT_VERSION); $this->HttpClient->addUserAgentString($this->getPhpVersion()); $this->ChatAPIHttpClient->addUserAgentString('MessageBird/ApiClient/' . self::CLIENT_VERSION); $this->ChatAPIHttpClient->addUserAgentString($this->getPhpVersion()); if ($accessKey !== null) { $this->setAccessKey($accessKey); } $this->messages = new Resources\Messages($this->HttpClient); $this->hlr = new Resources\Hlr($this->HttpClient); $this->verify = new Resources\Verify($this->HttpClient); $this->balance = new Resources\Balance($this->HttpClient); $this->voicemessages = new Resources\VoiceMessage($this->HttpClient); $this->lookup = new Resources\Lookup($this->HttpClient); $this->lookupHlr = new Resources\LookupHlr($this->HttpClient); $this->chatMessages = new Resources\Chat\Message($this->ChatAPIHttpClient); $this->chatChannels = new Resources\Chat\Channel($this->ChatAPIHttpClient); $this->chatPlatforms = new Resources\Chat\Platform($this->ChatAPIHttpClient); $this->chatContacts = new Resources\Chat\Contact($this->ChatAPIHttpClient); }
/** * @param $accessKey */ public function __construct($accessKey = null) { $this->HttpClient = new Common\HttpClient(self::ENDPOINT); $this->HttpClient->addUserAgentString('MessageBird/ApiClient/' . self::CLIENT_VERSION); $this->HttpClient->addUserAgentString($this->getPhpVersion()); if ($accessKey !== null) { $this->setAccessKey($accessKey); } $this->messages = new Resources\Messages($this->HttpClient); $this->hlr = new Resources\Hlr($this->HttpClient); $this->otp = new Resources\Otp($this->HttpClient); $this->balance = new Resources\Balance($this->HttpClient); $this->voicemessages = new Resources\VoiceMessage($this->HttpClient); }