Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Room Messages API #29

Merged
merged 3 commits into from
May 8, 2020
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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release History

## 1.3.3
* Add Room Messages API

## 1.3.2
* Add Specialties API
* Add Skills V2 API
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "upwork/php-upwork",
"description": "PHP bindings for Upwork API",
"version": "v1.3.2",
"version": "v1.3.3",
"type": "library",
"keywords": ["upwork", "php", "api"],
"homepage": "http://www.upwork.com",
"time": "2018-05-24",
"time": "2020-05-08",
"license": "Apache-2.0",
"authors": [
{
Expand Down
19 changes: 19 additions & 0 deletions src/Upwork/API/Routers/Messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ public function getRoomDetails($company, $roomId, $params = array())
return $response;
}

/**
* Get messages from a specific room
*
* @param string $company Company ID
* @param string $roomId Room ID
* @param array $params List of parameters
* @access public
* @return object
*/
public function getRoomMessages($company, $roomId, $params = array())
{
ApiDebug::p(__FUNCTION__);

$response = $this->_client->get('/messages/v3/' . $company . '/rooms/' . $roomId . '/stories', $params);
ApiDebug::p('received data', $response);

return $response;
}

/**
* Get a specific room by offer ID
*
Expand Down
11 changes: 11 additions & 0 deletions tests/Upwork/API/Routers/MessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ public function testGetRoomDetails()
$this->_checkResponse($response);
}

/**
* @test
*/
public function testGetRoomMessages()
{
$router = new \Upwork\API\Routers\Messages($this->_client);
$response = $router->getRoomMessages('company', 'room-id', array());

$this->_checkResponse($response);
}

/**
* @test
*/
Expand Down