lint fix
This commit is contained in:
parent
4406c7bd55
commit
9f19bec7a7
|
@ -11,8 +11,9 @@ use Utopia\Validator\ArrayList;
|
|||
use Utopia\Validator\Text;
|
||||
|
||||
/**
|
||||
* Email Providers
|
||||
* Email Providers
|
||||
*/
|
||||
|
||||
App::post('/v1/messaging/providers/mailgun')
|
||||
->desc('Create Mailgun Provider')
|
||||
->groups(['api', 'messaging'])
|
||||
|
@ -69,7 +70,7 @@ App::post('/v1/messaging/messages/email')
|
|||
$provider = $dbForProject->getDocument('providers', $providerId);
|
||||
|
||||
if ($provider->isEmpty()) {
|
||||
throw new Exception(Exception::PROVIDER_NOT_FOUND);
|
||||
throw new Exception(Exception::PROVIDER_NOT_FOUND);
|
||||
}
|
||||
|
||||
$message = $dbForProject->createDocument('messages', new Document([
|
||||
|
|
|
@ -2,23 +2,19 @@
|
|||
|
||||
use Appwrite\Resque\Worker;
|
||||
use Utopia\CLI\Console;
|
||||
|
||||
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
|
||||
use Utopia\Messaging\Adapters\SMS\Msg91;
|
||||
use Utopia\Messaging\Adapters\SMS\Telesign;
|
||||
use Utopia\Messaging\Adapters\SMS\TextMagic;
|
||||
use Utopia\Messaging\Adapters\SMS\Twilio;
|
||||
use Utopia\Messaging\Adapters\SMS\Vonage;
|
||||
|
||||
use Utopia\Messaging\Adapters\Push as PushAdapter;
|
||||
use Utopia\Messaging\Adapters\Push\APNS;
|
||||
use Utopia\Messaging\Adapters\Push\FCM;
|
||||
|
||||
use Utopia\Messaging\Adapters\Email as EmailAdapter;
|
||||
use Utopia\Messaging\Adapters\Email\Mailgun;
|
||||
use Utopia\Messaging\Adapters\Email\SendGrid;
|
||||
|
||||
|
||||
require_once __DIR__ . '/../init.php';
|
||||
|
||||
Console::title('Messaging V1 Worker');
|
||||
|
@ -29,8 +25,8 @@ class MessagingV1 extends Worker
|
|||
protected ?SMSAdapter $sms = null;
|
||||
protected ?PushAdapter $push = null;
|
||||
protected ?EmailAdapter $email = null;
|
||||
|
||||
|
||||
|
||||
|
||||
protected ?string $from = null;
|
||||
|
||||
public function getName(): string
|
||||
|
@ -48,7 +44,7 @@ class MessagingV1 extends Worker
|
|||
'msg91' => new Msg91($credentials['senderId'], $credentials['authKey']),
|
||||
'vonage' => new Vonage($credentials['apiKey'], $credentials['apiSecret']),
|
||||
default => null
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function push($record): ?PushAdapter
|
||||
|
@ -56,15 +52,15 @@ class MessagingV1 extends Worker
|
|||
$credentials = $record->getAttribute('credentials');
|
||||
return match ($record->getAttribute('provider')) {
|
||||
'apns' => new APNS(
|
||||
$credentials['authKey'],
|
||||
$credentials['authKeyId'],
|
||||
$credentials['teamId'],
|
||||
$credentials['bundleId'],
|
||||
$credentials['authKey'],
|
||||
$credentials['authKeyId'],
|
||||
$credentials['teamId'],
|
||||
$credentials['bundleId'],
|
||||
$credentials['endpoint']
|
||||
),
|
||||
'fcm' => new FCM($credentials['serverKey']),
|
||||
default => null
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
public function email($record): ?EmailAdapter
|
||||
|
@ -74,7 +70,7 @@ class MessagingV1 extends Worker
|
|||
'mailgun' => new Mailgun($credentials['apiKey'], $credentials['domain']),
|
||||
'sendgrid' => new SendGrid($credentials['apiKey']),
|
||||
default => null
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
public function init(): void
|
||||
|
@ -83,25 +79,25 @@ class MessagingV1 extends Worker
|
|||
|
||||
public function run(): void
|
||||
{
|
||||
$providerId = $this->args['providerId'];
|
||||
$providerRecord =
|
||||
$providerId = $this->args['providerId'];
|
||||
$providerRecord =
|
||||
$this
|
||||
->getConsoleDB()
|
||||
->getDocument('providers', $providerId);
|
||||
|
||||
$provider = match ($providerRecord->getAttribute('type')) {//stubbbbbbed.
|
||||
'sms' => $this->sms($providerRecord),
|
||||
'push' => $this->push($providerRecord),
|
||||
'email' => $this->email($providerRecord),
|
||||
default => null
|
||||
};
|
||||
$provider = match ($providerRecord->getAttribute('type')) {//stubbbbbbed.
|
||||
'sms' => $this->sms($providerRecord),
|
||||
'push' => $this->push($providerRecord),
|
||||
'email' => $this->email($providerRecord),
|
||||
default => null
|
||||
};
|
||||
|
||||
// Query for the provider
|
||||
// switch on provider name
|
||||
// call function passing needed credentials returns required provider.
|
||||
|
||||
$messageId = $this->args['messageId'];
|
||||
$message =
|
||||
$messageId = $this->args['messageId'];
|
||||
$message =
|
||||
$this
|
||||
->getConsoleDB()
|
||||
->getDocument('messages', $messageId);
|
||||
|
|
Loading…
Reference in a new issue