Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yparitcher committed Nov 26, 2024
1 parent 0126a0e commit 031e582
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/RingCentral.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected function getMessages(string $extensionId, ?Carbon $fromDate = null, ?C
'perPage' => $perPage,
];
if ($fromDate) {
$dtat['dateFrom'] = $fromDate->toIso8601String();
$data['dateFrom'] = $fromDate->toIso8601String();
}
if ($toDate) {
$data['dateTo'] = $toDate->toIso8601String();
Expand All @@ -210,12 +210,7 @@ public function getMessageAttachmentById(string $extensionId, string $messageId,
return $this->get('/account/~/extension/'.$extensionId.'/message-store/'.$messageId.'/content/'.$attachementId);
}

public function getCallLog(string $id): Collection {
$r = $this->get("/account/~/call-log/{$id}");
return $r->collect();
}

public function getCallLogs(?Carbon $fromDate = null, ?Carbon $toDate = null, bool $withRecording = true, ?int $perPage = 100): Collection {
public function getCallLogs(?Carbon $fromDate = null, ?Carbon $toDate = null, bool $withRecording = true, ?int $perPage = 100, ?string $sessionId = null): Collection {
$data = [
'type' => 'Voice',
'perPage' => $perPage,
Expand All @@ -224,10 +219,13 @@ public function getCallLogs(?Carbon $fromDate = null, ?Carbon $toDate = null, bo
$data['dateFrom'] = $fromDate->toIso8601String();
}
if ($toDate) {
$dtat['dateTo'] = $toDate->toIso8601String();
$data['dateTo'] = $toDate->toIso8601String();
}
if ($withRecording) {
$dtat['recordingType'] = 'All';
$data['recordingType'] = 'All';
}
if ($sessionId) {
$data['sessionId'] = $sessionId;
}
$r = $this->get('/account/~/call-log', $data);
return $r->collect('records');
Expand All @@ -242,10 +240,10 @@ public function getCallLogsForExtensionId(string $extensionId, ?Carbon $fromDate
$data['dateFrom'] = $fromDate->toIso8601String();
}
if ($toDate) {
$dtat['dateTo'] = $toDate->toIso8601String();
$data['dateTo'] = $toDate->toIso8601String();
}
if ($withRecording) {
$dtat['recordingType'] = 'All';
$data['recordingType'] = 'All';
}
$r = $this->get('/account/~/extension/'.$extensionId.'/call-log', $data);
return $r->collect('records');
Expand Down

0 comments on commit 031e582

Please sign in to comment.