File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,16 @@ public function hydrateEntity($data, $idOrConversation)
49
49
return $ idOrConversation ;
50
50
}
51
51
52
+ public function hydrateAll ($ conversations )
53
+ {
54
+ $ hydrated = [];
55
+ foreach ($ conversations as $ conversation ) {
56
+ $ hydrated [] = $ this ->hydrateEntity ($ conversation , $ conversation ['id ' ]);
57
+ }
58
+
59
+ return $ hydrated ;
60
+ }
61
+
52
62
/**
53
63
* @param null $conversation
54
64
* @return $this|Conversation
Original file line number Diff line number Diff line change 11
11
12
12
use Nexmo \Client \ClientAwareInterface ;
13
13
use Nexmo \Client \ClientAwareTrait ;
14
- use Nexmo \Conversations \Conversation ;
15
14
use Nexmo \Entity \EntityInterface ;
16
15
use Nexmo \Entity \JsonResponseTrait ;
17
16
use Nexmo \Entity \JsonSerializableTrait ;
@@ -71,6 +70,20 @@ public function get()
71
70
return $ this ;
72
71
}
73
72
73
+ public function getConversations () {
74
+ $ response = $ this ->getClient ()->get (
75
+ \Nexmo \Client::BASE_API . Collection::getCollectionPath ().'/ ' .$ this ->getId ().'/conversations '
76
+ );
77
+
78
+ if ($ response ->getStatusCode () != '200 ' ){
79
+ throw $ this ->getException ($ response );
80
+ }
81
+
82
+ $ data = json_decode ($ response ->getBody ()->getContents (), true );
83
+ $ conversationCollection = $ this ->getClient ()->conversation ();
84
+
85
+ return $ conversationCollection ->hydrateAll ($ data );
86
+ }
74
87
75
88
public function jsonSerialize ()
76
89
{
You can’t perform that action at this time.
0 commit comments