From a8467f12160acb4c23c9527e2f161ca114fe563e Mon Sep 17 00:00:00 2001 From: Alexandr Volga Date: Wed, 3 Jan 2024 12:30:10 +0200 Subject: [PATCH] add archive/unarchive a call --- src/AircallCalls.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/AircallCalls.php b/src/AircallCalls.php index 079ee41..0dc3da4 100644 --- a/src/AircallCalls.php +++ b/src/AircallCalls.php @@ -203,6 +203,37 @@ public function addInsightCards(int $id, array $options = []) return $this->client->post($path.'/insight_cards', $options); } + /** + * Archive a Call + * @see https://developer.aircall.io/api-references/#archive-a-call + * + * @throws GuzzleException + * + * @return mixed + */ + public function archive(int $id) + { + $path = $this->callPath($id); + + return $this->client->put($path.'/archive'); + } + + /** + * Unarchive a Call + * @see https://developer.aircall.io/api-references/#unarchive-a-call + * + * @throws GuzzleException + * + * @return mixed + */ + public function archive(int $id) + { + $path = $this->callPath($id); + + return $this->client->put($path.'/unarchive'); + } + + public function callPath(int $id): string { return self::BASE_ENDPOINT.'/'.$id;