mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Merge pull request #8742 from appwrite/messaging-adapter-default-values
Messaging adapter default values
This commit is contained in:
commit
5ec88389d6
1 changed files with 40 additions and 21 deletions
|
|
@ -489,11 +489,29 @@ class Messaging extends Action
|
|||
|
||||
return match ($provider->getAttribute('provider')) {
|
||||
'mock' => new Mock('username', 'password'),
|
||||
'twilio' => new Twilio($credentials['accountSid'], $credentials['authToken'], null, isset($credentials['messagingServiceSid']) ? $credentials['messagingServiceSid'] : null),
|
||||
'textmagic' => new TextMagic($credentials['username'], $credentials['apiKey']),
|
||||
'telesign' => new Telesign($credentials['customerId'], $credentials['apiKey']),
|
||||
'msg91' => new Msg91($credentials['senderId'], $credentials['authKey'], $credentials['templateId']),
|
||||
'vonage' => new Vonage($credentials['apiKey'], $credentials['apiSecret']),
|
||||
'twilio' => new Twilio(
|
||||
$credentials['accountSid'] ?? '',
|
||||
$credentials['authToken'] ?? '',
|
||||
null,
|
||||
$credentials['messagingServiceSid'] ?? null
|
||||
),
|
||||
'textmagic' => new TextMagic(
|
||||
$credentials['username'] ?? '',
|
||||
$credentials['apiKey'] ?? ''
|
||||
),
|
||||
'telesign' => new Telesign(
|
||||
$credentials['customerId'] ?? '',
|
||||
$credentials['apiKey'] ?? ''
|
||||
),
|
||||
'msg91' => new Msg91(
|
||||
$credentials['senderId'] ?? '',
|
||||
$credentials['authKey'] ?? '',
|
||||
$credentials['templateId'] ?? ''
|
||||
),
|
||||
'vonage' => new Vonage(
|
||||
$credentials['apiKey'] ?? '',
|
||||
$credentials['apiSecret'] ?? ''
|
||||
),
|
||||
default => null
|
||||
};
|
||||
}
|
||||
|
|
@ -506,11 +524,11 @@ class Messaging extends Action
|
|||
return match ($provider->getAttribute('provider')) {
|
||||
'mock' => new Mock('username', 'password'),
|
||||
'apns' => new APNS(
|
||||
$credentials['authKey'],
|
||||
$credentials['authKeyId'],
|
||||
$credentials['teamId'],
|
||||
$credentials['bundleId'],
|
||||
$options['sandbox']
|
||||
$credentials['authKey'] ?? '',
|
||||
$credentials['authKeyId'] ?? '',
|
||||
$credentials['teamId'] ?? '',
|
||||
$credentials['bundleId'] ?? '',
|
||||
$options['sandbox'] ?? false
|
||||
),
|
||||
'fcm' => new FCM(\json_encode($credentials['serviceAccountJSON'])),
|
||||
default => null
|
||||
|
|
@ -521,24 +539,25 @@ class Messaging extends Action
|
|||
{
|
||||
$credentials = $provider->getAttribute('credentials', []);
|
||||
$options = $provider->getAttribute('options', []);
|
||||
$apiKey = $credentials['apiKey'] ?? '';
|
||||
|
||||
return match ($provider->getAttribute('provider')) {
|
||||
'mock' => new Mock('username', 'password'),
|
||||
'smtp' => new SMTP(
|
||||
$credentials['host'],
|
||||
$credentials['port'],
|
||||
$credentials['username'],
|
||||
$credentials['password'],
|
||||
$options['encryption'],
|
||||
$options['autoTLS'],
|
||||
$options['mailer'],
|
||||
$credentials['host'] ?? '',
|
||||
$credentials['port'] ?? 25,
|
||||
$credentials['username'] ?? '',
|
||||
$credentials['password'] ?? '',
|
||||
$options['encryption'] ?? '',
|
||||
$options['autoTLS'] ?? false,
|
||||
$options['mailer'] ?? '',
|
||||
),
|
||||
'mailgun' => new Mailgun(
|
||||
$credentials['apiKey'],
|
||||
$credentials['domain'],
|
||||
$credentials['isEuRegion']
|
||||
$apiKey,
|
||||
$credentials['domain'] ?? '',
|
||||
$credentials['isEuRegion'] ?? false
|
||||
),
|
||||
'sendgrid' => new Sendgrid($credentials['apiKey']),
|
||||
'sendgrid' => new Sendgrid($apiKey),
|
||||
default => null
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue