Skip to content

Commit 1b7fcff

Browse files
committed
conversation: get data and update done|open
1 parent 067ed4f commit 1b7fcff

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/Sendbee/Api/Client.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,51 @@ public function getConversations($params = [])
225225
return $this->makeRequest('conversations', self::GET, $query, [], Conversation::class);
226226
}
227227

228+
/**
229+
* Get conversations
230+
*
231+
* @param array $params
232+
* @return Sendbee\Api\Transport\Response|string
233+
* @throws GuzzleException
234+
* @throws DataException
235+
*/
236+
public function getConversation($params = [])
237+
{
238+
$requiredKeys = ['conversation_id'];
239+
$this->requireKeys($requiredKeys, $params);
240+
241+
$validParams = [
242+
'conversation_id', // Conversation UUID
243+
];
244+
245+
$query = $this->filterKeys($validParams, $params);
246+
247+
return $this->makeRequest('conversation', self::GET, $query, [], Conversation::class);
248+
}
249+
250+
/**
251+
* Get conversations
252+
*
253+
* @param array $params
254+
* @return Sendbee\Api\Transport\Response|string
255+
* @throws GuzzleException
256+
* @throws DataException
257+
*/
258+
public function updateConversation($params = [])
259+
{
260+
$requiredKeys = ['conversation_id'];
261+
$this->requireKeys($requiredKeys, $params);
262+
263+
$validParams = [
264+
'conversation_id', // Conversation UUID
265+
'folder', // Folder to assign conversation to - open|done
266+
];
267+
268+
$data = $this->filterKeys($validParams, $params);
269+
270+
return $this->makeRequest('/conversation', self::POST, [], $data, Conversation::class);
271+
}
272+
228273
/**
229274
* Get messages in a conversation
230275
*

0 commit comments

Comments
 (0)