diff --git a/src/Utopia/Messaging/Socketlabs.php b/src/Utopia/Messaging/Socketlabs.php new file mode 100644 index 00000000..9082bfe2 --- /dev/null +++ b/src/Utopia/Messaging/Socketlabs.php @@ -0,0 +1,72 @@ +client = $client; + } + + public function send(array $message): bool + { + $email = new Email(); + $email + ->setFrom($message['from']) + ->setTo($message['to']) + ->setSubject($message['subject']) + ->setBody($message['body']); + + $response = $this->client->send($email); + + return $response->isSuccess(); + } + + public function trackOpen(string $messageId): bool + { + $response = $this->client->trackOpen($messageId); + + return $response->isSuccess(); + } + + public function trackClick(string $messageId, string $link): bool + { + $response = $this->client->trackClick($messageId, $link); + + return $response->isSuccess(); + } + + public function getTemplate(string $templateId): array + { + $response = $this->client->getTemplate($templateId); + + return $response->getData(); + } + + public function createTemplate(array $template): string + { + $response = $this->client->createTemplate($template); + + return $response->getData()['id']; + } + + public function updateTemplate(string $templateId, array $template): bool + { + $response = $this->client->updateTemplate($templateId, $template); + + return $response->isSuccess(); + } + + public function deleteTemplate(string $templateId): bool + { + $response = $this->client->deleteTemplate($templateId); + + return $response->isSuccess(); + } +}