Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "messagebird/php-rest-api",
"description": "MessageBird REST API client for PHP",
"version": "1.4.1",
"type": "library",
"homepage": "https://github.com/messagebird/php-rest-api",
"license": "BSD-2-Clause",
Expand Down
2 changes: 1 addition & 1 deletion examples/chatchannels-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
);

try {
$ChatChannelResult = $MessageBird->chatchannels->create($ChatChannel);
$ChatChannelResult = $MessageBird->chatChannels->create($ChatChannel);
var_dump($ChatChannelResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
3 changes: 1 addition & 2 deletions examples/chatchannels-delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
$MessageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.

try {

$deleted = $MessageBird->chatchannels->delete('4affac2c577fb22e373921n52675409'); // Set a message id here
$deleted = $MessageBird->chatChannels->delete('4affac2c577fb22e373921n52675409'); // Set a message id here
var_dump('Deleted: ' . $deleted);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
2 changes: 1 addition & 1 deletion examples/chatchannels-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$MessageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.

try {
$ChatChannelResult = $MessageBird->chatchannels->getList();
$ChatChannelResult = $MessageBird->chatChannels->getList();
var_dump($ChatChannelResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
4 changes: 1 addition & 3 deletions examples/chatchannels-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
$ChatChannel->name = 'New name';
$ChatChannel->callbackUrl = 'http://newurl.dev';


try {

$ChatChannelResult = $MessageBird->chatchannels->update($ChatChannel, '331af4c577e3asbbc3631455680736');
$ChatChannelResult = $MessageBird->chatChannels->update($ChatChannel, '331af4c577e3asbbc3631455680736');
var_dump($ChatChannelResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
2 changes: 1 addition & 1 deletion examples/chatchannels-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$MessageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.

try {
$ChatChannelResult = $MessageBird->chatchannels->read('0051af4c577e3eebbc3631n95680736'); // Set a channel id here
$ChatChannelResult = $MessageBird->chatChannels->read('0051af4c577e3eebbc3631n95680736'); // Set a channel id here
var_dump($ChatChannelResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
3 changes: 1 addition & 2 deletions examples/chatcontacts-delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
$MessageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.

try {

$deleted = $MessageBird->chatcontacts->delete('4affa2345d7fb22e373921n524df5409'); // Set a contact id
$deleted = $MessageBird->chatContacts->delete('4affa2345d7fb22e373921n524df5409'); // Set a contact id
var_dump('Deleted : ' . $deleted);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
3 changes: 1 addition & 2 deletions examples/chatcontacts-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
$MessageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.

try {

$ChatContactResult = $MessageBird->chatcontacts->getList();
$ChatContactResult = $MessageBird->chatContacts->getList();
var_dump($ChatContactResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
3 changes: 1 addition & 2 deletions examples/chatcontacts-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
$MessageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.

try {

$ChatContactResult = $MessageBird->chatcontacts->read('0051af4c577e3eebbc3631n95680736'); // Set a contact id here
$ChatContactResult = $MessageBird->chatContacts->read('0051af4c577e3eebbc3631n95680736'); // Set a contact id here
var_dump($ChatContactResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
3 changes: 1 addition & 2 deletions examples/chatmessages-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
$ChatMessage->payload = 'This is a test message to test the Chat API';
$ChatMessage->type = 'text';


try {
$ChatMessageResult = $MessageBird->chatmessages->create($ChatMessage);
$ChatMessageResult = $MessageBird->chatMessages->create($ChatMessage);
var_dump($ChatMessageResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
3 changes: 1 addition & 2 deletions examples/chatmessages-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

$ChatMessage = new \MessageBird\Objects\Chat\Message();


try {
$ChatMessageResult = $MessageBird->chatmessages->getList();
$ChatMessageResult = $MessageBird->chatMessages->getList();
var_dump($ChatMessageResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
3 changes: 1 addition & 2 deletions examples/chatmessages-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
$ChatMessage = new \MessageBird\Objects\Chat\Message();

try {

$MessageResult = $MessageBird->chatmessages->read('d6508edc578ca7641e3919n79796670'); // Set a message id here
$MessageResult = $MessageBird->chatMessages->read('d6508edc578ca7641e3919n79796670'); // Set a message id here
var_dump($MessageResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
3 changes: 1 addition & 2 deletions examples/chatplatforms-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
$ChatPlatform = new \MessageBird\Objects\Chat\Channel();

try {

$ChatPlatformResult = $MessageBird->chatplatforms->getList();
$ChatPlatformResult = $MessageBird->chatPlatforms->getList();
var_dump($ChatPlatformResult);

} catch (\MessageBird\Exceptions\AuthenticateException $e) {
Expand Down
27 changes: 22 additions & 5 deletions src/MessageBird/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Client
const ENDPOINT = 'https://rest.messagebird.com';
const CHATAPI_ENDPOINT = 'https://chat.messagebird.com/1';

const CLIENT_VERSION = '1.4.1';
const CLIENT_VERSION = '1.5.0';

/**
* @var string
Expand Down Expand Up @@ -55,6 +55,23 @@ class Client
*/
public $lookupHlr;

/**
* @var Resources\Chat\Message
*/
public $chatMessages;
/**
* @var Resources\Chat\Channel
*/
public $chatChannels;
/**
* @var Resources\Chat\Platform
*/
public $chatPlatforms;
/**
* @var Resources\Chat\Contact
*/
public $chatContacts;

/**
* @var Common\HttpClient
*/
Expand Down Expand Up @@ -96,10 +113,10 @@ public function __construct($accessKey = null, Common\HttpClient $httpClient = n
$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);
$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);

}

Expand Down
19 changes: 0 additions & 19 deletions src/MessageBird/Objects/Chat/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ class Channel extends Base
*/
public $callbackUrl;

/**
* The endpoint of the action (platforms, messages, channels, contacts)
*
* @var string
*/
public $endpoint;

/**
* A unique random ID which is created on the MessageBird platform and is returned upon creation of the object.
*
Expand Down Expand Up @@ -87,16 +80,4 @@ class Channel extends Base
*/
protected $_links = array();

/**
* @param $object
*
* @return $this|void
*/
public function loadFromArray ($object)
{
parent::loadFromArray($object);

return $this;
}

}
12 changes: 0 additions & 12 deletions src/MessageBird/Objects/Chat/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,4 @@ class Contact extends Base
*/
protected $updatedAt;

/**
* @param $object
*
* @return $this|void
*/
public function loadFromArray ($object)
{
parent::loadFromArray($object);

return $this;
}

}
18 changes: 0 additions & 18 deletions src/MessageBird/Objects/Chat/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ class Message extends Base
*/
public $contactId;

/**
* The endpoint of the action (platforms, messages, channels, contacts)
*
* @var string
*/
public $endpoint;

/**
* A unique random ID which is created on the MessageBird platform and is returned upon creation of the object.
*
Expand Down Expand Up @@ -82,17 +75,6 @@ class Message extends Base
*/
protected $_links = array();

/**
* @param $object
*
* @return $this|void
*/
public function loadFromArray ($object)
{
parent::loadFromArray($object);

return $this;
}

public function getId()
{
Expand Down
12 changes: 0 additions & 12 deletions src/MessageBird/Objects/Chat/Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,4 @@ class Platform extends Base
*/
protected $_links;

/**
* @param $object
*
* @return $this|void
*/
public function loadFromArray($object)
{
parent::loadFromArray($object);

return $this;
}

}
8 changes: 4 additions & 4 deletions tests/integration/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public function testClientConstructor()
$this->assertInstanceOf('MessageBird\Resources\Messages', $MessageBird->messages);
$this->assertInstanceOf('MessageBird\Resources\VoiceMessage', $MessageBird->voicemessages);
$this->assertInstanceOf('MessageBird\Resources\Verify', $MessageBird->verify);
$this->assertInstanceOf('MessageBird\Resources\Chat\Message', $MessageBird->chatmessages);
$this->assertInstanceOf('MessageBird\Resources\Chat\Platform', $MessageBird->chatplatforms);
$this->assertInstanceOf('MessageBird\Resources\Chat\Channel', $MessageBird->chatchannels);
$this->assertInstanceOf('MessageBird\Resources\Chat\Contact', $MessageBird->chatcontacts);
$this->assertInstanceOf('MessageBird\Resources\Chat\Message', $MessageBird->chatMessages);
$this->assertInstanceOf('MessageBird\Resources\Chat\Platform', $MessageBird->chatPlatforms);
$this->assertInstanceOf('MessageBird\Resources\Chat\Channel', $MessageBird->chatChannels);
$this->assertInstanceOf('MessageBird\Resources\Chat\Contact', $MessageBird->chatContacts);

}

Expand Down
Loading