1
0
Fork 0
mirror of synced 2024-10-02 10:16:27 +13:00

Merge branch 'providers-from-attribute' of https://github.com/appwrite/appwrite into review-changes-1.5.x

This commit is contained in:
prateek banga 2023-10-25 23:55:45 +05:30
commit f6f4397aab
7 changed files with 133 additions and 57 deletions

View file

@ -42,14 +42,14 @@ App::post('/v1/messaging/providers/mailgun')
->label('sdk.response.model', Response::MODEL_PROVIDER)
->param('providerId', '', new CustomId(), 'Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Provider name.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->param('isEuRegion', false, new Boolean(), 'Set as EU region.', true)
->param('from', '', new Email(), 'Sender Email Address.')
->param('from', '', new Email(), 'Sender email address.')
->param('apiKey', '', new Text(0), 'Mailgun API Key.')
->param('domain', '', new Text(0), 'Mailgun Domain.')
->param('isEuRegion', false, new Boolean(), 'Set as EU region.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, bool $enabled, bool $isEuRegion, string $from, string $apiKey, string $domain, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, string $from, string $apiKey, string $domain, bool $isEuRegion, bool $enabled, Database $dbForProject, Response $response) {
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
$provider = new Document([
@ -105,11 +105,12 @@ App::post('/v1/messaging/providers/sendgrid')
->label('sdk.response.model', Response::MODEL_PROVIDER)
->param('providerId', '', new CustomId(), 'Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Provider name.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->param('from', '', new Text(256), 'Sender email address.')
->param('apiKey', '', new Text(0), 'Sendgrid API key.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, bool $enabled, string $apiKey, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, string $from, string $apiKey, bool $enabled, Database $dbForProject, Response $response) {
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
$provider = new Document([
'$id' => $providerId,
@ -117,11 +118,13 @@ App::post('/v1/messaging/providers/sendgrid')
'provider' => 'sendgrid',
'type' => 'email',
'enabled' => $enabled,
'options' => [],
'search' => $providerId . ' ' . $name . ' ' . 'sendgrid' . ' ' . 'email',
'credentials' => [
'apiKey' => $apiKey,
],
'options' => [
'from' => $from,
]
]);
// Check if a default provider exists, if not, set this one as default
@ -160,13 +163,13 @@ App::post('/v1/messaging/providers/msg91')
->label('sdk.response.model', Response::MODEL_PROVIDER)
->param('providerId', '', new CustomId(), 'Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Provider name.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->param('from', '', new Text(256), 'Sender Number.')
->param('from', '', new Text(256), 'Sender number.')
->param('senderId', '', new Text(0), 'Msg91 Sender ID.')
->param('authKey', '', new Text(0), 'Msg91 Auth Key.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, bool $enabled, string $from, string $senderId, string $authKey, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, string $from, string $senderId, string $authKey, bool $enabled, Database $dbForProject, Response $response) {
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
$provider = new Document([
'$id' => $providerId,
@ -220,12 +223,13 @@ App::post('/v1/messaging/providers/telesign')
->label('sdk.response.model', Response::MODEL_PROVIDER)
->param('providerId', '', new CustomId(), 'Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Provider name.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->param('from', '', new Text(256), 'Sender number.')
->param('username', '', new Text(0), 'Telesign username.')
->param('password', '', new Text(0), 'Telesign password.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, bool $enabled, string $username, string $password, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, string $from, string $username, string $password, bool $enabled, Database $dbForProject, Response $response) {
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
$provider = new Document([
'$id' => $providerId,
@ -238,6 +242,9 @@ App::post('/v1/messaging/providers/telesign')
'username' => $username,
'password' => $password,
],
'options' => [
'from' => $from,
]
]);
// Check if a default provider exists, if not, set this one as default
@ -276,12 +283,13 @@ App::post('/v1/messaging/providers/textmagic')
->label('sdk.response.model', Response::MODEL_PROVIDER)
->param('providerId', '', new CustomId(), 'Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Provider name.')
->param('from', '', new Text(256), 'Sender number.')
->param('username', '', new Text(0), 'Textmagic username.')
->param('apiKey', '', new Text(0), 'Textmagic apiKey.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->param('username', '', new Text(0), 'TextMagic username.')
->param('apiKey', '', new Text(0), 'TextMagic apiKey.')
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, bool $enabled, string $username, string $apiKey, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, string $from, string $username, string $apiKey, bool $enabled, Database $dbForProject, Response $response) {
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
$provider = new Document([
'$id' => $providerId,
@ -294,6 +302,9 @@ App::post('/v1/messaging/providers/textmagic')
'username' => $username,
'apiKey' => $apiKey,
],
'options' => [
'from' => $from,
]
]);
// Check if a default provider exists, if not, set this one as default
@ -332,12 +343,13 @@ App::post('/v1/messaging/providers/twilio')
->label('sdk.response.model', Response::MODEL_PROVIDER)
->param('providerId', '', new CustomId(), 'Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Provider name.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->param('from', '', new Text(256), 'Sender number.')
->param('accountSid', '', new Text(0), 'Twilio account secret ID.')
->param('authToken', '', new Text(0), 'Twilio authentication token.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, bool $enabled, string $accountSid, string $authToken, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, string $from, string $accountSid, string $authToken, bool $enabled, Database $dbForProject, Response $response) {
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
$provider = new Document([
'$id' => $providerId,
@ -350,6 +362,9 @@ App::post('/v1/messaging/providers/twilio')
'accountSid' => $accountSid,
'authToken' => $authToken,
],
'options' => [
'from' => $from,
]
]);
// Check if a default provider exists, if not, set this one as default
@ -388,12 +403,13 @@ App::post('/v1/messaging/providers/vonage')
->label('sdk.response.model', Response::MODEL_PROVIDER)
->param('providerId', '', new CustomId(), 'Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Provider name.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->param('from', '', new Text(256), 'Sender number.')
->param('apiKey', '', new Text(0), 'Vonage API key.')
->param('apiSecret', '', new Text(0), 'Vonage API secret.')
->param('enabled', true, new Boolean(), 'Set as enabled.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, bool $enabled, string $apiKey, string $apiSecret, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, string $from, string $apiKey, string $apiSecret, bool $enabled, Database $dbForProject, Response $response) {
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
$provider = new Document([
'$id' => $providerId,
@ -406,6 +422,9 @@ App::post('/v1/messaging/providers/vonage')
'apiKey' => $apiKey,
'apiSecret' => $apiSecret,
],
'options' => [
'from' => $from,
]
]);
// Check if a default provider exists, if not, set this one as default
@ -560,7 +579,7 @@ App::get('/v1/messaging/providers')
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('dbForProject')
->inject('response')
->action(function (array $queries, Database $dbForProject, Response $response) {
->action(function (array $queries, string $search, Database $dbForProject, Response $response) {
$queries = Query::parseQueries($queries);
if (!empty($search)) {
@ -629,7 +648,7 @@ App::patch('/v1/messaging/providers/mailgun/:providerId')
->param('name', '', new Text(128), 'Provider name.', true)
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
->param('isEuRegion', null, new Boolean(), 'Set as eu region.', true)
->param('from', '', new Text(256), 'Sender Email Address.', true)
->param('from', '', new Text(256), 'Sender email address.', true)
->param('apiKey', '', new Text(0), 'Mailgun API Key.', true)
->param('domain', '', new Text(0), 'Mailgun Domain.', true)
->inject('dbForProject')
@ -700,9 +719,10 @@ App::patch('/v1/messaging/providers/sendgrid/:providerId')
->param('name', '', new Text(128), 'Provider name.', true)
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
->param('apiKey', '', new Text(0), 'Sendgrid API key.', true)
->param('from', '', new Text(256), 'Sender email address.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, ?bool $enabled, string $apiKey, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, ?bool $enabled, string $apiKey, string $from, Database $dbForProject, Response $response) {
$provider = $dbForProject->getDocument('providers', $providerId);
if ($provider->isEmpty()) {
@ -719,6 +739,12 @@ App::patch('/v1/messaging/providers/sendgrid/:providerId')
$provider->setAttribute('search', $provider->getId() . ' ' . $name . ' ' . 'sendgrid' . ' ' . 'email');
}
if (!empty($from)) {
$provider->setAttribute('options', [
'from' => $from,
]);
}
if ($enabled === true || $enabled === false) {
$provider->setAttribute('enabled', $enabled);
}
@ -753,9 +779,10 @@ App::patch('/v1/messaging/providers/msg91/:providerId')
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
->param('senderId', '', new Text(0), 'Msg91 Sender ID.', true)
->param('authKey', '', new Text(0), 'Msg91 Auth Key.', true)
->param('from', '', new Text(256), 'Sender number.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, ?bool $enabled, string $senderId, string $authKey, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, ?bool $enabled, string $senderId, string $authKey, string $from, Database $dbForProject, Response $response) {
$provider = $dbForProject->getDocument('providers', $providerId);
if ($provider->isEmpty()) {
@ -772,6 +799,12 @@ App::patch('/v1/messaging/providers/msg91/:providerId')
$provider->setAttribute('search', $provider->getId() . ' ' . $name . ' ' . 'msg91' . ' ' . 'sms');
}
if (!empty($from)) {
$provider->setAttribute('options', [
'from' => $from,
]);
}
if ($enabled === true || $enabled === false) {
$provider->setAttribute('enabled', $enabled);
}
@ -812,9 +845,10 @@ App::patch('/v1/messaging/providers/telesign/:providerId')
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
->param('username', '', new Text(0), 'Telesign username.', true)
->param('password', '', new Text(0), 'Telesign password.', true)
->param('from', '', new Text(256), 'Sender number.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, ?bool $enabled, string $username, string $password, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, ?bool $enabled, string $username, string $password, string $from, Database $dbForProject, Response $response) {
$provider = $dbForProject->getDocument('providers', $providerId);
if ($provider->isEmpty()) {
@ -831,6 +865,12 @@ App::patch('/v1/messaging/providers/telesign/:providerId')
$provider->setAttribute('search', $provider->getId() . ' ' . $name . ' ' . 'telesign' . ' ' . 'sms');
}
if (!empty($from)) {
$provider->setAttribute('options', [
'from' => $from,
]);
}
if ($enabled === true || $enabled === false) {
$provider->setAttribute('enabled', $enabled);
}
@ -869,11 +909,12 @@ App::patch('/v1/messaging/providers/textmagic/:providerId')
->param('providerId', '', new UID(), 'Provider ID.')
->param('name', '', new Text(128), 'Provider name.', true)
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
->param('username', '', new Text(0), 'TextMagic username.', true)
->param('apiKey', '', new Text(0), 'TextMagic apiKey.', true)
->param('username', '', new Text(0), 'Textmagic username.', true)
->param('apiKey', '', new Text(0), 'Textmagic apiKey.', true)
->param('from', '', new Text(256), 'Sender number.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, ?bool $enabled, string $username, string $apiKey, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, ?bool $enabled, string $username, string $apiKey, string $from, Database $dbForProject, Response $response) {
$provider = $dbForProject->getDocument('providers', $providerId);
if ($provider->isEmpty()) {
@ -890,6 +931,12 @@ App::patch('/v1/messaging/providers/textmagic/:providerId')
$provider->setAttribute('search', $provider->getId() . ' ' . $name . ' ' . 'textmagic' . ' ' . 'sms');
}
if (!empty($from)) {
$provider->setAttribute('options', [
'from' => $from,
]);
}
if ($enabled === true || $enabled === false) {
$provider->setAttribute('enabled', $enabled);
}
@ -930,9 +977,10 @@ App::patch('/v1/messaging/providers/twilio/:providerId')
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
->param('accountSid', null, new Text(0), 'Twilio account secret ID.', true)
->param('authToken', null, new Text(0), 'Twilio authentication token.', true)
->param('from', '', new Text(256), 'Sender number.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, ?bool $enabled, string $accountSid, string $authToken, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, ?bool $enabled, string $accountSid, string $authToken, string $from, Database $dbForProject, Response $response) {
$provider = $dbForProject->getDocument('providers', $providerId);
if ($provider->isEmpty()) {
@ -949,6 +997,12 @@ App::patch('/v1/messaging/providers/twilio/:providerId')
$provider->setAttribute('search', $provider->getId() . ' ' . $name . ' ' . 'twilio' . ' ' . 'sms');
}
if (!empty($from)) {
$provider->setAttribute('options', [
'from' => $from,
]);
}
if ($enabled === true || $enabled === false) {
$provider->setAttribute('enabled', $enabled);
}
@ -989,9 +1043,10 @@ App::patch('/v1/messaging/providers/vonage/:providerId')
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
->param('apiKey', '', new Text(0), 'Vonage API key.', true)
->param('apiSecret', '', new Text(0), 'Vonage API secret.', true)
->param('from', '', new Text(256), 'Sender number.', true)
->inject('dbForProject')
->inject('response')
->action(function (string $providerId, string $name, ?bool $enabled, string $apiKey, string $apiSecret, Database $dbForProject, Response $response) {
->action(function (string $providerId, string $name, ?bool $enabled, string $apiKey, string $apiSecret, string $from, Database $dbForProject, Response $response) {
$provider = $dbForProject->getDocument('providers', $providerId);
if ($provider->isEmpty()) {
@ -1008,6 +1063,12 @@ App::patch('/v1/messaging/providers/vonage/:providerId')
$provider->setAttribute('search', $provider->getId() . ' ' . $name . ' ' . 'vonage' . ' ' . 'sms');
}
if (!empty($from)) {
$provider->setAttribute('options', [
'from' => $from,
]);
}
if ($enabled === true || $enabled === false) {
$provider->setAttribute('enabled', $enabled);
}

14
composer.lock generated
View file

@ -1906,16 +1906,16 @@
},
{
"name": "utopia-php/database",
"version": "0.44.2",
"version": "0.44.3",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "591cadbc2c622a3304aae9a16ebfdbe75ef33a06"
"reference": "b2d403c25a77506e03db5736335b0cae52bcc18a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/591cadbc2c622a3304aae9a16ebfdbe75ef33a06",
"reference": "591cadbc2c622a3304aae9a16ebfdbe75ef33a06",
"url": "https://api.github.com/repos/utopia-php/database/zipball/b2d403c25a77506e03db5736335b0cae52bcc18a",
"reference": "b2d403c25a77506e03db5736335b0cae52bcc18a",
"shasum": ""
},
"require": {
@ -1928,7 +1928,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.14",
"laravel/pint": "1.4.*",
"laravel/pint": "1.13.*",
"pcov/clobber": "^2.0",
"phpstan/phpstan": "1.10.*",
"phpunit/phpunit": "^9.4",
@ -1956,9 +1956,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.44.2"
"source": "https://github.com/utopia-php/database/tree/0.44.3"
},
"time": "2023-10-19T07:39:00+00:00"
"time": "2023-10-24T10:13:48+00:00"
},
{
"name": "utopia-php/domains",

View file

@ -1784,8 +1784,8 @@ trait Base
}
}';
case self::$CREATE_MAILGUN_PROVIDER:
return 'mutation createMailgunProvider($providerId: String!, $name: String!, $domain: String!, $apiKey: String!, $from: String!) {
messagingCreateMailgunProvider(providerId: $providerId, name: $name, domain: $domain, apiKey: $apiKey, from: $from) {
return 'mutation createMailgunProvider($providerId: String!, $name: String!, $domain: String!, $apiKey: String!, $from: String!, $isEuRegion: Boolean!) {
messagingCreateMailgunProvider(providerId: $providerId, name: $name, domain: $domain, apiKey: $apiKey, from: $from, isEuRegion: $isEuRegion) {
_id
name
provider
@ -1795,8 +1795,8 @@ trait Base
}
}';
case self::$CREATE_SENDGRID_PROVIDER:
return 'mutation createSendgridProvider($providerId: String!, $name: String!, $apiKey: String!) {
messagingCreateSendgridProvider(providerId: $providerId, name: $name, apiKey: $apiKey) {
return 'mutation createSendgridProvider($providerId: String!, $name: String!, $from: String!, $apiKey: String!) {
messagingCreateSendgridProvider(providerId: $providerId, name: $name, from: $from, apiKey: $apiKey) {
_id
name
provider
@ -1806,8 +1806,8 @@ trait Base
}
}';
case self::$CREATE_TWILIO_PROVIDER:
return 'mutation createTwilioProvider($providerId: String!, $name: String!, $accountSid: String!, $authToken: String!) {
messagingCreateTwilioProvider(providerId: $providerId, name: $name, accountSid: $accountSid, authToken: $authToken) {
return 'mutation createTwilioProvider($providerId: String!, $name: String!, $from: String!, $accountSid: String!, $authToken: String!) {
messagingCreateTwilioProvider(providerId: $providerId, name: $name, from: $from, accountSid: $accountSid, authToken: $authToken) {
_id
name
provider
@ -1817,8 +1817,8 @@ trait Base
}
}';
case self::$CREATE_TELESIGN_PROVIDER:
return 'mutation createTelesignProvider($providerId: String!, $name: String!, $username: String!, $password: String!) {
messagingCreateTelesignProvider(providerId: $providerId, name: $name, username: $username, password: $password) {
return 'mutation createTelesignProvider($providerId: String!, $name: String!, $from: String!, $username: String!, $password: String!) {
messagingCreateTelesignProvider(providerId: $providerId, name: $name, from: $from, username: $username, password: $password) {
_id
name
provider
@ -1828,8 +1828,8 @@ trait Base
}
}';
case self::$CREATE_TEXTMAGIC_PROVIDER:
return 'mutation createTextmagicProvider($providerId: String!, $name: String!, $username: String!, $apiKey: String!) {
messagingCreateTextmagicProvider(providerId: $providerId, name: $name, username: $username, apiKey: $apiKey) {
return 'mutation createTextMagicProvider($providerId: String!, $name: String!, $from: String!, $username: String!, $apiKey: String!) {
messagingCreateTextMagicProvider(providerId: $providerId, name: $name, from: $from, username: $username, apiKey: $apiKey) {
_id
name
provider
@ -1839,8 +1839,8 @@ trait Base
}
}';
case self::$CREATE_MSG91_PROVIDER:
return 'mutation createMsg91Provider($providerId: String!, $name: String!, $from: String!, $senderId: String!, $authKey: String!, $default: Boolean, $enabled: Boolean) {
messagingCreateMsg91Provider(providerId: $providerId, name: $name, from: $from, senderId: $senderId, authKey: $authKey, default: $default, enabled: $enabled) {
return 'mutation createMsg91Provider($providerId: String!, $name: String!, $from: String!, $senderId: String!, $authKey: String!, $enabled: Boolean) {
messagingCreateMsg91Provider(providerId: $providerId, name: $name, from: $from, senderId: $senderId, authKey: $authKey, enabled: $enabled) {
_id
name
provider
@ -1850,8 +1850,8 @@ trait Base
}
}';
case self::$CREATE_VONAGE_PROVIDER:
return 'mutation createVonageProvider($providerId: String!, $name: String!, $apiKey: String!, $apiSecret: String!) {
messagingCreateVonageProvider(providerId: $providerId, name: $name, apiKey: $apiKey, apiSecret: $apiSecret) {
return 'mutation createVonageProvider($providerId: String!, $name: String!, $from: String!, $apiKey: String!, $apiSecret: String!) {
messagingCreateVonageProvider(providerId: $providerId, name: $name, from: $from, apiKey: $apiKey, apiSecret: $apiSecret) {
_id
name
provider
@ -1952,8 +1952,8 @@ trait Base
}
}';
case self::$UPDATE_TEXTMAGIC_PROVIDER:
return 'mutation updateTextmagicProvider($providerId: String!, $name: String!, $username: String!, $apiKey: String!) {
messagingUpdateTextmagicProvider(providerId: $providerId, name: $name, username: $username, apiKey: $apiKey) {
return 'mutation updateTextMagicProvider($providerId: String!, $name: String!, $username: String!, $apiKey: String!) {
messagingUpdateTextMagicProvider(providerId: $providerId, name: $name, username: $username, apiKey: $apiKey) {
_id
name
provider

View file

@ -22,31 +22,36 @@ class MessagingTest extends Scope
'providerId' => ID::unique(),
'name' => 'Sengrid1',
'apiKey' => 'my-apikey',
'from' => 'sender-email@my-domain.com',
],
'Mailgun' => [
'providerId' => ID::unique(),
'name' => 'Mailgun1',
'apiKey' => 'my-apikey',
'domain' => 'my-domain',
'from' => 'sender-email@my-domain',
'from' => 'sender-email@my-domain.com',
'isEuRegion' => false,
],
'Twilio' => [
'providerId' => ID::unique(),
'name' => 'Twilio1',
'accountSid' => 'my-accountSid',
'authToken' => 'my-authToken',
'from' => '+123456789',
],
'Telesign' => [
'providerId' => ID::unique(),
'name' => 'Telesign1',
'username' => 'my-username',
'password' => 'my-password',
'from' => '+123456789',
],
'Textmagic' => [
'TextMagic' => [
'providerId' => ID::unique(),
'name' => 'Textmagic1',
'username' => 'my-username',
'apiKey' => 'my-apikey',
'from' => '+123456789',
],
'Msg91' => [
'providerId' => ID::unique(),
@ -60,6 +65,7 @@ class MessagingTest extends Scope
'name' => 'Vonage1',
'apiKey' => 'my-apikey',
'apiSecret' => 'my-apisecret',
'from' => '+123456789',
],
'Fcm' => [
'providerId' => ID::unique(),
@ -90,6 +96,7 @@ class MessagingTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]), $graphQLPayload);
var_dump($response['body']);
\array_push($providers, $response['body']['data']['messagingCreate' . $key . 'Provider']);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals($providersParams[$key]['name'], $response['body']['data']['messagingCreate' . $key . 'Provider']['name']);
@ -127,7 +134,7 @@ class MessagingTest extends Scope
'username' => 'my-username',
'password' => 'my-password',
],
'Textmagic' => [
'TextMagic' => [
'providerId' => $providers[4]['_id'],
'name' => 'Textmagic2',
'username' => 'my-username',
@ -266,6 +273,7 @@ class MessagingTest extends Scope
'providerId' => ID::unique(),
'name' => 'Sengrid1',
'apiKey' => 'my-apikey',
'from' => 'sender-email@my-domain.com',
]
];
$query = $this->getQuery(self::$CREATE_SENDGRID_PROVIDER);

View file

@ -60,7 +60,7 @@ class UsersTest extends Scope
'name' => 'Mailgun1',
'apiKey' => 'api-key',
'domain' => 'domain',
'from' => 'from@domain',
'from' => 'from@domain.com',
'isEuRegion' => false,
],
];

View file

@ -15,31 +15,36 @@ trait MessagingBase
'providerId' => ID::unique(),
'name' => 'Sengrid1',
'apiKey' => 'my-apikey',
'from' => 'sender-email@my-domain.com',
],
'mailgun' => [
'providerId' => ID::unique(),
'name' => 'Mailgun1',
'apiKey' => 'my-apikey',
'domain' => 'my-domain',
'from' => 'sender-email@my-domain',
'from' => 'sender-email@my-domain.com',
'isEuRegion' => false,
],
'twilio' => [
'providerId' => ID::unique(),
'name' => 'Twilio1',
'accountSid' => 'my-accountSid',
'authToken' => 'my-authToken',
'from' => '+123456789',
],
'telesign' => [
'providerId' => ID::unique(),
'name' => 'Telesign1',
'username' => 'my-username',
'password' => 'my-password',
'from' => '+123456789',
],
'textmagic' => [
'providerId' => ID::unique(),
'name' => 'Textmagic1',
'username' => 'my-username',
'apiKey' => 'my-apikey',
'from' => '+123456789',
],
'msg91' => [
'providerId' => ID::unique(),
@ -53,6 +58,7 @@ trait MessagingBase
'name' => 'Vonage1',
'apiKey' => 'my-apikey',
'apiSecret' => 'my-apisecret',
'from' => '+123456789',
],
'fcm' => [
'providerId' => ID::unique(),
@ -220,6 +226,7 @@ trait MessagingBase
'providerId' => 'unique()',
'name' => 'Sendgrid1',
'apiKey' => 'my-apikey',
'from' => 'sender-email@my-domain.com',
]);
$this->assertEquals(201, $provider['headers']['status-code']);
$response = $this->client->call(Client::METHOD_POST, '/messaging/topics', [