From f3f6c4f9a6d27a4e9b5a81c10e0337a3c9fa207f Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 3 Apr 2026 17:50:35 +0530 Subject: [PATCH 1/5] chore: update PHP SDK to 22.0.0 --- CHANGELOG.md | 9 + composer.json | 4 +- .../databases/create-datetime-attribute.md | 2 +- .../databases/update-datetime-attribute.md | 2 +- docs/examples/messaging/create-email.md | 2 +- docs/examples/messaging/create-push.md | 2 +- docs/examples/messaging/create-sms.md | 2 +- docs/examples/messaging/update-email.md | 2 +- docs/examples/messaging/update-push.md | 2 +- docs/examples/messaging/update-sms.md | 2 +- .../tablesdb/create-datetime-column.md | 2 +- .../tablesdb/update-datetime-column.md | 2 +- docs/examples/tokens/create-file-token.md | 2 +- docs/examples/tokens/update.md | 2 +- docs/health.md | 3 +- src/Appwrite/Client.php | 14 +- src/Appwrite/Enums/Adapter.php | 11 +- src/Appwrite/Enums/AttributeStatus.php | 14 +- src/Appwrite/Enums/AuthenticationFactor.php | 13 +- src/Appwrite/Enums/AuthenticatorType.php | 10 +- src/Appwrite/Enums/BackupServices.php | 15 +- src/Appwrite/Enums/Browser.php | 23 +- src/Appwrite/Enums/BrowserPermission.php | 29 +- src/Appwrite/Enums/BuildRuntime.php | 113 +- src/Appwrite/Enums/ColumnStatus.php | 14 +- src/Appwrite/Enums/Compression.php | 12 +- src/Appwrite/Enums/CreditCard.php | 26 +- src/Appwrite/Enums/DatabaseType.php | 13 +- src/Appwrite/Enums/DatabasesIndexType.php | 13 +- src/Appwrite/Enums/DeploymentDownloadType.php | 11 +- src/Appwrite/Enums/DeploymentStatus.php | 15 +- src/Appwrite/Enums/ExecutionMethod.php | 16 +- src/Appwrite/Enums/ExecutionStatus.php | 14 +- src/Appwrite/Enums/ExecutionTrigger.php | 12 +- src/Appwrite/Enums/Flag.php | 204 +- src/Appwrite/Enums/Framework.php | 24 +- src/Appwrite/Enums/HealthAntivirusStatus.php | 12 +- src/Appwrite/Enums/HealthCheckStatus.php | 11 +- src/Appwrite/Enums/ImageFormat.php | 16 +- src/Appwrite/Enums/ImageGravity.php | 18 +- src/Appwrite/Enums/IndexStatus.php | 14 +- src/Appwrite/Enums/MessagePriority.php | 11 +- src/Appwrite/Enums/MessageStatus.php | 14 +- src/Appwrite/Enums/MessagingProviderType.php | 12 +- src/Appwrite/Enums/Name.php | 22 +- src/Appwrite/Enums/OAuthProvider.php | 48 +- src/Appwrite/Enums/OrderBy.php | 11 +- src/Appwrite/Enums/PasswordHash.php | 20 +- src/Appwrite/Enums/RelationMutate.php | 12 +- src/Appwrite/Enums/RelationshipType.php | 13 +- src/Appwrite/Enums/Runtime.php | 113 +- src/Appwrite/Enums/Scopes.php | 79 +- src/Appwrite/Enums/SmtpEncryption.php | 12 +- src/Appwrite/Enums/TablesDBIndexType.php | 13 +- src/Appwrite/Enums/TemplateReferenceType.php | 12 +- src/Appwrite/Enums/Theme.php | 11 +- src/Appwrite/Enums/Timezone.php | 428 +++- src/Appwrite/Enums/VCSReferenceType.php | 12 +- src/Appwrite/Models/ActivityEvent.php | 90 + src/Appwrite/Models/ActivityEventList.php | 30 + src/Appwrite/Models/AlgoArgon2.php | 27 + src/Appwrite/Models/AlgoBcrypt.php | 21 + src/Appwrite/Models/AlgoMd5.php | 21 + src/Appwrite/Models/AlgoPhpass.php | 21 + src/Appwrite/Models/AlgoScrypt.php | 29 + src/Appwrite/Models/AlgoScryptModified.php | 27 + src/Appwrite/Models/AlgoSha.php | 21 + src/Appwrite/Models/ArraySerializable.php | 154 ++ src/Appwrite/Models/AttributeBoolean.php | 49 + src/Appwrite/Models/AttributeDatetime.php | 51 + src/Appwrite/Models/AttributeEmail.php | 51 + src/Appwrite/Models/AttributeEnum.php | 53 + src/Appwrite/Models/AttributeFloat.php | 53 + src/Appwrite/Models/AttributeInteger.php | 53 + src/Appwrite/Models/AttributeIp.php | 51 + src/Appwrite/Models/AttributeLine.php | 49 + src/Appwrite/Models/AttributeList.php | 23 + src/Appwrite/Models/AttributeLongtext.php | 51 + src/Appwrite/Models/AttributeMediumtext.php | 51 + src/Appwrite/Models/AttributePoint.php | 49 + src/Appwrite/Models/AttributePolygon.php | 49 + src/Appwrite/Models/AttributeRelationship.php | 58 + src/Appwrite/Models/AttributeString.php | 53 + src/Appwrite/Models/AttributeText.php | 51 + src/Appwrite/Models/AttributeUrl.php | 51 + src/Appwrite/Models/AttributeVarchar.php | 53 + src/Appwrite/Models/BackupArchive.php | 52 + src/Appwrite/Models/BackupArchiveList.php | 30 + src/Appwrite/Models/BackupPolicy.php | 50 + src/Appwrite/Models/BackupPolicyList.php | 30 + src/Appwrite/Models/BackupRestoration.php | 50 + src/Appwrite/Models/BackupRestorationList.php | 30 + src/Appwrite/Models/Bucket.php | 57 + src/Appwrite/Models/BucketList.php | 30 + src/Appwrite/Models/Collection.php | 60 + src/Appwrite/Models/CollectionList.php | 30 + src/Appwrite/Models/ColumnBoolean.php | 49 + src/Appwrite/Models/ColumnDatetime.php | 51 + src/Appwrite/Models/ColumnEmail.php | 51 + src/Appwrite/Models/ColumnEnum.php | 53 + src/Appwrite/Models/ColumnFloat.php | 53 + src/Appwrite/Models/ColumnIndex.php | 48 + src/Appwrite/Models/ColumnIndexList.php | 30 + src/Appwrite/Models/ColumnInteger.php | 53 + src/Appwrite/Models/ColumnIp.php | 51 + src/Appwrite/Models/ColumnLine.php | 49 + src/Appwrite/Models/ColumnList.php | 23 + src/Appwrite/Models/ColumnLongtext.php | 51 + src/Appwrite/Models/ColumnMediumtext.php | 51 + src/Appwrite/Models/ColumnPoint.php | 49 + src/Appwrite/Models/ColumnPolygon.php | 49 + src/Appwrite/Models/ColumnRelationship.php | 58 + src/Appwrite/Models/ColumnString.php | 53 + src/Appwrite/Models/ColumnText.php | 51 + src/Appwrite/Models/ColumnUrl.php | 51 + src/Appwrite/Models/ColumnVarchar.php | 53 + src/Appwrite/Models/Continent.php | 23 + src/Appwrite/Models/ContinentList.php | 30 + src/Appwrite/Models/Country.php | 23 + src/Appwrite/Models/CountryList.php | 30 + src/Appwrite/Models/Currency.php | 33 + src/Appwrite/Models/CurrencyList.php | 30 + src/Appwrite/Models/Database.php | 54 + src/Appwrite/Models/DatabaseList.php | 30 + src/Appwrite/Models/Deployment.php | 84 + src/Appwrite/Models/DeploymentList.php | 30 + src/Appwrite/Models/Document.php | 50 + src/Appwrite/Models/DocumentList.php | 30 + src/Appwrite/Models/Execution.php | 76 + src/Appwrite/Models/ExecutionList.php | 30 + src/Appwrite/Models/File.php | 55 + src/Appwrite/Models/FileList.php | 30 + src/Appwrite/Models/Framework.php | 36 + src/Appwrite/Models/FrameworkAdapter.php | 29 + src/Appwrite/Models/FrameworkList.php | 30 + src/Appwrite/Models/FunctionList.php | 30 + src/Appwrite/Models/FunctionModel.php | 95 + src/Appwrite/Models/Headers.php | 23 + src/Appwrite/Models/HealthAntivirus.php | 25 + src/Appwrite/Models/HealthCertificate.php | 31 + src/Appwrite/Models/HealthQueue.php | 21 + src/Appwrite/Models/HealthStatus.php | 27 + src/Appwrite/Models/HealthStatusList.php | 30 + src/Appwrite/Models/HealthTime.php | 25 + src/Appwrite/Models/Identity.php | 48 + src/Appwrite/Models/IdentityList.php | 30 + src/Appwrite/Models/Index.php | 50 + src/Appwrite/Models/IndexList.php | 30 + src/Appwrite/Models/Jwt.php | 21 + src/Appwrite/Models/Language.php | 25 + src/Appwrite/Models/LanguageList.php | 30 + src/Appwrite/Models/Locale.php | 33 + src/Appwrite/Models/LocaleCode.php | 23 + src/Appwrite/Models/LocaleCodeList.php | 30 + src/Appwrite/Models/Log.php | 61 + src/Appwrite/Models/LogList.php | 30 + src/Appwrite/Models/Membership.php | 54 + src/Appwrite/Models/MembershipList.php | 30 + src/Appwrite/Models/Message.php | 56 + src/Appwrite/Models/MessageList.php | 30 + src/Appwrite/Models/MfaChallenge.php | 35 + src/Appwrite/Models/MfaFactors.php | 27 + src/Appwrite/Models/MfaRecoveryCodes.php | 21 + src/Appwrite/Models/MfaType.php | 23 + src/Appwrite/Models/Phone.php | 25 + src/Appwrite/Models/PhoneList.php | 30 + src/Appwrite/Models/Preferences.php | 23 + src/Appwrite/Models/Provider.php | 46 + src/Appwrite/Models/ProviderList.php | 30 + src/Appwrite/Models/ResourceToken.php | 41 + src/Appwrite/Models/ResourceTokenList.php | 30 + src/Appwrite/Models/Row.php | 50 + src/Appwrite/Models/RowList.php | 30 + src/Appwrite/Models/Runtime.php | 42 + src/Appwrite/Models/RuntimeList.php | 30 + src/Appwrite/Models/Session.php | 86 + src/Appwrite/Models/SessionList.php | 30 + src/Appwrite/Models/Site.php | 99 + src/Appwrite/Models/SiteList.php | 30 + src/Appwrite/Models/Specification.php | 27 + src/Appwrite/Models/SpecificationList.php | 30 + src/Appwrite/Models/Subscriber.php | 46 + src/Appwrite/Models/SubscriberList.php | 30 + src/Appwrite/Models/Table.php | 60 + src/Appwrite/Models/TableList.php | 30 + src/Appwrite/Models/Target.php | 46 + src/Appwrite/Models/TargetList.php | 30 + src/Appwrite/Models/Team.php | 40 + src/Appwrite/Models/TeamList.php | 30 + src/Appwrite/Models/Token.php | 39 + src/Appwrite/Models/Topic.php | 44 + src/Appwrite/Models/TopicList.php | 30 + src/Appwrite/Models/Transaction.php | 40 + src/Appwrite/Models/TransactionList.php | 30 + src/Appwrite/Models/User.php | 77 + src/Appwrite/Models/UserList.php | 30 + src/Appwrite/Models/Variable.php | 44 + src/Appwrite/Models/VariableList.php | 30 + src/Appwrite/Models/Webhook.php | 54 + src/Appwrite/Models/WebhookList.php | 30 + src/Appwrite/Service.php | 76 +- src/Appwrite/Services/Account.php | 507 +++-- src/Appwrite/Services/Activities.php | 26 +- src/Appwrite/Services/Avatars.php | 42 +- src/Appwrite/Services/Backups.php | 132 +- src/Appwrite/Services/Databases.php | 831 ++++++-- src/Appwrite/Services/Functions.php | 288 ++- src/Appwrite/Services/Graphql.php | 12 +- src/Appwrite/Services/Health.php | 291 ++- src/Appwrite/Services/Locale.php | 98 +- src/Appwrite/Services/Messaging.php | 550 ++++-- src/Appwrite/Services/Project.php | 55 +- src/Appwrite/Services/Sites.php | 276 ++- src/Appwrite/Services/Storage.php | 132 +- src/Appwrite/Services/TablesDB.php | 831 ++++++-- src/Appwrite/Services/Teams.php | 144 +- src/Appwrite/Services/Tokens.php | 55 +- src/Appwrite/Services/Users.php | 476 +++-- src/Appwrite/Services/Webhooks.php | 67 +- tests/Appwrite/Services/AccountTest.php | 1509 +++++++------- tests/Appwrite/Services/ActivitiesTest.php | 119 +- tests/Appwrite/Services/AvatarsTest.php | 48 +- tests/Appwrite/Services/BackupsTest.php | 285 +-- tests/Appwrite/Services/DatabasesTest.php | 1730 ++++++++++------- tests/Appwrite/Services/FunctionsTest.php | 1086 ++++++----- tests/Appwrite/Services/GraphqlTest.php | 12 +- tests/Appwrite/Services/HealthTest.php | 314 +-- tests/Appwrite/Services/LocaleTest.php | 142 +- tests/Appwrite/Services/MessagingTest.php | 1211 +++++++----- tests/Appwrite/Services/ProjectTest.php | 103 +- tests/Appwrite/Services/SitesTest.php | 1058 +++++----- tests/Appwrite/Services/StorageTest.php | 301 +-- tests/Appwrite/Services/TablesDBTest.php | 1730 ++++++++++------- tests/Appwrite/Services/TeamsTest.php | 278 +-- tests/Appwrite/Services/TokensTest.php | 96 +- tests/Appwrite/Services/UsersTest.php | 1438 ++++++++------ tests/Appwrite/Services/WebhooksTest.php | 173 +- 237 files changed, 17948 insertions(+), 6046 deletions(-) create mode 100644 src/Appwrite/Models/ActivityEvent.php create mode 100644 src/Appwrite/Models/ActivityEventList.php create mode 100644 src/Appwrite/Models/AlgoArgon2.php create mode 100644 src/Appwrite/Models/AlgoBcrypt.php create mode 100644 src/Appwrite/Models/AlgoMd5.php create mode 100644 src/Appwrite/Models/AlgoPhpass.php create mode 100644 src/Appwrite/Models/AlgoScrypt.php create mode 100644 src/Appwrite/Models/AlgoScryptModified.php create mode 100644 src/Appwrite/Models/AlgoSha.php create mode 100644 src/Appwrite/Models/ArraySerializable.php create mode 100644 src/Appwrite/Models/AttributeBoolean.php create mode 100644 src/Appwrite/Models/AttributeDatetime.php create mode 100644 src/Appwrite/Models/AttributeEmail.php create mode 100644 src/Appwrite/Models/AttributeEnum.php create mode 100644 src/Appwrite/Models/AttributeFloat.php create mode 100644 src/Appwrite/Models/AttributeInteger.php create mode 100644 src/Appwrite/Models/AttributeIp.php create mode 100644 src/Appwrite/Models/AttributeLine.php create mode 100644 src/Appwrite/Models/AttributeList.php create mode 100644 src/Appwrite/Models/AttributeLongtext.php create mode 100644 src/Appwrite/Models/AttributeMediumtext.php create mode 100644 src/Appwrite/Models/AttributePoint.php create mode 100644 src/Appwrite/Models/AttributePolygon.php create mode 100644 src/Appwrite/Models/AttributeRelationship.php create mode 100644 src/Appwrite/Models/AttributeString.php create mode 100644 src/Appwrite/Models/AttributeText.php create mode 100644 src/Appwrite/Models/AttributeUrl.php create mode 100644 src/Appwrite/Models/AttributeVarchar.php create mode 100644 src/Appwrite/Models/BackupArchive.php create mode 100644 src/Appwrite/Models/BackupArchiveList.php create mode 100644 src/Appwrite/Models/BackupPolicy.php create mode 100644 src/Appwrite/Models/BackupPolicyList.php create mode 100644 src/Appwrite/Models/BackupRestoration.php create mode 100644 src/Appwrite/Models/BackupRestorationList.php create mode 100644 src/Appwrite/Models/Bucket.php create mode 100644 src/Appwrite/Models/BucketList.php create mode 100644 src/Appwrite/Models/Collection.php create mode 100644 src/Appwrite/Models/CollectionList.php create mode 100644 src/Appwrite/Models/ColumnBoolean.php create mode 100644 src/Appwrite/Models/ColumnDatetime.php create mode 100644 src/Appwrite/Models/ColumnEmail.php create mode 100644 src/Appwrite/Models/ColumnEnum.php create mode 100644 src/Appwrite/Models/ColumnFloat.php create mode 100644 src/Appwrite/Models/ColumnIndex.php create mode 100644 src/Appwrite/Models/ColumnIndexList.php create mode 100644 src/Appwrite/Models/ColumnInteger.php create mode 100644 src/Appwrite/Models/ColumnIp.php create mode 100644 src/Appwrite/Models/ColumnLine.php create mode 100644 src/Appwrite/Models/ColumnList.php create mode 100644 src/Appwrite/Models/ColumnLongtext.php create mode 100644 src/Appwrite/Models/ColumnMediumtext.php create mode 100644 src/Appwrite/Models/ColumnPoint.php create mode 100644 src/Appwrite/Models/ColumnPolygon.php create mode 100644 src/Appwrite/Models/ColumnRelationship.php create mode 100644 src/Appwrite/Models/ColumnString.php create mode 100644 src/Appwrite/Models/ColumnText.php create mode 100644 src/Appwrite/Models/ColumnUrl.php create mode 100644 src/Appwrite/Models/ColumnVarchar.php create mode 100644 src/Appwrite/Models/Continent.php create mode 100644 src/Appwrite/Models/ContinentList.php create mode 100644 src/Appwrite/Models/Country.php create mode 100644 src/Appwrite/Models/CountryList.php create mode 100644 src/Appwrite/Models/Currency.php create mode 100644 src/Appwrite/Models/CurrencyList.php create mode 100644 src/Appwrite/Models/Database.php create mode 100644 src/Appwrite/Models/DatabaseList.php create mode 100644 src/Appwrite/Models/Deployment.php create mode 100644 src/Appwrite/Models/DeploymentList.php create mode 100644 src/Appwrite/Models/Document.php create mode 100644 src/Appwrite/Models/DocumentList.php create mode 100644 src/Appwrite/Models/Execution.php create mode 100644 src/Appwrite/Models/ExecutionList.php create mode 100644 src/Appwrite/Models/File.php create mode 100644 src/Appwrite/Models/FileList.php create mode 100644 src/Appwrite/Models/Framework.php create mode 100644 src/Appwrite/Models/FrameworkAdapter.php create mode 100644 src/Appwrite/Models/FrameworkList.php create mode 100644 src/Appwrite/Models/FunctionList.php create mode 100644 src/Appwrite/Models/FunctionModel.php create mode 100644 src/Appwrite/Models/Headers.php create mode 100644 src/Appwrite/Models/HealthAntivirus.php create mode 100644 src/Appwrite/Models/HealthCertificate.php create mode 100644 src/Appwrite/Models/HealthQueue.php create mode 100644 src/Appwrite/Models/HealthStatus.php create mode 100644 src/Appwrite/Models/HealthStatusList.php create mode 100644 src/Appwrite/Models/HealthTime.php create mode 100644 src/Appwrite/Models/Identity.php create mode 100644 src/Appwrite/Models/IdentityList.php create mode 100644 src/Appwrite/Models/Index.php create mode 100644 src/Appwrite/Models/IndexList.php create mode 100644 src/Appwrite/Models/Jwt.php create mode 100644 src/Appwrite/Models/Language.php create mode 100644 src/Appwrite/Models/LanguageList.php create mode 100644 src/Appwrite/Models/Locale.php create mode 100644 src/Appwrite/Models/LocaleCode.php create mode 100644 src/Appwrite/Models/LocaleCodeList.php create mode 100644 src/Appwrite/Models/Log.php create mode 100644 src/Appwrite/Models/LogList.php create mode 100644 src/Appwrite/Models/Membership.php create mode 100644 src/Appwrite/Models/MembershipList.php create mode 100644 src/Appwrite/Models/Message.php create mode 100644 src/Appwrite/Models/MessageList.php create mode 100644 src/Appwrite/Models/MfaChallenge.php create mode 100644 src/Appwrite/Models/MfaFactors.php create mode 100644 src/Appwrite/Models/MfaRecoveryCodes.php create mode 100644 src/Appwrite/Models/MfaType.php create mode 100644 src/Appwrite/Models/Phone.php create mode 100644 src/Appwrite/Models/PhoneList.php create mode 100644 src/Appwrite/Models/Preferences.php create mode 100644 src/Appwrite/Models/Provider.php create mode 100644 src/Appwrite/Models/ProviderList.php create mode 100644 src/Appwrite/Models/ResourceToken.php create mode 100644 src/Appwrite/Models/ResourceTokenList.php create mode 100644 src/Appwrite/Models/Row.php create mode 100644 src/Appwrite/Models/RowList.php create mode 100644 src/Appwrite/Models/Runtime.php create mode 100644 src/Appwrite/Models/RuntimeList.php create mode 100644 src/Appwrite/Models/Session.php create mode 100644 src/Appwrite/Models/SessionList.php create mode 100644 src/Appwrite/Models/Site.php create mode 100644 src/Appwrite/Models/SiteList.php create mode 100644 src/Appwrite/Models/Specification.php create mode 100644 src/Appwrite/Models/SpecificationList.php create mode 100644 src/Appwrite/Models/Subscriber.php create mode 100644 src/Appwrite/Models/SubscriberList.php create mode 100644 src/Appwrite/Models/Table.php create mode 100644 src/Appwrite/Models/TableList.php create mode 100644 src/Appwrite/Models/Target.php create mode 100644 src/Appwrite/Models/TargetList.php create mode 100644 src/Appwrite/Models/Team.php create mode 100644 src/Appwrite/Models/TeamList.php create mode 100644 src/Appwrite/Models/Token.php create mode 100644 src/Appwrite/Models/Topic.php create mode 100644 src/Appwrite/Models/TopicList.php create mode 100644 src/Appwrite/Models/Transaction.php create mode 100644 src/Appwrite/Models/TransactionList.php create mode 100644 src/Appwrite/Models/User.php create mode 100644 src/Appwrite/Models/UserList.php create mode 100644 src/Appwrite/Models/Variable.php create mode 100644 src/Appwrite/Models/VariableList.php create mode 100644 src/Appwrite/Models/Webhook.php create mode 100644 src/Appwrite/Models/WebhookList.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d4c557f..0e0f6e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 22.0.0 + +* [BREAKING] Raised minimum PHP version from 8.0 to 8.2 +* [BREAKING] All service methods now return typed model objects instead of `array` +* Added 142 typed response model classes with `ArraySerializable` trait for backward-compatible array access +* Added `from(string)` factory method to all enums for value-based construction +* Added `Client::getHeaders()` method to retrieve request headers +* Added `dart-3.11` and `flutter-3.41` runtime enum values + ## 21.0.0 * [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents diff --git a/composer.json b/composer.json index 6d9446d..0098e64 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } }, "require": { - "php": ">=8.0.0", + "php": ">=8.2.0", "ext-curl": "*", "ext-json": "*" }, @@ -25,4 +25,4 @@ "mockery/mockery": "1.6.12" }, "minimum-stability": "dev" -} \ No newline at end of file +} diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index f7c3862..862ed26 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -16,6 +16,6 @@ $result = $databases->createDatetimeAttribute( collectionId: '', key: '', required: false, - default: '', // optional + default: '2020-10-15T06:38:00.000+00:00', // optional array: false // optional );``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index a1fb43f..9bff931 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -16,6 +16,6 @@ $result = $databases->updateDatetimeAttribute( collectionId: '', key: '', required: false, - default: '', + default: '2020-10-15T06:38:00.000+00:00', newKey: '' // optional );``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 68f46f9..bde1bb5 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -23,5 +23,5 @@ $result = $messaging->createEmail( attachments: [], // optional draft: false, // optional html: false, // optional - scheduledAt: '' // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 2673d48..7efef53 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -28,7 +28,7 @@ $result = $messaging->createPush( tag: '', // optional badge: null, // optional draft: false, // optional - scheduledAt: '', // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional contentAvailable: false, // optional critical: false, // optional priority: MessagePriority::NORMAL() // optional diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 5f946db..1f45876 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -18,5 +18,5 @@ $result = $messaging->createSMS( users: [], // optional targets: [], // optional draft: false, // optional - scheduledAt: '' // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 347f030..80918b1 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -22,6 +22,6 @@ $result = $messaging->updateEmail( html: false, // optional cc: [], // optional bcc: [], // optional - scheduledAt: '', // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional attachments: [] // optional );``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 0b3f1bc..32cb120 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -28,7 +28,7 @@ $result = $messaging->updatePush( tag: '', // optional badge: null, // optional draft: false, // optional - scheduledAt: '', // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional contentAvailable: false, // optional critical: false, // optional priority: MessagePriority::NORMAL() // optional diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 3dc932a..e59af27 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -18,5 +18,5 @@ $result = $messaging->updateSMS( targets: [], // optional content: '', // optional draft: false, // optional - scheduledAt: '' // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 9e9ad84..9e21e01 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -16,6 +16,6 @@ $result = $tablesDB->createDatetimeColumn( tableId: '', key: '', required: false, - default: '', // optional + default: '2020-10-15T06:38:00.000+00:00', // optional array: false // optional );``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 4f994a5..30ef56b 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -16,6 +16,6 @@ $result = $tablesDB->updateDatetimeColumn( tableId: '', key: '', required: false, - default: '', + default: '2020-10-15T06:38:00.000+00:00', newKey: '' // optional );``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md index d172c15..af8391f 100644 --- a/docs/examples/tokens/create-file-token.md +++ b/docs/examples/tokens/create-file-token.md @@ -14,5 +14,5 @@ $tokens = new Tokens($client); $result = $tokens->createFileToken( bucketId: '', fileId: '', - expire: '' // optional + expire: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md index 07c37e3..870b3fa 100644 --- a/docs/examples/tokens/update.md +++ b/docs/examples/tokens/update.md @@ -13,5 +13,5 @@ $tokens = new Tokens($client); $result = $tokens->update( tokenId: '', - expire: '' // optional + expire: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/health.md b/docs/health.md index ead6d70..0e5edd7 100644 --- a/docs/health.md +++ b/docs/health.md @@ -68,7 +68,8 @@ GET https://cloud.appwrite.io/v1/health/pubsub GET https://cloud.appwrite.io/v1/health/queue/audits ``` -** Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. ** +** Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. + ** ### Parameters diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index db61a29..0a9c7ea 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/21.0.0 ()', + 'user-agent' => 'AppwritePHPSDK/22.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '21.0.0', + 'x-sdk-version'=> '22.0.0', ]; /** @@ -270,6 +270,16 @@ public function addHeader(string $key, string $value): Client return $this; } + /** + * Get the request headers. + * + * @return array + */ + public function getHeaders(): array + { + return $this->headers; + } + /** * Call * diff --git a/src/Appwrite/Enums/Adapter.php b/src/Appwrite/Enums/Adapter.php index 0abdeed..b9be67f 100644 --- a/src/Appwrite/Enums/Adapter.php +++ b/src/Appwrite/Enums/Adapter.php @@ -40,4 +40,13 @@ public static function SSR(): Adapter } return self::$SSR; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'static' => self::STATIC(), + 'ssr' => self::SSR(), + default => throw new \InvalidArgumentException('Unknown Adapter value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/AttributeStatus.php b/src/Appwrite/Enums/AttributeStatus.php index 0b9a6ee..9ddf0b5 100644 --- a/src/Appwrite/Enums/AttributeStatus.php +++ b/src/Appwrite/Enums/AttributeStatus.php @@ -64,4 +64,16 @@ public static function FAILED(): AttributeStatus } return self::$FAILED; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'available' => self::AVAILABLE(), + 'processing' => self::PROCESSING(), + 'deleting' => self::DELETING(), + 'stuck' => self::STUCK(), + 'failed' => self::FAILED(), + default => throw new \InvalidArgumentException('Unknown AttributeStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/AuthenticationFactor.php b/src/Appwrite/Enums/AuthenticationFactor.php index 5258c8c..b369472 100644 --- a/src/Appwrite/Enums/AuthenticationFactor.php +++ b/src/Appwrite/Enums/AuthenticationFactor.php @@ -56,4 +56,15 @@ public static function RECOVERYCODE(): AuthenticationFactor } return self::$RECOVERYCODE; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'email' => self::EMAIL(), + 'phone' => self::PHONE(), + 'totp' => self::TOTP(), + 'recoverycode' => self::RECOVERYCODE(), + default => throw new \InvalidArgumentException('Unknown AuthenticationFactor value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/AuthenticatorType.php b/src/Appwrite/Enums/AuthenticatorType.php index 9e8634a..74fe1c5 100644 --- a/src/Appwrite/Enums/AuthenticatorType.php +++ b/src/Appwrite/Enums/AuthenticatorType.php @@ -32,4 +32,12 @@ public static function TOTP(): AuthenticatorType } return self::$TOTP; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'totp' => self::TOTP(), + default => throw new \InvalidArgumentException('Unknown AuthenticatorType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/BackupServices.php b/src/Appwrite/Enums/BackupServices.php index 326d361..dd4fc22 100644 --- a/src/Appwrite/Enums/BackupServices.php +++ b/src/Appwrite/Enums/BackupServices.php @@ -72,4 +72,17 @@ public static function STORAGE(): BackupServices } return self::$STORAGE; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'databases' => self::DATABASES(), + 'tablesdb' => self::TABLESDB(), + 'documentsdb' => self::DOCUMENTSDB(), + 'vectorsdb' => self::VECTORSDB(), + 'functions' => self::FUNCTIONS(), + 'storage' => self::STORAGE(), + default => throw new \InvalidArgumentException('Unknown BackupServices value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Browser.php b/src/Appwrite/Enums/Browser.php index fc560f2..c53dc05 100644 --- a/src/Appwrite/Enums/Browser.php +++ b/src/Appwrite/Enums/Browser.php @@ -136,4 +136,25 @@ public static function OPERANEXT(): Browser } return self::$OPERANEXT; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'aa' => self::AVANTBROWSER(), + 'an' => self::ANDROIDWEBVIEWBETA(), + 'ch' => self::GOOGLECHROME(), + 'ci' => self::GOOGLECHROMEIOS(), + 'cm' => self::GOOGLECHROMEMOBILE(), + 'cr' => self::CHROMIUM(), + 'ff' => self::MOZILLAFIREFOX(), + 'sf' => self::SAFARI(), + 'mf' => self::MOBILESAFARI(), + 'ps' => self::MICROSOFTEDGE(), + 'oi' => self::MICROSOFTEDGEIOS(), + 'om' => self::OPERAMINI(), + 'op' => self::OPERA(), + 'on' => self::OPERANEXT(), + default => throw new \InvalidArgumentException('Unknown Browser value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/BrowserPermission.php b/src/Appwrite/Enums/BrowserPermission.php index 30a13a1..71fa9b1 100644 --- a/src/Appwrite/Enums/BrowserPermission.php +++ b/src/Appwrite/Enums/BrowserPermission.php @@ -184,4 +184,31 @@ public static function XRSPATIALTRACKING(): BrowserPermission } return self::$XRSPATIALTRACKING; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'geolocation' => self::GEOLOCATION(), + 'camera' => self::CAMERA(), + 'microphone' => self::MICROPHONE(), + 'notifications' => self::NOTIFICATIONS(), + 'midi' => self::MIDI(), + 'push' => self::PUSH(), + 'clipboard-read' => self::CLIPBOARDREAD(), + 'clipboard-write' => self::CLIPBOARDWRITE(), + 'payment-handler' => self::PAYMENTHANDLER(), + 'usb' => self::USB(), + 'bluetooth' => self::BLUETOOTH(), + 'accelerometer' => self::ACCELEROMETER(), + 'gyroscope' => self::GYROSCOPE(), + 'magnetometer' => self::MAGNETOMETER(), + 'ambient-light-sensor' => self::AMBIENTLIGHTSENSOR(), + 'background-sync' => self::BACKGROUNDSYNC(), + 'persistent-storage' => self::PERSISTENTSTORAGE(), + 'screen-wake-lock' => self::SCREENWAKELOCK(), + 'web-share' => self::WEBSHARE(), + 'xr-spatial-tracking' => self::XRSPATIALTRACKING(), + default => throw new \InvalidArgumentException('Unknown BrowserPermission value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index f0d01a0..d3bcad0 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -54,6 +54,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $DART38; private static BuildRuntime $DART39; private static BuildRuntime $DART310; + private static BuildRuntime $DART311; private static BuildRuntime $DOTNET60; private static BuildRuntime $DOTNET70; private static BuildRuntime $DOTNET80; @@ -92,6 +93,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $FLUTTER332; private static BuildRuntime $FLUTTER335; private static BuildRuntime $FLUTTER338; + private static BuildRuntime $FLUTTER341; private string $value; @@ -446,6 +448,13 @@ public static function DART310(): BuildRuntime } return self::$DART310; } + public static function DART311(): BuildRuntime + { + if (!isset(self::$DART311)) { + self::$DART311 = new BuildRuntime('dart-3.11'); + } + return self::$DART311; + } public static function DOTNET60(): BuildRuntime { if (!isset(self::$DOTNET60)) { @@ -712,4 +721,106 @@ public static function FLUTTER338(): BuildRuntime } return self::$FLUTTER338; } -} \ No newline at end of file + public static function FLUTTER341(): BuildRuntime + { + if (!isset(self::$FLUTTER341)) { + self::$FLUTTER341 = new BuildRuntime('flutter-3.41'); + } + return self::$FLUTTER341; + } + + public static function from(string $value): self + { + return match ($value) { + 'node-14.5' => self::NODE145(), + 'node-16.0' => self::NODE160(), + 'node-18.0' => self::NODE180(), + 'node-19.0' => self::NODE190(), + 'node-20.0' => self::NODE200(), + 'node-21.0' => self::NODE210(), + 'node-22' => self::NODE22(), + 'node-23' => self::NODE23(), + 'node-24' => self::NODE24(), + 'node-25' => self::NODE25(), + 'php-8.0' => self::PHP80(), + 'php-8.1' => self::PHP81(), + 'php-8.2' => self::PHP82(), + 'php-8.3' => self::PHP83(), + 'php-8.4' => self::PHP84(), + 'ruby-3.0' => self::RUBY30(), + 'ruby-3.1' => self::RUBY31(), + 'ruby-3.2' => self::RUBY32(), + 'ruby-3.3' => self::RUBY33(), + 'ruby-3.4' => self::RUBY34(), + 'ruby-4.0' => self::RUBY40(), + 'python-3.8' => self::PYTHON38(), + 'python-3.9' => self::PYTHON39(), + 'python-3.10' => self::PYTHON310(), + 'python-3.11' => self::PYTHON311(), + 'python-3.12' => self::PYTHON312(), + 'python-3.13' => self::PYTHON313(), + 'python-3.14' => self::PYTHON314(), + 'python-ml-3.11' => self::PYTHONML311(), + 'python-ml-3.12' => self::PYTHONML312(), + 'python-ml-3.13' => self::PYTHONML313(), + 'deno-1.40' => self::DENO140(), + 'deno-1.46' => self::DENO146(), + 'deno-2.0' => self::DENO20(), + 'deno-2.5' => self::DENO25(), + 'deno-2.6' => self::DENO26(), + 'dart-2.15' => self::DART215(), + 'dart-2.16' => self::DART216(), + 'dart-2.17' => self::DART217(), + 'dart-2.18' => self::DART218(), + 'dart-2.19' => self::DART219(), + 'dart-3.0' => self::DART30(), + 'dart-3.1' => self::DART31(), + 'dart-3.3' => self::DART33(), + 'dart-3.5' => self::DART35(), + 'dart-3.8' => self::DART38(), + 'dart-3.9' => self::DART39(), + 'dart-3.10' => self::DART310(), + 'dart-3.11' => self::DART311(), + 'dotnet-6.0' => self::DOTNET60(), + 'dotnet-7.0' => self::DOTNET70(), + 'dotnet-8.0' => self::DOTNET80(), + 'dotnet-10' => self::DOTNET10(), + 'java-8.0' => self::JAVA80(), + 'java-11.0' => self::JAVA110(), + 'java-17.0' => self::JAVA170(), + 'java-18.0' => self::JAVA180(), + 'java-21.0' => self::JAVA210(), + 'java-22' => self::JAVA22(), + 'java-25' => self::JAVA25(), + 'swift-5.5' => self::SWIFT55(), + 'swift-5.8' => self::SWIFT58(), + 'swift-5.9' => self::SWIFT59(), + 'swift-5.10' => self::SWIFT510(), + 'swift-6.2' => self::SWIFT62(), + 'kotlin-1.6' => self::KOTLIN16(), + 'kotlin-1.8' => self::KOTLIN18(), + 'kotlin-1.9' => self::KOTLIN19(), + 'kotlin-2.0' => self::KOTLIN20(), + 'kotlin-2.3' => self::KOTLIN23(), + 'cpp-17' => self::CPP17(), + 'cpp-20' => self::CPP20(), + 'bun-1.0' => self::BUN10(), + 'bun-1.1' => self::BUN11(), + 'bun-1.2' => self::BUN12(), + 'bun-1.3' => self::BUN13(), + 'go-1.23' => self::GO123(), + 'go-1.24' => self::GO124(), + 'go-1.25' => self::GO125(), + 'go-1.26' => self::GO126(), + 'static-1' => self::STATIC1(), + 'flutter-3.24' => self::FLUTTER324(), + 'flutter-3.27' => self::FLUTTER327(), + 'flutter-3.29' => self::FLUTTER329(), + 'flutter-3.32' => self::FLUTTER332(), + 'flutter-3.35' => self::FLUTTER335(), + 'flutter-3.38' => self::FLUTTER338(), + 'flutter-3.41' => self::FLUTTER341(), + default => throw new \InvalidArgumentException('Unknown BuildRuntime value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ColumnStatus.php b/src/Appwrite/Enums/ColumnStatus.php index d67f433..8ed9c71 100644 --- a/src/Appwrite/Enums/ColumnStatus.php +++ b/src/Appwrite/Enums/ColumnStatus.php @@ -64,4 +64,16 @@ public static function FAILED(): ColumnStatus } return self::$FAILED; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'available' => self::AVAILABLE(), + 'processing' => self::PROCESSING(), + 'deleting' => self::DELETING(), + 'stuck' => self::STUCK(), + 'failed' => self::FAILED(), + default => throw new \InvalidArgumentException('Unknown ColumnStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Compression.php b/src/Appwrite/Enums/Compression.php index 1e73987..ecfab33 100644 --- a/src/Appwrite/Enums/Compression.php +++ b/src/Appwrite/Enums/Compression.php @@ -48,4 +48,14 @@ public static function ZSTD(): Compression } return self::$ZSTD; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'gzip' => self::GZIP(), + 'zstd' => self::ZSTD(), + default => throw new \InvalidArgumentException('Unknown Compression value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/CreditCard.php b/src/Appwrite/Enums/CreditCard.php index 416a5b4..c291380 100644 --- a/src/Appwrite/Enums/CreditCard.php +++ b/src/Appwrite/Enums/CreditCard.php @@ -160,4 +160,28 @@ public static function RUPAY(): CreditCard } return self::$RUPAY; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'amex' => self::AMERICANEXPRESS(), + 'argencard' => self::ARGENCARD(), + 'cabal' => self::CABAL(), + 'cencosud' => self::CENCOSUD(), + 'diners' => self::DINERSCLUB(), + 'discover' => self::DISCOVER(), + 'elo' => self::ELO(), + 'hipercard' => self::HIPERCARD(), + 'jcb' => self::JCB(), + 'mastercard' => self::MASTERCARD(), + 'naranja' => self::NARANJA(), + 'targeta-shopping' => self::TARJETASHOPPING(), + 'unionpay' => self::UNIONPAY(), + 'visa' => self::VISA(), + 'mir' => self::MIR(), + 'maestro' => self::MAESTRO(), + 'rupay' => self::RUPAY(), + default => throw new \InvalidArgumentException('Unknown CreditCard value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/DatabaseType.php b/src/Appwrite/Enums/DatabaseType.php index ccbc5c0..e5d7dfe 100644 --- a/src/Appwrite/Enums/DatabaseType.php +++ b/src/Appwrite/Enums/DatabaseType.php @@ -56,4 +56,15 @@ public static function VECTORSDB(): DatabaseType } return self::$VECTORSDB; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'legacy' => self::LEGACY(), + 'tablesdb' => self::TABLESDB(), + 'documentsdb' => self::DOCUMENTSDB(), + 'vectorsdb' => self::VECTORSDB(), + default => throw new \InvalidArgumentException('Unknown DatabaseType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/DatabasesIndexType.php b/src/Appwrite/Enums/DatabasesIndexType.php index e4b061d..52443f4 100644 --- a/src/Appwrite/Enums/DatabasesIndexType.php +++ b/src/Appwrite/Enums/DatabasesIndexType.php @@ -56,4 +56,15 @@ public static function SPATIAL(): DatabasesIndexType } return self::$SPATIAL; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'key' => self::KEY(), + 'fulltext' => self::FULLTEXT(), + 'unique' => self::UNIQUE(), + 'spatial' => self::SPATIAL(), + default => throw new \InvalidArgumentException('Unknown DatabasesIndexType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/DeploymentDownloadType.php b/src/Appwrite/Enums/DeploymentDownloadType.php index 5acdb73..59d278b 100644 --- a/src/Appwrite/Enums/DeploymentDownloadType.php +++ b/src/Appwrite/Enums/DeploymentDownloadType.php @@ -40,4 +40,13 @@ public static function OUTPUT(): DeploymentDownloadType } return self::$OUTPUT; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'source' => self::SOURCE(), + 'output' => self::OUTPUT(), + default => throw new \InvalidArgumentException('Unknown DeploymentDownloadType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/DeploymentStatus.php b/src/Appwrite/Enums/DeploymentStatus.php index 1cc26b6..930af80 100644 --- a/src/Appwrite/Enums/DeploymentStatus.php +++ b/src/Appwrite/Enums/DeploymentStatus.php @@ -72,4 +72,17 @@ public static function FAILED(): DeploymentStatus } return self::$FAILED; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'waiting' => self::WAITING(), + 'processing' => self::PROCESSING(), + 'building' => self::BUILDING(), + 'ready' => self::READY(), + 'canceled' => self::CANCELED(), + 'failed' => self::FAILED(), + default => throw new \InvalidArgumentException('Unknown DeploymentStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ExecutionMethod.php b/src/Appwrite/Enums/ExecutionMethod.php index 6f16869..b8a0c3d 100644 --- a/src/Appwrite/Enums/ExecutionMethod.php +++ b/src/Appwrite/Enums/ExecutionMethod.php @@ -80,4 +80,18 @@ public static function HEAD(): ExecutionMethod } return self::$HEAD; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'GET' => self::GET(), + 'POST' => self::POST(), + 'PUT' => self::PUT(), + 'PATCH' => self::PATCH(), + 'DELETE' => self::DELETE(), + 'OPTIONS' => self::OPTIONS(), + 'HEAD' => self::HEAD(), + default => throw new \InvalidArgumentException('Unknown ExecutionMethod value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ExecutionStatus.php b/src/Appwrite/Enums/ExecutionStatus.php index a5999aa..efb2030 100644 --- a/src/Appwrite/Enums/ExecutionStatus.php +++ b/src/Appwrite/Enums/ExecutionStatus.php @@ -64,4 +64,16 @@ public static function SCHEDULED(): ExecutionStatus } return self::$SCHEDULED; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'waiting' => self::WAITING(), + 'processing' => self::PROCESSING(), + 'completed' => self::COMPLETED(), + 'failed' => self::FAILED(), + 'scheduled' => self::SCHEDULED(), + default => throw new \InvalidArgumentException('Unknown ExecutionStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ExecutionTrigger.php b/src/Appwrite/Enums/ExecutionTrigger.php index 7366d7b..64449f2 100644 --- a/src/Appwrite/Enums/ExecutionTrigger.php +++ b/src/Appwrite/Enums/ExecutionTrigger.php @@ -48,4 +48,14 @@ public static function EVENT(): ExecutionTrigger } return self::$EVENT; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'http' => self::HTTP(), + 'schedule' => self::SCHEDULE(), + 'event' => self::EVENT(), + default => throw new \InvalidArgumentException('Unknown ExecutionTrigger value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Flag.php b/src/Appwrite/Enums/Flag.php index e7145b1..0e6965d 100644 --- a/src/Appwrite/Enums/Flag.php +++ b/src/Appwrite/Enums/Flag.php @@ -1584,4 +1584,206 @@ public static function ZIMBABWE(): Flag } return self::$ZIMBABWE; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'af' => self::AFGHANISTAN(), + 'ao' => self::ANGOLA(), + 'al' => self::ALBANIA(), + 'ad' => self::ANDORRA(), + 'ae' => self::UNITEDARABEMIRATES(), + 'ar' => self::ARGENTINA(), + 'am' => self::ARMENIA(), + 'ag' => self::ANTIGUAANDBARBUDA(), + 'au' => self::AUSTRALIA(), + 'at' => self::AUSTRIA(), + 'az' => self::AZERBAIJAN(), + 'bi' => self::BURUNDI(), + 'be' => self::BELGIUM(), + 'bj' => self::BENIN(), + 'bf' => self::BURKINAFASO(), + 'bd' => self::BANGLADESH(), + 'bg' => self::BULGARIA(), + 'bh' => self::BAHRAIN(), + 'bs' => self::BAHAMAS(), + 'ba' => self::BOSNIAANDHERZEGOVINA(), + 'by' => self::BELARUS(), + 'bz' => self::BELIZE(), + 'bo' => self::BOLIVIA(), + 'br' => self::BRAZIL(), + 'bb' => self::BARBADOS(), + 'bn' => self::BRUNEIDARUSSALAM(), + 'bt' => self::BHUTAN(), + 'bw' => self::BOTSWANA(), + 'cf' => self::CENTRALAFRICANREPUBLIC(), + 'ca' => self::CANADA(), + 'ch' => self::SWITZERLAND(), + 'cl' => self::CHILE(), + 'cn' => self::CHINA(), + 'ci' => self::CTEDIVOIRE(), + 'cm' => self::CAMEROON(), + 'cd' => self::DEMOCRATICREPUBLICOFTHECONGO(), + 'cg' => self::REPUBLICOFTHECONGO(), + 'co' => self::COLOMBIA(), + 'km' => self::COMOROS(), + 'cv' => self::CAPEVERDE(), + 'cr' => self::COSTARICA(), + 'cu' => self::CUBA(), + 'cy' => self::CYPRUS(), + 'cz' => self::CZECHREPUBLIC(), + 'de' => self::GERMANY(), + 'dj' => self::DJIBOUTI(), + 'dm' => self::DOMINICA(), + 'dk' => self::DENMARK(), + 'do' => self::DOMINICANREPUBLIC(), + 'dz' => self::ALGERIA(), + 'ec' => self::ECUADOR(), + 'eg' => self::EGYPT(), + 'er' => self::ERITREA(), + 'es' => self::SPAIN(), + 'ee' => self::ESTONIA(), + 'et' => self::ETHIOPIA(), + 'fi' => self::FINLAND(), + 'fj' => self::FIJI(), + 'fr' => self::FRANCE(), + 'fm' => self::MICRONESIAFEDERATEDSTATESOF(), + 'ga' => self::GABON(), + 'gb' => self::UNITEDKINGDOM(), + 'ge' => self::GEORGIA(), + 'gh' => self::GHANA(), + 'gn' => self::GUINEA(), + 'gm' => self::GAMBIA(), + 'gw' => self::GUINEABISSAU(), + 'gq' => self::EQUATORIALGUINEA(), + 'gr' => self::GREECE(), + 'gd' => self::GRENADA(), + 'gt' => self::GUATEMALA(), + 'gy' => self::GUYANA(), + 'hn' => self::HONDURAS(), + 'hr' => self::CROATIA(), + 'ht' => self::HAITI(), + 'hu' => self::HUNGARY(), + 'id' => self::INDONESIA(), + 'in' => self::INDIA(), + 'ie' => self::IRELAND(), + 'ir' => self::IRANISLAMICREPUBLICOF(), + 'iq' => self::IRAQ(), + 'is' => self::ICELAND(), + 'il' => self::ISRAEL(), + 'it' => self::ITALY(), + 'jm' => self::JAMAICA(), + 'jo' => self::JORDAN(), + 'jp' => self::JAPAN(), + 'kz' => self::KAZAKHSTAN(), + 'ke' => self::KENYA(), + 'kg' => self::KYRGYZSTAN(), + 'kh' => self::CAMBODIA(), + 'ki' => self::KIRIBATI(), + 'kn' => self::SAINTKITTSANDNEVIS(), + 'kr' => self::SOUTHKOREA(), + 'kw' => self::KUWAIT(), + 'la' => self::LAOPEOPLESDEMOCRATICREPUBLIC(), + 'lb' => self::LEBANON(), + 'lr' => self::LIBERIA(), + 'ly' => self::LIBYA(), + 'lc' => self::SAINTLUCIA(), + 'li' => self::LIECHTENSTEIN(), + 'lk' => self::SRILANKA(), + 'ls' => self::LESOTHO(), + 'lt' => self::LITHUANIA(), + 'lu' => self::LUXEMBOURG(), + 'lv' => self::LATVIA(), + 'ma' => self::MOROCCO(), + 'mc' => self::MONACO(), + 'md' => self::MOLDOVA(), + 'mg' => self::MADAGASCAR(), + 'mv' => self::MALDIVES(), + 'mx' => self::MEXICO(), + 'mh' => self::MARSHALLISLANDS(), + 'mk' => self::NORTHMACEDONIA(), + 'ml' => self::MALI(), + 'mt' => self::MALTA(), + 'mm' => self::MYANMAR(), + 'me' => self::MONTENEGRO(), + 'mn' => self::MONGOLIA(), + 'mz' => self::MOZAMBIQUE(), + 'mr' => self::MAURITANIA(), + 'mu' => self::MAURITIUS(), + 'mw' => self::MALAWI(), + 'my' => self::MALAYSIA(), + 'na' => self::NAMIBIA(), + 'ne' => self::NIGER(), + 'ng' => self::NIGERIA(), + 'ni' => self::NICARAGUA(), + 'nl' => self::NETHERLANDS(), + 'no' => self::NORWAY(), + 'np' => self::NEPAL(), + 'nr' => self::NAURU(), + 'nz' => self::NEWZEALAND(), + 'om' => self::OMAN(), + 'pk' => self::PAKISTAN(), + 'pa' => self::PANAMA(), + 'pe' => self::PERU(), + 'ph' => self::PHILIPPINES(), + 'pw' => self::PALAU(), + 'pg' => self::PAPUANEWGUINEA(), + 'pl' => self::POLAND(), + 'pf' => self::FRENCHPOLYNESIA(), + 'kp' => self::NORTHKOREA(), + 'pt' => self::PORTUGAL(), + 'py' => self::PARAGUAY(), + 'qa' => self::QATAR(), + 'ro' => self::ROMANIA(), + 'ru' => self::RUSSIA(), + 'rw' => self::RWANDA(), + 'sa' => self::SAUDIARABIA(), + 'sd' => self::SUDAN(), + 'sn' => self::SENEGAL(), + 'sg' => self::SINGAPORE(), + 'sb' => self::SOLOMONISLANDS(), + 'sl' => self::SIERRALEONE(), + 'sv' => self::ELSALVADOR(), + 'sm' => self::SANMARINO(), + 'so' => self::SOMALIA(), + 'rs' => self::SERBIA(), + 'ss' => self::SOUTHSUDAN(), + 'st' => self::SAOTOMEANDPRINCIPE(), + 'sr' => self::SURINAME(), + 'sk' => self::SLOVAKIA(), + 'si' => self::SLOVENIA(), + 'se' => self::SWEDEN(), + 'sz' => self::ESWATINI(), + 'sc' => self::SEYCHELLES(), + 'sy' => self::SYRIA(), + 'td' => self::CHAD(), + 'tg' => self::TOGO(), + 'th' => self::THAILAND(), + 'tj' => self::TAJIKISTAN(), + 'tm' => self::TURKMENISTAN(), + 'tl' => self::TIMORLESTE(), + 'to' => self::TONGA(), + 'tt' => self::TRINIDADANDTOBAGO(), + 'tn' => self::TUNISIA(), + 'tr' => self::TURKEY(), + 'tv' => self::TUVALU(), + 'tz' => self::TANZANIA(), + 'ug' => self::UGANDA(), + 'ua' => self::UKRAINE(), + 'uy' => self::URUGUAY(), + 'us' => self::UNITEDSTATES(), + 'uz' => self::UZBEKISTAN(), + 'va' => self::VATICANCITY(), + 'vc' => self::SAINTVINCENTANDTHEGRENADINES(), + 've' => self::VENEZUELA(), + 'vn' => self::VIETNAM(), + 'vu' => self::VANUATU(), + 'ws' => self::SAMOA(), + 'ye' => self::YEMEN(), + 'za' => self::SOUTHAFRICA(), + 'zm' => self::ZAMBIA(), + 'zw' => self::ZIMBABWE(), + default => throw new \InvalidArgumentException('Unknown Flag value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Framework.php b/src/Appwrite/Enums/Framework.php index 9b5104c..2dd77c5 100644 --- a/src/Appwrite/Enums/Framework.php +++ b/src/Appwrite/Enums/Framework.php @@ -144,4 +144,26 @@ public static function OTHER(): Framework } return self::$OTHER; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'analog' => self::ANALOG(), + 'angular' => self::ANGULAR(), + 'nextjs' => self::NEXTJS(), + 'react' => self::REACT(), + 'nuxt' => self::NUXT(), + 'vue' => self::VUE(), + 'sveltekit' => self::SVELTEKIT(), + 'astro' => self::ASTRO(), + 'tanstack-start' => self::TANSTACKSTART(), + 'remix' => self::REMIX(), + 'lynx' => self::LYNX(), + 'flutter' => self::FLUTTER(), + 'react-native' => self::REACTNATIVE(), + 'vite' => self::VITE(), + 'other' => self::OTHER(), + default => throw new \InvalidArgumentException('Unknown Framework value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/HealthAntivirusStatus.php b/src/Appwrite/Enums/HealthAntivirusStatus.php index 1fa83fb..edee604 100644 --- a/src/Appwrite/Enums/HealthAntivirusStatus.php +++ b/src/Appwrite/Enums/HealthAntivirusStatus.php @@ -48,4 +48,14 @@ public static function ONLINE(): HealthAntivirusStatus } return self::$ONLINE; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'disabled' => self::DISABLED(), + 'offline' => self::OFFLINE(), + 'online' => self::ONLINE(), + default => throw new \InvalidArgumentException('Unknown HealthAntivirusStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/HealthCheckStatus.php b/src/Appwrite/Enums/HealthCheckStatus.php index c321ff1..8d36ec4 100644 --- a/src/Appwrite/Enums/HealthCheckStatus.php +++ b/src/Appwrite/Enums/HealthCheckStatus.php @@ -40,4 +40,13 @@ public static function FAIL(): HealthCheckStatus } return self::$FAIL; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'pass' => self::PASS(), + 'fail' => self::FAIL(), + default => throw new \InvalidArgumentException('Unknown HealthCheckStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ImageFormat.php b/src/Appwrite/Enums/ImageFormat.php index 8cb2ce6..4b0a541 100644 --- a/src/Appwrite/Enums/ImageFormat.php +++ b/src/Appwrite/Enums/ImageFormat.php @@ -80,4 +80,18 @@ public static function GIF(): ImageFormat } return self::$GIF; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'jpg' => self::JPG(), + 'jpeg' => self::JPEG(), + 'png' => self::PNG(), + 'webp' => self::WEBP(), + 'heic' => self::HEIC(), + 'avif' => self::AVIF(), + 'gif' => self::GIF(), + default => throw new \InvalidArgumentException('Unknown ImageFormat value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ImageGravity.php b/src/Appwrite/Enums/ImageGravity.php index a909cb8..a101dc1 100644 --- a/src/Appwrite/Enums/ImageGravity.php +++ b/src/Appwrite/Enums/ImageGravity.php @@ -96,4 +96,20 @@ public static function BOTTOMRIGHT(): ImageGravity } return self::$BOTTOMRIGHT; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'center' => self::CENTER(), + 'top-left' => self::TOPLEFT(), + 'top' => self::TOP(), + 'top-right' => self::TOPRIGHT(), + 'left' => self::LEFT(), + 'right' => self::RIGHT(), + 'bottom-left' => self::BOTTOMLEFT(), + 'bottom' => self::BOTTOM(), + 'bottom-right' => self::BOTTOMRIGHT(), + default => throw new \InvalidArgumentException('Unknown ImageGravity value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/IndexStatus.php b/src/Appwrite/Enums/IndexStatus.php index 20c1651..e36b6e2 100644 --- a/src/Appwrite/Enums/IndexStatus.php +++ b/src/Appwrite/Enums/IndexStatus.php @@ -64,4 +64,16 @@ public static function FAILED(): IndexStatus } return self::$FAILED; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'available' => self::AVAILABLE(), + 'processing' => self::PROCESSING(), + 'deleting' => self::DELETING(), + 'stuck' => self::STUCK(), + 'failed' => self::FAILED(), + default => throw new \InvalidArgumentException('Unknown IndexStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/MessagePriority.php b/src/Appwrite/Enums/MessagePriority.php index e23d253..a13ec24 100644 --- a/src/Appwrite/Enums/MessagePriority.php +++ b/src/Appwrite/Enums/MessagePriority.php @@ -40,4 +40,13 @@ public static function HIGH(): MessagePriority } return self::$HIGH; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'normal' => self::NORMAL(), + 'high' => self::HIGH(), + default => throw new \InvalidArgumentException('Unknown MessagePriority value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/MessageStatus.php b/src/Appwrite/Enums/MessageStatus.php index 27f228f..15ce9f8 100644 --- a/src/Appwrite/Enums/MessageStatus.php +++ b/src/Appwrite/Enums/MessageStatus.php @@ -64,4 +64,16 @@ public static function FAILED(): MessageStatus } return self::$FAILED; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'draft' => self::DRAFT(), + 'processing' => self::PROCESSING(), + 'scheduled' => self::SCHEDULED(), + 'sent' => self::SENT(), + 'failed' => self::FAILED(), + default => throw new \InvalidArgumentException('Unknown MessageStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/MessagingProviderType.php b/src/Appwrite/Enums/MessagingProviderType.php index 24a8eb0..f5a7711 100644 --- a/src/Appwrite/Enums/MessagingProviderType.php +++ b/src/Appwrite/Enums/MessagingProviderType.php @@ -48,4 +48,14 @@ public static function PUSH(): MessagingProviderType } return self::$PUSH; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'email' => self::EMAIL(), + 'sms' => self::SMS(), + 'push' => self::PUSH(), + default => throw new \InvalidArgumentException('Unknown MessagingProviderType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Name.php b/src/Appwrite/Enums/Name.php index 7407769..0265d46 100644 --- a/src/Appwrite/Enums/Name.php +++ b/src/Appwrite/Enums/Name.php @@ -128,4 +128,24 @@ public static function V1MIGRATIONS(): Name } return self::$V1MIGRATIONS; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'v1-database' => self::V1DATABASE(), + 'v1-deletes' => self::V1DELETES(), + 'v1-audits' => self::V1AUDITS(), + 'v1-mails' => self::V1MAILS(), + 'v1-functions' => self::V1FUNCTIONS(), + 'v1-stats-resources' => self::V1STATSRESOURCES(), + 'v1-stats-usage' => self::V1STATSUSAGE(), + 'v1-webhooks' => self::V1WEBHOOKS(), + 'v1-certificates' => self::V1CERTIFICATES(), + 'v1-builds' => self::V1BUILDS(), + 'v1-screenshots' => self::V1SCREENSHOTS(), + 'v1-messaging' => self::V1MESSAGING(), + 'v1-migrations' => self::V1MIGRATIONS(), + default => throw new \InvalidArgumentException('Unknown Name value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index 9e12b9a..70d70d5 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -336,4 +336,50 @@ public static function ZOOM(): OAuthProvider } return self::$ZOOM; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'amazon' => self::AMAZON(), + 'apple' => self::APPLE(), + 'auth0' => self::AUTH0(), + 'authentik' => self::AUTHENTIK(), + 'autodesk' => self::AUTODESK(), + 'bitbucket' => self::BITBUCKET(), + 'bitly' => self::BITLY(), + 'box' => self::BOX(), + 'dailymotion' => self::DAILYMOTION(), + 'discord' => self::DISCORD(), + 'disqus' => self::DISQUS(), + 'dropbox' => self::DROPBOX(), + 'etsy' => self::ETSY(), + 'facebook' => self::FACEBOOK(), + 'figma' => self::FIGMA(), + 'github' => self::GITHUB(), + 'gitlab' => self::GITLAB(), + 'google' => self::GOOGLE(), + 'linkedin' => self::LINKEDIN(), + 'microsoft' => self::MICROSOFT(), + 'notion' => self::NOTION(), + 'oidc' => self::OIDC(), + 'okta' => self::OKTA(), + 'paypal' => self::PAYPAL(), + 'paypalSandbox' => self::PAYPALSANDBOX(), + 'podio' => self::PODIO(), + 'salesforce' => self::SALESFORCE(), + 'slack' => self::SLACK(), + 'spotify' => self::SPOTIFY(), + 'stripe' => self::STRIPE(), + 'tradeshift' => self::TRADESHIFT(), + 'tradeshiftBox' => self::TRADESHIFTBOX(), + 'twitch' => self::TWITCH(), + 'wordpress' => self::WORDPRESS(), + 'yahoo' => self::YAHOO(), + 'yammer' => self::YAMMER(), + 'yandex' => self::YANDEX(), + 'zoho' => self::ZOHO(), + 'zoom' => self::ZOOM(), + default => throw new \InvalidArgumentException('Unknown OAuthProvider value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OrderBy.php b/src/Appwrite/Enums/OrderBy.php index 457dd7a..ee63245 100644 --- a/src/Appwrite/Enums/OrderBy.php +++ b/src/Appwrite/Enums/OrderBy.php @@ -40,4 +40,13 @@ public static function DESC(): OrderBy } return self::$DESC; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'asc' => self::ASC(), + 'desc' => self::DESC(), + default => throw new \InvalidArgumentException('Unknown OrderBy value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/PasswordHash.php b/src/Appwrite/Enums/PasswordHash.php index 27d080d..63de69b 100644 --- a/src/Appwrite/Enums/PasswordHash.php +++ b/src/Appwrite/Enums/PasswordHash.php @@ -112,4 +112,22 @@ public static function SHA3512(): PasswordHash } return self::$SHA3512; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'sha1' => self::SHA1(), + 'sha224' => self::SHA224(), + 'sha256' => self::SHA256(), + 'sha384' => self::SHA384(), + 'sha512/224' => self::SHA512224(), + 'sha512/256' => self::SHA512256(), + 'sha512' => self::SHA512(), + 'sha3-224' => self::SHA3224(), + 'sha3-256' => self::SHA3256(), + 'sha3-384' => self::SHA3384(), + 'sha3-512' => self::SHA3512(), + default => throw new \InvalidArgumentException('Unknown PasswordHash value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/RelationMutate.php b/src/Appwrite/Enums/RelationMutate.php index 0357acc..6e02d82 100644 --- a/src/Appwrite/Enums/RelationMutate.php +++ b/src/Appwrite/Enums/RelationMutate.php @@ -48,4 +48,14 @@ public static function SETNULL(): RelationMutate } return self::$SETNULL; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'cascade' => self::CASCADE(), + 'restrict' => self::RESTRICT(), + 'setNull' => self::SETNULL(), + default => throw new \InvalidArgumentException('Unknown RelationMutate value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/RelationshipType.php b/src/Appwrite/Enums/RelationshipType.php index b920b50..f2d6e2e 100644 --- a/src/Appwrite/Enums/RelationshipType.php +++ b/src/Appwrite/Enums/RelationshipType.php @@ -56,4 +56,15 @@ public static function ONETOMANY(): RelationshipType } return self::$ONETOMANY; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'oneToOne' => self::ONETOONE(), + 'manyToOne' => self::MANYTOONE(), + 'manyToMany' => self::MANYTOMANY(), + 'oneToMany' => self::ONETOMANY(), + default => throw new \InvalidArgumentException('Unknown RelationshipType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 2388a96..18825a6 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -54,6 +54,7 @@ class Runtime implements JsonSerializable private static Runtime $DART38; private static Runtime $DART39; private static Runtime $DART310; + private static Runtime $DART311; private static Runtime $DOTNET60; private static Runtime $DOTNET70; private static Runtime $DOTNET80; @@ -92,6 +93,7 @@ class Runtime implements JsonSerializable private static Runtime $FLUTTER332; private static Runtime $FLUTTER335; private static Runtime $FLUTTER338; + private static Runtime $FLUTTER341; private string $value; @@ -446,6 +448,13 @@ public static function DART310(): Runtime } return self::$DART310; } + public static function DART311(): Runtime + { + if (!isset(self::$DART311)) { + self::$DART311 = new Runtime('dart-3.11'); + } + return self::$DART311; + } public static function DOTNET60(): Runtime { if (!isset(self::$DOTNET60)) { @@ -712,4 +721,106 @@ public static function FLUTTER338(): Runtime } return self::$FLUTTER338; } -} \ No newline at end of file + public static function FLUTTER341(): Runtime + { + if (!isset(self::$FLUTTER341)) { + self::$FLUTTER341 = new Runtime('flutter-3.41'); + } + return self::$FLUTTER341; + } + + public static function from(string $value): self + { + return match ($value) { + 'node-14.5' => self::NODE145(), + 'node-16.0' => self::NODE160(), + 'node-18.0' => self::NODE180(), + 'node-19.0' => self::NODE190(), + 'node-20.0' => self::NODE200(), + 'node-21.0' => self::NODE210(), + 'node-22' => self::NODE22(), + 'node-23' => self::NODE23(), + 'node-24' => self::NODE24(), + 'node-25' => self::NODE25(), + 'php-8.0' => self::PHP80(), + 'php-8.1' => self::PHP81(), + 'php-8.2' => self::PHP82(), + 'php-8.3' => self::PHP83(), + 'php-8.4' => self::PHP84(), + 'ruby-3.0' => self::RUBY30(), + 'ruby-3.1' => self::RUBY31(), + 'ruby-3.2' => self::RUBY32(), + 'ruby-3.3' => self::RUBY33(), + 'ruby-3.4' => self::RUBY34(), + 'ruby-4.0' => self::RUBY40(), + 'python-3.8' => self::PYTHON38(), + 'python-3.9' => self::PYTHON39(), + 'python-3.10' => self::PYTHON310(), + 'python-3.11' => self::PYTHON311(), + 'python-3.12' => self::PYTHON312(), + 'python-3.13' => self::PYTHON313(), + 'python-3.14' => self::PYTHON314(), + 'python-ml-3.11' => self::PYTHONML311(), + 'python-ml-3.12' => self::PYTHONML312(), + 'python-ml-3.13' => self::PYTHONML313(), + 'deno-1.40' => self::DENO140(), + 'deno-1.46' => self::DENO146(), + 'deno-2.0' => self::DENO20(), + 'deno-2.5' => self::DENO25(), + 'deno-2.6' => self::DENO26(), + 'dart-2.15' => self::DART215(), + 'dart-2.16' => self::DART216(), + 'dart-2.17' => self::DART217(), + 'dart-2.18' => self::DART218(), + 'dart-2.19' => self::DART219(), + 'dart-3.0' => self::DART30(), + 'dart-3.1' => self::DART31(), + 'dart-3.3' => self::DART33(), + 'dart-3.5' => self::DART35(), + 'dart-3.8' => self::DART38(), + 'dart-3.9' => self::DART39(), + 'dart-3.10' => self::DART310(), + 'dart-3.11' => self::DART311(), + 'dotnet-6.0' => self::DOTNET60(), + 'dotnet-7.0' => self::DOTNET70(), + 'dotnet-8.0' => self::DOTNET80(), + 'dotnet-10' => self::DOTNET10(), + 'java-8.0' => self::JAVA80(), + 'java-11.0' => self::JAVA110(), + 'java-17.0' => self::JAVA170(), + 'java-18.0' => self::JAVA180(), + 'java-21.0' => self::JAVA210(), + 'java-22' => self::JAVA22(), + 'java-25' => self::JAVA25(), + 'swift-5.5' => self::SWIFT55(), + 'swift-5.8' => self::SWIFT58(), + 'swift-5.9' => self::SWIFT59(), + 'swift-5.10' => self::SWIFT510(), + 'swift-6.2' => self::SWIFT62(), + 'kotlin-1.6' => self::KOTLIN16(), + 'kotlin-1.8' => self::KOTLIN18(), + 'kotlin-1.9' => self::KOTLIN19(), + 'kotlin-2.0' => self::KOTLIN20(), + 'kotlin-2.3' => self::KOTLIN23(), + 'cpp-17' => self::CPP17(), + 'cpp-20' => self::CPP20(), + 'bun-1.0' => self::BUN10(), + 'bun-1.1' => self::BUN11(), + 'bun-1.2' => self::BUN12(), + 'bun-1.3' => self::BUN13(), + 'go-1.23' => self::GO123(), + 'go-1.24' => self::GO124(), + 'go-1.25' => self::GO125(), + 'go-1.26' => self::GO126(), + 'static-1' => self::STATIC1(), + 'flutter-3.24' => self::FLUTTER324(), + 'flutter-3.27' => self::FLUTTER327(), + 'flutter-3.29' => self::FLUTTER329(), + 'flutter-3.32' => self::FLUTTER332(), + 'flutter-3.35' => self::FLUTTER335(), + 'flutter-3.38' => self::FLUTTER338(), + 'flutter-3.41' => self::FLUTTER341(), + default => throw new \InvalidArgumentException('Unknown Runtime value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Scopes.php b/src/Appwrite/Enums/Scopes.php index 1f2165e..5087bf7 100644 --- a/src/Appwrite/Enums/Scopes.php +++ b/src/Appwrite/Enums/Scopes.php @@ -584,4 +584,81 @@ public static function EVENTSREAD(): Scopes } return self::$EVENTSREAD; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'sessions.write' => self::SESSIONSWRITE(), + 'users.read' => self::USERSREAD(), + 'users.write' => self::USERSWRITE(), + 'teams.read' => self::TEAMSREAD(), + 'teams.write' => self::TEAMSWRITE(), + 'databases.read' => self::DATABASESREAD(), + 'databases.write' => self::DATABASESWRITE(), + 'collections.read' => self::COLLECTIONSREAD(), + 'collections.write' => self::COLLECTIONSWRITE(), + 'tables.read' => self::TABLESREAD(), + 'tables.write' => self::TABLESWRITE(), + 'attributes.read' => self::ATTRIBUTESREAD(), + 'attributes.write' => self::ATTRIBUTESWRITE(), + 'columns.read' => self::COLUMNSREAD(), + 'columns.write' => self::COLUMNSWRITE(), + 'indexes.read' => self::INDEXESREAD(), + 'indexes.write' => self::INDEXESWRITE(), + 'documents.read' => self::DOCUMENTSREAD(), + 'documents.write' => self::DOCUMENTSWRITE(), + 'rows.read' => self::ROWSREAD(), + 'rows.write' => self::ROWSWRITE(), + 'files.read' => self::FILESREAD(), + 'files.write' => self::FILESWRITE(), + 'buckets.read' => self::BUCKETSREAD(), + 'buckets.write' => self::BUCKETSWRITE(), + 'functions.read' => self::FUNCTIONSREAD(), + 'functions.write' => self::FUNCTIONSWRITE(), + 'sites.read' => self::SITESREAD(), + 'sites.write' => self::SITESWRITE(), + 'log.read' => self::LOGREAD(), + 'log.write' => self::LOGWRITE(), + 'execution.read' => self::EXECUTIONREAD(), + 'execution.write' => self::EXECUTIONWRITE(), + 'locale.read' => self::LOCALEREAD(), + 'avatars.read' => self::AVATARSREAD(), + 'health.read' => self::HEALTHREAD(), + 'providers.read' => self::PROVIDERSREAD(), + 'providers.write' => self::PROVIDERSWRITE(), + 'messages.read' => self::MESSAGESREAD(), + 'messages.write' => self::MESSAGESWRITE(), + 'topics.read' => self::TOPICSREAD(), + 'topics.write' => self::TOPICSWRITE(), + 'subscribers.read' => self::SUBSCRIBERSREAD(), + 'subscribers.write' => self::SUBSCRIBERSWRITE(), + 'targets.read' => self::TARGETSREAD(), + 'targets.write' => self::TARGETSWRITE(), + 'rules.read' => self::RULESREAD(), + 'rules.write' => self::RULESWRITE(), + 'schedules.read' => self::SCHEDULESREAD(), + 'schedules.write' => self::SCHEDULESWRITE(), + 'migrations.read' => self::MIGRATIONSREAD(), + 'migrations.write' => self::MIGRATIONSWRITE(), + 'vcs.read' => self::VCSREAD(), + 'vcs.write' => self::VCSWRITE(), + 'assistant.read' => self::ASSISTANTREAD(), + 'tokens.read' => self::TOKENSREAD(), + 'tokens.write' => self::TOKENSWRITE(), + 'webhooks.read' => self::WEBHOOKSREAD(), + 'webhooks.write' => self::WEBHOOKSWRITE(), + 'project.read' => self::PROJECTREAD(), + 'project.write' => self::PROJECTWRITE(), + 'policies.write' => self::POLICIESWRITE(), + 'policies.read' => self::POLICIESREAD(), + 'archives.read' => self::ARCHIVESREAD(), + 'archives.write' => self::ARCHIVESWRITE(), + 'restorations.read' => self::RESTORATIONSREAD(), + 'restorations.write' => self::RESTORATIONSWRITE(), + 'domains.read' => self::DOMAINSREAD(), + 'domains.write' => self::DOMAINSWRITE(), + 'events.read' => self::EVENTSREAD(), + default => throw new \InvalidArgumentException('Unknown Scopes value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/SmtpEncryption.php b/src/Appwrite/Enums/SmtpEncryption.php index 53b7a04..6f0e2f1 100644 --- a/src/Appwrite/Enums/SmtpEncryption.php +++ b/src/Appwrite/Enums/SmtpEncryption.php @@ -48,4 +48,14 @@ public static function TLS(): SmtpEncryption } return self::$TLS; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'ssl' => self::SSL(), + 'tls' => self::TLS(), + default => throw new \InvalidArgumentException('Unknown SmtpEncryption value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/TablesDBIndexType.php b/src/Appwrite/Enums/TablesDBIndexType.php index f82b337..e9fa174 100644 --- a/src/Appwrite/Enums/TablesDBIndexType.php +++ b/src/Appwrite/Enums/TablesDBIndexType.php @@ -56,4 +56,15 @@ public static function SPATIAL(): TablesDBIndexType } return self::$SPATIAL; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'key' => self::KEY(), + 'fulltext' => self::FULLTEXT(), + 'unique' => self::UNIQUE(), + 'spatial' => self::SPATIAL(), + default => throw new \InvalidArgumentException('Unknown TablesDBIndexType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/TemplateReferenceType.php b/src/Appwrite/Enums/TemplateReferenceType.php index 605fc3a..e81e29c 100644 --- a/src/Appwrite/Enums/TemplateReferenceType.php +++ b/src/Appwrite/Enums/TemplateReferenceType.php @@ -48,4 +48,14 @@ public static function TAG(): TemplateReferenceType } return self::$TAG; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'commit' => self::COMMIT(), + 'branch' => self::BRANCH(), + 'tag' => self::TAG(), + default => throw new \InvalidArgumentException('Unknown TemplateReferenceType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Theme.php b/src/Appwrite/Enums/Theme.php index f17c100..fd6a7f2 100644 --- a/src/Appwrite/Enums/Theme.php +++ b/src/Appwrite/Enums/Theme.php @@ -40,4 +40,13 @@ public static function DARK(): Theme } return self::$DARK; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'light' => self::LIGHT(), + 'dark' => self::DARK(), + default => throw new \InvalidArgumentException('Unknown Theme value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Timezone.php b/src/Appwrite/Enums/Timezone.php index 67d4571..47805f7 100644 --- a/src/Appwrite/Enums/Timezone.php +++ b/src/Appwrite/Enums/Timezone.php @@ -3376,4 +3376,430 @@ public static function UTC(): Timezone } return self::$UTC; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'africa/abidjan' => self::AFRICAABIDJAN(), + 'africa/accra' => self::AFRICAACCRA(), + 'africa/addis_ababa' => self::AFRICAADDISABABA(), + 'africa/algiers' => self::AFRICAALGIERS(), + 'africa/asmara' => self::AFRICAASMARA(), + 'africa/bamako' => self::AFRICABAMAKO(), + 'africa/bangui' => self::AFRICABANGUI(), + 'africa/banjul' => self::AFRICABANJUL(), + 'africa/bissau' => self::AFRICABISSAU(), + 'africa/blantyre' => self::AFRICABLANTYRE(), + 'africa/brazzaville' => self::AFRICABRAZZAVILLE(), + 'africa/bujumbura' => self::AFRICABUJUMBURA(), + 'africa/cairo' => self::AFRICACAIRO(), + 'africa/casablanca' => self::AFRICACASABLANCA(), + 'africa/ceuta' => self::AFRICACEUTA(), + 'africa/conakry' => self::AFRICACONAKRY(), + 'africa/dakar' => self::AFRICADAKAR(), + 'africa/dar_es_salaam' => self::AFRICADARESSALAAM(), + 'africa/djibouti' => self::AFRICADJIBOUTI(), + 'africa/douala' => self::AFRICADOUALA(), + 'africa/el_aaiun' => self::AFRICAELAAIUN(), + 'africa/freetown' => self::AFRICAFREETOWN(), + 'africa/gaborone' => self::AFRICAGABORONE(), + 'africa/harare' => self::AFRICAHARARE(), + 'africa/johannesburg' => self::AFRICAJOHANNESBURG(), + 'africa/juba' => self::AFRICAJUBA(), + 'africa/kampala' => self::AFRICAKAMPALA(), + 'africa/khartoum' => self::AFRICAKHARTOUM(), + 'africa/kigali' => self::AFRICAKIGALI(), + 'africa/kinshasa' => self::AFRICAKINSHASA(), + 'africa/lagos' => self::AFRICALAGOS(), + 'africa/libreville' => self::AFRICALIBREVILLE(), + 'africa/lome' => self::AFRICALOME(), + 'africa/luanda' => self::AFRICALUANDA(), + 'africa/lubumbashi' => self::AFRICALUBUMBASHI(), + 'africa/lusaka' => self::AFRICALUSAKA(), + 'africa/malabo' => self::AFRICAMALABO(), + 'africa/maputo' => self::AFRICAMAPUTO(), + 'africa/maseru' => self::AFRICAMASERU(), + 'africa/mbabane' => self::AFRICAMBABANE(), + 'africa/mogadishu' => self::AFRICAMOGADISHU(), + 'africa/monrovia' => self::AFRICAMONROVIA(), + 'africa/nairobi' => self::AFRICANAIROBI(), + 'africa/ndjamena' => self::AFRICANDJAMENA(), + 'africa/niamey' => self::AFRICANIAMEY(), + 'africa/nouakchott' => self::AFRICANOUAKCHOTT(), + 'africa/ouagadougou' => self::AFRICAOUAGADOUGOU(), + 'africa/porto-novo' => self::AFRICAPORTONOVO(), + 'africa/sao_tome' => self::AFRICASAOTOME(), + 'africa/tripoli' => self::AFRICATRIPOLI(), + 'africa/tunis' => self::AFRICATUNIS(), + 'africa/windhoek' => self::AFRICAWINDHOEK(), + 'america/adak' => self::AMERICAADAK(), + 'america/anchorage' => self::AMERICAANCHORAGE(), + 'america/anguilla' => self::AMERICAANGUILLA(), + 'america/antigua' => self::AMERICAANTIGUA(), + 'america/araguaina' => self::AMERICAARAGUAINA(), + 'america/argentina/buenos_aires' => self::AMERICAARGENTINABUENOSAIRES(), + 'america/argentina/catamarca' => self::AMERICAARGENTINACATAMARCA(), + 'america/argentina/cordoba' => self::AMERICAARGENTINACORDOBA(), + 'america/argentina/jujuy' => self::AMERICAARGENTINAJUJUY(), + 'america/argentina/la_rioja' => self::AMERICAARGENTINALARIOJA(), + 'america/argentina/mendoza' => self::AMERICAARGENTINAMENDOZA(), + 'america/argentina/rio_gallegos' => self::AMERICAARGENTINARIOGALLEGOS(), + 'america/argentina/salta' => self::AMERICAARGENTINASALTA(), + 'america/argentina/san_juan' => self::AMERICAARGENTINASANJUAN(), + 'america/argentina/san_luis' => self::AMERICAARGENTINASANLUIS(), + 'america/argentina/tucuman' => self::AMERICAARGENTINATUCUMAN(), + 'america/argentina/ushuaia' => self::AMERICAARGENTINAUSHUAIA(), + 'america/aruba' => self::AMERICAARUBA(), + 'america/asuncion' => self::AMERICAASUNCION(), + 'america/atikokan' => self::AMERICAATIKOKAN(), + 'america/bahia' => self::AMERICABAHIA(), + 'america/bahia_banderas' => self::AMERICABAHIABANDERAS(), + 'america/barbados' => self::AMERICABARBADOS(), + 'america/belem' => self::AMERICABELEM(), + 'america/belize' => self::AMERICABELIZE(), + 'america/blanc-sablon' => self::AMERICABLANCSABLON(), + 'america/boa_vista' => self::AMERICABOAVISTA(), + 'america/bogota' => self::AMERICABOGOTA(), + 'america/boise' => self::AMERICABOISE(), + 'america/cambridge_bay' => self::AMERICACAMBRIDGEBAY(), + 'america/campo_grande' => self::AMERICACAMPOGRANDE(), + 'america/cancun' => self::AMERICACANCUN(), + 'america/caracas' => self::AMERICACARACAS(), + 'america/cayenne' => self::AMERICACAYENNE(), + 'america/cayman' => self::AMERICACAYMAN(), + 'america/chicago' => self::AMERICACHICAGO(), + 'america/chihuahua' => self::AMERICACHIHUAHUA(), + 'america/ciudad_juarez' => self::AMERICACIUDADJUAREZ(), + 'america/costa_rica' => self::AMERICACOSTARICA(), + 'america/coyhaique' => self::AMERICACOYHAIQUE(), + 'america/creston' => self::AMERICACRESTON(), + 'america/cuiaba' => self::AMERICACUIABA(), + 'america/curacao' => self::AMERICACURACAO(), + 'america/danmarkshavn' => self::AMERICADANMARKSHAVN(), + 'america/dawson' => self::AMERICADAWSON(), + 'america/dawson_creek' => self::AMERICADAWSONCREEK(), + 'america/denver' => self::AMERICADENVER(), + 'america/detroit' => self::AMERICADETROIT(), + 'america/dominica' => self::AMERICADOMINICA(), + 'america/edmonton' => self::AMERICAEDMONTON(), + 'america/eirunepe' => self::AMERICAEIRUNEPE(), + 'america/el_salvador' => self::AMERICAELSALVADOR(), + 'america/fort_nelson' => self::AMERICAFORTNELSON(), + 'america/fortaleza' => self::AMERICAFORTALEZA(), + 'america/glace_bay' => self::AMERICAGLACEBAY(), + 'america/goose_bay' => self::AMERICAGOOSEBAY(), + 'america/grand_turk' => self::AMERICAGRANDTURK(), + 'america/grenada' => self::AMERICAGRENADA(), + 'america/guadeloupe' => self::AMERICAGUADELOUPE(), + 'america/guatemala' => self::AMERICAGUATEMALA(), + 'america/guayaquil' => self::AMERICAGUAYAQUIL(), + 'america/guyana' => self::AMERICAGUYANA(), + 'america/halifax' => self::AMERICAHALIFAX(), + 'america/havana' => self::AMERICAHAVANA(), + 'america/hermosillo' => self::AMERICAHERMOSILLO(), + 'america/indiana/indianapolis' => self::AMERICAINDIANAINDIANAPOLIS(), + 'america/indiana/knox' => self::AMERICAINDIANAKNOX(), + 'america/indiana/marengo' => self::AMERICAINDIANAMARENGO(), + 'america/indiana/petersburg' => self::AMERICAINDIANAPETERSBURG(), + 'america/indiana/tell_city' => self::AMERICAINDIANATELLCITY(), + 'america/indiana/vevay' => self::AMERICAINDIANAVEVAY(), + 'america/indiana/vincennes' => self::AMERICAINDIANAVINCENNES(), + 'america/indiana/winamac' => self::AMERICAINDIANAWINAMAC(), + 'america/inuvik' => self::AMERICAINUVIK(), + 'america/iqaluit' => self::AMERICAIQALUIT(), + 'america/jamaica' => self::AMERICAJAMAICA(), + 'america/juneau' => self::AMERICAJUNEAU(), + 'america/kentucky/louisville' => self::AMERICAKENTUCKYLOUISVILLE(), + 'america/kentucky/monticello' => self::AMERICAKENTUCKYMONTICELLO(), + 'america/kralendijk' => self::AMERICAKRALENDIJK(), + 'america/la_paz' => self::AMERICALAPAZ(), + 'america/lima' => self::AMERICALIMA(), + 'america/los_angeles' => self::AMERICALOSANGELES(), + 'america/lower_princes' => self::AMERICALOWERPRINCES(), + 'america/maceio' => self::AMERICAMACEIO(), + 'america/managua' => self::AMERICAMANAGUA(), + 'america/manaus' => self::AMERICAMANAUS(), + 'america/marigot' => self::AMERICAMARIGOT(), + 'america/martinique' => self::AMERICAMARTINIQUE(), + 'america/matamoros' => self::AMERICAMATAMOROS(), + 'america/mazatlan' => self::AMERICAMAZATLAN(), + 'america/menominee' => self::AMERICAMENOMINEE(), + 'america/merida' => self::AMERICAMERIDA(), + 'america/metlakatla' => self::AMERICAMETLAKATLA(), + 'america/mexico_city' => self::AMERICAMEXICOCITY(), + 'america/miquelon' => self::AMERICAMIQUELON(), + 'america/moncton' => self::AMERICAMONCTON(), + 'america/monterrey' => self::AMERICAMONTERREY(), + 'america/montevideo' => self::AMERICAMONTEVIDEO(), + 'america/montserrat' => self::AMERICAMONTSERRAT(), + 'america/nassau' => self::AMERICANASSAU(), + 'america/new_york' => self::AMERICANEWYORK(), + 'america/nome' => self::AMERICANOME(), + 'america/noronha' => self::AMERICANORONHA(), + 'america/north_dakota/beulah' => self::AMERICANORTHDAKOTABEULAH(), + 'america/north_dakota/center' => self::AMERICANORTHDAKOTACENTER(), + 'america/north_dakota/new_salem' => self::AMERICANORTHDAKOTANEWSALEM(), + 'america/nuuk' => self::AMERICANUUK(), + 'america/ojinaga' => self::AMERICAOJINAGA(), + 'america/panama' => self::AMERICAPANAMA(), + 'america/paramaribo' => self::AMERICAPARAMARIBO(), + 'america/phoenix' => self::AMERICAPHOENIX(), + 'america/port-au-prince' => self::AMERICAPORTAUPRINCE(), + 'america/port_of_spain' => self::AMERICAPORTOFSPAIN(), + 'america/porto_velho' => self::AMERICAPORTOVELHO(), + 'america/puerto_rico' => self::AMERICAPUERTORICO(), + 'america/punta_arenas' => self::AMERICAPUNTAARENAS(), + 'america/rankin_inlet' => self::AMERICARANKININLET(), + 'america/recife' => self::AMERICARECIFE(), + 'america/regina' => self::AMERICAREGINA(), + 'america/resolute' => self::AMERICARESOLUTE(), + 'america/rio_branco' => self::AMERICARIOBRANCO(), + 'america/santarem' => self::AMERICASANTAREM(), + 'america/santiago' => self::AMERICASANTIAGO(), + 'america/santo_domingo' => self::AMERICASANTODOMINGO(), + 'america/sao_paulo' => self::AMERICASAOPAULO(), + 'america/scoresbysund' => self::AMERICASCORESBYSUND(), + 'america/sitka' => self::AMERICASITKA(), + 'america/st_barthelemy' => self::AMERICASTBARTHELEMY(), + 'america/st_johns' => self::AMERICASTJOHNS(), + 'america/st_kitts' => self::AMERICASTKITTS(), + 'america/st_lucia' => self::AMERICASTLUCIA(), + 'america/st_thomas' => self::AMERICASTTHOMAS(), + 'america/st_vincent' => self::AMERICASTVINCENT(), + 'america/swift_current' => self::AMERICASWIFTCURRENT(), + 'america/tegucigalpa' => self::AMERICATEGUCIGALPA(), + 'america/thule' => self::AMERICATHULE(), + 'america/tijuana' => self::AMERICATIJUANA(), + 'america/toronto' => self::AMERICATORONTO(), + 'america/tortola' => self::AMERICATORTOLA(), + 'america/vancouver' => self::AMERICAVANCOUVER(), + 'america/whitehorse' => self::AMERICAWHITEHORSE(), + 'america/winnipeg' => self::AMERICAWINNIPEG(), + 'america/yakutat' => self::AMERICAYAKUTAT(), + 'antarctica/casey' => self::ANTARCTICACASEY(), + 'antarctica/davis' => self::ANTARCTICADAVIS(), + 'antarctica/dumontdurville' => self::ANTARCTICADUMONTDURVILLE(), + 'antarctica/macquarie' => self::ANTARCTICAMACQUARIE(), + 'antarctica/mawson' => self::ANTARCTICAMAWSON(), + 'antarctica/mcmurdo' => self::ANTARCTICAMCMURDO(), + 'antarctica/palmer' => self::ANTARCTICAPALMER(), + 'antarctica/rothera' => self::ANTARCTICAROTHERA(), + 'antarctica/syowa' => self::ANTARCTICASYOWA(), + 'antarctica/troll' => self::ANTARCTICATROLL(), + 'antarctica/vostok' => self::ANTARCTICAVOSTOK(), + 'arctic/longyearbyen' => self::ARCTICLONGYEARBYEN(), + 'asia/aden' => self::ASIAADEN(), + 'asia/almaty' => self::ASIAALMATY(), + 'asia/amman' => self::ASIAAMMAN(), + 'asia/anadyr' => self::ASIAANADYR(), + 'asia/aqtau' => self::ASIAAQTAU(), + 'asia/aqtobe' => self::ASIAAQTOBE(), + 'asia/ashgabat' => self::ASIAASHGABAT(), + 'asia/atyrau' => self::ASIAATYRAU(), + 'asia/baghdad' => self::ASIABAGHDAD(), + 'asia/bahrain' => self::ASIABAHRAIN(), + 'asia/baku' => self::ASIABAKU(), + 'asia/bangkok' => self::ASIABANGKOK(), + 'asia/barnaul' => self::ASIABARNAUL(), + 'asia/beirut' => self::ASIABEIRUT(), + 'asia/bishkek' => self::ASIABISHKEK(), + 'asia/brunei' => self::ASIABRUNEI(), + 'asia/chita' => self::ASIACHITA(), + 'asia/colombo' => self::ASIACOLOMBO(), + 'asia/damascus' => self::ASIADAMASCUS(), + 'asia/dhaka' => self::ASIADHAKA(), + 'asia/dili' => self::ASIADILI(), + 'asia/dubai' => self::ASIADUBAI(), + 'asia/dushanbe' => self::ASIADUSHANBE(), + 'asia/famagusta' => self::ASIAFAMAGUSTA(), + 'asia/gaza' => self::ASIAGAZA(), + 'asia/hebron' => self::ASIAHEBRON(), + 'asia/ho_chi_minh' => self::ASIAHOCHIMINH(), + 'asia/hong_kong' => self::ASIAHONGKONG(), + 'asia/hovd' => self::ASIAHOVD(), + 'asia/irkutsk' => self::ASIAIRKUTSK(), + 'asia/jakarta' => self::ASIAJAKARTA(), + 'asia/jayapura' => self::ASIAJAYAPURA(), + 'asia/jerusalem' => self::ASIAJERUSALEM(), + 'asia/kabul' => self::ASIAKABUL(), + 'asia/kamchatka' => self::ASIAKAMCHATKA(), + 'asia/karachi' => self::ASIAKARACHI(), + 'asia/kathmandu' => self::ASIAKATHMANDU(), + 'asia/khandyga' => self::ASIAKHANDYGA(), + 'asia/kolkata' => self::ASIAKOLKATA(), + 'asia/krasnoyarsk' => self::ASIAKRASNOYARSK(), + 'asia/kuala_lumpur' => self::ASIAKUALALUMPUR(), + 'asia/kuching' => self::ASIAKUCHING(), + 'asia/kuwait' => self::ASIAKUWAIT(), + 'asia/macau' => self::ASIAMACAU(), + 'asia/magadan' => self::ASIAMAGADAN(), + 'asia/makassar' => self::ASIAMAKASSAR(), + 'asia/manila' => self::ASIAMANILA(), + 'asia/muscat' => self::ASIAMUSCAT(), + 'asia/nicosia' => self::ASIANICOSIA(), + 'asia/novokuznetsk' => self::ASIANOVOKUZNETSK(), + 'asia/novosibirsk' => self::ASIANOVOSIBIRSK(), + 'asia/omsk' => self::ASIAOMSK(), + 'asia/oral' => self::ASIAORAL(), + 'asia/phnom_penh' => self::ASIAPHNOMPENH(), + 'asia/pontianak' => self::ASIAPONTIANAK(), + 'asia/pyongyang' => self::ASIAPYONGYANG(), + 'asia/qatar' => self::ASIAQATAR(), + 'asia/qostanay' => self::ASIAQOSTANAY(), + 'asia/qyzylorda' => self::ASIAQYZYLORDA(), + 'asia/riyadh' => self::ASIARIYADH(), + 'asia/sakhalin' => self::ASIASAKHALIN(), + 'asia/samarkand' => self::ASIASAMARKAND(), + 'asia/seoul' => self::ASIASEOUL(), + 'asia/shanghai' => self::ASIASHANGHAI(), + 'asia/singapore' => self::ASIASINGAPORE(), + 'asia/srednekolymsk' => self::ASIASREDNEKOLYMSK(), + 'asia/taipei' => self::ASIATAIPEI(), + 'asia/tashkent' => self::ASIATASHKENT(), + 'asia/tbilisi' => self::ASIATBILISI(), + 'asia/tehran' => self::ASIATEHRAN(), + 'asia/thimphu' => self::ASIATHIMPHU(), + 'asia/tokyo' => self::ASIATOKYO(), + 'asia/tomsk' => self::ASIATOMSK(), + 'asia/ulaanbaatar' => self::ASIAULAANBAATAR(), + 'asia/urumqi' => self::ASIAURUMQI(), + 'asia/ust-nera' => self::ASIAUSTNERA(), + 'asia/vientiane' => self::ASIAVIENTIANE(), + 'asia/vladivostok' => self::ASIAVLADIVOSTOK(), + 'asia/yakutsk' => self::ASIAYAKUTSK(), + 'asia/yangon' => self::ASIAYANGON(), + 'asia/yekaterinburg' => self::ASIAYEKATERINBURG(), + 'asia/yerevan' => self::ASIAYEREVAN(), + 'atlantic/azores' => self::ATLANTICAZORES(), + 'atlantic/bermuda' => self::ATLANTICBERMUDA(), + 'atlantic/canary' => self::ATLANTICCANARY(), + 'atlantic/cape_verde' => self::ATLANTICCAPEVERDE(), + 'atlantic/faroe' => self::ATLANTICFAROE(), + 'atlantic/madeira' => self::ATLANTICMADEIRA(), + 'atlantic/reykjavik' => self::ATLANTICREYKJAVIK(), + 'atlantic/south_georgia' => self::ATLANTICSOUTHGEORGIA(), + 'atlantic/st_helena' => self::ATLANTICSTHELENA(), + 'atlantic/stanley' => self::ATLANTICSTANLEY(), + 'australia/adelaide' => self::AUSTRALIAADELAIDE(), + 'australia/brisbane' => self::AUSTRALIABRISBANE(), + 'australia/broken_hill' => self::AUSTRALIABROKENHILL(), + 'australia/darwin' => self::AUSTRALIADARWIN(), + 'australia/eucla' => self::AUSTRALIAEUCLA(), + 'australia/hobart' => self::AUSTRALIAHOBART(), + 'australia/lindeman' => self::AUSTRALIALINDEMAN(), + 'australia/lord_howe' => self::AUSTRALIALORDHOWE(), + 'australia/melbourne' => self::AUSTRALIAMELBOURNE(), + 'australia/perth' => self::AUSTRALIAPERTH(), + 'australia/sydney' => self::AUSTRALIASYDNEY(), + 'europe/amsterdam' => self::EUROPEAMSTERDAM(), + 'europe/andorra' => self::EUROPEANDORRA(), + 'europe/astrakhan' => self::EUROPEASTRAKHAN(), + 'europe/athens' => self::EUROPEATHENS(), + 'europe/belgrade' => self::EUROPEBELGRADE(), + 'europe/berlin' => self::EUROPEBERLIN(), + 'europe/bratislava' => self::EUROPEBRATISLAVA(), + 'europe/brussels' => self::EUROPEBRUSSELS(), + 'europe/bucharest' => self::EUROPEBUCHAREST(), + 'europe/budapest' => self::EUROPEBUDAPEST(), + 'europe/busingen' => self::EUROPEBUSINGEN(), + 'europe/chisinau' => self::EUROPECHISINAU(), + 'europe/copenhagen' => self::EUROPECOPENHAGEN(), + 'europe/dublin' => self::EUROPEDUBLIN(), + 'europe/gibraltar' => self::EUROPEGIBRALTAR(), + 'europe/guernsey' => self::EUROPEGUERNSEY(), + 'europe/helsinki' => self::EUROPEHELSINKI(), + 'europe/isle_of_man' => self::EUROPEISLEOFMAN(), + 'europe/istanbul' => self::EUROPEISTANBUL(), + 'europe/jersey' => self::EUROPEJERSEY(), + 'europe/kaliningrad' => self::EUROPEKALININGRAD(), + 'europe/kirov' => self::EUROPEKIROV(), + 'europe/kyiv' => self::EUROPEKYIV(), + 'europe/lisbon' => self::EUROPELISBON(), + 'europe/ljubljana' => self::EUROPELJUBLJANA(), + 'europe/london' => self::EUROPELONDON(), + 'europe/luxembourg' => self::EUROPELUXEMBOURG(), + 'europe/madrid' => self::EUROPEMADRID(), + 'europe/malta' => self::EUROPEMALTA(), + 'europe/mariehamn' => self::EUROPEMARIEHAMN(), + 'europe/minsk' => self::EUROPEMINSK(), + 'europe/monaco' => self::EUROPEMONACO(), + 'europe/moscow' => self::EUROPEMOSCOW(), + 'europe/oslo' => self::EUROPEOSLO(), + 'europe/paris' => self::EUROPEPARIS(), + 'europe/podgorica' => self::EUROPEPODGORICA(), + 'europe/prague' => self::EUROPEPRAGUE(), + 'europe/riga' => self::EUROPERIGA(), + 'europe/rome' => self::EUROPEROME(), + 'europe/samara' => self::EUROPESAMARA(), + 'europe/san_marino' => self::EUROPESANMARINO(), + 'europe/sarajevo' => self::EUROPESARAJEVO(), + 'europe/saratov' => self::EUROPESARATOV(), + 'europe/simferopol' => self::EUROPESIMFEROPOL(), + 'europe/skopje' => self::EUROPESKOPJE(), + 'europe/sofia' => self::EUROPESOFIA(), + 'europe/stockholm' => self::EUROPESTOCKHOLM(), + 'europe/tallinn' => self::EUROPETALLINN(), + 'europe/tirane' => self::EUROPETIRANE(), + 'europe/ulyanovsk' => self::EUROPEULYANOVSK(), + 'europe/vaduz' => self::EUROPEVADUZ(), + 'europe/vatican' => self::EUROPEVATICAN(), + 'europe/vienna' => self::EUROPEVIENNA(), + 'europe/vilnius' => self::EUROPEVILNIUS(), + 'europe/volgograd' => self::EUROPEVOLGOGRAD(), + 'europe/warsaw' => self::EUROPEWARSAW(), + 'europe/zagreb' => self::EUROPEZAGREB(), + 'europe/zurich' => self::EUROPEZURICH(), + 'indian/antananarivo' => self::INDIANANTANANARIVO(), + 'indian/chagos' => self::INDIANCHAGOS(), + 'indian/christmas' => self::INDIANCHRISTMAS(), + 'indian/cocos' => self::INDIANCOCOS(), + 'indian/comoro' => self::INDIANCOMORO(), + 'indian/kerguelen' => self::INDIANKERGUELEN(), + 'indian/mahe' => self::INDIANMAHE(), + 'indian/maldives' => self::INDIANMALDIVES(), + 'indian/mauritius' => self::INDIANMAURITIUS(), + 'indian/mayotte' => self::INDIANMAYOTTE(), + 'indian/reunion' => self::INDIANREUNION(), + 'pacific/apia' => self::PACIFICAPIA(), + 'pacific/auckland' => self::PACIFICAUCKLAND(), + 'pacific/bougainville' => self::PACIFICBOUGAINVILLE(), + 'pacific/chatham' => self::PACIFICCHATHAM(), + 'pacific/chuuk' => self::PACIFICCHUUK(), + 'pacific/easter' => self::PACIFICEASTER(), + 'pacific/efate' => self::PACIFICEFATE(), + 'pacific/fakaofo' => self::PACIFICFAKAOFO(), + 'pacific/fiji' => self::PACIFICFIJI(), + 'pacific/funafuti' => self::PACIFICFUNAFUTI(), + 'pacific/galapagos' => self::PACIFICGALAPAGOS(), + 'pacific/gambier' => self::PACIFICGAMBIER(), + 'pacific/guadalcanal' => self::PACIFICGUADALCANAL(), + 'pacific/guam' => self::PACIFICGUAM(), + 'pacific/honolulu' => self::PACIFICHONOLULU(), + 'pacific/kanton' => self::PACIFICKANTON(), + 'pacific/kiritimati' => self::PACIFICKIRITIMATI(), + 'pacific/kosrae' => self::PACIFICKOSRAE(), + 'pacific/kwajalein' => self::PACIFICKWAJALEIN(), + 'pacific/majuro' => self::PACIFICMAJURO(), + 'pacific/marquesas' => self::PACIFICMARQUESAS(), + 'pacific/midway' => self::PACIFICMIDWAY(), + 'pacific/nauru' => self::PACIFICNAURU(), + 'pacific/niue' => self::PACIFICNIUE(), + 'pacific/norfolk' => self::PACIFICNORFOLK(), + 'pacific/noumea' => self::PACIFICNOUMEA(), + 'pacific/pago_pago' => self::PACIFICPAGOPAGO(), + 'pacific/palau' => self::PACIFICPALAU(), + 'pacific/pitcairn' => self::PACIFICPITCAIRN(), + 'pacific/pohnpei' => self::PACIFICPOHNPEI(), + 'pacific/port_moresby' => self::PACIFICPORTMORESBY(), + 'pacific/rarotonga' => self::PACIFICRAROTONGA(), + 'pacific/saipan' => self::PACIFICSAIPAN(), + 'pacific/tahiti' => self::PACIFICTAHITI(), + 'pacific/tarawa' => self::PACIFICTARAWA(), + 'pacific/tongatapu' => self::PACIFICTONGATAPU(), + 'pacific/wake' => self::PACIFICWAKE(), + 'pacific/wallis' => self::PACIFICWALLIS(), + 'utc' => self::UTC(), + default => throw new \InvalidArgumentException('Unknown Timezone value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/VCSReferenceType.php b/src/Appwrite/Enums/VCSReferenceType.php index adeb723..e47aa03 100644 --- a/src/Appwrite/Enums/VCSReferenceType.php +++ b/src/Appwrite/Enums/VCSReferenceType.php @@ -48,4 +48,14 @@ public static function TAG(): VCSReferenceType } return self::$TAG; } -} \ No newline at end of file + + public static function from(string $value): self + { + return match ($value) { + 'branch' => self::BRANCH(), + 'commit' => self::COMMIT(), + 'tag' => self::TAG(), + default => throw new \InvalidArgumentException('Unknown VCSReferenceType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Models/ActivityEvent.php b/src/Appwrite/Models/ActivityEvent.php new file mode 100644 index 0000000..51483d4 --- /dev/null +++ b/src/Appwrite/Models/ActivityEvent.php @@ -0,0 +1,90 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id' + ]; + + /** + * ActivityEvent constructor. + * + * @param string $id event id. + * @param string $userType user type. + * @param string $userId user id. + * @param string $userEmail user email. + * @param string $userName user name. + * @param string $resourceParent resource parent. + * @param string $resourceType resource type. + * @param string $resourceId resource id. + * @param string $resource resource. + * @param string $event event name. + * @param string $userAgent user agent. + * @param string $ip ip address. + * @param string $mode api mode when event triggered. + * @param string $country location. + * @param string $time log creation date in iso 8601 format. + * @param string $projectId project id. + * @param string $teamId team id. + * @param string $hostname hostname. + * @param string $osCode operating system code name. view list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + * @param string $osName operating system name. + * @param string $osVersion operating system version. + * @param string $clientType client type. + * @param string $clientCode client code name. view list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + * @param string $clientName client name. + * @param string $clientVersion client version. + * @param string $clientEngine client engine name. + * @param string $clientEngineVersion client engine name. + * @param string $deviceName device name. + * @param string $deviceBrand device brand name. + * @param string $deviceModel device model name. + * @param string $countryCode country two-character iso 3166-1 alpha code. + * @param string $countryName country name. + */ + public function __construct( + public string $id, + public string $userType, + public string $userId, + public string $userEmail, + public string $userName, + public string $resourceParent, + public string $resourceType, + public string $resourceId, + public string $resource, + public string $event, + public string $userAgent, + public string $ip, + public string $mode, + public string $country, + public string $time, + public string $projectId, + public string $teamId, + public string $hostname, + public string $osCode, + public string $osName, + public string $osVersion, + public string $clientType, + public string $clientCode, + public string $clientName, + public string $clientVersion, + public string $clientEngine, + public string $clientEngineVersion, + public string $deviceName, + public string $deviceBrand, + public string $deviceModel, + public string $countryCode, + public string $countryName + ) { + } +} diff --git a/src/Appwrite/Models/ActivityEventList.php b/src/Appwrite/Models/ActivityEventList.php new file mode 100644 index 0000000..8987e2f --- /dev/null +++ b/src/Appwrite/Models/ActivityEventList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'events' => ActivityEvent::class + ]; + + /** + * ActivityEventList constructor. + * + * @param int $total total number of events that matched your query. + * @param list $events list of events. + */ + public function __construct( + public int $total, + public array $events + ) { + } +} diff --git a/src/Appwrite/Models/AlgoArgon2.php b/src/Appwrite/Models/AlgoArgon2.php new file mode 100644 index 0000000..1196f63 --- /dev/null +++ b/src/Appwrite/Models/AlgoArgon2.php @@ -0,0 +1,27 @@ + $data + */ + public static function from(array $data): static + { + $reflection = new \ReflectionClass(static::class); + $constructor = $reflection->getConstructor(); + + if ($constructor === null) { + return new static(); + } + + $arguments = []; + + foreach ($constructor->getParameters() as $parameter) { + $name = $parameter->getName(); + + if ($name === 'data' && static::hasAdditionalProperties()) { + $arguments[$name] = isset($data['data']) && is_array($data['data']) ? $data['data'] : $data; + continue; + } + + $field = static::getFieldMap()[$name] ?? $name; + + if (!array_key_exists($field, $data)) { + if ($parameter->isDefaultValueAvailable()) { + $arguments[$name] = $parameter->getDefaultValue(); + continue; + } + + throw new \InvalidArgumentException('Missing required field "' . $field . '" for ' . static::class . '.'); + } + + $arguments[$name] = static::hydrateValue($name, $data[$field], $parameter); + } + + return new static(...$arguments); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = []; + + foreach (get_object_vars($this) as $name => $value) { + $field = static::getFieldMap()[$name] ?? $name; + $result[$field] = static::serializeValue($value); + } + + return $result; + } + + /** + * @return array + */ + private static function getFieldMap(): array + { + return defined(static::class . '::FIELD_MAP') ? static::FIELD_MAP : []; + } + + /** + * @return array + */ + private static function getArrayTypes(): array + { + return defined(static::class . '::ARRAY_TYPES') ? static::ARRAY_TYPES : []; + } + + private static function hasAdditionalProperties(): bool + { + return defined(static::class . '::ADDITIONAL_PROPERTIES') && static::ADDITIONAL_PROPERTIES; + } + + private static function hydrateValue(string $name, mixed $value, \ReflectionParameter $parameter): mixed + { + if ($value === null) { + return null; + } + + $type = $parameter->getType(); + + if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()) { + $typeName = $type->getName(); + + if (!method_exists($typeName, 'from')) { + return $value; + } + + return is_array($value) ? $typeName::from($value) : $typeName::from((string) $value); + } + + if ($type instanceof \ReflectionNamedType && $type->getName() === 'array' && is_array($value)) { + $arrayType = static::getArrayTypes()[$name] ?? null; + + if ($arrayType === null) { + return $value; + } + + return array_map( + static fn (mixed $item): mixed => static::hydrateArrayItem($arrayType, $item), + $value + ); + } + + return $value; + } + + private static function hydrateArrayItem(string $type, mixed $value): mixed + { + if ($value === null || !method_exists($type, 'from')) { + return $value; + } + + return is_array($value) ? $type::from($value) : $type::from((string) $value); + } + + private static function serializeValue(mixed $value): mixed + { + if ($value === null) { + return null; + } + + if (is_array($value)) { + return array_map( + static fn (mixed $item): mixed => static::serializeValue($item), + $value + ); + } + + if (is_object($value)) { + if (method_exists($value, 'toArray')) { + return $value->toArray(); + } + + if ($value instanceof \JsonSerializable) { + return $value->jsonSerialize(); + } + + if (method_exists($value, '__toString')) { + return (string) $value; + } + } + + return $value; + } +} diff --git a/src/Appwrite/Models/AttributeBoolean.php b/src/Appwrite/Models/AttributeBoolean.php new file mode 100644 index 0000000..56e55e4 --- /dev/null +++ b/src/Appwrite/Models/AttributeBoolean.php @@ -0,0 +1,49 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeBoolean constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param bool|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?bool $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeDatetime.php b/src/Appwrite/Models/AttributeDatetime.php new file mode 100644 index 0000000..0f96143 --- /dev/null +++ b/src/Appwrite/Models/AttributeDatetime.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeDatetime constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param string $format iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. only null is optional + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeEmail.php b/src/Appwrite/Models/AttributeEmail.php new file mode 100644 index 0000000..a5163cb --- /dev/null +++ b/src/Appwrite/Models/AttributeEmail.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeEmail constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param string $format string format. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeEnum.php b/src/Appwrite/Models/AttributeEnum.php new file mode 100644 index 0000000..ad7dcdb --- /dev/null +++ b/src/Appwrite/Models/AttributeEnum.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeEnum constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param array $elements array of elements in enumerated type. + * @param string $format string format. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public array $elements, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeFloat.php b/src/Appwrite/Models/AttributeFloat.php new file mode 100644 index 0000000..6ac1a6f --- /dev/null +++ b/src/Appwrite/Models/AttributeFloat.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeFloat constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param float|null $min minimum value to enforce for new documents. + * @param float|null $max maximum value to enforce for new documents. + * @param float|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?float $min = null, + public ?float $max = null, + public ?float $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeInteger.php b/src/Appwrite/Models/AttributeInteger.php new file mode 100644 index 0000000..a5b02dc --- /dev/null +++ b/src/Appwrite/Models/AttributeInteger.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeInteger constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param int|null $min minimum value to enforce for new documents. + * @param int|null $max maximum value to enforce for new documents. + * @param int|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?int $min = null, + public ?int $max = null, + public ?int $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeIp.php b/src/Appwrite/Models/AttributeIp.php new file mode 100644 index 0000000..53e4395 --- /dev/null +++ b/src/Appwrite/Models/AttributeIp.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeIp constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param string $format string format. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeLine.php b/src/Appwrite/Models/AttributeLine.php new file mode 100644 index 0000000..fe2fd2d --- /dev/null +++ b/src/Appwrite/Models/AttributeLine.php @@ -0,0 +1,49 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeLine constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param array|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?array $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeList.php b/src/Appwrite/Models/AttributeList.php new file mode 100644 index 0000000..31808ef --- /dev/null +++ b/src/Appwrite/Models/AttributeList.php @@ -0,0 +1,23 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeLongtext constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + * @param bool|null $encrypt defines whether this attribute is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeMediumtext.php b/src/Appwrite/Models/AttributeMediumtext.php new file mode 100644 index 0000000..c671a76 --- /dev/null +++ b/src/Appwrite/Models/AttributeMediumtext.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeMediumtext constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + * @param bool|null $encrypt defines whether this attribute is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributePoint.php b/src/Appwrite/Models/AttributePoint.php new file mode 100644 index 0000000..1124573 --- /dev/null +++ b/src/Appwrite/Models/AttributePoint.php @@ -0,0 +1,49 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributePoint constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param array|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?array $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributePolygon.php b/src/Appwrite/Models/AttributePolygon.php new file mode 100644 index 0000000..88c3fb0 --- /dev/null +++ b/src/Appwrite/Models/AttributePolygon.php @@ -0,0 +1,49 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributePolygon constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param array|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?array $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeRelationship.php b/src/Appwrite/Models/AttributeRelationship.php new file mode 100644 index 0000000..b57e248 --- /dev/null +++ b/src/Appwrite/Models/AttributeRelationship.php @@ -0,0 +1,58 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * AttributeRelationship constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param string $relatedCollection the id of the related collection. + * @param string $relationType the type of the relationship. + * @param bool $twoWay is the relationship two-way? + * @param string $twoWayKey the key of the two-way relationship. + * @param string $onDelete how deleting the parent document will propagate to child documents. + * @param string $side whether this is the parent or child side of the relationship + * @param bool|null $xarray is attribute an array? + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $relatedCollection, + public string $relationType, + public bool $twoWay, + public string $twoWayKey, + public string $onDelete, + public string $side, + public ?bool $xarray = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeString.php b/src/Appwrite/Models/AttributeString.php new file mode 100644 index 0000000..366855b --- /dev/null +++ b/src/Appwrite/Models/AttributeString.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeString constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param int $size attribute size. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + * @param bool|null $encrypt defines whether this attribute is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public int $size, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeText.php b/src/Appwrite/Models/AttributeText.php new file mode 100644 index 0000000..9ba2a24 --- /dev/null +++ b/src/Appwrite/Models/AttributeText.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeText constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + * @param bool|null $encrypt defines whether this attribute is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeUrl.php b/src/Appwrite/Models/AttributeUrl.php new file mode 100644 index 0000000..5dcb9fb --- /dev/null +++ b/src/Appwrite/Models/AttributeUrl.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeUrl constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param string $format string format. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/AttributeVarchar.php b/src/Appwrite/Models/AttributeVarchar.php new file mode 100644 index 0000000..b3d0ca9 --- /dev/null +++ b/src/Appwrite/Models/AttributeVarchar.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * AttributeVarchar constructor. + * + * @param string $key attribute key. + * @param string $type attribute type. + * @param AttributeStatus $status attribute status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an attribute. + * @param bool $required is attribute required? + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. + * @param int $size attribute size. + * @param bool|null $xarray is attribute an array? + * @param string|null $xdefault default value for attribute when not provided. cannot be set when attribute is required. + * @param bool|null $encrypt defines whether this attribute is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public AttributeStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public int $size, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/BackupArchive.php b/src/Appwrite/Models/BackupArchive.php new file mode 100644 index 0000000..418cb8e --- /dev/null +++ b/src/Appwrite/Models/BackupArchive.php @@ -0,0 +1,52 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * BackupArchive constructor. + * + * @param string $id archive id. + * @param string $createdAt archive creation time in iso 8601 format. + * @param string $updatedAt archive update date in iso 8601 format. + * @param string $policyId archive policy id. + * @param int $size archive size in bytes. + * @param string $status the status of the archive creation. possible values: pending, processing, uploading, completed, failed. + * @param string $startedAt the backup start time. + * @param string $migrationId migration id. + * @param array $services the services that are backed up by this archive. + * @param array $resources the resources that are backed up by this archive. + * @param string|null $resourceId the resource id to backup. set only if this archive should backup a single resource. + * @param string|null $resourceType the resource type to backup. set only if this archive should backup a single resource. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $policyId, + public int $size, + public string $status, + public string $startedAt, + public string $migrationId, + public array $services, + public array $resources, + public ?string $resourceId = null, + public ?string $resourceType = null + ) { + } +} diff --git a/src/Appwrite/Models/BackupArchiveList.php b/src/Appwrite/Models/BackupArchiveList.php new file mode 100644 index 0000000..c9f7ef3 --- /dev/null +++ b/src/Appwrite/Models/BackupArchiveList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'archives' => BackupArchive::class + ]; + + /** + * BackupArchiveList constructor. + * + * @param int $total total number of archives that matched your query. + * @param list $archives list of archives. + */ + public function __construct( + public int $total, + public array $archives + ) { + } +} diff --git a/src/Appwrite/Models/BackupPolicy.php b/src/Appwrite/Models/BackupPolicy.php new file mode 100644 index 0000000..bc0ea78 --- /dev/null +++ b/src/Appwrite/Models/BackupPolicy.php @@ -0,0 +1,50 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * BackupPolicy constructor. + * + * @param string $id backup policy id. + * @param string $name backup policy name. + * @param string $createdAt policy creation date in iso 8601 format. + * @param string $updatedAt policy update date in iso 8601 format. + * @param array $services the services that are backed up by this policy. + * @param array $resources the resources that are backed up by this policy. + * @param int $retention how many days to keep the backup before it will be automatically deleted. + * @param string $schedule policy backup schedule in cron format. + * @param bool $enabled is this policy enabled. + * @param string|null $resourceId the resource id to backup. set only if this policy should backup a single resource. + * @param string|null $resourceType the resource type to backup. set only if this policy should backup a single resource. + */ + public function __construct( + public string $id, + public string $name, + public string $createdAt, + public string $updatedAt, + public array $services, + public array $resources, + public int $retention, + public string $schedule, + public bool $enabled, + public ?string $resourceId = null, + public ?string $resourceType = null + ) { + } +} diff --git a/src/Appwrite/Models/BackupPolicyList.php b/src/Appwrite/Models/BackupPolicyList.php new file mode 100644 index 0000000..a8c23f6 --- /dev/null +++ b/src/Appwrite/Models/BackupPolicyList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'policies' => BackupPolicy::class + ]; + + /** + * BackupPolicyList constructor. + * + * @param int $total total number of policies that matched your query. + * @param list $policies list of policies. + */ + public function __construct( + public int $total, + public array $policies + ) { + } +} diff --git a/src/Appwrite/Models/BackupRestoration.php b/src/Appwrite/Models/BackupRestoration.php new file mode 100644 index 0000000..3b0fd41 --- /dev/null +++ b/src/Appwrite/Models/BackupRestoration.php @@ -0,0 +1,50 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * BackupRestoration constructor. + * + * @param string $id restoration id. + * @param string $createdAt restoration creation time in iso 8601 format. + * @param string $updatedAt restoration update date in iso 8601 format. + * @param string $archiveId backup archive id. + * @param string $policyId backup policy id. + * @param string $status the status of the restoration. possible values: pending, downloading, processing, completed, failed. + * @param string $startedAt the backup start time. + * @param string $migrationId migration id. + * @param array $services the services that are backed up by this policy. + * @param array $resources the resources that are backed up by this policy. + * @param string $options optional data in key-value object. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $archiveId, + public string $policyId, + public string $status, + public string $startedAt, + public string $migrationId, + public array $services, + public array $resources, + public string $options + ) { + } +} diff --git a/src/Appwrite/Models/BackupRestorationList.php b/src/Appwrite/Models/BackupRestorationList.php new file mode 100644 index 0000000..c68ca75 --- /dev/null +++ b/src/Appwrite/Models/BackupRestorationList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'restorations' => BackupRestoration::class + ]; + + /** + * BackupRestorationList constructor. + * + * @param int $total total number of restorations that matched your query. + * @param list $restorations list of restorations. + */ + public function __construct( + public int $total, + public array $restorations + ) { + } +} diff --git a/src/Appwrite/Models/Bucket.php b/src/Appwrite/Models/Bucket.php new file mode 100644 index 0000000..599bbf4 --- /dev/null +++ b/src/Appwrite/Models/Bucket.php @@ -0,0 +1,57 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'permissions' => '$permissions' + ]; + + /** + * Bucket constructor. + * + * @param string $id bucket id. + * @param string $createdAt bucket creation time in iso 8601 format. + * @param string $updatedAt bucket update date in iso 8601 format. + * @param array $permissions bucket permissions. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param bool $fileSecurity whether file-level security is enabled. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param string $name bucket name. + * @param bool $enabled bucket enabled. + * @param int $maximumFileSize maximum file size supported. + * @param array $allowedFileExtensions allowed file extensions. + * @param string $compression compression algorithm chosen for compression. will be one of none, [gzip](https://en.wikipedia.org/wiki/gzip), or [zstd](https://en.wikipedia.org/wiki/zstd). + * @param bool $encryption bucket is encrypted. + * @param bool $antivirus virus scanning is enabled. + * @param bool $transformations image transformations are enabled. + * @param int $totalSize total size of this bucket in bytes. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public bool $fileSecurity, + public string $name, + public bool $enabled, + public int $maximumFileSize, + public array $allowedFileExtensions, + public string $compression, + public bool $encryption, + public bool $antivirus, + public bool $transformations, + public int $totalSize + ) { + } +} diff --git a/src/Appwrite/Models/BucketList.php b/src/Appwrite/Models/BucketList.php new file mode 100644 index 0000000..4870bcc --- /dev/null +++ b/src/Appwrite/Models/BucketList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'buckets' => Bucket::class + ]; + + /** + * BucketList constructor. + * + * @param int $total total number of buckets that matched your query. + * @param list $buckets list of buckets. + */ + public function __construct( + public int $total, + public array $buckets + ) { + } +} diff --git a/src/Appwrite/Models/Collection.php b/src/Appwrite/Models/Collection.php new file mode 100644 index 0000000..103b37c --- /dev/null +++ b/src/Appwrite/Models/Collection.php @@ -0,0 +1,60 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'permissions' => '$permissions' + ]; + + /** + * @var array + */ + private const ARRAY_TYPES = [ + 'indexes' => Index::class + ]; + + /** + * Collection constructor. + * + * @param string $id collection id. + * @param string $createdAt collection creation date in iso 8601 format. + * @param string $updatedAt collection update date in iso 8601 format. + * @param array $permissions collection permissions. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param string $databaseId database id. + * @param string $name collection name. + * @param bool $enabled collection enabled. can be 'enabled' or 'disabled'. when disabled, the collection is inaccessible to users, but remains accessible to server sdks using api keys. + * @param bool $documentSecurity whether document-level permissions are enabled. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param array $attributes collection attributes. + * @param list $indexes collection indexes. + * @param int $bytesMax maximum document size in bytes. returns 0 when no limit applies. + * @param int $bytesUsed currently used document size in bytes based on defined attributes. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public string $databaseId, + public string $name, + public bool $enabled, + public bool $documentSecurity, + public array $attributes, + public array $indexes, + public int $bytesMax, + public int $bytesUsed + ) { + } +} diff --git a/src/Appwrite/Models/CollectionList.php b/src/Appwrite/Models/CollectionList.php new file mode 100644 index 0000000..3b2cf8c --- /dev/null +++ b/src/Appwrite/Models/CollectionList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'collections' => Collection::class + ]; + + /** + * CollectionList constructor. + * + * @param int $total total number of collections that matched your query. + * @param list $collections list of collections. + */ + public function __construct( + public int $total, + public array $collections + ) { + } +} diff --git a/src/Appwrite/Models/ColumnBoolean.php b/src/Appwrite/Models/ColumnBoolean.php new file mode 100644 index 0000000..c19edc8 --- /dev/null +++ b/src/Appwrite/Models/ColumnBoolean.php @@ -0,0 +1,49 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnBoolean constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param bool|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?bool $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnDatetime.php b/src/Appwrite/Models/ColumnDatetime.php new file mode 100644 index 0000000..a533d3f --- /dev/null +++ b/src/Appwrite/Models/ColumnDatetime.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnDatetime constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param string $format iso 8601 format. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. only null is optional + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnEmail.php b/src/Appwrite/Models/ColumnEmail.php new file mode 100644 index 0000000..d3c5957 --- /dev/null +++ b/src/Appwrite/Models/ColumnEmail.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnEmail constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param string $format string format. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnEnum.php b/src/Appwrite/Models/ColumnEnum.php new file mode 100644 index 0000000..8c46d1a --- /dev/null +++ b/src/Appwrite/Models/ColumnEnum.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnEnum constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param array $elements array of elements in enumerated type. + * @param string $format string format. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public array $elements, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnFloat.php b/src/Appwrite/Models/ColumnFloat.php new file mode 100644 index 0000000..da54de0 --- /dev/null +++ b/src/Appwrite/Models/ColumnFloat.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnFloat constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param float|null $min minimum value to enforce for new documents. + * @param float|null $max maximum value to enforce for new documents. + * @param float|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?float $min = null, + public ?float $max = null, + public ?float $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnIndex.php b/src/Appwrite/Models/ColumnIndex.php new file mode 100644 index 0000000..1b7ea05 --- /dev/null +++ b/src/Appwrite/Models/ColumnIndex.php @@ -0,0 +1,48 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * ColumnIndex constructor. + * + * @param string $id index id. + * @param string $createdAt index creation date in iso 8601 format. + * @param string $updatedAt index update date in iso 8601 format. + * @param string $key index key. + * @param string $type index type. + * @param string $status index status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an index. + * @param array $columns index columns. + * @param array $lengths index columns length. + * @param array|null $orders index orders. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $key, + public string $type, + public string $status, + public string $error, + public array $columns, + public array $lengths, + public ?array $orders = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnIndexList.php b/src/Appwrite/Models/ColumnIndexList.php new file mode 100644 index 0000000..d281069 --- /dev/null +++ b/src/Appwrite/Models/ColumnIndexList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'indexes' => ColumnIndex::class + ]; + + /** + * ColumnIndexList constructor. + * + * @param int $total total number of indexes that matched your query. + * @param list $indexes list of indexes. + */ + public function __construct( + public int $total, + public array $indexes + ) { + } +} diff --git a/src/Appwrite/Models/ColumnInteger.php b/src/Appwrite/Models/ColumnInteger.php new file mode 100644 index 0000000..7d34eb9 --- /dev/null +++ b/src/Appwrite/Models/ColumnInteger.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnInteger constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param int|null $min minimum value to enforce for new documents. + * @param int|null $max maximum value to enforce for new documents. + * @param int|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?int $min = null, + public ?int $max = null, + public ?int $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnIp.php b/src/Appwrite/Models/ColumnIp.php new file mode 100644 index 0000000..8cd23b9 --- /dev/null +++ b/src/Appwrite/Models/ColumnIp.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnIp constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param string $format string format. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnLine.php b/src/Appwrite/Models/ColumnLine.php new file mode 100644 index 0000000..540e9ca --- /dev/null +++ b/src/Appwrite/Models/ColumnLine.php @@ -0,0 +1,49 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnLine constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param array|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?array $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnList.php b/src/Appwrite/Models/ColumnList.php new file mode 100644 index 0000000..c67057a --- /dev/null +++ b/src/Appwrite/Models/ColumnList.php @@ -0,0 +1,23 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnLongtext constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + * @param bool|null $encrypt defines whether this column is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnMediumtext.php b/src/Appwrite/Models/ColumnMediumtext.php new file mode 100644 index 0000000..05a2f42 --- /dev/null +++ b/src/Appwrite/Models/ColumnMediumtext.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnMediumtext constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + * @param bool|null $encrypt defines whether this column is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnPoint.php b/src/Appwrite/Models/ColumnPoint.php new file mode 100644 index 0000000..2835848 --- /dev/null +++ b/src/Appwrite/Models/ColumnPoint.php @@ -0,0 +1,49 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnPoint constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param array|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?array $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnPolygon.php b/src/Appwrite/Models/ColumnPolygon.php new file mode 100644 index 0000000..63d2941 --- /dev/null +++ b/src/Appwrite/Models/ColumnPolygon.php @@ -0,0 +1,49 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnPolygon constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param array|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?array $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnRelationship.php b/src/Appwrite/Models/ColumnRelationship.php new file mode 100644 index 0000000..593f3f9 --- /dev/null +++ b/src/Appwrite/Models/ColumnRelationship.php @@ -0,0 +1,58 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * ColumnRelationship constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param string $relatedTable the id of the related table. + * @param string $relationType the type of the relationship. + * @param bool $twoWay is the relationship two-way? + * @param string $twoWayKey the key of the two-way relationship. + * @param string $onDelete how deleting the parent document will propagate to child documents. + * @param string $side whether this is the parent or child side of the relationship + * @param bool|null $xarray is column an array? + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $relatedTable, + public string $relationType, + public bool $twoWay, + public string $twoWayKey, + public string $onDelete, + public string $side, + public ?bool $xarray = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnString.php b/src/Appwrite/Models/ColumnString.php new file mode 100644 index 0000000..9814926 --- /dev/null +++ b/src/Appwrite/Models/ColumnString.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnString constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param int $size column size. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + * @param bool|null $encrypt defines whether this column is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public int $size, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnText.php b/src/Appwrite/Models/ColumnText.php new file mode 100644 index 0000000..b4b0382 --- /dev/null +++ b/src/Appwrite/Models/ColumnText.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnText constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + * @param bool|null $encrypt defines whether this column is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnUrl.php b/src/Appwrite/Models/ColumnUrl.php new file mode 100644 index 0000000..3c1d807 --- /dev/null +++ b/src/Appwrite/Models/ColumnUrl.php @@ -0,0 +1,51 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnUrl constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param string $format string format. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public string $format, + public ?bool $xarray = null, + public ?string $xdefault = null + ) { + } +} diff --git a/src/Appwrite/Models/ColumnVarchar.php b/src/Appwrite/Models/ColumnVarchar.php new file mode 100644 index 0000000..ec5807b --- /dev/null +++ b/src/Appwrite/Models/ColumnVarchar.php @@ -0,0 +1,53 @@ + + */ + private const FIELD_MAP = [ + 'xarray' => 'array', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'xdefault' => 'default' + ]; + + /** + * ColumnVarchar constructor. + * + * @param string $key column key. + * @param string $type column type. + * @param ColumnStatus $status column status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an column. + * @param bool $required is column required? + * @param string $createdAt column creation date in iso 8601 format. + * @param string $updatedAt column update date in iso 8601 format. + * @param int $size column size. + * @param bool|null $xarray is column an array? + * @param string|null $xdefault default value for column when not provided. cannot be set when column is required. + * @param bool|null $encrypt defines whether this column is encrypted or not. + */ + public function __construct( + public string $key, + public string $type, + public ColumnStatus $status, + public string $error, + public bool $required, + public string $createdAt, + public string $updatedAt, + public int $size, + public ?bool $xarray = null, + public ?string $xdefault = null, + public ?bool $encrypt = null + ) { + } +} diff --git a/src/Appwrite/Models/Continent.php b/src/Appwrite/Models/Continent.php new file mode 100644 index 0000000..a0fcdce --- /dev/null +++ b/src/Appwrite/Models/Continent.php @@ -0,0 +1,23 @@ + + */ + private const ARRAY_TYPES = [ + 'continents' => Continent::class + ]; + + /** + * ContinentList constructor. + * + * @param int $total total number of continents that matched your query. + * @param list $continents list of continents. + */ + public function __construct( + public int $total, + public array $continents + ) { + } +} diff --git a/src/Appwrite/Models/Country.php b/src/Appwrite/Models/Country.php new file mode 100644 index 0000000..6e5bc15 --- /dev/null +++ b/src/Appwrite/Models/Country.php @@ -0,0 +1,23 @@ + + */ + private const ARRAY_TYPES = [ + 'countries' => Country::class + ]; + + /** + * CountryList constructor. + * + * @param int $total total number of countries that matched your query. + * @param list $countries list of countries. + */ + public function __construct( + public int $total, + public array $countries + ) { + } +} diff --git a/src/Appwrite/Models/Currency.php b/src/Appwrite/Models/Currency.php new file mode 100644 index 0000000..851c074 --- /dev/null +++ b/src/Appwrite/Models/Currency.php @@ -0,0 +1,33 @@ + + */ + private const ARRAY_TYPES = [ + 'currencies' => Currency::class + ]; + + /** + * CurrencyList constructor. + * + * @param int $total total number of currencies that matched your query. + * @param list $currencies list of currencies. + */ + public function __construct( + public int $total, + public array $currencies + ) { + } +} diff --git a/src/Appwrite/Models/Database.php b/src/Appwrite/Models/Database.php new file mode 100644 index 0000000..4d705c5 --- /dev/null +++ b/src/Appwrite/Models/Database.php @@ -0,0 +1,54 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * @var array + */ + private const ARRAY_TYPES = [ + 'policies' => Index::class, + 'archives' => Collection::class + ]; + + /** + * Database constructor. + * + * @param string $id database id. + * @param string $name database name. + * @param string $createdAt database creation date in iso 8601 format. + * @param string $updatedAt database update date in iso 8601 format. + * @param bool $enabled if database is enabled. can be 'enabled' or 'disabled'. when disabled, the database is inaccessible to users, but remains accessible to server sdks using api keys. + * @param DatabaseType $type database type. + * @param list $policies database backup policies. + * @param list $archives database backup archives. + */ + public function __construct( + public string $id, + public string $name, + public string $createdAt, + public string $updatedAt, + public bool $enabled, + public DatabaseType $type, + public array $policies, + public array $archives + ) { + } +} diff --git a/src/Appwrite/Models/DatabaseList.php b/src/Appwrite/Models/DatabaseList.php new file mode 100644 index 0000000..dba3959 --- /dev/null +++ b/src/Appwrite/Models/DatabaseList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'databases' => Database::class + ]; + + /** + * DatabaseList constructor. + * + * @param int $total total number of databases that matched your query. + * @param list $databases list of databases. + */ + public function __construct( + public int $total, + public array $databases + ) { + } +} diff --git a/src/Appwrite/Models/Deployment.php b/src/Appwrite/Models/Deployment.php new file mode 100644 index 0000000..2e985fc --- /dev/null +++ b/src/Appwrite/Models/Deployment.php @@ -0,0 +1,84 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Deployment constructor. + * + * @param string $id deployment id. + * @param string $createdAt deployment creation date in iso 8601 format. + * @param string $updatedAt deployment update date in iso 8601 format. + * @param string $type type of deployment. + * @param string $resourceId resource id. + * @param string $resourceType resource type. + * @param string $entrypoint the entrypoint file to use to execute the deployment code. + * @param int $sourceSize the code size in bytes. + * @param int $buildSize the build output size in bytes. + * @param int $totalSize the total size in bytes (source and build output). + * @param string $buildId the current build id. + * @param bool $activate whether the deployment should be automatically activated. + * @param string $screenshotLight screenshot with light theme preference file id. + * @param string $screenshotDark screenshot with dark theme preference file id. + * @param DeploymentStatus $status the deployment status. possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". + * @param string $buildLogs the build logs. + * @param int $buildDuration the current build time in seconds. + * @param string $providerRepositoryName the name of the vcs provider repository + * @param string $providerRepositoryOwner the name of the vcs provider repository owner + * @param string $providerRepositoryUrl the url of the vcs provider repository + * @param string $providerCommitHash the commit hash of the vcs commit + * @param string $providerCommitAuthorUrl the url of vcs commit author + * @param string $providerCommitAuthor the name of vcs commit author + * @param string $providerCommitMessage the commit message + * @param string $providerCommitUrl the url of the vcs commit + * @param string $providerBranch the branch of the vcs repository + * @param string $providerBranchUrl the branch of the vcs repository + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $type, + public string $resourceId, + public string $resourceType, + public string $entrypoint, + public int $sourceSize, + public int $buildSize, + public int $totalSize, + public string $buildId, + public bool $activate, + public string $screenshotLight, + public string $screenshotDark, + public DeploymentStatus $status, + public string $buildLogs, + public int $buildDuration, + public string $providerRepositoryName, + public string $providerRepositoryOwner, + public string $providerRepositoryUrl, + public string $providerCommitHash, + public string $providerCommitAuthorUrl, + public string $providerCommitAuthor, + public string $providerCommitMessage, + public string $providerCommitUrl, + public string $providerBranch, + public string $providerBranchUrl + ) { + } +} diff --git a/src/Appwrite/Models/DeploymentList.php b/src/Appwrite/Models/DeploymentList.php new file mode 100644 index 0000000..8343b61 --- /dev/null +++ b/src/Appwrite/Models/DeploymentList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'deployments' => Deployment::class + ]; + + /** + * DeploymentList constructor. + * + * @param int $total total number of deployments that matched your query. + * @param list $deployments list of deployments. + */ + public function __construct( + public int $total, + public array $deployments + ) { + } +} diff --git a/src/Appwrite/Models/Document.php b/src/Appwrite/Models/Document.php new file mode 100644 index 0000000..a45464a --- /dev/null +++ b/src/Appwrite/Models/Document.php @@ -0,0 +1,50 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'sequence' => '$sequence', + 'collectionId' => '$collectionId', + 'databaseId' => '$databaseId', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'permissions' => '$permissions' + ]; + + private const ADDITIONAL_PROPERTIES = true; + + /** + * Document constructor. + * + * @param string $id document id. + * @param string $sequence document sequence id. + * @param string $collectionId collection id. + * @param string $databaseId database id. + * @param string $createdAt document creation date in iso 8601 format. + * @param string $updatedAt document update date in iso 8601 format. + * @param array $permissions document permissions. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param array $data Additional properties. + */ + public function __construct( + public string $id, + public string $sequence, + public string $collectionId, + public string $databaseId, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public array $data = [] + ) { + } +} diff --git a/src/Appwrite/Models/DocumentList.php b/src/Appwrite/Models/DocumentList.php new file mode 100644 index 0000000..681aba2 --- /dev/null +++ b/src/Appwrite/Models/DocumentList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'documents' => Document::class + ]; + + /** + * DocumentList constructor. + * + * @param int $total total number of documents that matched your query. + * @param list $documents list of documents. + */ + public function __construct( + public int $total, + public array $documents + ) { + } +} diff --git a/src/Appwrite/Models/Execution.php b/src/Appwrite/Models/Execution.php new file mode 100644 index 0000000..5b01b32 --- /dev/null +++ b/src/Appwrite/Models/Execution.php @@ -0,0 +1,76 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'permissions' => '$permissions' + ]; + + /** + * @var array + */ + private const ARRAY_TYPES = [ + 'requestHeaders' => Headers::class, + 'responseHeaders' => Headers::class + ]; + + /** + * Execution constructor. + * + * @param string $id execution id. + * @param string $createdAt execution creation date in iso 8601 format. + * @param string $updatedAt execution update date in iso 8601 format. + * @param array $permissions execution roles. + * @param string $functionId function id. + * @param string $deploymentId function's deployment id used to create the execution. + * @param ExecutionTrigger $trigger the trigger that caused the function to execute. possible values can be: `http`, `schedule`, or `event`. + * @param ExecutionStatus $status the status of the function execution. possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. + * @param string $requestMethod http request method type. + * @param string $requestPath http request path and query. + * @param list $requestHeaders http request headers as a key-value object. this will return only whitelisted headers. all headers are returned if execution is created as synchronous. + * @param int $responseStatusCode http response status code. + * @param string $responseBody http response body. this will return empty unless execution is created as synchronous. + * @param list $responseHeaders http response headers as a key-value object. this will return only whitelisted headers. all headers are returned if execution is created as synchronous. + * @param string $logs function logs. includes the last 4,000 characters. this will return an empty string unless the response is returned using an api key or as part of a webhook payload. + * @param string $errors function errors. includes the last 4,000 characters. this will return an empty string unless the response is returned using an api key or as part of a webhook payload. + * @param float $duration resource(function/site) execution duration in seconds. + * @param string|null $scheduledAt the scheduled time for execution. if left empty, execution will be queued immediately. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public string $functionId, + public string $deploymentId, + public ExecutionTrigger $trigger, + public ExecutionStatus $status, + public string $requestMethod, + public string $requestPath, + public array $requestHeaders, + public int $responseStatusCode, + public string $responseBody, + public array $responseHeaders, + public string $logs, + public string $errors, + public float $duration, + public ?string $scheduledAt = null + ) { + } +} diff --git a/src/Appwrite/Models/ExecutionList.php b/src/Appwrite/Models/ExecutionList.php new file mode 100644 index 0000000..98c60e5 --- /dev/null +++ b/src/Appwrite/Models/ExecutionList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'executions' => Execution::class + ]; + + /** + * ExecutionList constructor. + * + * @param int $total total number of executions that matched your query. + * @param list $executions list of executions. + */ + public function __construct( + public int $total, + public array $executions + ) { + } +} diff --git a/src/Appwrite/Models/File.php b/src/Appwrite/Models/File.php new file mode 100644 index 0000000..6ed5914 --- /dev/null +++ b/src/Appwrite/Models/File.php @@ -0,0 +1,55 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'permissions' => '$permissions' + ]; + + /** + * File constructor. + * + * @param string $id file id. + * @param string $bucketId bucket id. + * @param string $createdAt file creation date in iso 8601 format. + * @param string $updatedAt file update date in iso 8601 format. + * @param array $permissions file permissions. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param string $name file name. + * @param string $signature file md5 signature. + * @param string $mimeType file mime type. + * @param int $sizeOriginal file original size in bytes. + * @param int $chunksTotal total number of chunks available + * @param int $chunksUploaded total number of chunks uploaded + * @param bool $encryption whether file contents are encrypted at rest. + * @param string $compression compression algorithm used for the file. will be one of none, [gzip](https://en.wikipedia.org/wiki/gzip), or [zstd](https://en.wikipedia.org/wiki/zstd). + */ + public function __construct( + public string $id, + public string $bucketId, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public string $name, + public string $signature, + public string $mimeType, + public int $sizeOriginal, + public int $chunksTotal, + public int $chunksUploaded, + public bool $encryption, + public string $compression + ) { + } +} diff --git a/src/Appwrite/Models/FileList.php b/src/Appwrite/Models/FileList.php new file mode 100644 index 0000000..c10730b --- /dev/null +++ b/src/Appwrite/Models/FileList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'files' => File::class + ]; + + /** + * FileList constructor. + * + * @param int $total total number of files that matched your query. + * @param list $files list of files. + */ + public function __construct( + public int $total, + public array $files + ) { + } +} diff --git a/src/Appwrite/Models/Framework.php b/src/Appwrite/Models/Framework.php new file mode 100644 index 0000000..0d67031 --- /dev/null +++ b/src/Appwrite/Models/Framework.php @@ -0,0 +1,36 @@ + + */ + private const ARRAY_TYPES = [ + 'adapters' => FrameworkAdapter::class + ]; + + /** + * Framework constructor. + * + * @param string $key framework key. + * @param string $name framework name. + * @param string $buildRuntime default runtime version. + * @param array $runtimes list of supported runtime versions. + * @param list $adapters list of supported adapters. + */ + public function __construct( + public string $key, + public string $name, + public string $buildRuntime, + public array $runtimes, + public array $adapters + ) { + } +} diff --git a/src/Appwrite/Models/FrameworkAdapter.php b/src/Appwrite/Models/FrameworkAdapter.php new file mode 100644 index 0000000..7f79799 --- /dev/null +++ b/src/Appwrite/Models/FrameworkAdapter.php @@ -0,0 +1,29 @@ + + */ + private const ARRAY_TYPES = [ + 'frameworks' => Framework::class + ]; + + /** + * FrameworkList constructor. + * + * @param int $total total number of frameworks that matched your query. + * @param list $frameworks list of frameworks. + */ + public function __construct( + public int $total, + public array $frameworks + ) { + } +} diff --git a/src/Appwrite/Models/FunctionList.php b/src/Appwrite/Models/FunctionList.php new file mode 100644 index 0000000..919073a --- /dev/null +++ b/src/Appwrite/Models/FunctionList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'functions' => FunctionModel::class + ]; + + /** + * FunctionList constructor. + * + * @param int $total total number of functions that matched your query. + * @param list $functions list of functions. + */ + public function __construct( + public int $total, + public array $functions + ) { + } +} diff --git a/src/Appwrite/Models/FunctionModel.php b/src/Appwrite/Models/FunctionModel.php new file mode 100644 index 0000000..79d6624 --- /dev/null +++ b/src/Appwrite/Models/FunctionModel.php @@ -0,0 +1,95 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * @var array + */ + private const ARRAY_TYPES = [ + 'vars' => Variable::class + ]; + + /** + * Function constructor. + * + * @param string $id function id. + * @param string $createdAt function creation date in iso 8601 format. + * @param string $updatedAt function update date in iso 8601 format. + * @param array $execute execution permissions. + * @param string $name function name. + * @param bool $enabled function enabled. + * @param bool $live is the function deployed with the latest configuration? this is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. when the value is false, redeploy the function to update it with the latest configuration. + * @param bool $logging when disabled, executions will exclude logs and errors, and will be slightly faster. + * @param string $runtime function execution and build runtime. + * @param int $deploymentRetention how many days to keep the non-active deployments before they will be automatically deleted. + * @param string $deploymentId function's active deployment id. + * @param string $deploymentCreatedAt active deployment creation date in iso 8601 format. + * @param string $latestDeploymentId function's latest deployment id. + * @param string $latestDeploymentCreatedAt latest deployment creation date in iso 8601 format. + * @param string $latestDeploymentStatus status of latest deployment. possible values are "waiting", "processing", "building", "ready", and "failed". + * @param array $scopes allowed permission scopes. + * @param list $vars function variables. + * @param array $events function trigger events. + * @param string $schedule function execution schedule in cron format. + * @param int $timeout function execution timeout in seconds. + * @param string $entrypoint the entrypoint file used to execute the deployment. + * @param string $commands the build command used to build the deployment. + * @param string $version version of open runtimes used for the function. + * @param string $installationId function vcs (version control system) installation id. + * @param string $providerRepositoryId vcs (version control system) repository id + * @param string $providerBranch vcs (version control system) branch name + * @param string $providerRootDirectory path to function in vcs (version control system) repository + * @param bool $providerSilentMode is vcs (version control system) connection is in silent mode? when in silence mode, no comments will be posted on the repository pull or merge requests + * @param string $buildSpecification machine specification for deployment builds. + * @param string $runtimeSpecification machine specification for executions. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public array $execute, + public string $name, + public bool $enabled, + public bool $live, + public bool $logging, + public string $runtime, + public int $deploymentRetention, + public string $deploymentId, + public string $deploymentCreatedAt, + public string $latestDeploymentId, + public string $latestDeploymentCreatedAt, + public string $latestDeploymentStatus, + public array $scopes, + public array $vars, + public array $events, + public string $schedule, + public int $timeout, + public string $entrypoint, + public string $commands, + public string $version, + public string $installationId, + public string $providerRepositoryId, + public string $providerBranch, + public string $providerRootDirectory, + public bool $providerSilentMode, + public string $buildSpecification, + public string $runtimeSpecification + ) { + } +} diff --git a/src/Appwrite/Models/Headers.php b/src/Appwrite/Models/Headers.php new file mode 100644 index 0000000..323b7bc --- /dev/null +++ b/src/Appwrite/Models/Headers.php @@ -0,0 +1,23 @@ + + */ + private const ARRAY_TYPES = [ + 'statuses' => HealthStatus::class + ]; + + /** + * HealthStatusList constructor. + * + * @param int $total total number of statuses that matched your query. + * @param list $statuses list of statuses. + */ + public function __construct( + public int $total, + public array $statuses + ) { + } +} diff --git a/src/Appwrite/Models/HealthTime.php b/src/Appwrite/Models/HealthTime.php new file mode 100644 index 0000000..0cb511a --- /dev/null +++ b/src/Appwrite/Models/HealthTime.php @@ -0,0 +1,25 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Identity constructor. + * + * @param string $id identity id. + * @param string $createdAt identity creation date in iso 8601 format. + * @param string $updatedAt identity update date in iso 8601 format. + * @param string $userId user id. + * @param string $provider identity provider. + * @param string $providerUid id of the user in the identity provider. + * @param string $providerEmail email of the user in the identity provider. + * @param string $providerAccessToken identity provider access token. + * @param string $providerAccessTokenExpiry the date of when the access token expires in iso 8601 format. + * @param string $providerRefreshToken identity provider refresh token. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $userId, + public string $provider, + public string $providerUid, + public string $providerEmail, + public string $providerAccessToken, + public string $providerAccessTokenExpiry, + public string $providerRefreshToken + ) { + } +} diff --git a/src/Appwrite/Models/IdentityList.php b/src/Appwrite/Models/IdentityList.php new file mode 100644 index 0000000..5855e4f --- /dev/null +++ b/src/Appwrite/Models/IdentityList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'identities' => Identity::class + ]; + + /** + * IdentityList constructor. + * + * @param int $total total number of identities that matched your query. + * @param list $identities list of identities. + */ + public function __construct( + public int $total, + public array $identities + ) { + } +} diff --git a/src/Appwrite/Models/Index.php b/src/Appwrite/Models/Index.php new file mode 100644 index 0000000..4dcff6f --- /dev/null +++ b/src/Appwrite/Models/Index.php @@ -0,0 +1,50 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Index constructor. + * + * @param string $id index id. + * @param string $createdAt index creation date in iso 8601 format. + * @param string $updatedAt index update date in iso 8601 format. + * @param string $key index key. + * @param string $type index type. + * @param IndexStatus $status index status. possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * @param string $error error message. displays error generated on failure of creating or deleting an index. + * @param array $attributes index attributes. + * @param array $lengths index attributes length. + * @param array|null $orders index orders. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $key, + public string $type, + public IndexStatus $status, + public string $error, + public array $attributes, + public array $lengths, + public ?array $orders = null + ) { + } +} diff --git a/src/Appwrite/Models/IndexList.php b/src/Appwrite/Models/IndexList.php new file mode 100644 index 0000000..c57f4f1 --- /dev/null +++ b/src/Appwrite/Models/IndexList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'indexes' => Index::class + ]; + + /** + * IndexList constructor. + * + * @param int $total total number of indexes that matched your query. + * @param list $indexes list of indexes. + */ + public function __construct( + public int $total, + public array $indexes + ) { + } +} diff --git a/src/Appwrite/Models/Jwt.php b/src/Appwrite/Models/Jwt.php new file mode 100644 index 0000000..1aa624b --- /dev/null +++ b/src/Appwrite/Models/Jwt.php @@ -0,0 +1,21 @@ + + */ + private const ARRAY_TYPES = [ + 'languages' => Language::class + ]; + + /** + * LanguageList constructor. + * + * @param int $total total number of languages that matched your query. + * @param list $languages list of languages. + */ + public function __construct( + public int $total, + public array $languages + ) { + } +} diff --git a/src/Appwrite/Models/Locale.php b/src/Appwrite/Models/Locale.php new file mode 100644 index 0000000..9a47580 --- /dev/null +++ b/src/Appwrite/Models/Locale.php @@ -0,0 +1,33 @@ + + */ + private const ARRAY_TYPES = [ + 'localeCodes' => LocaleCode::class + ]; + + /** + * LocaleCodeList constructor. + * + * @param int $total total number of localecodes that matched your query. + * @param list $localeCodes list of localecodes. + */ + public function __construct( + public int $total, + public array $localeCodes + ) { + } +} diff --git a/src/Appwrite/Models/Log.php b/src/Appwrite/Models/Log.php new file mode 100644 index 0000000..bd6faf0 --- /dev/null +++ b/src/Appwrite/Models/Log.php @@ -0,0 +1,61 @@ + + */ + private const ARRAY_TYPES = [ + 'logs' => Log::class + ]; + + /** + * LogList constructor. + * + * @param int $total total number of logs that matched your query. + * @param list $logs list of logs. + */ + public function __construct( + public int $total, + public array $logs + ) { + } +} diff --git a/src/Appwrite/Models/Membership.php b/src/Appwrite/Models/Membership.php new file mode 100644 index 0000000..0f460ee --- /dev/null +++ b/src/Appwrite/Models/Membership.php @@ -0,0 +1,54 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Membership constructor. + * + * @param string $id membership id. + * @param string $createdAt membership creation date in iso 8601 format. + * @param string $updatedAt membership update date in iso 8601 format. + * @param string $userId user id. + * @param string $userName user name. hide this attribute by toggling membership privacy in the console. + * @param string $userEmail user email address. hide this attribute by toggling membership privacy in the console. + * @param string $teamId team id. + * @param string $teamName team name. + * @param string $invited date, the user has been invited to join the team in iso 8601 format. + * @param string $joined date, the user has accepted the invitation to join the team in iso 8601 format. + * @param bool $confirm user confirmation status, true if the user has joined the team or false otherwise. + * @param bool $mfa multi factor authentication status, true if the user has mfa enabled or false otherwise. hide this attribute by toggling membership privacy in the console. + * @param array $roles user list of roles + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $userId, + public string $userName, + public string $userEmail, + public string $teamId, + public string $teamName, + public string $invited, + public string $joined, + public bool $confirm, + public bool $mfa, + public array $roles + ) { + } +} diff --git a/src/Appwrite/Models/MembershipList.php b/src/Appwrite/Models/MembershipList.php new file mode 100644 index 0000000..1037155 --- /dev/null +++ b/src/Appwrite/Models/MembershipList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'memberships' => Membership::class + ]; + + /** + * MembershipList constructor. + * + * @param int $total total number of memberships that matched your query. + * @param list $memberships list of memberships. + */ + public function __construct( + public int $total, + public array $memberships + ) { + } +} diff --git a/src/Appwrite/Models/Message.php b/src/Appwrite/Models/Message.php new file mode 100644 index 0000000..f9233ae --- /dev/null +++ b/src/Appwrite/Models/Message.php @@ -0,0 +1,56 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Message constructor. + * + * @param string $id message id. + * @param string $createdAt message creation time in iso 8601 format. + * @param string $updatedAt message update date in iso 8601 format. + * @param string $providerType message provider type. + * @param array $topics topic ids set as recipients. + * @param array $users user ids set as recipients. + * @param array $targets target ids set as recipients. + * @param int $deliveredTotal number of recipients the message was delivered to. + * @param array $data data of the message. + * @param MessageStatus $status status of delivery. + * @param string|null $scheduledAt the scheduled time for message. + * @param string|null $deliveredAt the time when the message was delivered. + * @param array|null $deliveryErrors delivery errors if any. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $providerType, + public array $topics, + public array $users, + public array $targets, + public int $deliveredTotal, + public array $data, + public MessageStatus $status, + public ?string $scheduledAt = null, + public ?string $deliveredAt = null, + public ?array $deliveryErrors = null + ) { + } +} diff --git a/src/Appwrite/Models/MessageList.php b/src/Appwrite/Models/MessageList.php new file mode 100644 index 0000000..f583a87 --- /dev/null +++ b/src/Appwrite/Models/MessageList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'messages' => Message::class + ]; + + /** + * MessageList constructor. + * + * @param int $total total number of messages that matched your query. + * @param list $messages list of messages. + */ + public function __construct( + public int $total, + public array $messages + ) { + } +} diff --git a/src/Appwrite/Models/MfaChallenge.php b/src/Appwrite/Models/MfaChallenge.php new file mode 100644 index 0000000..26d8f64 --- /dev/null +++ b/src/Appwrite/Models/MfaChallenge.php @@ -0,0 +1,35 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt' + ]; + + /** + * MfaChallenge constructor. + * + * @param string $id token id. + * @param string $createdAt token creation date in iso 8601 format. + * @param string $userId user id. + * @param string $expire token expiration date in iso 8601 format. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $userId, + public string $expire + ) { + } +} diff --git a/src/Appwrite/Models/MfaFactors.php b/src/Appwrite/Models/MfaFactors.php new file mode 100644 index 0000000..7f54889 --- /dev/null +++ b/src/Appwrite/Models/MfaFactors.php @@ -0,0 +1,27 @@ + + */ + private const ARRAY_TYPES = [ + 'phones' => Phone::class + ]; + + /** + * PhoneList constructor. + * + * @param int $total total number of phones that matched your query. + * @param list $phones list of phones. + */ + public function __construct( + public int $total, + public array $phones + ) { + } +} diff --git a/src/Appwrite/Models/Preferences.php b/src/Appwrite/Models/Preferences.php new file mode 100644 index 0000000..9b8abe4 --- /dev/null +++ b/src/Appwrite/Models/Preferences.php @@ -0,0 +1,23 @@ + $data Additional properties. + */ + public function __construct( + public array $data = [] + ) { + } +} diff --git a/src/Appwrite/Models/Provider.php b/src/Appwrite/Models/Provider.php new file mode 100644 index 0000000..013ea20 --- /dev/null +++ b/src/Appwrite/Models/Provider.php @@ -0,0 +1,46 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Provider constructor. + * + * @param string $id provider id. + * @param string $createdAt provider creation time in iso 8601 format. + * @param string $updatedAt provider update date in iso 8601 format. + * @param string $name the name for the provider instance. + * @param string $provider the name of the provider service. + * @param bool $enabled is provider enabled? + * @param string $type type of provider. + * @param array $credentials provider credentials. + * @param array|null $options provider options. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $name, + public string $provider, + public bool $enabled, + public string $type, + public array $credentials, + public ?array $options = null + ) { + } +} diff --git a/src/Appwrite/Models/ProviderList.php b/src/Appwrite/Models/ProviderList.php new file mode 100644 index 0000000..a7f28a1 --- /dev/null +++ b/src/Appwrite/Models/ProviderList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'providers' => Provider::class + ]; + + /** + * ProviderList constructor. + * + * @param int $total total number of providers that matched your query. + * @param list $providers list of providers. + */ + public function __construct( + public int $total, + public array $providers + ) { + } +} diff --git a/src/Appwrite/Models/ResourceToken.php b/src/Appwrite/Models/ResourceToken.php new file mode 100644 index 0000000..3eb90f2 --- /dev/null +++ b/src/Appwrite/Models/ResourceToken.php @@ -0,0 +1,41 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt' + ]; + + /** + * ResourceToken constructor. + * + * @param string $id token id. + * @param string $createdAt token creation date in iso 8601 format. + * @param string $resourceId resource id. + * @param string $resourceType resource type. + * @param string $expire token expiration date in iso 8601 format. + * @param string $secret jwt encoded string. + * @param string $accessedAt most recent access date in iso 8601 format. this attribute is only updated again after 24 hours. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $resourceId, + public string $resourceType, + public string $expire, + public string $secret, + public string $accessedAt + ) { + } +} diff --git a/src/Appwrite/Models/ResourceTokenList.php b/src/Appwrite/Models/ResourceTokenList.php new file mode 100644 index 0000000..478060d --- /dev/null +++ b/src/Appwrite/Models/ResourceTokenList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'tokens' => ResourceToken::class + ]; + + /** + * ResourceTokenList constructor. + * + * @param int $total total number of tokens that matched your query. + * @param list $tokens list of tokens. + */ + public function __construct( + public int $total, + public array $tokens + ) { + } +} diff --git a/src/Appwrite/Models/Row.php b/src/Appwrite/Models/Row.php new file mode 100644 index 0000000..a0bb523 --- /dev/null +++ b/src/Appwrite/Models/Row.php @@ -0,0 +1,50 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'sequence' => '$sequence', + 'tableId' => '$tableId', + 'databaseId' => '$databaseId', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'permissions' => '$permissions' + ]; + + private const ADDITIONAL_PROPERTIES = true; + + /** + * Row constructor. + * + * @param string $id row id. + * @param string $sequence row sequence id. + * @param string $tableId table id. + * @param string $databaseId database id. + * @param string $createdAt row creation date in iso 8601 format. + * @param string $updatedAt row update date in iso 8601 format. + * @param array $permissions row permissions. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param array $data Additional properties. + */ + public function __construct( + public string $id, + public string $sequence, + public string $tableId, + public string $databaseId, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public array $data = [] + ) { + } +} diff --git a/src/Appwrite/Models/RowList.php b/src/Appwrite/Models/RowList.php new file mode 100644 index 0000000..c22695b --- /dev/null +++ b/src/Appwrite/Models/RowList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'rows' => Row::class + ]; + + /** + * RowList constructor. + * + * @param int $total total number of rows that matched your query. + * @param list $rows list of rows. + */ + public function __construct( + public int $total, + public array $rows + ) { + } +} diff --git a/src/Appwrite/Models/Runtime.php b/src/Appwrite/Models/Runtime.php new file mode 100644 index 0000000..5d8d0de --- /dev/null +++ b/src/Appwrite/Models/Runtime.php @@ -0,0 +1,42 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id' + ]; + + /** + * Runtime constructor. + * + * @param string $id runtime id. + * @param string $key parent runtime key. + * @param string $name runtime name. + * @param string $version runtime version. + * @param string $base base docker image used to build the runtime. + * @param string $image image name of docker hub. + * @param string $logo name of the logo image. + * @param array $supports list of supported architectures. + */ + public function __construct( + public string $id, + public string $key, + public string $name, + public string $version, + public string $base, + public string $image, + public string $logo, + public array $supports + ) { + } +} diff --git a/src/Appwrite/Models/RuntimeList.php b/src/Appwrite/Models/RuntimeList.php new file mode 100644 index 0000000..53daa1a --- /dev/null +++ b/src/Appwrite/Models/RuntimeList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'runtimes' => Runtime::class + ]; + + /** + * RuntimeList constructor. + * + * @param int $total total number of runtimes that matched your query. + * @param list $runtimes list of runtimes. + */ + public function __construct( + public int $total, + public array $runtimes + ) { + } +} diff --git a/src/Appwrite/Models/Session.php b/src/Appwrite/Models/Session.php new file mode 100644 index 0000000..03425cc --- /dev/null +++ b/src/Appwrite/Models/Session.php @@ -0,0 +1,86 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Session constructor. + * + * @param string $id session id. + * @param string $createdAt session creation date in iso 8601 format. + * @param string $updatedAt session update date in iso 8601 format. + * @param string $userId user id. + * @param string $expire session expiration date in iso 8601 format. + * @param string $provider session provider. + * @param string $providerUid session provider user id. + * @param string $providerAccessToken session provider access token. + * @param string $providerAccessTokenExpiry the date of when the access token expires in iso 8601 format. + * @param string $providerRefreshToken session provider refresh token. + * @param string $ip ip in use when the session was created. + * @param string $osCode operating system code name. view list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + * @param string $osName operating system name. + * @param string $osVersion operating system version. + * @param string $clientType client type. + * @param string $clientCode client code name. view list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + * @param string $clientName client name. + * @param string $clientVersion client version. + * @param string $clientEngine client engine name. + * @param string $clientEngineVersion client engine name. + * @param string $deviceName device name. + * @param string $deviceBrand device brand name. + * @param string $deviceModel device model name. + * @param string $countryCode country two-character iso 3166-1 alpha code. + * @param string $countryName country name. + * @param bool $current returns true if this the current user session. + * @param array $factors returns a list of active session factors. + * @param string $secret secret used to authenticate the user. only included if the request was made with an api key + * @param string $mfaUpdatedAt most recent date in iso 8601 format when the session successfully passed mfa challenge. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $userId, + public string $expire, + public string $provider, + public string $providerUid, + public string $providerAccessToken, + public string $providerAccessTokenExpiry, + public string $providerRefreshToken, + public string $ip, + public string $osCode, + public string $osName, + public string $osVersion, + public string $clientType, + public string $clientCode, + public string $clientName, + public string $clientVersion, + public string $clientEngine, + public string $clientEngineVersion, + public string $deviceName, + public string $deviceBrand, + public string $deviceModel, + public string $countryCode, + public string $countryName, + public bool $current, + public array $factors, + public string $secret, + public string $mfaUpdatedAt + ) { + } +} diff --git a/src/Appwrite/Models/SessionList.php b/src/Appwrite/Models/SessionList.php new file mode 100644 index 0000000..1e788df --- /dev/null +++ b/src/Appwrite/Models/SessionList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'sessions' => Session::class + ]; + + /** + * SessionList constructor. + * + * @param int $total total number of sessions that matched your query. + * @param list $sessions list of sessions. + */ + public function __construct( + public int $total, + public array $sessions + ) { + } +} diff --git a/src/Appwrite/Models/Site.php b/src/Appwrite/Models/Site.php new file mode 100644 index 0000000..1c0212d --- /dev/null +++ b/src/Appwrite/Models/Site.php @@ -0,0 +1,99 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * @var array + */ + private const ARRAY_TYPES = [ + 'vars' => Variable::class + ]; + + /** + * Site constructor. + * + * @param string $id site id. + * @param string $createdAt site creation date in iso 8601 format. + * @param string $updatedAt site update date in iso 8601 format. + * @param string $name site name. + * @param bool $enabled site enabled. + * @param bool $live is the site deployed with the latest configuration? this is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. when the value is false, redeploy the site to update it with the latest configuration. + * @param bool $logging when disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param string $framework site framework. + * @param int $deploymentRetention how many days to keep the non-active deployments before they will be automatically deleted. + * @param string $deploymentId site's active deployment id. + * @param string $deploymentCreatedAt active deployment creation date in iso 8601 format. + * @param string $deploymentScreenshotLight screenshot of active deployment with light theme preference file id. + * @param string $deploymentScreenshotDark screenshot of active deployment with dark theme preference file id. + * @param string $latestDeploymentId site's latest deployment id. + * @param string $latestDeploymentCreatedAt latest deployment creation date in iso 8601 format. + * @param string $latestDeploymentStatus status of latest deployment. possible values are "waiting", "processing", "building", "ready", and "failed". + * @param list $vars site variables. + * @param int $timeout site request timeout in seconds. + * @param string $installCommand the install command used to install the site dependencies. + * @param string $buildCommand the build command used to build the site. + * @param string $startCommand custom command to use when starting site runtime. + * @param string $outputDirectory the directory where the site build output is located. + * @param string $installationId site vcs (version control system) installation id. + * @param string $providerRepositoryId vcs (version control system) repository id + * @param string $providerBranch vcs (version control system) branch name + * @param string $providerRootDirectory path to site in vcs (version control system) repository + * @param bool $providerSilentMode is vcs (version control system) connection is in silent mode? when in silence mode, no comments will be posted on the repository pull or merge requests + * @param string $buildSpecification machine specification for deployment builds. + * @param string $runtimeSpecification machine specification for ssr executions. + * @param string $buildRuntime site build runtime. + * @param string $adapter site framework adapter. + * @param string $fallbackFile name of fallback file to use instead of 404 page. if null, appwrite 404 page will be displayed. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $name, + public bool $enabled, + public bool $live, + public bool $logging, + public string $framework, + public int $deploymentRetention, + public string $deploymentId, + public string $deploymentCreatedAt, + public string $deploymentScreenshotLight, + public string $deploymentScreenshotDark, + public string $latestDeploymentId, + public string $latestDeploymentCreatedAt, + public string $latestDeploymentStatus, + public array $vars, + public int $timeout, + public string $installCommand, + public string $buildCommand, + public string $startCommand, + public string $outputDirectory, + public string $installationId, + public string $providerRepositoryId, + public string $providerBranch, + public string $providerRootDirectory, + public bool $providerSilentMode, + public string $buildSpecification, + public string $runtimeSpecification, + public string $buildRuntime, + public string $adapter, + public string $fallbackFile + ) { + } +} diff --git a/src/Appwrite/Models/SiteList.php b/src/Appwrite/Models/SiteList.php new file mode 100644 index 0000000..54b2e6e --- /dev/null +++ b/src/Appwrite/Models/SiteList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'sites' => Site::class + ]; + + /** + * SiteList constructor. + * + * @param int $total total number of sites that matched your query. + * @param list $sites list of sites. + */ + public function __construct( + public int $total, + public array $sites + ) { + } +} diff --git a/src/Appwrite/Models/Specification.php b/src/Appwrite/Models/Specification.php new file mode 100644 index 0000000..a74f53c --- /dev/null +++ b/src/Appwrite/Models/Specification.php @@ -0,0 +1,27 @@ + + */ + private const ARRAY_TYPES = [ + 'specifications' => Specification::class + ]; + + /** + * SpecificationList constructor. + * + * @param int $total total number of specifications that matched your query. + * @param list $specifications list of specifications. + */ + public function __construct( + public int $total, + public array $specifications + ) { + } +} diff --git a/src/Appwrite/Models/Subscriber.php b/src/Appwrite/Models/Subscriber.php new file mode 100644 index 0000000..718c8f5 --- /dev/null +++ b/src/Appwrite/Models/Subscriber.php @@ -0,0 +1,46 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Subscriber constructor. + * + * @param string $id subscriber id. + * @param string $createdAt subscriber creation time in iso 8601 format. + * @param string $updatedAt subscriber update date in iso 8601 format. + * @param string $targetId target id. + * @param Target $target target. + * @param string $userId topic id. + * @param string $userName user name. + * @param string $topicId topic id. + * @param string $providerType the target provider type. can be one of the following: `email`, `sms` or `push`. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $targetId, + public Target $target, + public string $userId, + public string $userName, + public string $topicId, + public string $providerType + ) { + } +} diff --git a/src/Appwrite/Models/SubscriberList.php b/src/Appwrite/Models/SubscriberList.php new file mode 100644 index 0000000..886e747 --- /dev/null +++ b/src/Appwrite/Models/SubscriberList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'subscribers' => Subscriber::class + ]; + + /** + * SubscriberList constructor. + * + * @param int $total total number of subscribers that matched your query. + * @param list $subscribers list of subscribers. + */ + public function __construct( + public int $total, + public array $subscribers + ) { + } +} diff --git a/src/Appwrite/Models/Table.php b/src/Appwrite/Models/Table.php new file mode 100644 index 0000000..b5db6d0 --- /dev/null +++ b/src/Appwrite/Models/Table.php @@ -0,0 +1,60 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt', + 'permissions' => '$permissions' + ]; + + /** + * @var array + */ + private const ARRAY_TYPES = [ + 'indexes' => ColumnIndex::class + ]; + + /** + * Table constructor. + * + * @param string $id table id. + * @param string $createdAt table creation date in iso 8601 format. + * @param string $updatedAt table update date in iso 8601 format. + * @param array $permissions table permissions. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param string $databaseId database id. + * @param string $name table name. + * @param bool $enabled table enabled. can be 'enabled' or 'disabled'. when disabled, the table is inaccessible to users, but remains accessible to server sdks using api keys. + * @param bool $rowSecurity whether row-level permissions are enabled. [learn more about permissions](https://appwrite.io/docs/permissions). + * @param array $columns table columns. + * @param list $indexes table indexes. + * @param int $bytesMax maximum row size in bytes. returns 0 when no limit applies. + * @param int $bytesUsed currently used row size in bytes based on defined columns. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public string $databaseId, + public string $name, + public bool $enabled, + public bool $rowSecurity, + public array $columns, + public array $indexes, + public int $bytesMax, + public int $bytesUsed + ) { + } +} diff --git a/src/Appwrite/Models/TableList.php b/src/Appwrite/Models/TableList.php new file mode 100644 index 0000000..96b3e66 --- /dev/null +++ b/src/Appwrite/Models/TableList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'tables' => Table::class + ]; + + /** + * TableList constructor. + * + * @param int $total total number of tables that matched your query. + * @param list $tables list of tables. + */ + public function __construct( + public int $total, + public array $tables + ) { + } +} diff --git a/src/Appwrite/Models/Target.php b/src/Appwrite/Models/Target.php new file mode 100644 index 0000000..f1d6a05 --- /dev/null +++ b/src/Appwrite/Models/Target.php @@ -0,0 +1,46 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Target constructor. + * + * @param string $id target id. + * @param string $createdAt target creation time in iso 8601 format. + * @param string $updatedAt target update date in iso 8601 format. + * @param string $name target name. + * @param string $userId user id. + * @param string $providerType the target provider type. can be one of the following: `email`, `sms` or `push`. + * @param string $identifier the target identifier. + * @param bool $expired is the target expired. + * @param string|null $providerId provider id. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $name, + public string $userId, + public string $providerType, + public string $identifier, + public bool $expired, + public ?string $providerId = null + ) { + } +} diff --git a/src/Appwrite/Models/TargetList.php b/src/Appwrite/Models/TargetList.php new file mode 100644 index 0000000..93a3d15 --- /dev/null +++ b/src/Appwrite/Models/TargetList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'targets' => Target::class + ]; + + /** + * TargetList constructor. + * + * @param int $total total number of targets that matched your query. + * @param list $targets list of targets. + */ + public function __construct( + public int $total, + public array $targets + ) { + } +} diff --git a/src/Appwrite/Models/Team.php b/src/Appwrite/Models/Team.php new file mode 100644 index 0000000..a6e4d98 --- /dev/null +++ b/src/Appwrite/Models/Team.php @@ -0,0 +1,40 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Team constructor. + * + * @param string $id team id. + * @param string $createdAt team creation date in iso 8601 format. + * @param string $updatedAt team update date in iso 8601 format. + * @param string $name team name. + * @param int $total total number of team members. + * @param Preferences $prefs team preferences as a key-value object + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $name, + public int $total, + public Preferences $prefs + ) { + } +} diff --git a/src/Appwrite/Models/TeamList.php b/src/Appwrite/Models/TeamList.php new file mode 100644 index 0000000..9bc3645 --- /dev/null +++ b/src/Appwrite/Models/TeamList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'teams' => Team::class + ]; + + /** + * TeamList constructor. + * + * @param int $total total number of teams that matched your query. + * @param list $teams list of teams. + */ + public function __construct( + public int $total, + public array $teams + ) { + } +} diff --git a/src/Appwrite/Models/Token.php b/src/Appwrite/Models/Token.php new file mode 100644 index 0000000..bb843d5 --- /dev/null +++ b/src/Appwrite/Models/Token.php @@ -0,0 +1,39 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt' + ]; + + /** + * Token constructor. + * + * @param string $id token id. + * @param string $createdAt token creation date in iso 8601 format. + * @param string $userId user id. + * @param string $secret token secret key. this will return an empty string unless the response is returned using an api key or as part of a webhook payload. + * @param string $expire token expiration date in iso 8601 format. + * @param string $phrase security phrase of a token. empty if security phrase was not requested when creating a token. it includes randomly generated phrase which is also sent in the external resource such as email. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $userId, + public string $secret, + public string $expire, + public string $phrase + ) { + } +} diff --git a/src/Appwrite/Models/Topic.php b/src/Appwrite/Models/Topic.php new file mode 100644 index 0000000..ef39b20 --- /dev/null +++ b/src/Appwrite/Models/Topic.php @@ -0,0 +1,44 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Topic constructor. + * + * @param string $id topic id. + * @param string $createdAt topic creation time in iso 8601 format. + * @param string $updatedAt topic update date in iso 8601 format. + * @param string $name the name of the topic. + * @param int $emailTotal total count of email subscribers subscribed to the topic. + * @param int $smsTotal total count of sms subscribers subscribed to the topic. + * @param int $pushTotal total count of push subscribers subscribed to the topic. + * @param array $subscribe subscribe permissions. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $name, + public int $emailTotal, + public int $smsTotal, + public int $pushTotal, + public array $subscribe + ) { + } +} diff --git a/src/Appwrite/Models/TopicList.php b/src/Appwrite/Models/TopicList.php new file mode 100644 index 0000000..421acfd --- /dev/null +++ b/src/Appwrite/Models/TopicList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'topics' => Topic::class + ]; + + /** + * TopicList constructor. + * + * @param int $total total number of topics that matched your query. + * @param list $topics list of topics. + */ + public function __construct( + public int $total, + public array $topics + ) { + } +} diff --git a/src/Appwrite/Models/Transaction.php b/src/Appwrite/Models/Transaction.php new file mode 100644 index 0000000..7fc65f3 --- /dev/null +++ b/src/Appwrite/Models/Transaction.php @@ -0,0 +1,40 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Transaction constructor. + * + * @param string $id transaction id. + * @param string $createdAt transaction creation time in iso 8601 format. + * @param string $updatedAt transaction update date in iso 8601 format. + * @param string $status current status of the transaction. one of: pending, committing, committed, rolled_back, failed. + * @param int $operations number of operations in the transaction. + * @param string $expiresAt expiration time in iso 8601 format. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $status, + public int $operations, + public string $expiresAt + ) { + } +} diff --git a/src/Appwrite/Models/TransactionList.php b/src/Appwrite/Models/TransactionList.php new file mode 100644 index 0000000..b3ce209 --- /dev/null +++ b/src/Appwrite/Models/TransactionList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'transactions' => Transaction::class + ]; + + /** + * TransactionList constructor. + * + * @param int $total total number of transactions that matched your query. + * @param list $transactions list of transactions. + */ + public function __construct( + public int $total, + public array $transactions + ) { + } +} diff --git a/src/Appwrite/Models/User.php b/src/Appwrite/Models/User.php new file mode 100644 index 0000000..ad759c6 --- /dev/null +++ b/src/Appwrite/Models/User.php @@ -0,0 +1,77 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * @var array + */ + private const ARRAY_TYPES = [ + 'targets' => Target::class + ]; + + /** + * User constructor. + * + * @param string $id user id. + * @param string $createdAt user creation date in iso 8601 format. + * @param string $updatedAt user update date in iso 8601 format. + * @param string $name user name. + * @param string $registration user registration date in iso 8601 format. + * @param bool $status user status. pass `true` for enabled and `false` for disabled. + * @param array $labels labels for the user. + * @param string $passwordUpdate password update time in iso 8601 format. + * @param string $email user email address. + * @param string $phone user phone number in e.164 format. + * @param bool $emailVerification email verification status. + * @param bool $phoneVerification phone verification status. + * @param bool $mfa multi factor authentication status. + * @param Preferences $prefs user preferences as a key-value object + * @param list $targets a user-owned message receiver. a single user may have multiple e.g. emails, phones, and a browser. each target is registered with a single provider. + * @param string $accessedAt most recent access date in iso 8601 format. this attribute is only updated again after 24 hours. + * @param string|null $password hashed user password. + * @param string|null $hash password hashing algorithm. + * @param array|null $hashOptions password hashing algorithm configuration. + * @param bool|null $impersonator whether the user can impersonate other users. + * @param string|null $impersonatorUserId id of the original actor performing the impersonation. present only when the current request is impersonating another user. internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $name, + public string $registration, + public bool $status, + public array $labels, + public string $passwordUpdate, + public string $email, + public string $phone, + public bool $emailVerification, + public bool $phoneVerification, + public bool $mfa, + public Preferences $prefs, + public array $targets, + public string $accessedAt, + public ?string $password = null, + public ?string $hash = null, + public ?array $hashOptions = null, + public ?bool $impersonator = null, + public ?string $impersonatorUserId = null + ) { + } +} diff --git a/src/Appwrite/Models/UserList.php b/src/Appwrite/Models/UserList.php new file mode 100644 index 0000000..d77ad82 --- /dev/null +++ b/src/Appwrite/Models/UserList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'users' => User::class + ]; + + /** + * UserList constructor. + * + * @param int $total total number of users that matched your query. + * @param list $users list of users. + */ + public function __construct( + public int $total, + public array $users + ) { + } +} diff --git a/src/Appwrite/Models/Variable.php b/src/Appwrite/Models/Variable.php new file mode 100644 index 0000000..a010b9d --- /dev/null +++ b/src/Appwrite/Models/Variable.php @@ -0,0 +1,44 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Variable constructor. + * + * @param string $id variable id. + * @param string $createdAt variable creation date in iso 8601 format. + * @param string $updatedAt variable creation date in iso 8601 format. + * @param string $key variable key. + * @param string $value variable value. + * @param bool $secret variable secret flag. secret variables can only be updated or deleted, but never read. + * @param string $resourceType service to which the variable belongs. possible values are "project", "function" + * @param string $resourceId id of resource to which the variable belongs. if resourcetype is "project", it is empty. if resourcetype is "function", it is id of the function. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $key, + public string $value, + public bool $secret, + public string $resourceType, + public string $resourceId + ) { + } +} diff --git a/src/Appwrite/Models/VariableList.php b/src/Appwrite/Models/VariableList.php new file mode 100644 index 0000000..8298e2a --- /dev/null +++ b/src/Appwrite/Models/VariableList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'variables' => Variable::class + ]; + + /** + * VariableList constructor. + * + * @param int $total total number of variables that matched your query. + * @param list $variables list of variables. + */ + public function __construct( + public int $total, + public array $variables + ) { + } +} diff --git a/src/Appwrite/Models/Webhook.php b/src/Appwrite/Models/Webhook.php new file mode 100644 index 0000000..5ffb3fa --- /dev/null +++ b/src/Appwrite/Models/Webhook.php @@ -0,0 +1,54 @@ + + */ + private const FIELD_MAP = [ + 'id' => '$id', + 'createdAt' => '$createdAt', + 'updatedAt' => '$updatedAt' + ]; + + /** + * Webhook constructor. + * + * @param string $id webhook id. + * @param string $createdAt webhook creation date in iso 8601 format. + * @param string $updatedAt webhook update date in iso 8601 format. + * @param string $name webhook name. + * @param string $url webhook url endpoint. + * @param array $events webhook trigger events. + * @param bool $security indicated if ssl / tls certificate verification is enabled. + * @param string $httpUser http basic authentication username. + * @param string $httpPass http basic authentication password. + * @param string $signatureKey signature key which can be used to validated incoming + * @param bool $enabled indicates if this webhook is enabled. + * @param string $logs webhook error logs from the most recent failure. + * @param int $attempts number of consecutive failed webhook attempts. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $name, + public string $url, + public array $events, + public bool $security, + public string $httpUser, + public string $httpPass, + public string $signatureKey, + public bool $enabled, + public string $logs, + public int $attempts + ) { + } +} diff --git a/src/Appwrite/Models/WebhookList.php b/src/Appwrite/Models/WebhookList.php new file mode 100644 index 0000000..83cfe2b --- /dev/null +++ b/src/Appwrite/Models/WebhookList.php @@ -0,0 +1,30 @@ + + */ + private const ARRAY_TYPES = [ + 'webhooks' => Webhook::class + ]; + + /** + * WebhookList constructor. + * + * @param int $total total number of webhooks that matched your query. + * @param list $webhooks list of webhooks. + */ + public function __construct( + public int $total, + public array $webhooks + ) { + } +} diff --git a/src/Appwrite/Service.php b/src/Appwrite/Service.php index a9a89a1..03a6542 100644 --- a/src/Appwrite/Service.php +++ b/src/Appwrite/Service.php @@ -10,4 +10,78 @@ public function __construct(Client $client) { $this->client = $client; } -} \ No newline at end of file + + /** + * @param mixed $response + * @param array $models + * @param array, all: array}> $dispatch + * @return mixed + */ + protected function parseResponse(mixed $response, array $models = [], array $dispatch = []): mixed + { + if (!is_array($response) || empty($models)) { + return $response; + } + + if (count($models) === 1) { + return $this->hydrateModel($models[0], $response); + } + + if (empty($dispatch)) { + throw new \UnexpectedValueException('Unable to match response to any expected response model.'); + } + + $bestModel = null; + $bestScore = -1; + + foreach ($dispatch as $model => $metadata) { + $requiredFields = $metadata['required'] ?? []; + $allFields = $metadata['all'] ?? []; + $missingRequiredField = false; + + foreach ($requiredFields as $field) { + if (!array_key_exists($field, $response)) { + $missingRequiredField = true; + break; + } + } + + if ($missingRequiredField) { + continue; + } + + $score = 0; + + foreach ($allFields as $field) { + if (array_key_exists($field, $response)) { + $score++; + } + } + + if ($score > $bestScore) { + $bestScore = $score; + $bestModel = $model; + } + } + + if ($bestScore < 0 || $bestModel === null) { + throw new \UnexpectedValueException('Unable to match response to any expected response model.'); + } + + return $this->hydrateModel($bestModel, $response); + } + + /** + * @param class-string $model + * @param array $response + * @return mixed + */ + protected function hydrateModel(string $model, array $response): mixed + { + if (!method_exists($model, 'from')) { + return $response; + } + + return $model::from($response); + } +} diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index c9d6b77..91a68dd 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -21,9 +21,9 @@ public function __construct(Client $client) * Get the currently logged in user. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function get(): array + public function get(): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -35,12 +35,18 @@ public function get(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -57,9 +63,9 @@ public function get(): array * @param string $password * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function create(string $userId, string $email, string $password, ?string $name = null): array + public function create(string $userId, string $email, string $password, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -79,12 +85,18 @@ public function create(string $userId, string $email, string $password, ?string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -100,9 +112,9 @@ public function create(string $userId, string $email, string $password, ?string * @param string $email * @param string $password * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateEmail(string $email, string $password): array + public function updateEmail(string $email, string $password): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -117,12 +129,18 @@ public function updateEmail(string $email, string $password): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -131,9 +149,9 @@ public function updateEmail(string $email, string $password): array * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\IdentityList */ - public function listIdentities(?array $queries = null, ?bool $total = null): array + public function listIdentities(?array $queries = null, ?bool $total = null): \Appwrite\Models\IdentityList { $apiPath = str_replace( [], @@ -153,12 +171,18 @@ public function listIdentities(?array $queries = null, ?bool $total = null): arr $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\IdentityList::class] + ); + } /** @@ -182,12 +206,15 @@ public function deleteIdentity(string $identityId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -199,9 +226,9 @@ public function deleteIdentity(string $identityId): string * * @param ?int $duration * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Jwt */ - public function createJWT(?int $duration = null): array + public function createJWT(?int $duration = null): \Appwrite\Models\Jwt { $apiPath = str_replace( [], @@ -218,12 +245,18 @@ public function createJWT(?int $duration = null): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Jwt::class] + ); + } /** @@ -233,9 +266,9 @@ public function createJWT(?int $duration = null): array * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\LogList */ - public function listLogs(?array $queries = null, ?bool $total = null): array + public function listLogs(?array $queries = null, ?bool $total = null): \Appwrite\Models\LogList { $apiPath = str_replace( [], @@ -255,12 +288,18 @@ public function listLogs(?array $queries = null, ?bool $total = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\LogList::class] + ); + } /** @@ -268,9 +307,9 @@ public function listLogs(?array $queries = null, ?bool $total = null): array * * @param bool $mfa * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateMFA(bool $mfa): array + public function updateMFA(bool $mfa): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -284,12 +323,18 @@ public function updateMFA(bool $mfa): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -300,9 +345,9 @@ public function updateMFA(bool $mfa): array * * @param AuthenticatorType $type * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaType */ - public function createMFAAuthenticator(AuthenticatorType $type): array + public function createMFAAuthenticator(AuthenticatorType $type): \Appwrite\Models\MfaType { $apiPath = str_replace( ['{type}'], @@ -316,12 +361,18 @@ public function createMFAAuthenticator(AuthenticatorType $type): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaType::class] + ); + } /** @@ -332,9 +383,9 @@ public function createMFAAuthenticator(AuthenticatorType $type): array * @param AuthenticatorType $type * @param string $otp * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateMFAAuthenticator(AuthenticatorType $type, string $otp): array + public function updateMFAAuthenticator(AuthenticatorType $type, string $otp): \Appwrite\Models\User { $apiPath = str_replace( ['{type}'], @@ -349,12 +400,18 @@ public function updateMFAAuthenticator(AuthenticatorType $type, string $otp): ar $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -378,12 +435,15 @@ public function deleteMFAAuthenticator(AuthenticatorType $type): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -393,9 +453,9 @@ public function deleteMFAAuthenticator(AuthenticatorType $type): string * * @param AuthenticationFactor $factor * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaChallenge */ - public function createMFAChallenge(AuthenticationFactor $factor): array + public function createMFAChallenge(AuthenticationFactor $factor): \Appwrite\Models\MfaChallenge { $apiPath = str_replace( [], @@ -409,12 +469,18 @@ public function createMFAChallenge(AuthenticationFactor $factor): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaChallenge::class] + ); + } /** @@ -427,9 +493,9 @@ public function createMFAChallenge(AuthenticationFactor $factor): array * @param string $challengeId * @param string $otp * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session */ - public function updateMFAChallenge(string $challengeId, string $otp): array + public function updateMFAChallenge(string $challengeId, string $otp): \Appwrite\Models\Session { $apiPath = str_replace( [], @@ -444,21 +510,27 @@ public function updateMFAChallenge(string $challengeId, string $otp): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** * List the factors available on the account to be used as a MFA challange. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaFactors */ - public function listMFAFactors(): array + public function listMFAFactors(): \Appwrite\Models\MfaFactors { $apiPath = str_replace( [], @@ -470,12 +542,18 @@ public function listMFAFactors(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaFactors::class] + ); + } /** @@ -485,9 +563,9 @@ public function listMFAFactors(): array * method. An OTP challenge is required to read recovery codes. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaRecoveryCodes */ - public function getMFARecoveryCodes(): array + public function getMFARecoveryCodes(): \Appwrite\Models\MfaRecoveryCodes { $apiPath = str_replace( [], @@ -499,12 +577,18 @@ public function getMFARecoveryCodes(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaRecoveryCodes::class] + ); + } /** @@ -515,9 +599,9 @@ public function getMFARecoveryCodes(): array * method. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaRecoveryCodes */ - public function createMFARecoveryCodes(): array + public function createMFARecoveryCodes(): \Appwrite\Models\MfaRecoveryCodes { $apiPath = str_replace( [], @@ -530,12 +614,18 @@ public function createMFARecoveryCodes(): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaRecoveryCodes::class] + ); + } /** @@ -545,9 +635,9 @@ public function createMFARecoveryCodes(): array * method. An OTP challenge is required to regenreate recovery codes. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaRecoveryCodes */ - public function updateMFARecoveryCodes(): array + public function updateMFARecoveryCodes(): \Appwrite\Models\MfaRecoveryCodes { $apiPath = str_replace( [], @@ -560,12 +650,18 @@ public function updateMFARecoveryCodes(): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaRecoveryCodes::class] + ); + } /** @@ -573,9 +669,9 @@ public function updateMFARecoveryCodes(): array * * @param string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateName(string $name): array + public function updateName(string $name): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -589,12 +685,18 @@ public function updateName(string $name): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -605,9 +707,9 @@ public function updateName(string $name): array * @param string $password * @param ?string $oldPassword * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updatePassword(string $password, ?string $oldPassword = null): array + public function updatePassword(string $password, ?string $oldPassword = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -625,12 +727,18 @@ public function updatePassword(string $password, ?string $oldPassword = null): a $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -643,9 +751,9 @@ public function updatePassword(string $password, ?string $oldPassword = null): a * @param string $phone * @param string $password * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updatePhone(string $phone, string $password): array + public function updatePhone(string $phone, string $password): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -660,21 +768,27 @@ public function updatePhone(string $phone, string $password): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** * Get the preferences as a key-value object for the currently logged in user. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Preferences */ - public function getPrefs(): array + public function getPrefs(): \Appwrite\Models\Preferences { $apiPath = str_replace( [], @@ -686,12 +800,18 @@ public function getPrefs(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Preferences::class] + ); + } /** @@ -701,9 +821,9 @@ public function getPrefs(): array * * @param array $prefs * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updatePrefs(array $prefs): array + public function updatePrefs(array $prefs): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -717,12 +837,18 @@ public function updatePrefs(array $prefs): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -738,9 +864,9 @@ public function updatePrefs(array $prefs): array * @param string $email * @param string $url * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function createRecovery(string $email, string $url): array + public function createRecovery(string $email, string $url): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -755,12 +881,18 @@ public function createRecovery(string $email, string $url): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -779,9 +911,9 @@ public function createRecovery(string $email, string $url): array * @param string $secret * @param string $password * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function updateRecovery(string $userId, string $secret, string $password): array + public function updateRecovery(string $userId, string $secret, string $password): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -797,12 +929,18 @@ public function updateRecovery(string $userId, string $secret, string $password) $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -810,9 +948,9 @@ public function updateRecovery(string $userId, string $secret, string $password) * logged in user. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\SessionList */ - public function listSessions(): array + public function listSessions(): \Appwrite\Models\SessionList { $apiPath = str_replace( [], @@ -824,12 +962,18 @@ public function listSessions(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\SessionList::class] + ); + } /** @@ -852,12 +996,15 @@ public function deleteSessions(): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -870,9 +1017,9 @@ public function deleteSessions(): string * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session */ - public function createAnonymousSession(): array + public function createAnonymousSession(): \Appwrite\Models\Session { $apiPath = str_replace( [], @@ -885,12 +1032,18 @@ public function createAnonymousSession(): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** @@ -904,9 +1057,9 @@ public function createAnonymousSession(): array * @param string $email * @param string $password * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session */ - public function createEmailPasswordSession(string $email, string $password): array + public function createEmailPasswordSession(string $email, string $password): \Appwrite\Models\Session { $apiPath = str_replace( [], @@ -921,12 +1074,18 @@ public function createEmailPasswordSession(string $email, string $password): arr $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** @@ -937,12 +1096,12 @@ public function createEmailPasswordSession(string $email, string $password): arr * @param string $userId * @param string $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session * * @deprecated This API has been deprecated since 1.6.0. Please use `createSession` instead. * @see Account::createSession */ - public function updateMagicURLSession(string $userId, string $secret): array + public function updateMagicURLSession(string $userId, string $secret): \Appwrite\Models\Session { $apiPath = str_replace( [], @@ -957,12 +1116,18 @@ public function updateMagicURLSession(string $userId, string $secret): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** @@ -973,12 +1138,12 @@ public function updateMagicURLSession(string $userId, string $secret): array * @param string $userId * @param string $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session * * @deprecated This API has been deprecated since 1.6.0. Please use `createSession` instead. * @see Account::createSession */ - public function updatePhoneSession(string $userId, string $secret): array + public function updatePhoneSession(string $userId, string $secret): \Appwrite\Models\Session { $apiPath = str_replace( [], @@ -993,12 +1158,18 @@ public function updatePhoneSession(string $userId, string $secret): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** @@ -1009,9 +1180,9 @@ public function updatePhoneSession(string $userId, string $secret): array * @param string $userId * @param string $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session */ - public function createSession(string $userId, string $secret): array + public function createSession(string $userId, string $secret): \Appwrite\Models\Session { $apiPath = str_replace( [], @@ -1026,12 +1197,18 @@ public function createSession(string $userId, string $secret): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** @@ -1040,9 +1217,9 @@ public function createSession(string $userId, string $secret): array * * @param string $sessionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session */ - public function getSession(string $sessionId): array + public function getSession(string $sessionId): \Appwrite\Models\Session { $apiPath = str_replace( ['{sessionId}'], @@ -1055,12 +1232,18 @@ public function getSession(string $sessionId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** @@ -1070,9 +1253,9 @@ public function getSession(string $sessionId): array * * @param string $sessionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session */ - public function updateSession(string $sessionId): array + public function updateSession(string $sessionId): \Appwrite\Models\Session { $apiPath = str_replace( ['{sessionId}'], @@ -1086,12 +1269,18 @@ public function updateSession(string $sessionId): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** @@ -1119,12 +1308,15 @@ public function deleteSession(string $sessionId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -1133,9 +1325,9 @@ public function deleteSession(string $sessionId): string * completely delete a user, use the Users API instead. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateStatus(): array + public function updateStatus(): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -1148,12 +1340,18 @@ public function updateStatus(): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -1176,9 +1374,9 @@ public function updateStatus(): array * @param string $email * @param ?bool $phrase * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function createEmailToken(string $userId, string $email, ?bool $phrase = null): array + public function createEmailToken(string $userId, string $email, ?bool $phrase = null): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1197,12 +1395,18 @@ public function createEmailToken(string $userId, string $email, ?bool $phrase = $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1226,9 +1430,9 @@ public function createEmailToken(string $userId, string $email, ?bool $phrase = * @param ?string $url * @param ?bool $phrase * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function createMagicURLToken(string $userId, string $email, ?string $url = null, ?bool $phrase = null): array + public function createMagicURLToken(string $userId, string $email, ?string $url = null, ?bool $phrase = null): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1251,12 +1455,18 @@ public function createMagicURLToken(string $userId, string $email, ?string $url $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1307,12 +1517,15 @@ public function createOAuth2Token(OAuthProvider $provider, ?string $success = nu $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams, 'location' ); + + return $response; + } /** @@ -1330,9 +1543,9 @@ public function createOAuth2Token(OAuthProvider $provider, ?string $success = nu * @param string $userId * @param string $phone * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function createPhoneToken(string $userId, string $phone): array + public function createPhoneToken(string $userId, string $phone): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1347,12 +1560,18 @@ public function createPhoneToken(string $userId, string $phone): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1374,9 +1593,9 @@ public function createPhoneToken(string $userId, string $phone): array * * @param string $url * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function createEmailVerification(string $url): array + public function createEmailVerification(string $url): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1390,12 +1609,18 @@ public function createEmailVerification(string $url): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1417,12 +1642,12 @@ public function createEmailVerification(string $url): array * * @param string $url * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token * * @deprecated This API has been deprecated since 1.8.0. Please use `createEmailVerification` instead. * @see Account::createEmailVerification */ - public function createVerification(string $url): array + public function createVerification(string $url): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1436,12 +1661,18 @@ public function createVerification(string $url): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1453,9 +1684,9 @@ public function createVerification(string $url): array * @param string $userId * @param string $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function updateEmailVerification(string $userId, string $secret): array + public function updateEmailVerification(string $userId, string $secret): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1470,12 +1701,18 @@ public function updateEmailVerification(string $userId, string $secret): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1487,12 +1724,12 @@ public function updateEmailVerification(string $userId, string $secret): array * @param string $userId * @param string $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token * * @deprecated This API has been deprecated since 1.8.0. Please use `updateEmailVerification` instead. * @see Account::updateEmailVerification */ - public function updateVerification(string $userId, string $secret): array + public function updateVerification(string $userId, string $secret): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1507,12 +1744,18 @@ public function updateVerification(string $userId, string $secret): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1526,9 +1769,9 @@ public function updateVerification(string $userId, string $secret): array * minutes. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function createPhoneVerification(): array + public function createPhoneVerification(): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1541,12 +1784,18 @@ public function createPhoneVerification(): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1558,9 +1807,9 @@ public function createPhoneVerification(): array * @param string $userId * @param string $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function updatePhoneVerification(string $userId, string $secret): array + public function updatePhoneVerification(string $userId, string $secret): \Appwrite\Models\Token { $apiPath = str_replace( [], @@ -1575,11 +1824,17 @@ public function updatePhoneVerification(string $userId, string $secret): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Activities.php b/src/Appwrite/Services/Activities.php index b8c0e83..d1aecb5 100644 --- a/src/Appwrite/Services/Activities.php +++ b/src/Appwrite/Services/Activities.php @@ -19,9 +19,9 @@ public function __construct(Client $client) * * @param ?string $queries * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ActivityEventList */ - public function listEvents(?string $queries = null): array + public function listEvents(?string $queries = null): \Appwrite\Models\ActivityEventList { $apiPath = str_replace( [], @@ -37,12 +37,18 @@ public function listEvents(?string $queries = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ActivityEventList::class] + ); + } /** @@ -51,9 +57,9 @@ public function listEvents(?string $queries = null): array * * @param string $eventId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ActivityEvent */ - public function getEvent(string $eventId): array + public function getEvent(string $eventId): \Appwrite\Models\ActivityEvent { $apiPath = str_replace( ['{eventId}'], @@ -66,11 +72,17 @@ public function getEvent(string $eventId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ActivityEvent::class] + ); + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php index 86e29d9..f3de7c3 100644 --- a/src/Appwrite/Services/Avatars.php +++ b/src/Appwrite/Services/Avatars.php @@ -65,12 +65,15 @@ public function getBrowser(Browser $code, ?int $width = null, ?int $height = nul $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -116,12 +119,15 @@ public function getCreditCard(CreditCard $code, ?int $width = null, ?int $height $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -147,12 +153,15 @@ public function getFavicon(string $url): string $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -199,12 +208,15 @@ public function getFlag(Flag $code, ?int $width = null, ?int $height = null, ?in $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -247,12 +259,15 @@ public function getImage(string $url, ?int $width = null, ?int $height = null): $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -308,12 +323,15 @@ public function getInitials(?string $name = null, ?int $width = null, ?int $heig $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -353,12 +371,15 @@ public function getQR(string $text, ?int $size = null, ?int $margin = null, ?boo $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -485,11 +506,14 @@ public function getScreenshot(string $url, ?array $headers = null, ?int $viewpor $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Backups.php b/src/Appwrite/Services/Backups.php index bca41ac..f850ed3 100644 --- a/src/Appwrite/Services/Backups.php +++ b/src/Appwrite/Services/Backups.php @@ -20,9 +20,9 @@ public function __construct(Client $client) * * @param ?array $queries * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupArchiveList */ - public function listArchives(?array $queries = null): array + public function listArchives(?array $queries = null): \Appwrite\Models\BackupArchiveList { $apiPath = str_replace( [], @@ -38,12 +38,18 @@ public function listArchives(?array $queries = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupArchiveList::class] + ); + } /** @@ -52,9 +58,9 @@ public function listArchives(?array $queries = null): array * @param array $services * @param ?string $resourceId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupArchive */ - public function createArchive(array $services, ?string $resourceId = null): array + public function createArchive(array $services, ?string $resourceId = null): \Appwrite\Models\BackupArchive { $apiPath = str_replace( [], @@ -69,12 +75,18 @@ public function createArchive(array $services, ?string $resourceId = null): arra $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupArchive::class] + ); + } /** @@ -82,9 +94,9 @@ public function createArchive(array $services, ?string $resourceId = null): arra * * @param string $archiveId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupArchive */ - public function getArchive(string $archiveId): array + public function getArchive(string $archiveId): \Appwrite\Models\BackupArchive { $apiPath = str_replace( ['{archiveId}'], @@ -97,12 +109,18 @@ public function getArchive(string $archiveId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupArchive::class] + ); + } /** @@ -126,12 +144,15 @@ public function deleteArchive(string $archiveId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -139,9 +160,9 @@ public function deleteArchive(string $archiveId): string * * @param ?array $queries * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupPolicyList */ - public function listPolicies(?array $queries = null): array + public function listPolicies(?array $queries = null): \Appwrite\Models\BackupPolicyList { $apiPath = str_replace( [], @@ -157,12 +178,18 @@ public function listPolicies(?array $queries = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupPolicyList::class] + ); + } /** @@ -176,9 +203,9 @@ public function listPolicies(?array $queries = null): array * @param ?string $resourceId * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupPolicy */ - public function createPolicy(string $policyId, array $services, int $retention, string $schedule, ?string $name = null, ?string $resourceId = null, ?bool $enabled = null): array + public function createPolicy(string $policyId, array $services, int $retention, string $schedule, ?string $name = null, ?string $resourceId = null, ?bool $enabled = null): \Appwrite\Models\BackupPolicy { $apiPath = str_replace( [], @@ -204,12 +231,18 @@ public function createPolicy(string $policyId, array $services, int $retention, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupPolicy::class] + ); + } /** @@ -217,9 +250,9 @@ public function createPolicy(string $policyId, array $services, int $retention, * * @param string $policyId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupPolicy */ - public function getPolicy(string $policyId): array + public function getPolicy(string $policyId): \Appwrite\Models\BackupPolicy { $apiPath = str_replace( ['{policyId}'], @@ -232,12 +265,18 @@ public function getPolicy(string $policyId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupPolicy::class] + ); + } /** @@ -249,9 +288,9 @@ public function getPolicy(string $policyId): array * @param ?string $schedule * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupPolicy */ - public function updatePolicy(string $policyId, ?string $name = null, ?int $retention = null, ?string $schedule = null, ?bool $enabled = null): array + public function updatePolicy(string $policyId, ?string $name = null, ?int $retention = null, ?string $schedule = null, ?bool $enabled = null): \Appwrite\Models\BackupPolicy { $apiPath = str_replace( ['{policyId}'], @@ -272,12 +311,18 @@ public function updatePolicy(string $policyId, ?string $name = null, ?int $reten $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupPolicy::class] + ); + } /** @@ -301,12 +346,15 @@ public function deletePolicy(string $policyId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -317,9 +365,9 @@ public function deletePolicy(string $policyId): string * @param ?string $newResourceId * @param ?string $newResourceName * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupRestoration */ - public function createRestoration(string $archiveId, array $services, ?string $newResourceId = null, ?string $newResourceName = null): array + public function createRestoration(string $archiveId, array $services, ?string $newResourceId = null, ?string $newResourceName = null): \Appwrite\Models\BackupRestoration { $apiPath = str_replace( [], @@ -342,12 +390,18 @@ public function createRestoration(string $archiveId, array $services, ?string $n $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupRestoration::class] + ); + } /** @@ -355,9 +409,9 @@ public function createRestoration(string $archiveId, array $services, ?string $n * * @param ?array $queries * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupRestorationList */ - public function listRestorations(?array $queries = null): array + public function listRestorations(?array $queries = null): \Appwrite\Models\BackupRestorationList { $apiPath = str_replace( [], @@ -373,12 +427,18 @@ public function listRestorations(?array $queries = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupRestorationList::class] + ); + } /** @@ -386,9 +446,9 @@ public function listRestorations(?array $queries = null): array * * @param string $restorationId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BackupRestoration */ - public function getRestoration(string $restorationId): array + public function getRestoration(string $restorationId): \Appwrite\Models\BackupRestoration { $apiPath = str_replace( ['{restorationId}'], @@ -401,11 +461,17 @@ public function getRestoration(string $restorationId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BackupRestoration::class] + ); + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 0f40c03..816d194 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -26,12 +26,12 @@ public function __construct(Client $client) * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DatabaseList * * @deprecated This API has been deprecated since 1.8.0. Please use `list` instead. * @see TablesDB::list */ - public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\DatabaseList { $apiPath = str_replace( [], @@ -55,12 +55,18 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DatabaseList::class] + ); + } /** @@ -71,12 +77,12 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param string $name * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Database * * @deprecated This API has been deprecated since 1.8.0. Please use `create` instead. * @see TablesDB::create */ - public function create(string $databaseId, string $name, ?bool $enabled = null): array + public function create(string $databaseId, string $name, ?bool $enabled = null): \Appwrite\Models\Database { $apiPath = str_replace( [], @@ -95,12 +101,18 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Database::class] + ); + } /** @@ -108,9 +120,9 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): * * @param ?array $queries * @throws AppwriteException - * @return array + * @return \Appwrite\Models\TransactionList */ - public function listTransactions(?array $queries = null): array + public function listTransactions(?array $queries = null): \Appwrite\Models\TransactionList { $apiPath = str_replace( [], @@ -126,12 +138,18 @@ public function listTransactions(?array $queries = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\TransactionList::class] + ); + } /** @@ -139,9 +157,9 @@ public function listTransactions(?array $queries = null): array * * @param ?int $ttl * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Transaction */ - public function createTransaction(?int $ttl = null): array + public function createTransaction(?int $ttl = null): \Appwrite\Models\Transaction { $apiPath = str_replace( [], @@ -158,12 +176,18 @@ public function createTransaction(?int $ttl = null): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Transaction::class] + ); + } /** @@ -171,9 +195,9 @@ public function createTransaction(?int $ttl = null): array * * @param string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Transaction */ - public function getTransaction(string $transactionId): array + public function getTransaction(string $transactionId): \Appwrite\Models\Transaction { $apiPath = str_replace( ['{transactionId}'], @@ -186,12 +210,18 @@ public function getTransaction(string $transactionId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Transaction::class] + ); + } /** @@ -201,9 +231,9 @@ public function getTransaction(string $transactionId): array * @param ?bool $commit * @param ?bool $rollback * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Transaction */ - public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): array + public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): \Appwrite\Models\Transaction { $apiPath = str_replace( ['{transactionId}'], @@ -225,12 +255,18 @@ public function updateTransaction(string $transactionId, ?bool $commit = null, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Transaction::class] + ); + } /** @@ -254,12 +290,15 @@ public function deleteTransaction(string $transactionId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -268,9 +307,9 @@ public function deleteTransaction(string $transactionId): string * @param string $transactionId * @param ?array $operations * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Transaction */ - public function createOperations(string $transactionId, ?array $operations = null): array + public function createOperations(string $transactionId, ?array $operations = null): \Appwrite\Models\Transaction { $apiPath = str_replace( ['{transactionId}'], @@ -288,12 +327,18 @@ public function createOperations(string $transactionId, ?array $operations = nul $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Transaction::class] + ); + } /** @@ -302,12 +347,12 @@ public function createOperations(string $transactionId, ?array $operations = nul * * @param string $databaseId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Database * * @deprecated This API has been deprecated since 1.8.0. Please use `get` instead. * @see TablesDB::get */ - public function get(string $databaseId): array + public function get(string $databaseId): \Appwrite\Models\Database { $apiPath = str_replace( ['{databaseId}'], @@ -320,12 +365,18 @@ public function get(string $databaseId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Database::class] + ); + } /** @@ -335,12 +386,12 @@ public function get(string $databaseId): array * @param ?string $name * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Database * * @deprecated This API has been deprecated since 1.8.0. Please use `update` instead. * @see TablesDB::update */ - public function update(string $databaseId, ?string $name = null, ?bool $enabled = null): array + public function update(string $databaseId, ?string $name = null, ?bool $enabled = null): \Appwrite\Models\Database { $apiPath = str_replace( ['{databaseId}'], @@ -362,12 +413,18 @@ public function update(string $databaseId, ?string $name = null, ?bool $enabled $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Database::class] + ); + } /** @@ -395,12 +452,15 @@ public function delete(string $databaseId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -412,12 +472,12 @@ public function delete(string $databaseId): string * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\CollectionList * * @deprecated This API has been deprecated since 1.8.0. Please use `listTables` instead. * @see TablesDB::listTables */ - public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\CollectionList { $apiPath = str_replace( ['{databaseId}'], @@ -442,12 +502,18 @@ public function listCollections(string $databaseId, ?array $queries = null, ?str $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\CollectionList::class] + ); + } /** @@ -465,12 +531,12 @@ public function listCollections(string $databaseId, ?array $queries = null, ?str * @param ?array $attributes * @param ?array $indexes * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Collection * * @deprecated This API has been deprecated since 1.8.0. Please use `createTable` instead. * @see TablesDB::createTable */ - public function createCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null, ?array $attributes = null, ?array $indexes = null): array + public function createCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null, ?array $attributes = null, ?array $indexes = null): \Appwrite\Models\Collection { $apiPath = str_replace( ['{databaseId}'], @@ -503,12 +569,18 @@ public function createCollection(string $databaseId, string $collectionId, strin $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Collection::class] + ); + } /** @@ -518,12 +590,12 @@ public function createCollection(string $databaseId, string $collectionId, strin * @param string $databaseId * @param string $collectionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Collection * * @deprecated This API has been deprecated since 1.8.0. Please use `getTable` instead. * @see TablesDB::getTable */ - public function getCollection(string $databaseId, string $collectionId): array + public function getCollection(string $databaseId, string $collectionId): \Appwrite\Models\Collection { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -537,12 +609,18 @@ public function getCollection(string $databaseId, string $collectionId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Collection::class] + ); + } /** @@ -555,12 +633,12 @@ public function getCollection(string $databaseId, string $collectionId): array * @param ?bool $documentSecurity * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Collection * * @deprecated This API has been deprecated since 1.8.0. Please use `updateTable` instead. * @see TablesDB::updateTable */ - public function updateCollection(string $databaseId, string $collectionId, ?string $name = null, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array + public function updateCollection(string $databaseId, string $collectionId, ?string $name = null, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): \Appwrite\Models\Collection { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -588,12 +666,18 @@ public function updateCollection(string $databaseId, string $collectionId, ?stri $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Collection::class] + ); + } /** @@ -623,12 +707,15 @@ public function deleteCollection(string $databaseId, string $collectionId): stri $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -639,12 +726,12 @@ public function deleteCollection(string $databaseId, string $collectionId): stri * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeList * * @deprecated This API has been deprecated since 1.8.0. Please use `listColumns` instead. * @see TablesDB::listColumns */ - public function listAttributes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): array + public function listAttributes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\AttributeList { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -666,12 +753,18 @@ public function listAttributes(string $databaseId, string $collectionId, ?array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeList::class] + ); + } /** @@ -685,12 +778,12 @@ public function listAttributes(string $databaseId, string $collectionId, ?array * @param ?bool $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeBoolean * * @deprecated This API has been deprecated since 1.8.0. Please use `createBooleanColumn` instead. * @see TablesDB::createBooleanColumn */ - public function createBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault = null, ?bool $xarray = null): array + public function createBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeBoolean { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -712,12 +805,18 @@ public function createBooleanAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeBoolean::class] + ); + } /** @@ -731,12 +830,12 @@ public function createBooleanAttribute(string $databaseId, string $collectionId, * @param ?bool $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeBoolean * * @deprecated This API has been deprecated since 1.8.0. Please use `updateBooleanColumn` instead. * @see TablesDB::updateBooleanColumn */ - public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): array + public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeBoolean { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -755,12 +854,18 @@ public function updateBooleanAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeBoolean::class] + ); + } /** @@ -773,12 +878,12 @@ public function updateBooleanAttribute(string $databaseId, string $collectionId, * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeDatetime * * @deprecated This API has been deprecated since 1.8.0. Please use `createDatetimeColumn` instead. * @see TablesDB::createDatetimeColumn */ - public function createDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeDatetime { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -800,12 +905,18 @@ public function createDatetimeAttribute(string $databaseId, string $collectionId $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeDatetime::class] + ); + } /** @@ -819,12 +930,12 @@ public function createDatetimeAttribute(string $databaseId, string $collectionId * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeDatetime * * @deprecated This API has been deprecated since 1.8.0. Please use `updateDatetimeColumn` instead. * @see TablesDB::updateDatetimeColumn */ - public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeDatetime { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -843,12 +954,18 @@ public function updateDatetimeAttribute(string $databaseId, string $collectionId $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeDatetime::class] + ); + } /** @@ -862,12 +979,12 @@ public function updateDatetimeAttribute(string $databaseId, string $collectionId * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeEmail * * @deprecated This API has been deprecated since 1.8.0. Please use `createEmailColumn` instead. * @see TablesDB::createEmailColumn */ - public function createEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeEmail { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -889,12 +1006,18 @@ public function createEmailAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeEmail::class] + ); + } /** @@ -909,12 +1032,12 @@ public function createEmailAttribute(string $databaseId, string $collectionId, s * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeEmail * * @deprecated This API has been deprecated since 1.8.0. Please use `updateEmailColumn` instead. * @see TablesDB::updateEmailColumn */ - public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeEmail { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -933,12 +1056,18 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeEmail::class] + ); + } /** @@ -954,12 +1083,12 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeEnum * * @deprecated This API has been deprecated since 1.8.0. Please use `createEnumColumn` instead. * @see TablesDB::createEnumColumn */ - public function createEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeEnum { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -982,12 +1111,18 @@ public function createEnumAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeEnum::class] + ); + } /** @@ -1003,12 +1138,12 @@ public function createEnumAttribute(string $databaseId, string $collectionId, st * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeEnum * * @deprecated This API has been deprecated since 1.8.0. Please use `updateEnumColumn` instead. * @see TablesDB::updateEnumColumn */ - public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeEnum { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1028,12 +1163,18 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeEnum::class] + ); + } /** @@ -1050,12 +1191,12 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st * @param ?float $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeFloat * * @deprecated This API has been deprecated since 1.8.0. Please use `createFloatColumn` instead. * @see TablesDB::createFloatColumn */ - public function createFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $min = null, ?float $max = null, ?float $xdefault = null, ?bool $xarray = null): array + public function createFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $min = null, ?float $max = null, ?float $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeFloat { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1079,12 +1220,18 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeFloat::class] + ); + } /** @@ -1101,12 +1248,12 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s * @param ?float $max * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeFloat * * @deprecated This API has been deprecated since 1.8.0. Please use `updateFloatColumn` instead. * @see TablesDB::updateFloatColumn */ - public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $xdefault, ?float $min = null, ?float $max = null, ?string $newKey = null): array + public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $xdefault, ?float $min = null, ?float $max = null, ?string $newKey = null): \Appwrite\Models\AttributeFloat { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1127,12 +1274,18 @@ public function updateFloatAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeFloat::class] + ); + } /** @@ -1149,12 +1302,12 @@ public function updateFloatAttribute(string $databaseId, string $collectionId, s * @param ?int $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeInteger * * @deprecated This API has been deprecated since 1.8.0. Please use `createIntegerColumn` instead. * @see TablesDB::createIntegerColumn */ - public function createIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): array + public function createIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeInteger { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1178,12 +1331,18 @@ public function createIntegerAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeInteger::class] + ); + } /** @@ -1200,12 +1359,12 @@ public function createIntegerAttribute(string $databaseId, string $collectionId, * @param ?int $max * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeInteger * * @deprecated This API has been deprecated since 1.8.0. Please use `updateIntegerColumn` instead. * @see TablesDB::updateIntegerColumn */ - public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): array + public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): \Appwrite\Models\AttributeInteger { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1226,12 +1385,18 @@ public function updateIntegerAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeInteger::class] + ); + } /** @@ -1245,12 +1410,12 @@ public function updateIntegerAttribute(string $databaseId, string $collectionId, * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeIp * * @deprecated This API has been deprecated since 1.8.0. Please use `createIpColumn` instead. * @see TablesDB::createIpColumn */ - public function createIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeIp { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1272,12 +1437,18 @@ public function createIpAttribute(string $databaseId, string $collectionId, stri $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeIp::class] + ); + } /** @@ -1292,12 +1463,12 @@ public function createIpAttribute(string $databaseId, string $collectionId, stri * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeIp * * @deprecated This API has been deprecated since 1.8.0. Please use `updateIpColumn` instead. * @see TablesDB::updateIpColumn */ - public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeIp { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1316,12 +1487,18 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeIp::class] + ); + } /** @@ -1333,12 +1510,12 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri * @param bool $required * @param ?array $xdefault * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeLine * * @deprecated This API has been deprecated since 1.8.0. Please use `createLineColumn` instead. * @see TablesDB::createLineColumn */ - public function createLineAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): array + public function createLineAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): \Appwrite\Models\AttributeLine { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1356,12 +1533,18 @@ public function createLineAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeLine::class] + ); + } /** @@ -1375,12 +1558,12 @@ public function createLineAttribute(string $databaseId, string $collectionId, st * @param ?array $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeLine * * @deprecated This API has been deprecated since 1.8.0. Please use `updateLineColumn` instead. * @see TablesDB::updateLineColumn */ - public function updateLineAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + public function updateLineAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): \Appwrite\Models\AttributeLine { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1399,12 +1582,18 @@ public function updateLineAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeLine::class] + ); + } /** @@ -1419,9 +1608,9 @@ public function updateLineAttribute(string $databaseId, string $collectionId, st * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeLongtext */ - public function createLongtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createLongtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\AttributeLongtext { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1447,12 +1636,18 @@ public function createLongtextAttribute(string $databaseId, string $collectionId $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeLongtext::class] + ); + } /** @@ -1467,9 +1662,9 @@ public function createLongtextAttribute(string $databaseId, string $collectionId * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeLongtext */ - public function updateLongtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateLongtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeLongtext { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1488,12 +1683,18 @@ public function updateLongtextAttribute(string $databaseId, string $collectionId $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeLongtext::class] + ); + } /** @@ -1508,9 +1709,9 @@ public function updateLongtextAttribute(string $databaseId, string $collectionId * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeMediumtext */ - public function createMediumtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createMediumtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\AttributeMediumtext { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1536,12 +1737,18 @@ public function createMediumtextAttribute(string $databaseId, string $collection $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeMediumtext::class] + ); + } /** @@ -1556,9 +1763,9 @@ public function createMediumtextAttribute(string $databaseId, string $collection * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeMediumtext */ - public function updateMediumtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateMediumtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeMediumtext { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1577,12 +1784,18 @@ public function updateMediumtextAttribute(string $databaseId, string $collection $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeMediumtext::class] + ); + } /** @@ -1594,12 +1807,12 @@ public function updateMediumtextAttribute(string $databaseId, string $collection * @param bool $required * @param ?array $xdefault * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributePoint * * @deprecated This API has been deprecated since 1.8.0. Please use `createPointColumn` instead. * @see TablesDB::createPointColumn */ - public function createPointAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): array + public function createPointAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): \Appwrite\Models\AttributePoint { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1617,12 +1830,18 @@ public function createPointAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributePoint::class] + ); + } /** @@ -1636,12 +1855,12 @@ public function createPointAttribute(string $databaseId, string $collectionId, s * @param ?array $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributePoint * * @deprecated This API has been deprecated since 1.8.0. Please use `updatePointColumn` instead. * @see TablesDB::updatePointColumn */ - public function updatePointAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + public function updatePointAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): \Appwrite\Models\AttributePoint { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1660,12 +1879,18 @@ public function updatePointAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributePoint::class] + ); + } /** @@ -1677,12 +1902,12 @@ public function updatePointAttribute(string $databaseId, string $collectionId, s * @param bool $required * @param ?array $xdefault * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributePolygon * * @deprecated This API has been deprecated since 1.8.0. Please use `createPolygonColumn` instead. * @see TablesDB::createPolygonColumn */ - public function createPolygonAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): array + public function createPolygonAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): \Appwrite\Models\AttributePolygon { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1700,12 +1925,18 @@ public function createPolygonAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributePolygon::class] + ); + } /** @@ -1719,12 +1950,12 @@ public function createPolygonAttribute(string $databaseId, string $collectionId, * @param ?array $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributePolygon * * @deprecated This API has been deprecated since 1.8.0. Please use `updatePolygonColumn` instead. * @see TablesDB::updatePolygonColumn */ - public function updatePolygonAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + public function updatePolygonAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): \Appwrite\Models\AttributePolygon { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1743,12 +1974,18 @@ public function updatePolygonAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributePolygon::class] + ); + } /** @@ -1765,12 +2002,12 @@ public function updatePolygonAttribute(string $databaseId, string $collectionId, * @param ?string $twoWayKey * @param ?RelationMutate $onDelete * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeRelationship * * @deprecated This API has been deprecated since 1.8.0. Please use `createRelationshipColumn` instead. * @see TablesDB::createRelationshipColumn */ - public function createRelationshipAttribute(string $databaseId, string $collectionId, string $relatedCollectionId, RelationshipType $type, ?bool $twoWay = null, ?string $key = null, ?string $twoWayKey = null, ?RelationMutate $onDelete = null): array + public function createRelationshipAttribute(string $databaseId, string $collectionId, string $relatedCollectionId, RelationshipType $type, ?bool $twoWay = null, ?string $key = null, ?string $twoWayKey = null, ?RelationMutate $onDelete = null): \Appwrite\Models\AttributeRelationship { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1797,12 +2034,18 @@ public function createRelationshipAttribute(string $databaseId, string $collecti $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeRelationship::class] + ); + } /** @@ -1816,12 +2059,12 @@ public function createRelationshipAttribute(string $databaseId, string $collecti * @param ?RelationMutate $onDelete * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeRelationship * * @deprecated This API has been deprecated since 1.8.0. Please use `updateRelationshipColumn` instead. * @see TablesDB::updateRelationshipColumn */ - public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): array + public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): \Appwrite\Models\AttributeRelationship { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1842,12 +2085,18 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeRelationship::class] + ); + } /** @@ -1863,12 +2112,12 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeString * * @deprecated This API has been deprecated since 1.8.0. Please use `createStringColumn` instead. * @see TablesDB::createStringColumn */ - public function createStringAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createStringAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\AttributeString { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1895,12 +2144,18 @@ public function createStringAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeString::class] + ); + } /** @@ -1916,12 +2171,12 @@ public function createStringAttribute(string $databaseId, string $collectionId, * @param ?int $size * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeString * * @deprecated This API has been deprecated since 1.8.0. Please use `updateStringColumn` instead. * @see TablesDB::updateStringColumn */ - public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array + public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): \Appwrite\Models\AttributeString { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1941,12 +2196,18 @@ public function updateStringAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeString::class] + ); + } /** @@ -1961,9 +2222,9 @@ public function updateStringAttribute(string $databaseId, string $collectionId, * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeText */ - public function createTextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createTextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\AttributeText { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -1989,12 +2250,18 @@ public function createTextAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeText::class] + ); + } /** @@ -2009,9 +2276,9 @@ public function createTextAttribute(string $databaseId, string $collectionId, st * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeText */ - public function updateTextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateTextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeText { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -2030,12 +2297,18 @@ public function updateTextAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeText::class] + ); + } /** @@ -2049,12 +2322,12 @@ public function updateTextAttribute(string $databaseId, string $collectionId, st * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeUrl * * @deprecated This API has been deprecated since 1.8.0. Please use `createUrlColumn` instead. * @see TablesDB::createUrlColumn */ - public function createUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeUrl { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2076,12 +2349,18 @@ public function createUrlAttribute(string $databaseId, string $collectionId, str $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeUrl::class] + ); + } /** @@ -2096,12 +2375,12 @@ public function createUrlAttribute(string $databaseId, string $collectionId, str * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeUrl * * @deprecated This API has been deprecated since 1.8.0. Please use `updateUrlColumn` instead. * @see TablesDB::updateUrlColumn */ - public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\AttributeUrl { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -2120,12 +2399,18 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeUrl::class] + ); + } /** @@ -2141,9 +2426,9 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeVarchar */ - public function createVarcharAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createVarcharAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\AttributeVarchar { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2170,12 +2455,18 @@ public function createVarcharAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeVarchar::class] + ); + } /** @@ -2191,9 +2482,9 @@ public function createVarcharAttribute(string $databaseId, string $collectionId, * @param ?int $size * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeVarchar */ - public function updateVarcharAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array + public function updateVarcharAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): \Appwrite\Models\AttributeVarchar { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -2213,12 +2504,18 @@ public function updateVarcharAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeVarchar::class] + ); + } /** @@ -2228,12 +2525,12 @@ public function updateVarcharAttribute(string $databaseId, string $collectionId, * @param string $collectionId * @param string $key * @throws AppwriteException - * @return array + * @return \Appwrite\Models\AttributeBoolean|\Appwrite\Models\AttributeInteger|\Appwrite\Models\AttributeFloat|\Appwrite\Models\AttributeEmail|\Appwrite\Models\AttributeEnum|\Appwrite\Models\AttributeUrl|\Appwrite\Models\AttributeIp|\Appwrite\Models\AttributeDatetime|\Appwrite\Models\AttributeRelationship|\Appwrite\Models\AttributeString * * @deprecated This API has been deprecated since 1.8.0. Please use `getColumn` instead. * @see TablesDB::getColumn */ - public function getAttribute(string $databaseId, string $collectionId, string $key): array + public function getAttribute(string $databaseId, string $collectionId, string $key): \Appwrite\Models\AttributeBoolean|\Appwrite\Models\AttributeInteger|\Appwrite\Models\AttributeFloat|\Appwrite\Models\AttributeEmail|\Appwrite\Models\AttributeEnum|\Appwrite\Models\AttributeUrl|\Appwrite\Models\AttributeIp|\Appwrite\Models\AttributeDatetime|\Appwrite\Models\AttributeRelationship|\Appwrite\Models\AttributeString { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -2248,12 +2545,61 @@ public function getAttribute(string $databaseId, string $collectionId, string $k $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\AttributeBoolean::class, \Appwrite\Models\AttributeInteger::class, \Appwrite\Models\AttributeFloat::class, \Appwrite\Models\AttributeEmail::class, \Appwrite\Models\AttributeEnum::class, \Appwrite\Models\AttributeUrl::class, \Appwrite\Models\AttributeIp::class, \Appwrite\Models\AttributeDatetime::class, \Appwrite\Models\AttributeRelationship::class, \Appwrite\Models\AttributeString::class] +, + [ + \Appwrite\Models\AttributeBoolean::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'default'], + ], + \Appwrite\Models\AttributeInteger::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'min', 'max', 'default'], + ], + \Appwrite\Models\AttributeFloat::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'min', 'max', 'default'], + ], + \Appwrite\Models\AttributeEmail::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'format', 'default'], + ], + \Appwrite\Models\AttributeEnum::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'elements', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'elements', 'format', 'default'], + ], + \Appwrite\Models\AttributeUrl::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'format', 'default'], + ], + \Appwrite\Models\AttributeIp::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'format', 'default'], + ], + \Appwrite\Models\AttributeDatetime::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'format', 'default'], + ], + \Appwrite\Models\AttributeRelationship::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'relatedCollection', 'relationType', 'twoWay', 'twoWayKey', 'onDelete', 'side'], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'relatedCollection', 'relationType', 'twoWay', 'twoWayKey', 'onDelete', 'side'], + ], + \Appwrite\Models\AttributeString::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'size', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'size', 'default', 'encrypt'], + ] + ] + ); + } /** @@ -2284,12 +2630,15 @@ public function deleteAttribute(string $databaseId, string $collectionId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -2303,12 +2652,12 @@ public function deleteAttribute(string $databaseId, string $collectionId, string * @param ?bool $total * @param ?int $ttl * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DocumentList * * @deprecated This API has been deprecated since 1.8.0. Please use `listRows` instead. * @see TablesDB::listRows */ - public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): array + public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): \Appwrite\Models\DocumentList { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2338,12 +2687,18 @@ public function listDocuments(string $databaseId, string $collectionId, ?array $ $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DocumentList::class] + ); + } /** @@ -2359,12 +2714,12 @@ public function listDocuments(string $databaseId, string $collectionId, ?array $ * @param ?array $permissions * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Document * * @deprecated This API has been deprecated since 1.8.0. Please use `createRow` instead. * @see TablesDB::createRow */ - public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null, ?string $transactionId = null): array + public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Document { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2383,12 +2738,18 @@ public function createDocument(string $databaseId, string $collectionId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Document::class] + ); + } /** @@ -2402,12 +2763,12 @@ public function createDocument(string $databaseId, string $collectionId, string * @param array $documents * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DocumentList * * @deprecated This API has been deprecated since 1.8.0. Please use `createRows` instead. * @see TablesDB::createRows */ - public function createDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): array + public function createDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): \Appwrite\Models\DocumentList { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2424,12 +2785,18 @@ public function createDocuments(string $databaseId, string $collectionId, array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DocumentList::class] + ); + } /** @@ -2444,12 +2811,12 @@ public function createDocuments(string $databaseId, string $collectionId, array * @param array $documents * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DocumentList * * @deprecated This API has been deprecated since 1.8.0. Please use `upsertRows` instead. * @see TablesDB::upsertRows */ - public function upsertDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): array + public function upsertDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): \Appwrite\Models\DocumentList { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2466,12 +2833,18 @@ public function upsertDocuments(string $databaseId, string $collectionId, array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DocumentList::class] + ); + } /** @@ -2485,12 +2858,12 @@ public function upsertDocuments(string $databaseId, string $collectionId, array * @param ?array $queries * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DocumentList * * @deprecated This API has been deprecated since 1.8.0. Please use `updateRows` instead. * @see TablesDB::updateRows */ - public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): array + public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\DocumentList { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2514,12 +2887,18 @@ public function updateDocuments(string $databaseId, string $collectionId, ?array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DocumentList::class] + ); + } /** @@ -2531,12 +2910,12 @@ public function updateDocuments(string $databaseId, string $collectionId, ?array * @param ?array $queries * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DocumentList * * @deprecated This API has been deprecated since 1.8.0. Please use `deleteRows` instead. * @see TablesDB::deleteRows */ - public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): array + public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\DocumentList { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2556,12 +2935,18 @@ public function deleteDocuments(string $databaseId, string $collectionId, ?array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DocumentList::class] + ); + } /** @@ -2574,12 +2959,12 @@ public function deleteDocuments(string $databaseId, string $collectionId, ?array * @param ?array $queries * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Document * * @deprecated This API has been deprecated since 1.8.0. Please use `getRow` instead. * @see TablesDB::getRow */ - public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null, ?string $transactionId = null): array + public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\Document { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{documentId}'], @@ -2602,12 +2987,18 @@ public function getDocument(string $databaseId, string $collectionId, string $do $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Document::class] + ); + } /** @@ -2623,12 +3014,12 @@ public function getDocument(string $databaseId, string $collectionId, string $do * @param ?array $permissions * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Document * * @deprecated This API has been deprecated since 1.8.0. Please use `upsertRow` instead. * @see TablesDB::upsertRow */ - public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array + public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Document { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{documentId}'], @@ -2650,12 +3041,18 @@ public function upsertDocument(string $databaseId, string $collectionId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Document::class] + ); + } /** @@ -2669,12 +3066,12 @@ public function upsertDocument(string $databaseId, string $collectionId, string * @param ?array $permissions * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Document * * @deprecated This API has been deprecated since 1.8.0. Please use `updateRow` instead. * @see TablesDB::updateRow */ - public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array + public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Document { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{documentId}'], @@ -2696,12 +3093,18 @@ public function updateDocument(string $databaseId, string $collectionId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Document::class] + ); + } /** @@ -2734,12 +3137,15 @@ public function deleteDocument(string $databaseId, string $collectionId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -2753,12 +3159,12 @@ public function deleteDocument(string $databaseId, string $collectionId, string * @param ?float $min * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Document * * @deprecated This API has been deprecated since 1.8.0. Please use `decrementRowColumn` instead. * @see TablesDB::decrementRowColumn */ - public function decrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $min = null, ?string $transactionId = null): array + public function decrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $min = null, ?string $transactionId = null): \Appwrite\Models\Document { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{documentId}', '{attribute}'], @@ -2781,12 +3187,18 @@ public function decrementDocumentAttribute(string $databaseId, string $collectio $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Document::class] + ); + } /** @@ -2800,12 +3212,12 @@ public function decrementDocumentAttribute(string $databaseId, string $collectio * @param ?float $max * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Document * * @deprecated This API has been deprecated since 1.8.0. Please use `incrementRowColumn` instead. * @see TablesDB::incrementRowColumn */ - public function incrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $max = null, ?string $transactionId = null): array + public function incrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $max = null, ?string $transactionId = null): \Appwrite\Models\Document { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{documentId}', '{attribute}'], @@ -2828,12 +3240,18 @@ public function incrementDocumentAttribute(string $databaseId, string $collectio $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Document::class] + ); + } /** @@ -2844,12 +3262,12 @@ public function incrementDocumentAttribute(string $databaseId, string $collectio * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\IndexList * * @deprecated This API has been deprecated since 1.8.0. Please use `listIndexes` instead. * @see TablesDB::listIndexes */ - public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): array + public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\IndexList { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2871,12 +3289,18 @@ public function listIndexes(string $databaseId, string $collectionId, ?array $qu $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\IndexList::class] + ); + } /** @@ -2892,12 +3316,12 @@ public function listIndexes(string $databaseId, string $collectionId, ?array $qu * @param ?array $orders * @param ?array $lengths * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Index * * @deprecated This API has been deprecated since 1.8.0. Please use `createIndex` instead. * @see TablesDB::createIndex */ - public function createIndex(string $databaseId, string $collectionId, string $key, DatabasesIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): array + public function createIndex(string $databaseId, string $collectionId, string $key, DatabasesIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): \Appwrite\Models\Index { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2923,12 +3347,18 @@ public function createIndex(string $databaseId, string $collectionId, string $ke $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Index::class] + ); + } /** @@ -2938,12 +3368,12 @@ public function createIndex(string $databaseId, string $collectionId, string $ke * @param string $collectionId * @param string $key * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Index * * @deprecated This API has been deprecated since 1.8.0. Please use `getIndex` instead. * @see TablesDB::getIndex */ - public function getIndex(string $databaseId, string $collectionId, string $key): array + public function getIndex(string $databaseId, string $collectionId, string $key): \Appwrite\Models\Index { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -2958,12 +3388,18 @@ public function getIndex(string $databaseId, string $collectionId, string $key): $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Index::class] + ); + } /** @@ -2994,11 +3430,14 @@ public function deleteIndex(string $databaseId, string $collectionId, string $ke $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 7eaab39..b2f7d6d 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -28,9 +28,9 @@ public function __construct(Client $client) * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\FunctionList */ - public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\FunctionList { $apiPath = str_replace( [], @@ -54,12 +54,18 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\FunctionList::class] + ); + } /** @@ -89,9 +95,9 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param ?string $runtimeSpecification * @param ?int $deploymentRetention * @throws AppwriteException - * @return array + * @return \Appwrite\Models\FunctionModel */ - public function create(string $functionId, string $name, Runtime $runtime, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): array + public function create(string $functionId, string $name, Runtime $runtime, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): \Appwrite\Models\FunctionModel { $apiPath = str_replace( [], @@ -175,21 +181,27 @@ public function create(string $functionId, string $name, Runtime $runtime, ?arra $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\FunctionModel::class] + ); + } /** * Get a list of all runtimes that are currently active on your instance. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\RuntimeList */ - public function listRuntimes(): array + public function listRuntimes(): \Appwrite\Models\RuntimeList { $apiPath = str_replace( [], @@ -201,21 +213,27 @@ public function listRuntimes(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\RuntimeList::class] + ); + } /** * List allowed function specifications for this instance. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\SpecificationList */ - public function listSpecifications(): array + public function listSpecifications(): \Appwrite\Models\SpecificationList { $apiPath = str_replace( [], @@ -227,12 +245,18 @@ public function listSpecifications(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\SpecificationList::class] + ); + } /** @@ -240,9 +264,9 @@ public function listSpecifications(): array * * @param string $functionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\FunctionModel */ - public function get(string $functionId): array + public function get(string $functionId): \Appwrite\Models\FunctionModel { $apiPath = str_replace( ['{functionId}'], @@ -255,12 +279,18 @@ public function get(string $functionId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\FunctionModel::class] + ); + } /** @@ -287,9 +317,9 @@ public function get(string $functionId): array * @param ?string $runtimeSpecification * @param ?int $deploymentRetention * @throws AppwriteException - * @return array + * @return \Appwrite\Models\FunctionModel */ - public function update(string $functionId, string $name, ?Runtime $runtime = null, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): array + public function update(string $functionId, string $name, ?Runtime $runtime = null, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): \Appwrite\Models\FunctionModel { $apiPath = str_replace( ['{functionId}'], @@ -373,12 +403,18 @@ public function update(string $functionId, string $name, ?Runtime $runtime = nul $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\FunctionModel::class] + ); + } /** @@ -402,12 +438,15 @@ public function delete(string $functionId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -417,9 +456,9 @@ public function delete(string $functionId): string * @param string $functionId * @param string $deploymentId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\FunctionModel */ - public function updateFunctionDeployment(string $functionId, string $deploymentId): array + public function updateFunctionDeployment(string $functionId, string $deploymentId): \Appwrite\Models\FunctionModel { $apiPath = str_replace( ['{functionId}'], @@ -434,12 +473,18 @@ public function updateFunctionDeployment(string $functionId, string $deploymentI $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\FunctionModel::class] + ); + } /** @@ -451,9 +496,9 @@ public function updateFunctionDeployment(string $functionId, string $deploymentI * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DeploymentList */ - public function listDeployments(string $functionId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listDeployments(string $functionId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\DeploymentList { $apiPath = str_replace( ['{functionId}'], @@ -478,12 +523,18 @@ public function listDeployments(string $functionId, ?array $queries = null, ?str $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DeploymentList::class] + ); + } /** @@ -504,9 +555,9 @@ public function listDeployments(string $functionId, ?array $queries = null, ?str * @param ?string $entrypoint * @param ?string $commands * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function createDeployment(string $functionId, InputFile $code, bool $activate, ?string $entrypoint = null, ?string $commands = null, ?callable $onProgress = null): array + public function createDeployment(string $functionId, InputFile $code, bool $activate, ?string $entrypoint = null, ?string $commands = null, ?callable $onProgress = null): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{functionId}'], @@ -538,9 +589,13 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti $postedName = $code->getFilename(); if ($size <= Client::CHUNK_SIZE) { $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($code->getData()), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ + $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', ], $apiParams); + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); } } else { $size = filesize($code->getPath()); @@ -549,9 +604,13 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti //send single file if size is less than or equal to 5MB if ($size <= Client::CHUNK_SIZE) { $apiParams['code'] = new \CURLFile($code->getPath(), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ + $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', ], $apiParams); + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); } } @@ -599,7 +658,10 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti if(!empty($handle)) { @fclose($handle); } - return $response; + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); } @@ -614,9 +676,9 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti * @param string $deploymentId * @param ?string $buildId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function createDuplicateDeployment(string $functionId, string $deploymentId, ?string $buildId = null): array + public function createDuplicateDeployment(string $functionId, string $deploymentId, ?string $buildId = null): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{functionId}'], @@ -635,12 +697,18 @@ public function createDuplicateDeployment(string $functionId, string $deployment $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -658,9 +726,9 @@ public function createDuplicateDeployment(string $functionId, string $deployment * @param string $reference * @param ?bool $activate * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function createTemplateDeployment(string $functionId, string $repository, string $owner, string $rootDirectory, TemplateReferenceType $type, string $reference, ?bool $activate = null): array + public function createTemplateDeployment(string $functionId, string $repository, string $owner, string $rootDirectory, TemplateReferenceType $type, string $reference, ?bool $activate = null): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{functionId}'], @@ -683,12 +751,18 @@ public function createTemplateDeployment(string $functionId, string $repository, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -701,9 +775,9 @@ public function createTemplateDeployment(string $functionId, string $repository, * @param string $reference * @param ?bool $activate * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function createVcsDeployment(string $functionId, VCSReferenceType $type, string $reference, ?bool $activate = null): array + public function createVcsDeployment(string $functionId, VCSReferenceType $type, string $reference, ?bool $activate = null): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{functionId}'], @@ -723,12 +797,18 @@ public function createVcsDeployment(string $functionId, VCSReferenceType $type, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -737,9 +817,9 @@ public function createVcsDeployment(string $functionId, VCSReferenceType $type, * @param string $functionId * @param string $deploymentId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function getDeployment(string $functionId, string $deploymentId): array + public function getDeployment(string $functionId, string $deploymentId): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{functionId}', '{deploymentId}'], @@ -753,12 +833,18 @@ public function getDeployment(string $functionId, string $deploymentId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -784,12 +870,15 @@ public function deleteDeployment(string $functionId, string $deploymentId): stri $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -821,12 +910,15 @@ public function getDeploymentDownload(string $functionId, string $deploymentId, $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -839,9 +931,9 @@ public function getDeploymentDownload(string $functionId, string $deploymentId, * @param string $functionId * @param string $deploymentId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function updateDeploymentStatus(string $functionId, string $deploymentId): array + public function updateDeploymentStatus(string $functionId, string $deploymentId): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{functionId}', '{deploymentId}'], @@ -856,12 +948,18 @@ public function updateDeploymentStatus(string $functionId, string $deploymentId) $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -872,9 +970,9 @@ public function updateDeploymentStatus(string $functionId, string $deploymentId) * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ExecutionList */ - public function listExecutions(string $functionId, ?array $queries = null, ?bool $total = null): array + public function listExecutions(string $functionId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\ExecutionList { $apiPath = str_replace( ['{functionId}'], @@ -895,12 +993,18 @@ public function listExecutions(string $functionId, ?array $queries = null, ?bool $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ExecutionList::class] + ); + } /** @@ -917,9 +1021,9 @@ public function listExecutions(string $functionId, ?array $queries = null, ?bool * @param ?array $headers * @param ?string $scheduledAt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Execution */ - public function createExecution(string $functionId, ?string $body = null, ?bool $async = null, ?string $xpath = null, ?ExecutionMethod $method = null, ?array $headers = null, ?string $scheduledAt = null): array + public function createExecution(string $functionId, ?string $body = null, ?bool $async = null, ?string $xpath = null, ?ExecutionMethod $method = null, ?array $headers = null, ?string $scheduledAt = null): \Appwrite\Models\Execution { $apiPath = str_replace( ['{functionId}'], @@ -954,12 +1058,18 @@ public function createExecution(string $functionId, ?string $body = null, ?bool $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Execution::class] + ); + } /** @@ -968,9 +1078,9 @@ public function createExecution(string $functionId, ?string $body = null, ?bool * @param string $functionId * @param string $executionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Execution */ - public function getExecution(string $functionId, string $executionId): array + public function getExecution(string $functionId, string $executionId): \Appwrite\Models\Execution { $apiPath = str_replace( ['{functionId}', '{executionId}'], @@ -984,12 +1094,18 @@ public function getExecution(string $functionId, string $executionId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Execution::class] + ); + } /** @@ -1015,12 +1131,15 @@ public function deleteExecution(string $functionId, string $executionId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -1028,9 +1147,9 @@ public function deleteExecution(string $functionId, string $executionId): string * * @param string $functionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\VariableList */ - public function listVariables(string $functionId): array + public function listVariables(string $functionId): \Appwrite\Models\VariableList { $apiPath = str_replace( ['{functionId}'], @@ -1043,12 +1162,18 @@ public function listVariables(string $functionId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\VariableList::class] + ); + } /** @@ -1060,9 +1185,9 @@ public function listVariables(string $functionId): array * @param string $value * @param ?bool $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function createVariable(string $functionId, string $key, string $value, ?bool $secret = null): array + public function createVariable(string $functionId, string $key, string $value, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{functionId}'], @@ -1082,12 +1207,18 @@ public function createVariable(string $functionId, string $key, string $value, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -1096,9 +1227,9 @@ public function createVariable(string $functionId, string $key, string $value, ? * @param string $functionId * @param string $variableId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function getVariable(string $functionId, string $variableId): array + public function getVariable(string $functionId, string $variableId): \Appwrite\Models\Variable { $apiPath = str_replace( ['{functionId}', '{variableId}'], @@ -1112,12 +1243,18 @@ public function getVariable(string $functionId, string $variableId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -1129,9 +1266,9 @@ public function getVariable(string $functionId, string $variableId): array * @param ?string $value * @param ?bool $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function updateVariable(string $functionId, string $variableId, string $key, ?string $value = null, ?bool $secret = null): array + public function updateVariable(string $functionId, string $variableId, string $key, ?string $value = null, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{functionId}', '{variableId}'], @@ -1149,12 +1286,18 @@ public function updateVariable(string $functionId, string $variableId, string $k $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -1180,11 +1323,14 @@ public function deleteVariable(string $functionId, string $variableId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Graphql.php b/src/Appwrite/Services/Graphql.php index fd78b28..7df7a94 100644 --- a/src/Appwrite/Services/Graphql.php +++ b/src/Appwrite/Services/Graphql.php @@ -36,12 +36,15 @@ public function query(array $query): array $apiHeaders['x-sdk-graphql'] = 'true'; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -66,11 +69,14 @@ public function mutation(array $query): array $apiHeaders['x-sdk-graphql'] = 'true'; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index 966e1ae..84a0422 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -19,9 +19,9 @@ public function __construct(Client $client) * Check the Appwrite HTTP server is up and responsive. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthStatus */ - public function get(): array + public function get(): \Appwrite\Models\HealthStatus { $apiPath = str_replace( [], @@ -33,21 +33,27 @@ public function get(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthStatus::class] + ); + } /** * Check the Appwrite Antivirus server is up and connection is successful. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthAntivirus */ - public function getAntivirus(): array + public function getAntivirus(): \Appwrite\Models\HealthAntivirus { $apiPath = str_replace( [], @@ -59,12 +65,18 @@ public function getAntivirus(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthAntivirus::class] + ); + } /** @@ -72,9 +84,9 @@ public function getAntivirus(): array * successful. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthStatusList */ - public function getCache(): array + public function getCache(): \Appwrite\Models\HealthStatusList { $apiPath = str_replace( [], @@ -86,12 +98,18 @@ public function getCache(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthStatusList::class] + ); + } /** @@ -99,9 +117,9 @@ public function getCache(): array * * @param ?string $domain * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthCertificate */ - public function getCertificate(?string $domain = null): array + public function getCertificate(?string $domain = null): \Appwrite\Models\HealthCertificate { $apiPath = str_replace( [], @@ -117,12 +135,18 @@ public function getCertificate(?string $domain = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthCertificate::class] + ); + } /** @@ -133,9 +157,9 @@ public function getCertificate(?string $domain = null): array * @param ?int $threshold * @param ?int $inactivityDays * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthStatus */ - public function getConsolePausing(?int $threshold = null, ?int $inactivityDays = null): array + public function getConsolePausing(?int $threshold = null, ?int $inactivityDays = null): \Appwrite\Models\HealthStatus { $apiPath = str_replace( [], @@ -155,21 +179,27 @@ public function getConsolePausing(?int $threshold = null, ?int $inactivityDays = $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthStatus::class] + ); + } /** * Check the Appwrite database servers are up and connection is successful. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthStatusList */ - public function getDB(): array + public function getDB(): \Appwrite\Models\HealthStatusList { $apiPath = str_replace( [], @@ -181,21 +211,27 @@ public function getDB(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthStatusList::class] + ); + } /** * Check the Appwrite pub-sub servers are up and connection is successful. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthStatusList */ - public function getPubSub(): array + public function getPubSub(): \Appwrite\Models\HealthStatusList { $apiPath = str_replace( [], @@ -207,23 +243,30 @@ public function getPubSub(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthStatusList::class] + ); + } /** * Get the number of audit logs that are waiting to be processed in the * Appwrite internal queue server. + * * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueAudits(?int $threshold = null): array + public function getQueueAudits(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -239,12 +282,18 @@ public function getQueueAudits(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -253,9 +302,9 @@ public function getQueueAudits(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueBuilds(?int $threshold = null): array + public function getQueueBuilds(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -271,12 +320,18 @@ public function getQueueBuilds(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -286,9 +341,9 @@ public function getQueueBuilds(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueCertificates(?int $threshold = null): array + public function getQueueCertificates(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -304,12 +359,18 @@ public function getQueueCertificates(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -319,9 +380,9 @@ public function getQueueCertificates(?int $threshold = null): array * @param ?string $name * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueDatabases(?string $name = null, ?int $threshold = null): array + public function getQueueDatabases(?string $name = null, ?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -341,12 +402,18 @@ public function getQueueDatabases(?string $name = null, ?int $threshold = null): $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -355,9 +422,9 @@ public function getQueueDatabases(?string $name = null, ?int $threshold = null): * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueDeletes(?int $threshold = null): array + public function getQueueDeletes(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -373,12 +440,18 @@ public function getQueueDeletes(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -388,9 +461,9 @@ public function getQueueDeletes(?int $threshold = null): array * @param Name $name * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getFailedJobs(Name $name, ?int $threshold = null): array + public function getFailedJobs(Name $name, ?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( ['{name}'], @@ -407,12 +480,18 @@ public function getFailedJobs(Name $name, ?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -421,9 +500,9 @@ public function getFailedJobs(Name $name, ?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueFunctions(?int $threshold = null): array + public function getQueueFunctions(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -439,12 +518,18 @@ public function getQueueFunctions(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -453,9 +538,9 @@ public function getQueueFunctions(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueLogs(?int $threshold = null): array + public function getQueueLogs(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -471,12 +556,18 @@ public function getQueueLogs(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -485,9 +576,9 @@ public function getQueueLogs(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueMails(?int $threshold = null): array + public function getQueueMails(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -503,12 +594,18 @@ public function getQueueMails(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -517,9 +614,9 @@ public function getQueueMails(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueMessaging(?int $threshold = null): array + public function getQueueMessaging(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -535,12 +632,18 @@ public function getQueueMessaging(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -549,9 +652,9 @@ public function getQueueMessaging(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueMigrations(?int $threshold = null): array + public function getQueueMigrations(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -567,12 +670,18 @@ public function getQueueMigrations(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -581,9 +690,9 @@ public function getQueueMigrations(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueStatsResources(?int $threshold = null): array + public function getQueueStatsResources(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -599,12 +708,18 @@ public function getQueueStatsResources(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -613,9 +728,9 @@ public function getQueueStatsResources(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueUsage(?int $threshold = null): array + public function getQueueUsage(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -631,12 +746,18 @@ public function getQueueUsage(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** @@ -645,9 +766,9 @@ public function getQueueUsage(?int $threshold = null): array * * @param ?int $threshold * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthQueue */ - public function getQueueWebhooks(?int $threshold = null): array + public function getQueueWebhooks(?int $threshold = null): \Appwrite\Models\HealthQueue { $apiPath = str_replace( [], @@ -663,21 +784,27 @@ public function getQueueWebhooks(?int $threshold = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthQueue::class] + ); + } /** * Check the Appwrite storage device is up and connection is successful. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthStatus */ - public function getStorage(): array + public function getStorage(): \Appwrite\Models\HealthStatus { $apiPath = str_replace( [], @@ -689,21 +816,27 @@ public function getStorage(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthStatus::class] + ); + } /** * Check the Appwrite local storage device is up and connection is successful. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthStatus */ - public function getStorageLocal(): array + public function getStorageLocal(): \Appwrite\Models\HealthStatus { $apiPath = str_replace( [], @@ -715,12 +848,18 @@ public function getStorageLocal(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthStatus::class] + ); + } /** @@ -733,9 +872,9 @@ public function getStorageLocal(): array * uses NTP. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\HealthTime */ - public function getTime(): array + public function getTime(): \Appwrite\Models\HealthTime { $apiPath = str_replace( [], @@ -747,11 +886,17 @@ public function getTime(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\HealthTime::class] + ); + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Locale.php b/src/Appwrite/Services/Locale.php index 0516c51..8019808 100644 --- a/src/Appwrite/Services/Locale.php +++ b/src/Appwrite/Services/Locale.php @@ -23,9 +23,9 @@ public function __construct(Client $client) * ([IP Geolocation by DB-IP](https://db-ip.com)) * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Locale */ - public function get(): array + public function get(): \Appwrite\Models\Locale { $apiPath = str_replace( [], @@ -37,12 +37,18 @@ public function get(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Locale::class] + ); + } /** @@ -50,9 +56,9 @@ public function get(): array * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\LocaleCodeList */ - public function listCodes(): array + public function listCodes(): \Appwrite\Models\LocaleCodeList { $apiPath = str_replace( [], @@ -64,12 +70,18 @@ public function listCodes(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\LocaleCodeList::class] + ); + } /** @@ -77,9 +89,9 @@ public function listCodes(): array * supported language. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ContinentList */ - public function listContinents(): array + public function listContinents(): \Appwrite\Models\ContinentList { $apiPath = str_replace( [], @@ -91,12 +103,18 @@ public function listContinents(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ContinentList::class] + ); + } /** @@ -104,9 +122,9 @@ public function listContinents(): array * supported language. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\CountryList */ - public function listCountries(): array + public function listCountries(): \Appwrite\Models\CountryList { $apiPath = str_replace( [], @@ -118,12 +136,18 @@ public function listCountries(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\CountryList::class] + ); + } /** @@ -131,9 +155,9 @@ public function listCountries(): array * locale header to get the data in a supported language. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\CountryList */ - public function listCountriesEU(): array + public function listCountriesEU(): \Appwrite\Models\CountryList { $apiPath = str_replace( [], @@ -145,12 +169,18 @@ public function listCountriesEU(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\CountryList::class] + ); + } /** @@ -158,9 +188,9 @@ public function listCountriesEU(): array * data in a supported language. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\PhoneList */ - public function listCountriesPhones(): array + public function listCountriesPhones(): \Appwrite\Models\PhoneList { $apiPath = str_replace( [], @@ -172,12 +202,18 @@ public function listCountriesPhones(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\PhoneList::class] + ); + } /** @@ -186,9 +222,9 @@ public function listCountriesPhones(): array * header to get the data in a supported language. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\CurrencyList */ - public function listCurrencies(): array + public function listCurrencies(): \Appwrite\Models\CurrencyList { $apiPath = str_replace( [], @@ -200,12 +236,18 @@ public function listCurrencies(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\CurrencyList::class] + ); + } /** @@ -213,9 +255,9 @@ public function listCurrencies(): array * in English, and name in the respective language. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\LanguageList */ - public function listLanguages(): array + public function listLanguages(): \Appwrite\Models\LanguageList { $apiPath = str_replace( [], @@ -227,11 +269,17 @@ public function listLanguages(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\LanguageList::class] + ); + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index df72407..d5d8fd8 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -23,9 +23,9 @@ public function __construct(Client $client) * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MessageList */ - public function listMessages(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listMessages(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\MessageList { $apiPath = str_replace( [], @@ -49,12 +49,18 @@ public function listMessages(?array $queries = null, ?string $search = null, ?bo $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MessageList::class] + ); + } /** @@ -73,9 +79,9 @@ public function listMessages(?array $queries = null, ?string $search = null, ?bo * @param ?bool $html * @param ?string $scheduledAt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Message */ - public function createEmail(string $messageId, string $subject, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?array $cc = null, ?array $bcc = null, ?array $attachments = null, ?bool $draft = null, ?bool $html = null, ?string $scheduledAt = null): array + public function createEmail(string $messageId, string $subject, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?array $cc = null, ?array $bcc = null, ?array $attachments = null, ?bool $draft = null, ?bool $html = null, ?string $scheduledAt = null): \Appwrite\Models\Message { $apiPath = str_replace( [], @@ -124,12 +130,18 @@ public function createEmail(string $messageId, string $subject, string $content, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Message::class] + ); + } /** @@ -151,9 +163,9 @@ public function createEmail(string $messageId, string $subject, string $content, * @param ?string $scheduledAt * @param ?array $attachments * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Message */ - public function updateEmail(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $subject = null, ?string $content = null, ?bool $draft = null, ?bool $html = null, ?array $cc = null, ?array $bcc = null, ?string $scheduledAt = null, ?array $attachments = null): array + public function updateEmail(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $subject = null, ?string $content = null, ?bool $draft = null, ?bool $html = null, ?array $cc = null, ?array $bcc = null, ?string $scheduledAt = null, ?array $attachments = null): \Appwrite\Models\Message { $apiPath = str_replace( ['{messageId}'], @@ -178,12 +190,18 @@ public function updateEmail(string $messageId, ?array $topics = null, ?array $us $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Message::class] + ); + } /** @@ -209,9 +227,9 @@ public function updateEmail(string $messageId, ?array $topics = null, ?array $us * @param ?bool $critical * @param ?MessagePriority $priority * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Message */ - public function createPush(string $messageId, ?string $title = null, ?string $body = null, ?array $topics = null, ?array $users = null, ?array $targets = null, ?array $data = null, ?string $action = null, ?string $image = null, ?string $icon = null, ?string $sound = null, ?string $color = null, ?string $tag = null, ?int $badge = null, ?bool $draft = null, ?string $scheduledAt = null, ?bool $contentAvailable = null, ?bool $critical = null, ?MessagePriority $priority = null): array + public function createPush(string $messageId, ?string $title = null, ?string $body = null, ?array $topics = null, ?array $users = null, ?array $targets = null, ?array $data = null, ?string $action = null, ?string $image = null, ?string $icon = null, ?string $sound = null, ?string $color = null, ?string $tag = null, ?int $badge = null, ?bool $draft = null, ?string $scheduledAt = null, ?bool $contentAvailable = null, ?bool $critical = null, ?MessagePriority $priority = null): \Appwrite\Models\Message { $apiPath = str_replace( [], @@ -291,12 +309,18 @@ public function createPush(string $messageId, ?string $title = null, ?string $bo $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Message::class] + ); + } /** @@ -325,9 +349,9 @@ public function createPush(string $messageId, ?string $title = null, ?string $bo * @param ?bool $critical * @param ?MessagePriority $priority * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Message */ - public function updatePush(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $title = null, ?string $body = null, ?array $data = null, ?string $action = null, ?string $image = null, ?string $icon = null, ?string $sound = null, ?string $color = null, ?string $tag = null, ?int $badge = null, ?bool $draft = null, ?string $scheduledAt = null, ?bool $contentAvailable = null, ?bool $critical = null, ?MessagePriority $priority = null): array + public function updatePush(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $title = null, ?string $body = null, ?array $data = null, ?string $action = null, ?string $image = null, ?string $icon = null, ?string $sound = null, ?string $color = null, ?string $tag = null, ?int $badge = null, ?bool $draft = null, ?string $scheduledAt = null, ?bool $contentAvailable = null, ?bool $critical = null, ?MessagePriority $priority = null): \Appwrite\Models\Message { $apiPath = str_replace( ['{messageId}'], @@ -359,12 +383,18 @@ public function updatePush(string $messageId, ?array $topics = null, ?array $use $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Message::class] + ); + } /** @@ -378,9 +408,9 @@ public function updatePush(string $messageId, ?array $topics = null, ?array $use * @param ?bool $draft * @param ?string $scheduledAt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Message */ - public function createSMS(string $messageId, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?bool $draft = null, ?string $scheduledAt = null): array + public function createSMS(string $messageId, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?bool $draft = null, ?string $scheduledAt = null): \Appwrite\Models\Message { $apiPath = str_replace( [], @@ -412,12 +442,18 @@ public function createSMS(string $messageId, string $content, ?array $topics = n $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Message::class] + ); + } /** @@ -434,9 +470,9 @@ public function createSMS(string $messageId, string $content, ?array $topics = n * @param ?bool $draft * @param ?string $scheduledAt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Message */ - public function updateSMS(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $content = null, ?bool $draft = null, ?string $scheduledAt = null): array + public function updateSMS(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $content = null, ?bool $draft = null, ?string $scheduledAt = null): \Appwrite\Models\Message { $apiPath = str_replace( ['{messageId}'], @@ -456,12 +492,18 @@ public function updateSMS(string $messageId, ?array $topics = null, ?array $user $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Message::class] + ); + } /** @@ -470,9 +512,9 @@ public function updateSMS(string $messageId, ?array $topics = null, ?array $user * * @param string $messageId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Message */ - public function getMessage(string $messageId): array + public function getMessage(string $messageId): \Appwrite\Models\Message { $apiPath = str_replace( ['{messageId}'], @@ -485,12 +527,18 @@ public function getMessage(string $messageId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Message::class] + ); + } /** @@ -515,12 +563,15 @@ public function delete(string $messageId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -530,9 +581,9 @@ public function delete(string $messageId): string * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\LogList */ - public function listMessageLogs(string $messageId, ?array $queries = null, ?bool $total = null): array + public function listMessageLogs(string $messageId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\LogList { $apiPath = str_replace( ['{messageId}'], @@ -553,12 +604,18 @@ public function listMessageLogs(string $messageId, ?array $queries = null, ?bool $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\LogList::class] + ); + } /** @@ -568,9 +625,9 @@ public function listMessageLogs(string $messageId, ?array $queries = null, ?bool * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\TargetList */ - public function listTargets(string $messageId, ?array $queries = null, ?bool $total = null): array + public function listTargets(string $messageId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\TargetList { $apiPath = str_replace( ['{messageId}'], @@ -591,12 +648,18 @@ public function listTargets(string $messageId, ?array $queries = null, ?bool $to $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\TargetList::class] + ); + } /** @@ -606,9 +669,9 @@ public function listTargets(string $messageId, ?array $queries = null, ?bool $to * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ProviderList */ - public function listProviders(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listProviders(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\ProviderList { $apiPath = str_replace( [], @@ -632,12 +695,18 @@ public function listProviders(?array $queries = null, ?string $search = null, ?b $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ProviderList::class] + ); + } /** @@ -652,9 +721,9 @@ public function listProviders(?array $queries = null, ?string $search = null, ?b * @param ?bool $sandbox * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createAPNSProvider(string $providerId, string $name, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null, ?bool $enabled = null): array + public function createAPNSProvider(string $providerId, string $name, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -690,12 +759,18 @@ public function createAPNSProvider(string $providerId, string $name, ?string $au $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -710,9 +785,9 @@ public function createAPNSProvider(string $providerId, string $name, ?string $au * @param ?string $bundleId * @param ?bool $sandbox * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateAPNSProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null): array + public function updateAPNSProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -748,12 +823,18 @@ public function updateAPNSProvider(string $providerId, ?string $name = null, ?bo $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -764,9 +845,9 @@ public function updateAPNSProvider(string $providerId, ?string $name = null, ?bo * @param ?array $serviceAccountJSON * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createFCMProvider(string $providerId, string $name, ?array $serviceAccountJSON = null, ?bool $enabled = null): array + public function createFCMProvider(string $providerId, string $name, ?array $serviceAccountJSON = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -783,12 +864,18 @@ public function createFCMProvider(string $providerId, string $name, ?array $serv $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -799,9 +886,9 @@ public function createFCMProvider(string $providerId, string $name, ?array $serv * @param ?bool $enabled * @param ?array $serviceAccountJSON * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateFCMProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?array $serviceAccountJSON = null): array + public function updateFCMProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?array $serviceAccountJSON = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -821,12 +908,18 @@ public function updateFCMProvider(string $providerId, ?string $name = null, ?boo $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -843,9 +936,9 @@ public function updateFCMProvider(string $providerId, ?string $name = null, ?boo * @param ?string $replyToEmail * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createMailgunProvider(string $providerId, string $name, ?string $apiKey = null, ?string $domain = null, ?bool $isEuRegion = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + public function createMailgunProvider(string $providerId, string $name, ?string $apiKey = null, ?string $domain = null, ?bool $isEuRegion = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -886,12 +979,18 @@ public function createMailgunProvider(string $providerId, string $name, ?string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -908,9 +1007,9 @@ public function createMailgunProvider(string $providerId, string $name, ?string * @param ?string $replyToName * @param ?string $replyToEmail * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateMailgunProvider(string $providerId, ?string $name = null, ?string $apiKey = null, ?string $domain = null, ?bool $isEuRegion = null, ?bool $enabled = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): array + public function updateMailgunProvider(string $providerId, ?string $name = null, ?string $apiKey = null, ?string $domain = null, ?bool $isEuRegion = null, ?bool $enabled = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -954,12 +1053,18 @@ public function updateMailgunProvider(string $providerId, ?string $name = null, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -972,9 +1077,9 @@ public function updateMailgunProvider(string $providerId, ?string $name = null, * @param ?string $authKey * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createMsg91Provider(string $providerId, string $name, ?string $templateId = null, ?string $senderId = null, ?string $authKey = null, ?bool $enabled = null): array + public function createMsg91Provider(string $providerId, string $name, ?string $templateId = null, ?string $senderId = null, ?string $authKey = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -1002,12 +1107,18 @@ public function createMsg91Provider(string $providerId, string $name, ?string $t $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1020,9 +1131,9 @@ public function createMsg91Provider(string $providerId, string $name, ?string $t * @param ?string $senderId * @param ?string $authKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateMsg91Provider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $templateId = null, ?string $senderId = null, ?string $authKey = null): array + public function updateMsg91Provider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $templateId = null, ?string $senderId = null, ?string $authKey = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1053,12 +1164,18 @@ public function updateMsg91Provider(string $providerId, ?string $name = null, ?b $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1073,9 +1190,9 @@ public function updateMsg91Provider(string $providerId, ?string $name = null, ?b * @param ?string $replyToEmail * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createResendProvider(string $providerId, string $name, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + public function createResendProvider(string $providerId, string $name, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -1111,12 +1228,18 @@ public function createResendProvider(string $providerId, string $name, ?string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1131,9 +1254,9 @@ public function createResendProvider(string $providerId, string $name, ?string $ * @param ?string $replyToName * @param ?string $replyToEmail * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateResendProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): array + public function updateResendProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1172,12 +1295,18 @@ public function updateResendProvider(string $providerId, ?string $name = null, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1192,9 +1321,9 @@ public function updateResendProvider(string $providerId, ?string $name = null, ? * @param ?string $replyToEmail * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createSendgridProvider(string $providerId, string $name, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + public function createSendgridProvider(string $providerId, string $name, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -1230,12 +1359,18 @@ public function createSendgridProvider(string $providerId, string $name, ?string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1250,9 +1385,9 @@ public function createSendgridProvider(string $providerId, string $name, ?string * @param ?string $replyToName * @param ?string $replyToEmail * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateSendgridProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): array + public function updateSendgridProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1291,12 +1426,18 @@ public function updateSendgridProvider(string $providerId, ?string $name = null, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1317,9 +1458,9 @@ public function updateSendgridProvider(string $providerId, ?string $name = null, * @param ?string $replyToEmail * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createSMTPProvider(string $providerId, string $name, string $host, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + public function createSMTPProvider(string $providerId, string $name, string $host, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -1376,12 +1517,18 @@ public function createSMTPProvider(string $providerId, string $name, string $hos $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1402,9 +1549,9 @@ public function createSMTPProvider(string $providerId, string $name, string $hos * @param ?string $replyToEmail * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateSMTPProvider(string $providerId, ?string $name = null, ?string $host = null, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + public function updateSMTPProvider(string $providerId, ?string $name = null, ?string $host = null, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1461,12 +1608,18 @@ public function updateSMTPProvider(string $providerId, ?string $name = null, ?st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1479,9 +1632,9 @@ public function updateSMTPProvider(string $providerId, ?string $name = null, ?st * @param ?string $apiKey * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createTelesignProvider(string $providerId, string $name, ?string $from = null, ?string $customerId = null, ?string $apiKey = null, ?bool $enabled = null): array + public function createTelesignProvider(string $providerId, string $name, ?string $from = null, ?string $customerId = null, ?string $apiKey = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -1509,12 +1662,18 @@ public function createTelesignProvider(string $providerId, string $name, ?string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1527,9 +1686,9 @@ public function createTelesignProvider(string $providerId, string $name, ?string * @param ?string $apiKey * @param ?string $from * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateTelesignProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $customerId = null, ?string $apiKey = null, ?string $from = null): array + public function updateTelesignProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $customerId = null, ?string $apiKey = null, ?string $from = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1560,12 +1719,18 @@ public function updateTelesignProvider(string $providerId, ?string $name = null, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1578,9 +1743,9 @@ public function updateTelesignProvider(string $providerId, ?string $name = null, * @param ?string $apiKey * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createTextmagicProvider(string $providerId, string $name, ?string $from = null, ?string $username = null, ?string $apiKey = null, ?bool $enabled = null): array + public function createTextmagicProvider(string $providerId, string $name, ?string $from = null, ?string $username = null, ?string $apiKey = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -1608,12 +1773,18 @@ public function createTextmagicProvider(string $providerId, string $name, ?strin $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1626,9 +1797,9 @@ public function createTextmagicProvider(string $providerId, string $name, ?strin * @param ?string $apiKey * @param ?string $from * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateTextmagicProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $username = null, ?string $apiKey = null, ?string $from = null): array + public function updateTextmagicProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $username = null, ?string $apiKey = null, ?string $from = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1659,12 +1830,18 @@ public function updateTextmagicProvider(string $providerId, ?string $name = null $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1677,9 +1854,9 @@ public function updateTextmagicProvider(string $providerId, ?string $name = null * @param ?string $authToken * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createTwilioProvider(string $providerId, string $name, ?string $from = null, ?string $accountSid = null, ?string $authToken = null, ?bool $enabled = null): array + public function createTwilioProvider(string $providerId, string $name, ?string $from = null, ?string $accountSid = null, ?string $authToken = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -1707,12 +1884,18 @@ public function createTwilioProvider(string $providerId, string $name, ?string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1725,9 +1908,9 @@ public function createTwilioProvider(string $providerId, string $name, ?string $ * @param ?string $authToken * @param ?string $from * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateTwilioProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $accountSid = null, ?string $authToken = null, ?string $from = null): array + public function updateTwilioProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $accountSid = null, ?string $authToken = null, ?string $from = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1758,12 +1941,18 @@ public function updateTwilioProvider(string $providerId, ?string $name = null, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1776,9 +1965,9 @@ public function updateTwilioProvider(string $providerId, ?string $name = null, ? * @param ?string $apiSecret * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function createVonageProvider(string $providerId, string $name, ?string $from = null, ?string $apiKey = null, ?string $apiSecret = null, ?bool $enabled = null): array + public function createVonageProvider(string $providerId, string $name, ?string $from = null, ?string $apiKey = null, ?string $apiSecret = null, ?bool $enabled = null): \Appwrite\Models\Provider { $apiPath = str_replace( [], @@ -1806,12 +1995,18 @@ public function createVonageProvider(string $providerId, string $name, ?string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1824,9 +2019,9 @@ public function createVonageProvider(string $providerId, string $name, ?string $ * @param ?string $apiSecret * @param ?string $from * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function updateVonageProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $apiSecret = null, ?string $from = null): array + public function updateVonageProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $apiSecret = null, ?string $from = null): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1857,12 +2052,18 @@ public function updateVonageProvider(string $providerId, ?string $name = null, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1871,9 +2072,9 @@ public function updateVonageProvider(string $providerId, ?string $name = null, ? * * @param string $providerId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Provider */ - public function getProvider(string $providerId): array + public function getProvider(string $providerId): \Appwrite\Models\Provider { $apiPath = str_replace( ['{providerId}'], @@ -1886,12 +2087,18 @@ public function getProvider(string $providerId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Provider::class] + ); + } /** @@ -1915,12 +2122,15 @@ public function deleteProvider(string $providerId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -1930,9 +2140,9 @@ public function deleteProvider(string $providerId): string * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\LogList */ - public function listProviderLogs(string $providerId, ?array $queries = null, ?bool $total = null): array + public function listProviderLogs(string $providerId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\LogList { $apiPath = str_replace( ['{providerId}'], @@ -1953,12 +2163,18 @@ public function listProviderLogs(string $providerId, ?array $queries = null, ?bo $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\LogList::class] + ); + } /** @@ -1968,9 +2184,9 @@ public function listProviderLogs(string $providerId, ?array $queries = null, ?bo * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\LogList */ - public function listSubscriberLogs(string $subscriberId, ?array $queries = null, ?bool $total = null): array + public function listSubscriberLogs(string $subscriberId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\LogList { $apiPath = str_replace( ['{subscriberId}'], @@ -1991,12 +2207,18 @@ public function listSubscriberLogs(string $subscriberId, ?array $queries = null, $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\LogList::class] + ); + } /** @@ -2006,9 +2228,9 @@ public function listSubscriberLogs(string $subscriberId, ?array $queries = null, * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\TopicList */ - public function listTopics(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listTopics(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\TopicList { $apiPath = str_replace( [], @@ -2032,12 +2254,18 @@ public function listTopics(?array $queries = null, ?string $search = null, ?bool $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\TopicList::class] + ); + } /** @@ -2047,9 +2275,9 @@ public function listTopics(?array $queries = null, ?string $search = null, ?bool * @param string $name * @param ?array $subscribe * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Topic */ - public function createTopic(string $topicId, string $name, ?array $subscribe = null): array + public function createTopic(string $topicId, string $name, ?array $subscribe = null): \Appwrite\Models\Topic { $apiPath = str_replace( [], @@ -2068,12 +2296,18 @@ public function createTopic(string $topicId, string $name, ?array $subscribe = n $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Topic::class] + ); + } /** @@ -2082,9 +2316,9 @@ public function createTopic(string $topicId, string $name, ?array $subscribe = n * * @param string $topicId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Topic */ - public function getTopic(string $topicId): array + public function getTopic(string $topicId): \Appwrite\Models\Topic { $apiPath = str_replace( ['{topicId}'], @@ -2097,12 +2331,18 @@ public function getTopic(string $topicId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Topic::class] + ); + } /** @@ -2113,9 +2353,9 @@ public function getTopic(string $topicId): array * @param ?string $name * @param ?array $subscribe * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Topic */ - public function updateTopic(string $topicId, ?string $name = null, ?array $subscribe = null): array + public function updateTopic(string $topicId, ?string $name = null, ?array $subscribe = null): \Appwrite\Models\Topic { $apiPath = str_replace( ['{topicId}'], @@ -2131,12 +2371,18 @@ public function updateTopic(string $topicId, ?string $name = null, ?array $subsc $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Topic::class] + ); + } /** @@ -2160,12 +2406,15 @@ public function deleteTopic(string $topicId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -2175,9 +2424,9 @@ public function deleteTopic(string $topicId): string * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\LogList */ - public function listTopicLogs(string $topicId, ?array $queries = null, ?bool $total = null): array + public function listTopicLogs(string $topicId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\LogList { $apiPath = str_replace( ['{topicId}'], @@ -2198,12 +2447,18 @@ public function listTopicLogs(string $topicId, ?array $queries = null, ?bool $to $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\LogList::class] + ); + } /** @@ -2214,9 +2469,9 @@ public function listTopicLogs(string $topicId, ?array $queries = null, ?bool $to * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\SubscriberList */ - public function listSubscribers(string $topicId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listSubscribers(string $topicId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\SubscriberList { $apiPath = str_replace( ['{topicId}'], @@ -2241,12 +2496,18 @@ public function listSubscribers(string $topicId, ?array $queries = null, ?string $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\SubscriberList::class] + ); + } /** @@ -2256,9 +2517,9 @@ public function listSubscribers(string $topicId, ?array $queries = null, ?string * @param string $subscriberId * @param string $targetId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Subscriber */ - public function createSubscriber(string $topicId, string $subscriberId, string $targetId): array + public function createSubscriber(string $topicId, string $subscriberId, string $targetId): \Appwrite\Models\Subscriber { $apiPath = str_replace( ['{topicId}'], @@ -2274,12 +2535,18 @@ public function createSubscriber(string $topicId, string $subscriberId, string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Subscriber::class] + ); + } /** @@ -2289,9 +2556,9 @@ public function createSubscriber(string $topicId, string $subscriberId, string $ * @param string $topicId * @param string $subscriberId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Subscriber */ - public function getSubscriber(string $topicId, string $subscriberId): array + public function getSubscriber(string $topicId, string $subscriberId): \Appwrite\Models\Subscriber { $apiPath = str_replace( ['{topicId}', '{subscriberId}'], @@ -2305,12 +2572,18 @@ public function getSubscriber(string $topicId, string $subscriberId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Subscriber::class] + ); + } /** @@ -2336,11 +2609,14 @@ public function deleteSubscriber(string $topicId, string $subscriberId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Project.php b/src/Appwrite/Services/Project.php index 881a397..fca2f75 100644 --- a/src/Appwrite/Services/Project.php +++ b/src/Appwrite/Services/Project.php @@ -20,9 +20,9 @@ public function __construct(Client $client) * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\VariableList */ - public function listVariables(?array $queries = null, ?bool $total = null): array + public function listVariables(?array $queries = null, ?bool $total = null): \Appwrite\Models\VariableList { $apiPath = str_replace( [], @@ -42,12 +42,18 @@ public function listVariables(?array $queries = null, ?bool $total = null): arra $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\VariableList::class] + ); + } /** @@ -59,9 +65,9 @@ public function listVariables(?array $queries = null, ?bool $total = null): arra * @param string $value * @param ?bool $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function createVariable(string $variableId, string $key, string $value, ?bool $secret = null): array + public function createVariable(string $variableId, string $key, string $value, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( [], @@ -81,12 +87,18 @@ public function createVariable(string $variableId, string $key, string $value, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -94,9 +106,9 @@ public function createVariable(string $variableId, string $key, string $value, ? * * @param string $variableId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function getVariable(string $variableId): array + public function getVariable(string $variableId): \Appwrite\Models\Variable { $apiPath = str_replace( ['{variableId}'], @@ -109,12 +121,18 @@ public function getVariable(string $variableId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -125,9 +143,9 @@ public function getVariable(string $variableId): array * @param ?string $value * @param ?bool $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function updateVariable(string $variableId, ?string $key = null, ?string $value = null, ?bool $secret = null): array + public function updateVariable(string $variableId, ?string $key = null, ?string $value = null, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{variableId}'], @@ -144,12 +162,18 @@ public function updateVariable(string $variableId, ?string $key = null, ?string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -173,11 +197,14 @@ public function deleteVariable(string $variableId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index a0930b9..db8f18d 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -28,9 +28,9 @@ public function __construct(Client $client) * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\SiteList */ - public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\SiteList { $apiPath = str_replace( [], @@ -54,12 +54,18 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\SiteList::class] + ); + } /** @@ -87,9 +93,9 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param ?string $runtimeSpecification * @param ?int $deploymentRetention * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Site */ - public function create(string $siteId, string $name, Framework $framework, BuildRuntime $buildRuntime, ?bool $enabled = null, ?bool $logging = null, ?int $timeout = null, ?string $installCommand = null, ?string $buildCommand = null, ?string $startCommand = null, ?string $outputDirectory = null, ?Adapter $adapter = null, ?string $installationId = null, ?string $fallbackFile = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): array + public function create(string $siteId, string $name, Framework $framework, BuildRuntime $buildRuntime, ?bool $enabled = null, ?bool $logging = null, ?int $timeout = null, ?string $installCommand = null, ?string $buildCommand = null, ?string $startCommand = null, ?string $outputDirectory = null, ?Adapter $adapter = null, ?string $installationId = null, ?string $fallbackFile = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): \Appwrite\Models\Site { $apiPath = str_replace( [], @@ -174,12 +180,18 @@ public function create(string $siteId, string $name, Framework $framework, Build $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Site::class] + ); + } /** @@ -187,9 +199,9 @@ public function create(string $siteId, string $name, Framework $framework, Build * instance. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\FrameworkList */ - public function listFrameworks(): array + public function listFrameworks(): \Appwrite\Models\FrameworkList { $apiPath = str_replace( [], @@ -201,21 +213,27 @@ public function listFrameworks(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\FrameworkList::class] + ); + } /** * List allowed site specifications for this instance. * * @throws AppwriteException - * @return array + * @return \Appwrite\Models\SpecificationList */ - public function listSpecifications(): array + public function listSpecifications(): \Appwrite\Models\SpecificationList { $apiPath = str_replace( [], @@ -227,12 +245,18 @@ public function listSpecifications(): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\SpecificationList::class] + ); + } /** @@ -240,9 +264,9 @@ public function listSpecifications(): array * * @param string $siteId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Site */ - public function get(string $siteId): array + public function get(string $siteId): \Appwrite\Models\Site { $apiPath = str_replace( ['{siteId}'], @@ -255,12 +279,18 @@ public function get(string $siteId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Site::class] + ); + } /** @@ -288,9 +318,9 @@ public function get(string $siteId): array * @param ?string $runtimeSpecification * @param ?int $deploymentRetention * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Site */ - public function update(string $siteId, string $name, Framework $framework, ?bool $enabled = null, ?bool $logging = null, ?int $timeout = null, ?string $installCommand = null, ?string $buildCommand = null, ?string $startCommand = null, ?string $outputDirectory = null, ?BuildRuntime $buildRuntime = null, ?Adapter $adapter = null, ?string $fallbackFile = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): array + public function update(string $siteId, string $name, Framework $framework, ?bool $enabled = null, ?bool $logging = null, ?int $timeout = null, ?string $installCommand = null, ?string $buildCommand = null, ?string $startCommand = null, ?string $outputDirectory = null, ?BuildRuntime $buildRuntime = null, ?Adapter $adapter = null, ?string $fallbackFile = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): \Appwrite\Models\Site { $apiPath = str_replace( ['{siteId}'], @@ -378,12 +408,18 @@ public function update(string $siteId, string $name, Framework $framework, ?bool $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Site::class] + ); + } /** @@ -407,12 +443,15 @@ public function delete(string $siteId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -422,9 +461,9 @@ public function delete(string $siteId): string * @param string $siteId * @param string $deploymentId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Site */ - public function updateSiteDeployment(string $siteId, string $deploymentId): array + public function updateSiteDeployment(string $siteId, string $deploymentId): \Appwrite\Models\Site { $apiPath = str_replace( ['{siteId}'], @@ -439,12 +478,18 @@ public function updateSiteDeployment(string $siteId, string $deploymentId): arra $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Site::class] + ); + } /** @@ -456,9 +501,9 @@ public function updateSiteDeployment(string $siteId, string $deploymentId): arra * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DeploymentList */ - public function listDeployments(string $siteId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listDeployments(string $siteId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\DeploymentList { $apiPath = str_replace( ['{siteId}'], @@ -483,12 +528,18 @@ public function listDeployments(string $siteId, ?array $queries = null, ?string $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DeploymentList::class] + ); + } /** @@ -503,9 +554,9 @@ public function listDeployments(string $siteId, ?array $queries = null, ?string * @param ?string $outputDirectory * @param ?bool $activate * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function createDeployment(string $siteId, InputFile $code, ?string $installCommand = null, ?string $buildCommand = null, ?string $outputDirectory = null, ?bool $activate = null, ?callable $onProgress = null): array + public function createDeployment(string $siteId, InputFile $code, ?string $installCommand = null, ?string $buildCommand = null, ?string $outputDirectory = null, ?bool $activate = null, ?callable $onProgress = null): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{siteId}'], @@ -544,9 +595,13 @@ public function createDeployment(string $siteId, InputFile $code, ?string $insta $postedName = $code->getFilename(); if ($size <= Client::CHUNK_SIZE) { $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($code->getData()), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ + $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', ], $apiParams); + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); } } else { $size = filesize($code->getPath()); @@ -555,9 +610,13 @@ public function createDeployment(string $siteId, InputFile $code, ?string $insta //send single file if size is less than or equal to 5MB if ($size <= Client::CHUNK_SIZE) { $apiParams['code'] = new \CURLFile($code->getPath(), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ + $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', ], $apiParams); + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); } } @@ -605,7 +664,10 @@ public function createDeployment(string $siteId, InputFile $code, ?string $insta if(!empty($handle)) { @fclose($handle); } - return $response; + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); } @@ -619,9 +681,9 @@ public function createDeployment(string $siteId, InputFile $code, ?string $insta * @param string $siteId * @param string $deploymentId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function createDuplicateDeployment(string $siteId, string $deploymentId): array + public function createDuplicateDeployment(string $siteId, string $deploymentId): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{siteId}'], @@ -636,12 +698,18 @@ public function createDuplicateDeployment(string $siteId, string $deploymentId): $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -659,9 +727,9 @@ public function createDuplicateDeployment(string $siteId, string $deploymentId): * @param string $reference * @param ?bool $activate * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function createTemplateDeployment(string $siteId, string $repository, string $owner, string $rootDirectory, TemplateReferenceType $type, string $reference, ?bool $activate = null): array + public function createTemplateDeployment(string $siteId, string $repository, string $owner, string $rootDirectory, TemplateReferenceType $type, string $reference, ?bool $activate = null): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{siteId}'], @@ -684,12 +752,18 @@ public function createTemplateDeployment(string $siteId, string $repository, str $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -702,9 +776,9 @@ public function createTemplateDeployment(string $siteId, string $repository, str * @param string $reference * @param ?bool $activate * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function createVcsDeployment(string $siteId, VCSReferenceType $type, string $reference, ?bool $activate = null): array + public function createVcsDeployment(string $siteId, VCSReferenceType $type, string $reference, ?bool $activate = null): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{siteId}'], @@ -724,12 +798,18 @@ public function createVcsDeployment(string $siteId, VCSReferenceType $type, stri $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -738,9 +818,9 @@ public function createVcsDeployment(string $siteId, VCSReferenceType $type, stri * @param string $siteId * @param string $deploymentId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function getDeployment(string $siteId, string $deploymentId): array + public function getDeployment(string $siteId, string $deploymentId): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{siteId}', '{deploymentId}'], @@ -754,12 +834,18 @@ public function getDeployment(string $siteId, string $deploymentId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -785,12 +871,15 @@ public function deleteDeployment(string $siteId, string $deploymentId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -822,12 +911,15 @@ public function getDeploymentDownload(string $siteId, string $deploymentId, ?Dep $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -840,9 +932,9 @@ public function getDeploymentDownload(string $siteId, string $deploymentId, ?Dep * @param string $siteId * @param string $deploymentId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Deployment */ - public function updateDeploymentStatus(string $siteId, string $deploymentId): array + public function updateDeploymentStatus(string $siteId, string $deploymentId): \Appwrite\Models\Deployment { $apiPath = str_replace( ['{siteId}', '{deploymentId}'], @@ -857,12 +949,18 @@ public function updateDeploymentStatus(string $siteId, string $deploymentId): ar $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Deployment::class] + ); + } /** @@ -873,9 +971,9 @@ public function updateDeploymentStatus(string $siteId, string $deploymentId): ar * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ExecutionList */ - public function listLogs(string $siteId, ?array $queries = null, ?bool $total = null): array + public function listLogs(string $siteId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\ExecutionList { $apiPath = str_replace( ['{siteId}'], @@ -896,12 +994,18 @@ public function listLogs(string $siteId, ?array $queries = null, ?bool $total = $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ExecutionList::class] + ); + } /** @@ -910,9 +1014,9 @@ public function listLogs(string $siteId, ?array $queries = null, ?bool $total = * @param string $siteId * @param string $logId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Execution */ - public function getLog(string $siteId, string $logId): array + public function getLog(string $siteId, string $logId): \Appwrite\Models\Execution { $apiPath = str_replace( ['{siteId}', '{logId}'], @@ -926,12 +1030,18 @@ public function getLog(string $siteId, string $logId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Execution::class] + ); + } /** @@ -957,12 +1067,15 @@ public function deleteLog(string $siteId, string $logId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -970,9 +1083,9 @@ public function deleteLog(string $siteId, string $logId): string * * @param string $siteId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\VariableList */ - public function listVariables(string $siteId): array + public function listVariables(string $siteId): \Appwrite\Models\VariableList { $apiPath = str_replace( ['{siteId}'], @@ -985,12 +1098,18 @@ public function listVariables(string $siteId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\VariableList::class] + ); + } /** @@ -1002,9 +1121,9 @@ public function listVariables(string $siteId): array * @param string $value * @param ?bool $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function createVariable(string $siteId, string $key, string $value, ?bool $secret = null): array + public function createVariable(string $siteId, string $key, string $value, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{siteId}'], @@ -1024,12 +1143,18 @@ public function createVariable(string $siteId, string $key, string $value, ?bool $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -1038,9 +1163,9 @@ public function createVariable(string $siteId, string $key, string $value, ?bool * @param string $siteId * @param string $variableId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function getVariable(string $siteId, string $variableId): array + public function getVariable(string $siteId, string $variableId): \Appwrite\Models\Variable { $apiPath = str_replace( ['{siteId}', '{variableId}'], @@ -1054,12 +1179,18 @@ public function getVariable(string $siteId, string $variableId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -1071,9 +1202,9 @@ public function getVariable(string $siteId, string $variableId): array * @param ?string $value * @param ?bool $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Variable */ - public function updateVariable(string $siteId, string $variableId, string $key, ?string $value = null, ?bool $secret = null): array + public function updateVariable(string $siteId, string $variableId, string $key, ?string $value = null, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{siteId}', '{variableId}'], @@ -1091,12 +1222,18 @@ public function updateVariable(string $siteId, string $variableId, string $key, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Variable::class] + ); + } /** @@ -1122,11 +1259,14 @@ public function deleteVariable(string $siteId, string $variableId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 199cd61..3a0cb17 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -25,9 +25,9 @@ public function __construct(Client $client) * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\BucketList */ - public function listBuckets(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listBuckets(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\BucketList { $apiPath = str_replace( [], @@ -51,12 +51,18 @@ public function listBuckets(?array $queries = null, ?string $search = null, ?boo $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\BucketList::class] + ); + } /** @@ -74,9 +80,9 @@ public function listBuckets(?array $queries = null, ?string $search = null, ?boo * @param ?bool $antivirus * @param ?bool $transformations * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Bucket */ - public function createBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null, ?bool $transformations = null): array + public function createBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null, ?bool $transformations = null): \Appwrite\Models\Bucket { $apiPath = str_replace( [], @@ -124,12 +130,18 @@ public function createBucket(string $bucketId, string $name, ?array $permissions $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Bucket::class] + ); + } /** @@ -138,9 +150,9 @@ public function createBucket(string $bucketId, string $name, ?array $permissions * * @param string $bucketId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Bucket */ - public function getBucket(string $bucketId): array + public function getBucket(string $bucketId): \Appwrite\Models\Bucket { $apiPath = str_replace( ['{bucketId}'], @@ -153,12 +165,18 @@ public function getBucket(string $bucketId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Bucket::class] + ); + } /** @@ -176,9 +194,9 @@ public function getBucket(string $bucketId): array * @param ?bool $antivirus * @param ?bool $transformations * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Bucket */ - public function updateBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null, ?bool $transformations = null): array + public function updateBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null, ?bool $transformations = null): \Appwrite\Models\Bucket { $apiPath = str_replace( ['{bucketId}'], @@ -226,12 +244,18 @@ public function updateBucket(string $bucketId, string $name, ?array $permissions $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Bucket::class] + ); + } /** @@ -255,12 +279,15 @@ public function deleteBucket(string $bucketId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -272,9 +299,9 @@ public function deleteBucket(string $bucketId): string * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\FileList */ - public function listFiles(string $bucketId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listFiles(string $bucketId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\FileList { $apiPath = str_replace( ['{bucketId}'], @@ -299,12 +326,18 @@ public function listFiles(string $bucketId, ?array $queries = null, ?string $sea $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\FileList::class] + ); + } /** @@ -332,9 +365,9 @@ public function listFiles(string $bucketId, ?array $queries = null, ?string $sea * @param InputFile $file * @param ?array $permissions * @throws AppwriteException - * @return array + * @return \Appwrite\Models\File */ - public function createFile(string $bucketId, string $fileId, InputFile $file, ?array $permissions = null, ?callable $onProgress = null): array + public function createFile(string $bucketId, string $fileId, InputFile $file, ?array $permissions = null, ?callable $onProgress = null): \Appwrite\Models\File { $apiPath = str_replace( ['{bucketId}'], @@ -362,9 +395,13 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a $postedName = $file->getFilename(); if ($size <= Client::CHUNK_SIZE) { $apiParams['file'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($file->getData()), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ + $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', ], $apiParams); + return $this->parseResponse( + $response, + [\Appwrite\Models\File::class] + ); } } else { $size = filesize($file->getPath()); @@ -373,9 +410,13 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a //send single file if size is less than or equal to 5MB if ($size <= Client::CHUNK_SIZE) { $apiParams['file'] = new \CURLFile($file->getPath(), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ + $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', ], $apiParams); + return $this->parseResponse( + $response, + [\Appwrite\Models\File::class] + ); } } @@ -428,7 +469,10 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a if(!empty($handle)) { @fclose($handle); } - return $response; + return $this->parseResponse( + $response, + [\Appwrite\Models\File::class] + ); } @@ -439,9 +483,9 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a * @param string $bucketId * @param string $fileId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\File */ - public function getFile(string $bucketId, string $fileId): array + public function getFile(string $bucketId, string $fileId): \Appwrite\Models\File { $apiPath = str_replace( ['{bucketId}', '{fileId}'], @@ -455,12 +499,18 @@ public function getFile(string $bucketId, string $fileId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\File::class] + ); + } /** @@ -472,9 +522,9 @@ public function getFile(string $bucketId, string $fileId): array * @param ?string $name * @param ?array $permissions * @throws AppwriteException - * @return array + * @return \Appwrite\Models\File */ - public function updateFile(string $bucketId, string $fileId, ?string $name = null, ?array $permissions = null): array + public function updateFile(string $bucketId, string $fileId, ?string $name = null, ?array $permissions = null): \Appwrite\Models\File { $apiPath = str_replace( ['{bucketId}', '{fileId}'], @@ -494,12 +544,18 @@ public function updateFile(string $bucketId, string $fileId, ?string $name = nul $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\File::class] + ); + } /** @@ -526,12 +582,15 @@ public function deleteFile(string $bucketId, string $fileId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -563,12 +622,15 @@ public function getFileDownload(string $bucketId, string $fileId, ?string $token $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -657,12 +719,15 @@ public function getFilePreview(string $bucketId, string $fileId, ?int $width = n $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -694,11 +759,14 @@ public function getFileView(string $bucketId, string $fileId, ?string $token = n $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index e52fdf8..cfab672 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -26,9 +26,9 @@ public function __construct(Client $client) * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\DatabaseList */ - public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\DatabaseList { $apiPath = str_replace( [], @@ -52,12 +52,18 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\DatabaseList::class] + ); + } /** @@ -68,9 +74,9 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param string $name * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Database */ - public function create(string $databaseId, string $name, ?bool $enabled = null): array + public function create(string $databaseId, string $name, ?bool $enabled = null): \Appwrite\Models\Database { $apiPath = str_replace( [], @@ -89,12 +95,18 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Database::class] + ); + } /** @@ -102,9 +114,9 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): * * @param ?array $queries * @throws AppwriteException - * @return array + * @return \Appwrite\Models\TransactionList */ - public function listTransactions(?array $queries = null): array + public function listTransactions(?array $queries = null): \Appwrite\Models\TransactionList { $apiPath = str_replace( [], @@ -120,12 +132,18 @@ public function listTransactions(?array $queries = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\TransactionList::class] + ); + } /** @@ -133,9 +151,9 @@ public function listTransactions(?array $queries = null): array * * @param ?int $ttl * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Transaction */ - public function createTransaction(?int $ttl = null): array + public function createTransaction(?int $ttl = null): \Appwrite\Models\Transaction { $apiPath = str_replace( [], @@ -152,12 +170,18 @@ public function createTransaction(?int $ttl = null): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Transaction::class] + ); + } /** @@ -165,9 +189,9 @@ public function createTransaction(?int $ttl = null): array * * @param string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Transaction */ - public function getTransaction(string $transactionId): array + public function getTransaction(string $transactionId): \Appwrite\Models\Transaction { $apiPath = str_replace( ['{transactionId}'], @@ -180,12 +204,18 @@ public function getTransaction(string $transactionId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Transaction::class] + ); + } /** @@ -195,9 +225,9 @@ public function getTransaction(string $transactionId): array * @param ?bool $commit * @param ?bool $rollback * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Transaction */ - public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): array + public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): \Appwrite\Models\Transaction { $apiPath = str_replace( ['{transactionId}'], @@ -219,12 +249,18 @@ public function updateTransaction(string $transactionId, ?bool $commit = null, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Transaction::class] + ); + } /** @@ -248,12 +284,15 @@ public function deleteTransaction(string $transactionId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -262,9 +301,9 @@ public function deleteTransaction(string $transactionId): string * @param string $transactionId * @param ?array $operations * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Transaction */ - public function createOperations(string $transactionId, ?array $operations = null): array + public function createOperations(string $transactionId, ?array $operations = null): \Appwrite\Models\Transaction { $apiPath = str_replace( ['{transactionId}'], @@ -282,12 +321,18 @@ public function createOperations(string $transactionId, ?array $operations = nul $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Transaction::class] + ); + } /** @@ -296,9 +341,9 @@ public function createOperations(string $transactionId, ?array $operations = nul * * @param string $databaseId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Database */ - public function get(string $databaseId): array + public function get(string $databaseId): \Appwrite\Models\Database { $apiPath = str_replace( ['{databaseId}'], @@ -311,12 +356,18 @@ public function get(string $databaseId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Database::class] + ); + } /** @@ -326,9 +377,9 @@ public function get(string $databaseId): array * @param ?string $name * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Database */ - public function update(string $databaseId, ?string $name = null, ?bool $enabled = null): array + public function update(string $databaseId, ?string $name = null, ?bool $enabled = null): \Appwrite\Models\Database { $apiPath = str_replace( ['{databaseId}'], @@ -350,12 +401,18 @@ public function update(string $databaseId, ?string $name = null, ?bool $enabled $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Database::class] + ); + } /** @@ -380,12 +437,15 @@ public function delete(string $databaseId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -397,9 +457,9 @@ public function delete(string $databaseId): string * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\TableList */ - public function listTables(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listTables(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\TableList { $apiPath = str_replace( ['{databaseId}'], @@ -424,12 +484,18 @@ public function listTables(string $databaseId, ?array $queries = null, ?string $ $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\TableList::class] + ); + } /** @@ -447,9 +513,9 @@ public function listTables(string $databaseId, ?array $queries = null, ?string $ * @param ?array $columns * @param ?array $indexes * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Table */ - public function createTable(string $databaseId, string $tableId, string $name, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null, ?array $columns = null, ?array $indexes = null): array + public function createTable(string $databaseId, string $tableId, string $name, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null, ?array $columns = null, ?array $indexes = null): \Appwrite\Models\Table { $apiPath = str_replace( ['{databaseId}'], @@ -482,12 +548,18 @@ public function createTable(string $databaseId, string $tableId, string $name, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Table::class] + ); + } /** @@ -497,9 +569,9 @@ public function createTable(string $databaseId, string $tableId, string $name, ? * @param string $databaseId * @param string $tableId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Table */ - public function getTable(string $databaseId, string $tableId): array + public function getTable(string $databaseId, string $tableId): \Appwrite\Models\Table { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -513,12 +585,18 @@ public function getTable(string $databaseId, string $tableId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Table::class] + ); + } /** @@ -531,9 +609,9 @@ public function getTable(string $databaseId, string $tableId): array * @param ?bool $rowSecurity * @param ?bool $enabled * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Table */ - public function updateTable(string $databaseId, string $tableId, ?string $name = null, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null): array + public function updateTable(string $databaseId, string $tableId, ?string $name = null, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null): \Appwrite\Models\Table { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -561,12 +639,18 @@ public function updateTable(string $databaseId, string $tableId, ?string $name = $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Table::class] + ); + } /** @@ -593,12 +677,15 @@ public function deleteTable(string $databaseId, string $tableId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -609,9 +696,9 @@ public function deleteTable(string $databaseId, string $tableId): string * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnList */ - public function listColumns(string $databaseId, string $tableId, ?array $queries = null, ?bool $total = null): array + public function listColumns(string $databaseId, string $tableId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\ColumnList { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -633,12 +720,18 @@ public function listColumns(string $databaseId, string $tableId, ?array $queries $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnList::class] + ); + } /** @@ -652,9 +745,9 @@ public function listColumns(string $databaseId, string $tableId, ?array $queries * @param ?bool $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnBoolean */ - public function createBooleanColumn(string $databaseId, string $tableId, string $key, bool $required, ?bool $xdefault = null, ?bool $xarray = null): array + public function createBooleanColumn(string $databaseId, string $tableId, string $key, bool $required, ?bool $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnBoolean { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -676,12 +769,18 @@ public function createBooleanColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnBoolean::class] + ); + } /** @@ -695,9 +794,9 @@ public function createBooleanColumn(string $databaseId, string $tableId, string * @param ?bool $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnBoolean */ - public function updateBooleanColumn(string $databaseId, string $tableId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): array + public function updateBooleanColumn(string $databaseId, string $tableId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnBoolean { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -716,12 +815,18 @@ public function updateBooleanColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnBoolean::class] + ); + } /** @@ -734,9 +839,9 @@ public function updateBooleanColumn(string $databaseId, string $tableId, string * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnDatetime */ - public function createDatetimeColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createDatetimeColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnDatetime { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -758,12 +863,18 @@ public function createDatetimeColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnDatetime::class] + ); + } /** @@ -777,9 +888,9 @@ public function createDatetimeColumn(string $databaseId, string $tableId, string * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnDatetime */ - public function updateDatetimeColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateDatetimeColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnDatetime { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -798,12 +909,18 @@ public function updateDatetimeColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnDatetime::class] + ); + } /** @@ -817,9 +934,9 @@ public function updateDatetimeColumn(string $databaseId, string $tableId, string * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnEmail */ - public function createEmailColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createEmailColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnEmail { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -841,12 +958,18 @@ public function createEmailColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnEmail::class] + ); + } /** @@ -861,9 +984,9 @@ public function createEmailColumn(string $databaseId, string $tableId, string $k * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnEmail */ - public function updateEmailColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateEmailColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnEmail { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -882,12 +1005,18 @@ public function updateEmailColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnEmail::class] + ); + } /** @@ -902,9 +1031,9 @@ public function updateEmailColumn(string $databaseId, string $tableId, string $k * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnEnum */ - public function createEnumColumn(string $databaseId, string $tableId, string $key, array $elements, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createEnumColumn(string $databaseId, string $tableId, string $key, array $elements, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnEnum { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -927,12 +1056,18 @@ public function createEnumColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnEnum::class] + ); + } /** @@ -948,9 +1083,9 @@ public function createEnumColumn(string $databaseId, string $tableId, string $ke * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnEnum */ - public function updateEnumColumn(string $databaseId, string $tableId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateEnumColumn(string $databaseId, string $tableId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnEnum { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -970,12 +1105,18 @@ public function updateEnumColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnEnum::class] + ); + } /** @@ -992,9 +1133,9 @@ public function updateEnumColumn(string $databaseId, string $tableId, string $ke * @param ?float $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnFloat */ - public function createFloatColumn(string $databaseId, string $tableId, string $key, bool $required, ?float $min = null, ?float $max = null, ?float $xdefault = null, ?bool $xarray = null): array + public function createFloatColumn(string $databaseId, string $tableId, string $key, bool $required, ?float $min = null, ?float $max = null, ?float $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnFloat { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1018,12 +1159,18 @@ public function createFloatColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnFloat::class] + ); + } /** @@ -1040,9 +1187,9 @@ public function createFloatColumn(string $databaseId, string $tableId, string $k * @param ?float $max * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnFloat */ - public function updateFloatColumn(string $databaseId, string $tableId, string $key, bool $required, ?float $xdefault, ?float $min = null, ?float $max = null, ?string $newKey = null): array + public function updateFloatColumn(string $databaseId, string $tableId, string $key, bool $required, ?float $xdefault, ?float $min = null, ?float $max = null, ?string $newKey = null): \Appwrite\Models\ColumnFloat { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1063,12 +1210,18 @@ public function updateFloatColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnFloat::class] + ); + } /** @@ -1085,9 +1238,9 @@ public function updateFloatColumn(string $databaseId, string $tableId, string $k * @param ?int $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnInteger */ - public function createIntegerColumn(string $databaseId, string $tableId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): array + public function createIntegerColumn(string $databaseId, string $tableId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnInteger { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1111,12 +1264,18 @@ public function createIntegerColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnInteger::class] + ); + } /** @@ -1133,9 +1292,9 @@ public function createIntegerColumn(string $databaseId, string $tableId, string * @param ?int $max * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnInteger */ - public function updateIntegerColumn(string $databaseId, string $tableId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): array + public function updateIntegerColumn(string $databaseId, string $tableId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): \Appwrite\Models\ColumnInteger { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1156,12 +1315,18 @@ public function updateIntegerColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnInteger::class] + ); + } /** @@ -1175,9 +1340,9 @@ public function updateIntegerColumn(string $databaseId, string $tableId, string * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnIp */ - public function createIpColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createIpColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnIp { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1199,12 +1364,18 @@ public function createIpColumn(string $databaseId, string $tableId, string $key, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnIp::class] + ); + } /** @@ -1219,9 +1390,9 @@ public function createIpColumn(string $databaseId, string $tableId, string $key, * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnIp */ - public function updateIpColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateIpColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnIp { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1240,12 +1411,18 @@ public function updateIpColumn(string $databaseId, string $tableId, string $key, $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnIp::class] + ); + } /** @@ -1257,9 +1434,9 @@ public function updateIpColumn(string $databaseId, string $tableId, string $key, * @param bool $required * @param ?array $xdefault * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnLine */ - public function createLineColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): array + public function createLineColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): \Appwrite\Models\ColumnLine { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1277,12 +1454,18 @@ public function createLineColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnLine::class] + ); + } /** @@ -1296,9 +1479,9 @@ public function createLineColumn(string $databaseId, string $tableId, string $ke * @param ?array $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnLine */ - public function updateLineColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + public function updateLineColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): \Appwrite\Models\ColumnLine { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1317,12 +1500,18 @@ public function updateLineColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnLine::class] + ); + } /** @@ -1337,9 +1526,9 @@ public function updateLineColumn(string $databaseId, string $tableId, string $ke * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnLongtext */ - public function createLongtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createLongtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\ColumnLongtext { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1365,12 +1554,18 @@ public function createLongtextColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnLongtext::class] + ); + } /** @@ -1385,9 +1580,9 @@ public function createLongtextColumn(string $databaseId, string $tableId, string * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnLongtext */ - public function updateLongtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateLongtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnLongtext { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1406,12 +1601,18 @@ public function updateLongtextColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnLongtext::class] + ); + } /** @@ -1426,9 +1627,9 @@ public function updateLongtextColumn(string $databaseId, string $tableId, string * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnMediumtext */ - public function createMediumtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createMediumtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\ColumnMediumtext { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1454,12 +1655,18 @@ public function createMediumtextColumn(string $databaseId, string $tableId, stri $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnMediumtext::class] + ); + } /** @@ -1474,9 +1681,9 @@ public function createMediumtextColumn(string $databaseId, string $tableId, stri * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnMediumtext */ - public function updateMediumtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateMediumtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnMediumtext { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1495,12 +1702,18 @@ public function updateMediumtextColumn(string $databaseId, string $tableId, stri $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnMediumtext::class] + ); + } /** @@ -1512,9 +1725,9 @@ public function updateMediumtextColumn(string $databaseId, string $tableId, stri * @param bool $required * @param ?array $xdefault * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnPoint */ - public function createPointColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): array + public function createPointColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): \Appwrite\Models\ColumnPoint { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1532,12 +1745,18 @@ public function createPointColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnPoint::class] + ); + } /** @@ -1551,9 +1770,9 @@ public function createPointColumn(string $databaseId, string $tableId, string $k * @param ?array $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnPoint */ - public function updatePointColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + public function updatePointColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): \Appwrite\Models\ColumnPoint { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1572,12 +1791,18 @@ public function updatePointColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnPoint::class] + ); + } /** @@ -1589,9 +1814,9 @@ public function updatePointColumn(string $databaseId, string $tableId, string $k * @param bool $required * @param ?array $xdefault * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnPolygon */ - public function createPolygonColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): array + public function createPolygonColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): \Appwrite\Models\ColumnPolygon { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1609,12 +1834,18 @@ public function createPolygonColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnPolygon::class] + ); + } /** @@ -1628,9 +1859,9 @@ public function createPolygonColumn(string $databaseId, string $tableId, string * @param ?array $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnPolygon */ - public function updatePolygonColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + public function updatePolygonColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): \Appwrite\Models\ColumnPolygon { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1649,12 +1880,18 @@ public function updatePolygonColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnPolygon::class] + ); + } /** @@ -1671,9 +1908,9 @@ public function updatePolygonColumn(string $databaseId, string $tableId, string * @param ?string $twoWayKey * @param ?RelationMutate $onDelete * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnRelationship */ - public function createRelationshipColumn(string $databaseId, string $tableId, string $relatedTableId, RelationshipType $type, ?bool $twoWay = null, ?string $key = null, ?string $twoWayKey = null, ?RelationMutate $onDelete = null): array + public function createRelationshipColumn(string $databaseId, string $tableId, string $relatedTableId, RelationshipType $type, ?bool $twoWay = null, ?string $key = null, ?string $twoWayKey = null, ?RelationMutate $onDelete = null): \Appwrite\Models\ColumnRelationship { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1700,12 +1937,18 @@ public function createRelationshipColumn(string $databaseId, string $tableId, st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnRelationship::class] + ); + } /** @@ -1721,12 +1964,12 @@ public function createRelationshipColumn(string $databaseId, string $tableId, st * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnString * * @deprecated This API has been deprecated since 1.9.0. Please use `createTextColumn` instead. * @see TablesDB::createTextColumn */ - public function createStringColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createStringColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\ColumnString { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1753,12 +1996,18 @@ public function createStringColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnString::class] + ); + } /** @@ -1774,12 +2023,12 @@ public function createStringColumn(string $databaseId, string $tableId, string $ * @param ?int $size * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnString * * @deprecated This API has been deprecated since 1.8.0. Please use `updateTextColumn` instead. * @see TablesDB::updateTextColumn */ - public function updateStringColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array + public function updateStringColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): \Appwrite\Models\ColumnString { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1799,12 +2048,18 @@ public function updateStringColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnString::class] + ); + } /** @@ -1819,9 +2074,9 @@ public function updateStringColumn(string $databaseId, string $tableId, string $ * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnText */ - public function createTextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createTextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\ColumnText { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1847,12 +2102,18 @@ public function createTextColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnText::class] + ); + } /** @@ -1867,9 +2128,9 @@ public function createTextColumn(string $databaseId, string $tableId, string $ke * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnText */ - public function updateTextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateTextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnText { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1888,12 +2149,18 @@ public function updateTextColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnText::class] + ); + } /** @@ -1907,9 +2174,9 @@ public function updateTextColumn(string $databaseId, string $tableId, string $ke * @param ?string $xdefault * @param ?bool $xarray * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnUrl */ - public function createUrlColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + public function createUrlColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnUrl { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1931,12 +2198,18 @@ public function createUrlColumn(string $databaseId, string $tableId, string $key $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnUrl::class] + ); + } /** @@ -1951,9 +2224,9 @@ public function createUrlColumn(string $databaseId, string $tableId, string $key * @param ?string $xdefault * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnUrl */ - public function updateUrlColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + public function updateUrlColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): \Appwrite\Models\ColumnUrl { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -1972,12 +2245,18 @@ public function updateUrlColumn(string $databaseId, string $tableId, string $key $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnUrl::class] + ); + } /** @@ -1993,9 +2272,9 @@ public function updateUrlColumn(string $databaseId, string $tableId, string $key * @param ?bool $xarray * @param ?bool $encrypt * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnVarchar */ - public function createVarcharColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + public function createVarcharColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): \Appwrite\Models\ColumnVarchar { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2022,12 +2301,18 @@ public function createVarcharColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnVarchar::class] + ); + } /** @@ -2043,9 +2328,9 @@ public function createVarcharColumn(string $databaseId, string $tableId, string * @param ?int $size * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnVarchar */ - public function updateVarcharColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array + public function updateVarcharColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): \Appwrite\Models\ColumnVarchar { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -2065,12 +2350,18 @@ public function updateVarcharColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnVarchar::class] + ); + } /** @@ -2080,9 +2371,9 @@ public function updateVarcharColumn(string $databaseId, string $tableId, string * @param string $tableId * @param string $key * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnBoolean|\Appwrite\Models\ColumnInteger|\Appwrite\Models\ColumnFloat|\Appwrite\Models\ColumnEmail|\Appwrite\Models\ColumnEnum|\Appwrite\Models\ColumnUrl|\Appwrite\Models\ColumnIp|\Appwrite\Models\ColumnDatetime|\Appwrite\Models\ColumnRelationship|\Appwrite\Models\ColumnString */ - public function getColumn(string $databaseId, string $tableId, string $key): array + public function getColumn(string $databaseId, string $tableId, string $key): \Appwrite\Models\ColumnBoolean|\Appwrite\Models\ColumnInteger|\Appwrite\Models\ColumnFloat|\Appwrite\Models\ColumnEmail|\Appwrite\Models\ColumnEnum|\Appwrite\Models\ColumnUrl|\Appwrite\Models\ColumnIp|\Appwrite\Models\ColumnDatetime|\Appwrite\Models\ColumnRelationship|\Appwrite\Models\ColumnString { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -2097,12 +2388,61 @@ public function getColumn(string $databaseId, string $tableId, string $key): arr $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnBoolean::class, \Appwrite\Models\ColumnInteger::class, \Appwrite\Models\ColumnFloat::class, \Appwrite\Models\ColumnEmail::class, \Appwrite\Models\ColumnEnum::class, \Appwrite\Models\ColumnUrl::class, \Appwrite\Models\ColumnIp::class, \Appwrite\Models\ColumnDatetime::class, \Appwrite\Models\ColumnRelationship::class, \Appwrite\Models\ColumnString::class] +, + [ + \Appwrite\Models\ColumnBoolean::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'default'], + ], + \Appwrite\Models\ColumnInteger::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'min', 'max', 'default'], + ], + \Appwrite\Models\ColumnFloat::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'min', 'max', 'default'], + ], + \Appwrite\Models\ColumnEmail::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'format', 'default'], + ], + \Appwrite\Models\ColumnEnum::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'elements', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'elements', 'format', 'default'], + ], + \Appwrite\Models\ColumnUrl::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'format', 'default'], + ], + \Appwrite\Models\ColumnIp::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'format', 'default'], + ], + \Appwrite\Models\ColumnDatetime::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'format', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'format', 'default'], + ], + \Appwrite\Models\ColumnRelationship::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'relatedTable', 'relationType', 'twoWay', 'twoWayKey', 'onDelete', 'side'], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'relatedTable', 'relationType', 'twoWay', 'twoWayKey', 'onDelete', 'side'], + ], + \Appwrite\Models\ColumnString::class => [ + 'required' => ['key', 'type', 'status', 'error', 'required', '$createdAt', '$updatedAt', 'size', ], + 'all' => ['key', 'type', 'status', 'error', 'required', 'array', '$createdAt', '$updatedAt', 'size', 'default', 'encrypt'], + ] + ] + ); + } /** @@ -2130,12 +2470,15 @@ public function deleteColumn(string $databaseId, string $tableId, string $key): $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -2149,9 +2492,9 @@ public function deleteColumn(string $databaseId, string $tableId, string $key): * @param ?RelationMutate $onDelete * @param ?string $newKey * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnRelationship */ - public function updateRelationshipColumn(string $databaseId, string $tableId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): array + public function updateRelationshipColumn(string $databaseId, string $tableId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): \Appwrite\Models\ColumnRelationship { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -2169,12 +2512,18 @@ public function updateRelationshipColumn(string $databaseId, string $tableId, st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnRelationship::class] + ); + } /** @@ -2185,9 +2534,9 @@ public function updateRelationshipColumn(string $databaseId, string $tableId, st * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnIndexList */ - public function listIndexes(string $databaseId, string $tableId, ?array $queries = null, ?bool $total = null): array + public function listIndexes(string $databaseId, string $tableId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\ColumnIndexList { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2209,12 +2558,18 @@ public function listIndexes(string $databaseId, string $tableId, ?array $queries $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnIndexList::class] + ); + } /** @@ -2230,9 +2585,9 @@ public function listIndexes(string $databaseId, string $tableId, ?array $queries * @param ?array $orders * @param ?array $lengths * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnIndex */ - public function createIndex(string $databaseId, string $tableId, string $key, TablesDBIndexType $type, array $columns, ?array $orders = null, ?array $lengths = null): array + public function createIndex(string $databaseId, string $tableId, string $key, TablesDBIndexType $type, array $columns, ?array $orders = null, ?array $lengths = null): \Appwrite\Models\ColumnIndex { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2258,12 +2613,18 @@ public function createIndex(string $databaseId, string $tableId, string $key, Ta $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnIndex::class] + ); + } /** @@ -2273,9 +2634,9 @@ public function createIndex(string $databaseId, string $tableId, string $key, Ta * @param string $tableId * @param string $key * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ColumnIndex */ - public function getIndex(string $databaseId, string $tableId, string $key): array + public function getIndex(string $databaseId, string $tableId, string $key): \Appwrite\Models\ColumnIndex { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{key}'], @@ -2290,12 +2651,18 @@ public function getIndex(string $databaseId, string $tableId, string $key): arra $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ColumnIndex::class] + ); + } /** @@ -2323,12 +2690,15 @@ public function deleteIndex(string $databaseId, string $tableId, string $key): s $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -2342,9 +2712,9 @@ public function deleteIndex(string $databaseId, string $tableId, string $key): s * @param ?bool $total * @param ?int $ttl * @throws AppwriteException - * @return array + * @return \Appwrite\Models\RowList */ - public function listRows(string $databaseId, string $tableId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): array + public function listRows(string $databaseId, string $tableId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): \Appwrite\Models\RowList { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2374,12 +2744,18 @@ public function listRows(string $databaseId, string $tableId, ?array $queries = $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\RowList::class] + ); + } /** @@ -2395,9 +2771,9 @@ public function listRows(string $databaseId, string $tableId, ?array $queries = * @param ?array $permissions * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Row */ - public function createRow(string $databaseId, string $tableId, string $rowId, array $data, ?array $permissions = null, ?string $transactionId = null): array + public function createRow(string $databaseId, string $tableId, string $rowId, array $data, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Row { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2416,12 +2792,18 @@ public function createRow(string $databaseId, string $tableId, string $rowId, ar $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Row::class] + ); + } /** @@ -2435,9 +2817,9 @@ public function createRow(string $databaseId, string $tableId, string $rowId, ar * @param array $rows * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\RowList */ - public function createRows(string $databaseId, string $tableId, array $rows, ?string $transactionId = null): array + public function createRows(string $databaseId, string $tableId, array $rows, ?string $transactionId = null): \Appwrite\Models\RowList { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2454,12 +2836,18 @@ public function createRows(string $databaseId, string $tableId, array $rows, ?st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\RowList::class] + ); + } /** @@ -2474,9 +2862,9 @@ public function createRows(string $databaseId, string $tableId, array $rows, ?st * @param array $rows * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\RowList */ - public function upsertRows(string $databaseId, string $tableId, array $rows, ?string $transactionId = null): array + public function upsertRows(string $databaseId, string $tableId, array $rows, ?string $transactionId = null): \Appwrite\Models\RowList { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2493,12 +2881,18 @@ public function upsertRows(string $databaseId, string $tableId, array $rows, ?st $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\RowList::class] + ); + } /** @@ -2511,9 +2905,9 @@ public function upsertRows(string $databaseId, string $tableId, array $rows, ?st * @param ?array $queries * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\RowList */ - public function updateRows(string $databaseId, string $tableId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): array + public function updateRows(string $databaseId, string $tableId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\RowList { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2537,12 +2931,18 @@ public function updateRows(string $databaseId, string $tableId, ?array $data = n $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\RowList::class] + ); + } /** @@ -2554,9 +2954,9 @@ public function updateRows(string $databaseId, string $tableId, ?array $data = n * @param ?array $queries * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\RowList */ - public function deleteRows(string $databaseId, string $tableId, ?array $queries = null, ?string $transactionId = null): array + public function deleteRows(string $databaseId, string $tableId, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\RowList { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2576,12 +2976,18 @@ public function deleteRows(string $databaseId, string $tableId, ?array $queries $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\RowList::class] + ); + } /** @@ -2594,9 +3000,9 @@ public function deleteRows(string $databaseId, string $tableId, ?array $queries * @param ?array $queries * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Row */ - public function getRow(string $databaseId, string $tableId, string $rowId, ?array $queries = null, ?string $transactionId = null): array + public function getRow(string $databaseId, string $tableId, string $rowId, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\Row { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{rowId}'], @@ -2619,12 +3025,18 @@ public function getRow(string $databaseId, string $tableId, string $rowId, ?arra $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Row::class] + ); + } /** @@ -2640,9 +3052,9 @@ public function getRow(string $databaseId, string $tableId, string $rowId, ?arra * @param ?array $permissions * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Row */ - public function upsertRow(string $databaseId, string $tableId, string $rowId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array + public function upsertRow(string $databaseId, string $tableId, string $rowId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Row { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{rowId}'], @@ -2664,12 +3076,18 @@ public function upsertRow(string $databaseId, string $tableId, string $rowId, ?a $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Row::class] + ); + } /** @@ -2683,9 +3101,9 @@ public function upsertRow(string $databaseId, string $tableId, string $rowId, ?a * @param ?array $permissions * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Row */ - public function updateRow(string $databaseId, string $tableId, string $rowId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array + public function updateRow(string $databaseId, string $tableId, string $rowId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Row { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{rowId}'], @@ -2707,12 +3125,18 @@ public function updateRow(string $databaseId, string $tableId, string $rowId, ?a $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Row::class] + ); + } /** @@ -2742,12 +3166,15 @@ public function deleteRow(string $databaseId, string $tableId, string $rowId, ?s $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -2761,9 +3188,9 @@ public function deleteRow(string $databaseId, string $tableId, string $rowId, ?s * @param ?float $min * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Row */ - public function decrementRowColumn(string $databaseId, string $tableId, string $rowId, string $column, ?float $value = null, ?float $min = null, ?string $transactionId = null): array + public function decrementRowColumn(string $databaseId, string $tableId, string $rowId, string $column, ?float $value = null, ?float $min = null, ?string $transactionId = null): \Appwrite\Models\Row { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{rowId}', '{column}'], @@ -2786,12 +3213,18 @@ public function decrementRowColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Row::class] + ); + } /** @@ -2805,9 +3238,9 @@ public function decrementRowColumn(string $databaseId, string $tableId, string $ * @param ?float $max * @param ?string $transactionId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Row */ - public function incrementRowColumn(string $databaseId, string $tableId, string $rowId, string $column, ?float $value = null, ?float $max = null, ?string $transactionId = null): array + public function incrementRowColumn(string $databaseId, string $tableId, string $rowId, string $column, ?float $value = null, ?float $max = null, ?string $transactionId = null): \Appwrite\Models\Row { $apiPath = str_replace( ['{databaseId}', '{tableId}', '{rowId}', '{column}'], @@ -2830,11 +3263,17 @@ public function incrementRowColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Row::class] + ); + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Teams.php b/src/Appwrite/Services/Teams.php index 3f3480e..5f2f3c4 100644 --- a/src/Appwrite/Services/Teams.php +++ b/src/Appwrite/Services/Teams.php @@ -22,9 +22,9 @@ public function __construct(Client $client) * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\TeamList */ - public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\TeamList { $apiPath = str_replace( [], @@ -48,12 +48,18 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\TeamList::class] + ); + } /** @@ -65,9 +71,9 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param string $name * @param ?array $roles * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Team */ - public function create(string $teamId, string $name, ?array $roles = null): array + public function create(string $teamId, string $name, ?array $roles = null): \Appwrite\Models\Team { $apiPath = str_replace( [], @@ -86,12 +92,18 @@ public function create(string $teamId, string $name, ?array $roles = null): arra $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Team::class] + ); + } /** @@ -99,9 +111,9 @@ public function create(string $teamId, string $name, ?array $roles = null): arra * * @param string $teamId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Team */ - public function get(string $teamId): array + public function get(string $teamId): \Appwrite\Models\Team { $apiPath = str_replace( ['{teamId}'], @@ -114,12 +126,18 @@ public function get(string $teamId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Team::class] + ); + } /** @@ -128,9 +146,9 @@ public function get(string $teamId): array * @param string $teamId * @param string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Team */ - public function updateName(string $teamId, string $name): array + public function updateName(string $teamId, string $name): \Appwrite\Models\Team { $apiPath = str_replace( ['{teamId}'], @@ -145,12 +163,18 @@ public function updateName(string $teamId, string $name): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Team::class] + ); + } /** @@ -175,12 +199,15 @@ public function delete(string $teamId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -193,9 +220,9 @@ public function delete(string $teamId): string * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MembershipList */ - public function listMemberships(string $teamId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listMemberships(string $teamId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\MembershipList { $apiPath = str_replace( ['{teamId}'], @@ -220,12 +247,18 @@ public function listMemberships(string $teamId, ?array $queries = null, ?string $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MembershipList::class] + ); + } /** @@ -259,9 +292,9 @@ public function listMemberships(string $teamId, ?array $queries = null, ?string * @param ?string $url * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Membership */ - public function createMembership(string $teamId, array $roles, ?string $email = null, ?string $userId = null, ?string $phone = null, ?string $url = null, ?string $name = null): array + public function createMembership(string $teamId, array $roles, ?string $email = null, ?string $userId = null, ?string $phone = null, ?string $url = null, ?string $name = null): \Appwrite\Models\Membership { $apiPath = str_replace( ['{teamId}'], @@ -296,12 +329,18 @@ public function createMembership(string $teamId, array $roles, ?string $email = $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Membership::class] + ); + } /** @@ -312,9 +351,9 @@ public function createMembership(string $teamId, array $roles, ?string $email = * @param string $teamId * @param string $membershipId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Membership */ - public function getMembership(string $teamId, string $membershipId): array + public function getMembership(string $teamId, string $membershipId): \Appwrite\Models\Membership { $apiPath = str_replace( ['{teamId}', '{membershipId}'], @@ -328,12 +367,18 @@ public function getMembership(string $teamId, string $membershipId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Membership::class] + ); + } /** @@ -346,9 +391,9 @@ public function getMembership(string $teamId, string $membershipId): array * @param string $membershipId * @param array $roles * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Membership */ - public function updateMembership(string $teamId, string $membershipId, array $roles): array + public function updateMembership(string $teamId, string $membershipId, array $roles): \Appwrite\Models\Membership { $apiPath = str_replace( ['{teamId}', '{membershipId}'], @@ -364,12 +409,18 @@ public function updateMembership(string $teamId, string $membershipId, array $ro $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Membership::class] + ); + } /** @@ -397,12 +448,15 @@ public function deleteMembership(string $teamId, string $membershipId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -419,9 +473,9 @@ public function deleteMembership(string $teamId, string $membershipId): string * @param string $userId * @param string $secret * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Membership */ - public function updateMembershipStatus(string $teamId, string $membershipId, string $userId, string $secret): array + public function updateMembershipStatus(string $teamId, string $membershipId, string $userId, string $secret): \Appwrite\Models\Membership { $apiPath = str_replace( ['{teamId}', '{membershipId}'], @@ -438,12 +492,18 @@ public function updateMembershipStatus(string $teamId, string $membershipId, str $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Membership::class] + ); + } /** @@ -453,9 +513,9 @@ public function updateMembershipStatus(string $teamId, string $membershipId, str * * @param string $teamId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Preferences */ - public function getPrefs(string $teamId): array + public function getPrefs(string $teamId): \Appwrite\Models\Preferences { $apiPath = str_replace( ['{teamId}'], @@ -468,12 +528,18 @@ public function getPrefs(string $teamId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Preferences::class] + ); + } /** @@ -484,9 +550,9 @@ public function getPrefs(string $teamId): array * @param string $teamId * @param array $prefs * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Preferences */ - public function updatePrefs(string $teamId, array $prefs): array + public function updatePrefs(string $teamId, array $prefs): \Appwrite\Models\Preferences { $apiPath = str_replace( ['{teamId}'], @@ -501,11 +567,17 @@ public function updatePrefs(string $teamId, array $prefs): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Preferences::class] + ); + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Tokens.php b/src/Appwrite/Services/Tokens.php index d004e4e..fac89ab 100644 --- a/src/Appwrite/Services/Tokens.php +++ b/src/Appwrite/Services/Tokens.php @@ -23,9 +23,9 @@ public function __construct(Client $client) * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ResourceTokenList */ - public function list(string $bucketId, string $fileId, ?array $queries = null, ?bool $total = null): array + public function list(string $bucketId, string $fileId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\ResourceTokenList { $apiPath = str_replace( ['{bucketId}', '{fileId}'], @@ -47,12 +47,18 @@ public function list(string $bucketId, string $fileId, ?array $queries = null, ? $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ResourceTokenList::class] + ); + } /** @@ -63,9 +69,9 @@ public function list(string $bucketId, string $fileId, ?array $queries = null, ? * @param string $fileId * @param ?string $expire * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ResourceToken */ - public function createFileToken(string $bucketId, string $fileId, ?string $expire = null): array + public function createFileToken(string $bucketId, string $fileId, ?string $expire = null): \Appwrite\Models\ResourceToken { $apiPath = str_replace( ['{bucketId}', '{fileId}'], @@ -81,12 +87,18 @@ public function createFileToken(string $bucketId, string $fileId, ?string $expir $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ResourceToken::class] + ); + } /** @@ -94,9 +106,9 @@ public function createFileToken(string $bucketId, string $fileId, ?string $expir * * @param string $tokenId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ResourceToken */ - public function get(string $tokenId): array + public function get(string $tokenId): \Appwrite\Models\ResourceToken { $apiPath = str_replace( ['{tokenId}'], @@ -109,12 +121,18 @@ public function get(string $tokenId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ResourceToken::class] + ); + } /** @@ -124,9 +142,9 @@ public function get(string $tokenId): array * @param string $tokenId * @param ?string $expire * @throws AppwriteException - * @return array + * @return \Appwrite\Models\ResourceToken */ - public function update(string $tokenId, ?string $expire = null): array + public function update(string $tokenId, ?string $expire = null): \Appwrite\Models\ResourceToken { $apiPath = str_replace( ['{tokenId}'], @@ -141,12 +159,18 @@ public function update(string $tokenId, ?string $expire = null): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\ResourceToken::class] + ); + } /** @@ -170,11 +194,14 @@ public function delete(string $tokenId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index da07936..bd01c8a 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -25,9 +25,9 @@ public function __construct(Client $client) * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\UserList */ - public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\UserList { $apiPath = str_replace( [], @@ -51,12 +51,18 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\UserList::class] + ); + } /** @@ -68,9 +74,9 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param ?string $password * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function create(string $userId, ?string $email = null, ?string $phone = null, ?string $password = null, ?string $name = null): array + public function create(string $userId, ?string $email = null, ?string $phone = null, ?string $password = null, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -94,12 +100,18 @@ public function create(string $userId, ?string $email = null, ?string $phone = n $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -113,9 +125,9 @@ public function create(string $userId, ?string $email = null, ?string $phone = n * @param string $password * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function createArgon2User(string $userId, string $email, string $password, ?string $name = null): array + public function createArgon2User(string $userId, string $email, string $password, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -135,12 +147,18 @@ public function createArgon2User(string $userId, string $email, string $password $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -154,9 +172,9 @@ public function createArgon2User(string $userId, string $email, string $password * @param string $password * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function createBcryptUser(string $userId, string $email, string $password, ?string $name = null): array + public function createBcryptUser(string $userId, string $email, string $password, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -176,12 +194,18 @@ public function createBcryptUser(string $userId, string $email, string $password $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -191,9 +215,9 @@ public function createBcryptUser(string $userId, string $email, string $password * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\IdentityList */ - public function listIdentities(?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listIdentities(?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\IdentityList { $apiPath = str_replace( [], @@ -217,12 +241,18 @@ public function listIdentities(?array $queries = null, ?string $search = null, ? $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\IdentityList::class] + ); + } /** @@ -246,12 +276,15 @@ public function deleteIdentity(string $identityId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -265,9 +298,9 @@ public function deleteIdentity(string $identityId): string * @param string $password * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function createMD5User(string $userId, string $email, string $password, ?string $name = null): array + public function createMD5User(string $userId, string $email, string $password, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -287,12 +320,18 @@ public function createMD5User(string $userId, string $email, string $password, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -306,9 +345,9 @@ public function createMD5User(string $userId, string $email, string $password, ? * @param string $password * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function createPHPassUser(string $userId, string $email, string $password, ?string $name = null): array + public function createPHPassUser(string $userId, string $email, string $password, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -328,12 +367,18 @@ public function createPHPassUser(string $userId, string $email, string $password $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -352,9 +397,9 @@ public function createPHPassUser(string $userId, string $email, string $password * @param int $passwordLength * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function createScryptUser(string $userId, string $email, string $password, string $passwordSalt, int $passwordCpu, int $passwordMemory, int $passwordParallel, int $passwordLength, ?string $name = null): array + public function createScryptUser(string $userId, string $email, string $password, string $passwordSalt, int $passwordCpu, int $passwordMemory, int $passwordParallel, int $passwordLength, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -379,12 +424,18 @@ public function createScryptUser(string $userId, string $email, string $password $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -402,9 +453,9 @@ public function createScryptUser(string $userId, string $email, string $password * @param string $passwordSignerKey * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function createScryptModifiedUser(string $userId, string $email, string $password, string $passwordSalt, string $passwordSaltSeparator, string $passwordSignerKey, ?string $name = null): array + public function createScryptModifiedUser(string $userId, string $email, string $password, string $passwordSalt, string $passwordSaltSeparator, string $passwordSignerKey, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -427,12 +478,18 @@ public function createScryptModifiedUser(string $userId, string $email, string $ $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -447,9 +504,9 @@ public function createScryptModifiedUser(string $userId, string $email, string $ * @param ?PasswordHash $passwordVersion * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function createSHAUser(string $userId, string $email, string $password, ?PasswordHash $passwordVersion = null, ?string $name = null): array + public function createSHAUser(string $userId, string $email, string $password, ?PasswordHash $passwordVersion = null, ?string $name = null): \Appwrite\Models\User { $apiPath = str_replace( [], @@ -473,12 +530,18 @@ public function createSHAUser(string $userId, string $email, string $password, ? $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -486,9 +549,9 @@ public function createSHAUser(string $userId, string $email, string $password, ? * * @param string $userId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function get(string $userId): array + public function get(string $userId): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -501,12 +564,18 @@ public function get(string $userId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -535,12 +604,15 @@ public function delete(string $userId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -549,9 +621,9 @@ public function delete(string $userId): string * @param string $userId * @param string $email * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateEmail(string $userId, string $email): array + public function updateEmail(string $userId, string $email): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -566,12 +638,18 @@ public function updateEmail(string $userId, string $email): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -585,9 +663,9 @@ public function updateEmail(string $userId, string $email): array * @param string $userId * @param bool $impersonator * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateImpersonator(string $userId, bool $impersonator): array + public function updateImpersonator(string $userId, bool $impersonator): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -602,12 +680,18 @@ public function updateImpersonator(string $userId, bool $impersonator): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -619,9 +703,9 @@ public function updateImpersonator(string $userId, bool $impersonator): array * @param ?string $sessionId * @param ?int $duration * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Jwt */ - public function createJWT(string $userId, ?string $sessionId = null, ?int $duration = null): array + public function createJWT(string $userId, ?string $sessionId = null, ?int $duration = null): \Appwrite\Models\Jwt { $apiPath = str_replace( ['{userId}'], @@ -643,12 +727,18 @@ public function createJWT(string $userId, ?string $sessionId = null, ?int $durat $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Jwt::class] + ); + } /** @@ -662,9 +752,9 @@ public function createJWT(string $userId, ?string $sessionId = null, ?int $durat * @param string $userId * @param array $labels * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateLabels(string $userId, array $labels): array + public function updateLabels(string $userId, array $labels): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -679,12 +769,18 @@ public function updateLabels(string $userId, array $labels): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -694,9 +790,9 @@ public function updateLabels(string $userId, array $labels): array * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\LogList */ - public function listLogs(string $userId, ?array $queries = null, ?bool $total = null): array + public function listLogs(string $userId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\LogList { $apiPath = str_replace( ['{userId}'], @@ -717,12 +813,18 @@ public function listLogs(string $userId, ?array $queries = null, ?bool $total = $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\LogList::class] + ); + } /** @@ -733,9 +835,9 @@ public function listLogs(string $userId, ?array $queries = null, ?bool $total = * @param ?string $search * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MembershipList */ - public function listMemberships(string $userId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + public function listMemberships(string $userId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\MembershipList { $apiPath = str_replace( ['{userId}'], @@ -760,12 +862,18 @@ public function listMemberships(string $userId, ?array $queries = null, ?string $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MembershipList::class] + ); + } /** @@ -774,9 +882,9 @@ public function listMemberships(string $userId, ?array $queries = null, ?string * @param string $userId * @param bool $mfa * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateMFA(string $userId, bool $mfa): array + public function updateMFA(string $userId, bool $mfa): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -791,12 +899,18 @@ public function updateMFA(string $userId, bool $mfa): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -822,12 +936,15 @@ public function deleteMFAAuthenticator(string $userId, AuthenticatorType $type): $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -835,9 +952,9 @@ public function deleteMFAAuthenticator(string $userId, AuthenticatorType $type): * * @param string $userId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaFactors */ - public function listMFAFactors(string $userId): array + public function listMFAFactors(string $userId): \Appwrite\Models\MfaFactors { $apiPath = str_replace( ['{userId}'], @@ -850,12 +967,18 @@ public function listMFAFactors(string $userId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaFactors::class] + ); + } /** @@ -866,9 +989,9 @@ public function listMFAFactors(string $userId): array * * @param string $userId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaRecoveryCodes */ - public function getMFARecoveryCodes(string $userId): array + public function getMFARecoveryCodes(string $userId): \Appwrite\Models\MfaRecoveryCodes { $apiPath = str_replace( ['{userId}'], @@ -881,12 +1004,18 @@ public function getMFARecoveryCodes(string $userId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaRecoveryCodes::class] + ); + } /** @@ -897,9 +1026,9 @@ public function getMFARecoveryCodes(string $userId): array * * @param string $userId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaRecoveryCodes */ - public function updateMFARecoveryCodes(string $userId): array + public function updateMFARecoveryCodes(string $userId): \Appwrite\Models\MfaRecoveryCodes { $apiPath = str_replace( ['{userId}'], @@ -913,12 +1042,18 @@ public function updateMFARecoveryCodes(string $userId): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaRecoveryCodes::class] + ); + } /** @@ -929,9 +1064,9 @@ public function updateMFARecoveryCodes(string $userId): array * * @param string $userId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\MfaRecoveryCodes */ - public function createMFARecoveryCodes(string $userId): array + public function createMFARecoveryCodes(string $userId): \Appwrite\Models\MfaRecoveryCodes { $apiPath = str_replace( ['{userId}'], @@ -945,12 +1080,18 @@ public function createMFARecoveryCodes(string $userId): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\MfaRecoveryCodes::class] + ); + } /** @@ -959,9 +1100,9 @@ public function createMFARecoveryCodes(string $userId): array * @param string $userId * @param string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateName(string $userId, string $name): array + public function updateName(string $userId, string $name): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -976,12 +1117,18 @@ public function updateName(string $userId, string $name): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -990,9 +1137,9 @@ public function updateName(string $userId, string $name): array * @param string $userId * @param string $password * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updatePassword(string $userId, string $password): array + public function updatePassword(string $userId, string $password): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -1007,12 +1154,18 @@ public function updatePassword(string $userId, string $password): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -1021,9 +1174,9 @@ public function updatePassword(string $userId, string $password): array * @param string $userId * @param string $number * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updatePhone(string $userId, string $number): array + public function updatePhone(string $userId, string $number): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -1038,12 +1191,18 @@ public function updatePhone(string $userId, string $number): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -1051,9 +1210,9 @@ public function updatePhone(string $userId, string $number): array * * @param string $userId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Preferences */ - public function getPrefs(string $userId): array + public function getPrefs(string $userId): \Appwrite\Models\Preferences { $apiPath = str_replace( ['{userId}'], @@ -1066,12 +1225,18 @@ public function getPrefs(string $userId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Preferences::class] + ); + } /** @@ -1082,9 +1247,9 @@ public function getPrefs(string $userId): array * @param string $userId * @param array $prefs * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Preferences */ - public function updatePrefs(string $userId, array $prefs): array + public function updatePrefs(string $userId, array $prefs): \Appwrite\Models\Preferences { $apiPath = str_replace( ['{userId}'], @@ -1099,12 +1264,18 @@ public function updatePrefs(string $userId, array $prefs): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Preferences::class] + ); + } /** @@ -1113,9 +1284,9 @@ public function updatePrefs(string $userId, array $prefs): array * @param string $userId * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\SessionList */ - public function listSessions(string $userId, ?bool $total = null): array + public function listSessions(string $userId, ?bool $total = null): \Appwrite\Models\SessionList { $apiPath = str_replace( ['{userId}'], @@ -1132,12 +1303,18 @@ public function listSessions(string $userId, ?bool $total = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\SessionList::class] + ); + } /** @@ -1150,9 +1327,9 @@ public function listSessions(string $userId, ?bool $total = null): array * * @param string $userId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Session */ - public function createSession(string $userId): array + public function createSession(string $userId): \Appwrite\Models\Session { $apiPath = str_replace( ['{userId}'], @@ -1166,12 +1343,18 @@ public function createSession(string $userId): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Session::class] + ); + } /** @@ -1195,12 +1378,15 @@ public function deleteSessions(string $userId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -1226,12 +1412,15 @@ public function deleteSession(string $userId, string $sessionId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -1241,9 +1430,9 @@ public function deleteSession(string $userId, string $sessionId): string * @param string $userId * @param bool $status * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateStatus(string $userId, bool $status): array + public function updateStatus(string $userId, bool $status): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -1258,12 +1447,18 @@ public function updateStatus(string $userId, bool $status): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -1273,9 +1468,9 @@ public function updateStatus(string $userId, bool $status): array * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\TargetList */ - public function listTargets(string $userId, ?array $queries = null, ?bool $total = null): array + public function listTargets(string $userId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\TargetList { $apiPath = str_replace( ['{userId}'], @@ -1296,12 +1491,18 @@ public function listTargets(string $userId, ?array $queries = null, ?bool $total $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\TargetList::class] + ); + } /** @@ -1314,9 +1515,9 @@ public function listTargets(string $userId, ?array $queries = null, ?bool $total * @param ?string $providerId * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Target */ - public function createTarget(string $userId, string $targetId, MessagingProviderType $providerType, string $identifier, ?string $providerId = null, ?string $name = null): array + public function createTarget(string $userId, string $targetId, MessagingProviderType $providerType, string $identifier, ?string $providerId = null, ?string $name = null): \Appwrite\Models\Target { $apiPath = str_replace( ['{userId}'], @@ -1341,12 +1542,18 @@ public function createTarget(string $userId, string $targetId, MessagingProvider $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Target::class] + ); + } /** @@ -1355,9 +1562,9 @@ public function createTarget(string $userId, string $targetId, MessagingProvider * @param string $userId * @param string $targetId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Target */ - public function getTarget(string $userId, string $targetId): array + public function getTarget(string $userId, string $targetId): \Appwrite\Models\Target { $apiPath = str_replace( ['{userId}', '{targetId}'], @@ -1371,12 +1578,18 @@ public function getTarget(string $userId, string $targetId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Target::class] + ); + } /** @@ -1388,9 +1601,9 @@ public function getTarget(string $userId, string $targetId): array * @param ?string $providerId * @param ?string $name * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Target */ - public function updateTarget(string $userId, string $targetId, ?string $identifier = null, ?string $providerId = null, ?string $name = null): array + public function updateTarget(string $userId, string $targetId, ?string $identifier = null, ?string $providerId = null, ?string $name = null): \Appwrite\Models\Target { $apiPath = str_replace( ['{userId}', '{targetId}'], @@ -1417,12 +1630,18 @@ public function updateTarget(string $userId, string $targetId, ?string $identifi $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Target::class] + ); + } /** @@ -1448,12 +1667,15 @@ public function deleteTarget(string $userId, string $targetId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -1467,9 +1689,9 @@ public function deleteTarget(string $userId, string $targetId): string * @param ?int $length * @param ?int $expire * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Token */ - public function createToken(string $userId, ?int $length = null, ?int $expire = null): array + public function createToken(string $userId, ?int $length = null, ?int $expire = null): \Appwrite\Models\Token { $apiPath = str_replace( ['{userId}'], @@ -1491,12 +1713,18 @@ public function createToken(string $userId, ?int $length = null, ?int $expire = $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Token::class] + ); + } /** @@ -1505,9 +1733,9 @@ public function createToken(string $userId, ?int $length = null, ?int $expire = * @param string $userId * @param bool $emailVerification * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updateEmailVerification(string $userId, bool $emailVerification): array + public function updateEmailVerification(string $userId, bool $emailVerification): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -1522,12 +1750,18 @@ public function updateEmailVerification(string $userId, bool $emailVerification) $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } /** @@ -1536,9 +1770,9 @@ public function updateEmailVerification(string $userId, bool $emailVerification) * @param string $userId * @param bool $phoneVerification * @throws AppwriteException - * @return array + * @return \Appwrite\Models\User */ - public function updatePhoneVerification(string $userId, bool $phoneVerification): array + public function updatePhoneVerification(string $userId, bool $phoneVerification): \Appwrite\Models\User { $apiPath = str_replace( ['{userId}'], @@ -1553,11 +1787,17 @@ public function updatePhoneVerification(string $userId, bool $phoneVerification) $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\User::class] + ); + } -} \ No newline at end of file +} diff --git a/src/Appwrite/Services/Webhooks.php b/src/Appwrite/Services/Webhooks.php index 9a00db1..5d6e81e 100644 --- a/src/Appwrite/Services/Webhooks.php +++ b/src/Appwrite/Services/Webhooks.php @@ -21,9 +21,9 @@ public function __construct(Client $client) * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return array + * @return \Appwrite\Models\WebhookList */ - public function list(?array $queries = null, ?bool $total = null): array + public function list(?array $queries = null, ?bool $total = null): \Appwrite\Models\WebhookList { $apiPath = str_replace( [], @@ -43,12 +43,18 @@ public function list(?array $queries = null, ?bool $total = null): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\WebhookList::class] + ); + } /** @@ -64,9 +70,9 @@ public function list(?array $queries = null, ?bool $total = null): array * @param ?string $httpUser * @param ?string $httpPass * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Webhook */ - public function create(string $webhookId, string $url, string $name, array $events, ?bool $enabled = null, ?bool $security = null, ?string $httpUser = null, ?string $httpPass = null): array + public function create(string $webhookId, string $url, string $name, array $events, ?bool $enabled = null, ?bool $security = null, ?string $httpUser = null, ?string $httpPass = null): \Appwrite\Models\Webhook { $apiPath = str_replace( [], @@ -99,12 +105,18 @@ public function create(string $webhookId, string $url, string $name, array $even $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Webhook::class] + ); + } /** @@ -113,9 +125,9 @@ public function create(string $webhookId, string $url, string $name, array $even * * @param string $webhookId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Webhook */ - public function get(string $webhookId): array + public function get(string $webhookId): \Appwrite\Models\Webhook { $apiPath = str_replace( ['{webhookId}'], @@ -128,12 +140,18 @@ public function get(string $webhookId): array $apiHeaders = []; - return $this->client->call( + $response = $this->client->call( Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Webhook::class] + ); + } /** @@ -149,9 +167,9 @@ public function get(string $webhookId): array * @param ?string $httpUser * @param ?string $httpPass * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Webhook */ - public function update(string $webhookId, string $name, string $url, array $events, ?bool $enabled = null, ?bool $security = null, ?string $httpUser = null, ?string $httpPass = null): array + public function update(string $webhookId, string $name, string $url, array $events, ?bool $enabled = null, ?bool $security = null, ?string $httpUser = null, ?string $httpPass = null): \Appwrite\Models\Webhook { $apiPath = str_replace( ['{webhookId}'], @@ -184,12 +202,18 @@ public function update(string $webhookId, string $name, string $url, array $even $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Webhook::class] + ); + } /** @@ -214,12 +238,15 @@ public function delete(string $webhookId): string $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); + + return $response; + } /** @@ -229,9 +256,9 @@ public function delete(string $webhookId): string * * @param string $webhookId * @throws AppwriteException - * @return array + * @return \Appwrite\Models\Webhook */ - public function updateSignature(string $webhookId): array + public function updateSignature(string $webhookId): \Appwrite\Models\Webhook { $apiPath = str_replace( ['{webhookId}'], @@ -245,11 +272,17 @@ public function updateSignature(string $webhookId): array $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; - return $this->client->call( + $response = $this->client->call( Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); + + return $this->parseResponse( + $response, + [\Appwrite\Models\Webhook::class] + ); + } -} \ No newline at end of file +} diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index d38511b..01af207 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -20,24 +20,35 @@ protected function setUp(): void { } public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -46,28 +57,39 @@ public function testMethodGet(): void { $response = $this->account->get( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -79,28 +101,39 @@ public function testMethodCreate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodUpdateEmail(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -111,14 +144,26 @@ public function testMethodUpdateEmail(): void { "password" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodListIdentities(): void { - - $data = array( - "total" => 5, - "identities" => array()); + + $data = array("total" => 5 +,"identities" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"provider" => "email" +,"providerUid" => "5e5bb8c16897e" +,"providerEmail" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -127,11 +172,11 @@ public function testMethodListIdentities(): void { $response = $this->account->listIdentities( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\IdentityList::class, $response); + } public function testMethodDeleteIdentity(): void { - + $data = ''; $this->client @@ -142,13 +187,14 @@ public function testMethodDeleteIdentity(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreateJWT(): void { - - $data = array( - "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"); + + $data = array("jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -157,14 +203,37 @@ public function testMethodCreateJWT(): void { $response = $this->account->createJWT( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Jwt::class, $response); + } public function testMethodListLogs(): void { - - $data = array( - "total" => 5, - "logs" => array()); + + $data = array("total" => 5 +,"logs" => array(array("event" => "account.sessions.create" +,"userId" => "610fc2f985ee0" +,"userEmail" => "john@appwrite.io" +,"userName" => "John Doe" +,"mode" => "admin" +,"ip" => "127.0.0.1" +,"time" => "2020-10-15T06:38:00.000+00:00" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -173,28 +242,39 @@ public function testMethodListLogs(): void { $response = $this->account->listLogs( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } public function testMethodUpdateMFA(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -204,14 +284,15 @@ public function testMethodUpdateMFA(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateMFAAuthenticator(): void { - - $data = array( - "secret" => "1", - "uri" => "1"); + + $data = array("secret" => "[SHARED_SECRET]" +,"uri" => "otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -221,28 +302,39 @@ public function testMethodCreateMFAAuthenticator(): void { AuthenticatorType::TOTP() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaType::class, $response); + } public function testMethodUpdateMFAAuthenticator(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -253,11 +345,11 @@ public function testMethodUpdateMFAAuthenticator(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodDeleteMFAAuthenticator(): void { - + $data = ''; $this->client @@ -268,16 +360,17 @@ public function testMethodDeleteMFAAuthenticator(): void { AuthenticatorType::TOTP() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreateMFAChallenge(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "expire" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"expire" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -287,41 +380,42 @@ public function testMethodCreateMFAChallenge(): void { AuthenticationFactor::EMAIL() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaChallenge::class, $response); + } public function testMethodUpdateMFAChallenge(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -332,16 +426,17 @@ public function testMethodUpdateMFAChallenge(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodListMFAFactors(): void { - - $data = array( - "totp" => true, - "phone" => true, - "email" => true, - "recoveryCode" => true); + + $data = array("totp" => true +,"phone" => true +,"email" => true +,"recoveryCode" => true +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -350,13 +445,14 @@ public function testMethodListMFAFactors(): void { $response = $this->account->listMFAFactors( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaFactors::class, $response); + } public function testMethodGetMFARecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array()); + + $data = array("recoveryCodes" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -365,13 +461,14 @@ public function testMethodGetMFARecoveryCodes(): void { $response = $this->account->getMFARecoveryCodes( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } public function testMethodCreateMFARecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array()); + + $data = array("recoveryCodes" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -380,13 +477,14 @@ public function testMethodCreateMFARecoveryCodes(): void { $response = $this->account->createMFARecoveryCodes( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } public function testMethodUpdateMFARecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array()); + + $data = array("recoveryCodes" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -395,28 +493,39 @@ public function testMethodUpdateMFARecoveryCodes(): void { $response = $this->account->updateMFARecoveryCodes( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } public function testMethodUpdateName(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -426,28 +535,39 @@ public function testMethodUpdateName(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodUpdatePassword(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -457,28 +577,39 @@ public function testMethodUpdatePassword(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodUpdatePhone(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -489,12 +620,13 @@ public function testMethodUpdatePhone(): void { "password" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodGetPrefs(): void { - - $data = array(); + + $data = array() +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -503,28 +635,39 @@ public function testMethodGetPrefs(): void { $response = $this->account->getPrefs( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } public function testMethodUpdatePrefs(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -534,18 +677,19 @@ public function testMethodUpdatePrefs(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateRecovery(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -556,18 +700,19 @@ public function testMethodCreateRecovery(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodUpdateRecovery(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -579,14 +724,45 @@ public function testMethodUpdateRecovery(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodListSessions(): void { - - $data = array( - "total" => 5, - "sessions" => array()); + + $data = array("total" => 5 +,"sessions" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -595,11 +771,11 @@ public function testMethodListSessions(): void { $response = $this->account->listSessions( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\SessionList::class, $response); + } public function testMethodDeleteSessions(): void { - + $data = ''; $this->client @@ -609,41 +785,42 @@ public function testMethodDeleteSessions(): void { $response = $this->account->deleteSessions( ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreateAnonymousSession(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -652,41 +829,42 @@ public function testMethodCreateAnonymousSession(): void { $response = $this->account->createAnonymousSession( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodCreateEmailPasswordSession(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -697,41 +875,42 @@ public function testMethodCreateEmailPasswordSession(): void { "password" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodUpdateMagicURLSession(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -742,41 +921,42 @@ public function testMethodUpdateMagicURLSession(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodUpdatePhoneSession(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -787,41 +967,42 @@ public function testMethodUpdatePhoneSession(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodCreateSession(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -832,41 +1013,42 @@ public function testMethodCreateSession(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodGetSession(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -876,41 +1058,42 @@ public function testMethodGetSession(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodUpdateSession(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -920,11 +1103,11 @@ public function testMethodUpdateSession(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodDeleteSession(): void { - + $data = ''; $this->client @@ -935,28 +1118,39 @@ public function testMethodDeleteSession(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateStatus(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -965,18 +1159,19 @@ public function testMethodUpdateStatus(): void { $response = $this->account->updateStatus( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateEmailToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -987,18 +1182,19 @@ public function testMethodCreateEmailToken(): void { "email@example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodCreateMagicURLToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1009,11 +1205,11 @@ public function testMethodCreateMagicURLToken(): void { "email@example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodCreateOAuth2Token(): void { - + $data = ''; $this->client @@ -1024,18 +1220,19 @@ public function testMethodCreateOAuth2Token(): void { OAuthProvider::AMAZON() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreatePhoneToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1046,18 +1243,19 @@ public function testMethodCreatePhoneToken(): void { "+12065550100" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodCreateEmailVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1067,18 +1265,19 @@ public function testMethodCreateEmailVerification(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodCreateVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1088,18 +1287,19 @@ public function testMethodCreateVerification(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodUpdateEmailVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1110,18 +1310,19 @@ public function testMethodUpdateEmailVerification(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodUpdateVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1132,18 +1333,19 @@ public function testMethodUpdateVerification(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodCreatePhoneVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1152,18 +1354,19 @@ public function testMethodCreatePhoneVerification(): void { $response = $this->account->createPhoneVerification( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodUpdatePhoneVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1174,7 +1377,7 @@ public function testMethodUpdatePhoneVerification(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } } diff --git a/tests/Appwrite/Services/ActivitiesTest.php b/tests/Appwrite/Services/ActivitiesTest.php index caaf39e..bdd346e 100644 --- a/tests/Appwrite/Services/ActivitiesTest.php +++ b/tests/Appwrite/Services/ActivitiesTest.php @@ -17,10 +17,44 @@ protected function setUp(): void { } public function testMethodListEvents(): void { - - $data = array( - "total" => 5, - "events" => array()); + + $data = array("total" => 5 +,"events" => array(array("\$id" => "5e5ea5c16897e" +,"userType" => "user" +,"userId" => "610fc2f985ee0" +,"userEmail" => "john@appwrite.io" +,"userName" => "John Doe" +,"resourceParent" => "database/ID" +,"resourceType" => "collection" +,"resourceId" => "610fc2f985ee0" +,"resource" => "collections/610fc2f985ee0" +,"event" => "account.sessions.create" +,"userAgent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" +,"ip" => "127.0.0.1" +,"mode" => "admin" +,"country" => "US" +,"time" => "2020-10-15T06:38:00.000+00:00" +,"projectId" => "610fc2f985ee0" +,"teamId" => "610fc2f985ee0" +,"hostname" => "appwrite.io" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -29,44 +63,45 @@ public function testMethodListEvents(): void { $response = $this->activities->listEvents( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ActivityEventList::class, $response); + } public function testMethodGetEvent(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "userType" => "user", - "userId" => "610fc2f985ee0", - "userEmail" => "john@appwrite.io", - "userName" => "John Doe", - "resourceParent" => "database/ID", - "resourceType" => "collection", - "resourceId" => "610fc2f985ee0", - "resource" => "collections/610fc2f985ee0", - "event" => "account.sessions.create", - "userAgent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36", - "ip" => "127.0.0.1", - "mode" => "admin", - "country" => "US", - "time" => "2020-10-15T06:38:00.000+00:00", - "projectId" => "610fc2f985ee0", - "teamId" => "610fc2f985ee0", - "hostname" => "appwrite.io", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States"); + + $data = array("\$id" => "5e5ea5c16897e" +,"userType" => "user" +,"userId" => "610fc2f985ee0" +,"userEmail" => "john@appwrite.io" +,"userName" => "John Doe" +,"resourceParent" => "database/ID" +,"resourceType" => "collection" +,"resourceId" => "610fc2f985ee0" +,"resource" => "collections/610fc2f985ee0" +,"event" => "account.sessions.create" +,"userAgent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" +,"ip" => "127.0.0.1" +,"mode" => "admin" +,"country" => "US" +,"time" => "2020-10-15T06:38:00.000+00:00" +,"projectId" => "610fc2f985ee0" +,"teamId" => "610fc2f985ee0" +,"hostname" => "appwrite.io" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -76,7 +111,7 @@ public function testMethodGetEvent(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ActivityEvent::class, $response); + } } diff --git a/tests/Appwrite/Services/AvatarsTest.php b/tests/Appwrite/Services/AvatarsTest.php index 4b75f42..6ce0a6d 100644 --- a/tests/Appwrite/Services/AvatarsTest.php +++ b/tests/Appwrite/Services/AvatarsTest.php @@ -24,7 +24,7 @@ protected function setUp(): void { } public function testMethodGetBrowser(): void { - + $data = ''; $this->client @@ -35,11 +35,11 @@ public function testMethodGetBrowser(): void { Browser::AVANTBROWSER() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetCreditCard(): void { - + $data = ''; $this->client @@ -50,11 +50,11 @@ public function testMethodGetCreditCard(): void { CreditCard::AMERICANEXPRESS() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetFavicon(): void { - + $data = ''; $this->client @@ -65,11 +65,11 @@ public function testMethodGetFavicon(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetFlag(): void { - + $data = ''; $this->client @@ -80,11 +80,11 @@ public function testMethodGetFlag(): void { Flag::AFGHANISTAN() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetImage(): void { - + $data = ''; $this->client @@ -95,11 +95,11 @@ public function testMethodGetImage(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetInitials(): void { - + $data = ''; $this->client @@ -109,11 +109,11 @@ public function testMethodGetInitials(): void { $response = $this->avatars->getInitials( ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetQR(): void { - + $data = ''; $this->client @@ -124,11 +124,11 @@ public function testMethodGetQR(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetScreenshot(): void { - + $data = ''; $this->client @@ -139,7 +139,7 @@ public function testMethodGetScreenshot(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/BackupsTest.php b/tests/Appwrite/Services/BackupsTest.php index c485ef7..cb05146 100644 --- a/tests/Appwrite/Services/BackupsTest.php +++ b/tests/Appwrite/Services/BackupsTest.php @@ -18,10 +18,22 @@ protected function setUp(): void { } public function testMethodListArchives(): void { - - $data = array( - "total" => 5, - "archives" => array()); + + $data = array("total" => 5 +,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"policyId" => "did8jx6ws45jana098ab7" +,"size" => 100000 +,"status" => "completed" +,"startedAt" => "2020-10-15T06:38:00.000+00:00" +,"migrationId" => "did8jx6ws45jana098ab7" +,"services" => array() +,"resources" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -30,22 +42,23 @@ public function testMethodListArchives(): void { $response = $this->backups->listArchives( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupArchiveList::class, $response); + } public function testMethodCreateArchive(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "policyId" => "did8jx6ws45jana098ab7", - "size" => 100000, - "status" => "completed", - "startedAt" => "2020-10-15T06:38:00.000+00:00", - "migrationId" => "did8jx6ws45jana098ab7", - "services" => array(), - "resources" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"policyId" => "did8jx6ws45jana098ab7" +,"size" => 100000 +,"status" => "completed" +,"startedAt" => "2020-10-15T06:38:00.000+00:00" +,"migrationId" => "did8jx6ws45jana098ab7" +,"services" => array() +,"resources" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -55,22 +68,23 @@ public function testMethodCreateArchive(): void { array(BackupServices::DATABASES()) ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupArchive::class, $response); + } public function testMethodGetArchive(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "policyId" => "did8jx6ws45jana098ab7", - "size" => 100000, - "status" => "completed", - "startedAt" => "2020-10-15T06:38:00.000+00:00", - "migrationId" => "did8jx6ws45jana098ab7", - "services" => array(), - "resources" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"policyId" => "did8jx6ws45jana098ab7" +,"size" => 100000 +,"status" => "completed" +,"startedAt" => "2020-10-15T06:38:00.000+00:00" +,"migrationId" => "did8jx6ws45jana098ab7" +,"services" => array() +,"resources" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -80,11 +94,11 @@ public function testMethodGetArchive(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupArchive::class, $response); + } public function testMethodDeleteArchive(): void { - + $data = ''; $this->client @@ -95,14 +109,25 @@ public function testMethodDeleteArchive(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListPolicies(): void { - - $data = array( - "total" => 5, - "policies" => array()); + + $data = array("total" => 5 +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"name" => "Hourly backups" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"services" => array() +,"resources" => array() +,"retention" => 7 +,"schedule" => "0 * * * *" +,"enabled" => true +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -111,21 +136,22 @@ public function testMethodListPolicies(): void { $response = $this->backups->listPolicies( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupPolicyList::class, $response); + } public function testMethodCreatePolicy(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "Hourly backups", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "services" => array(), - "resources" => array(), - "retention" => 7, - "schedule" => "0 * * * *", - "enabled" => true); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "Hourly backups" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"services" => array() +,"resources" => array() +,"retention" => 7 +,"schedule" => "0 * * * *" +,"enabled" => true +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -138,21 +164,22 @@ public function testMethodCreatePolicy(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } public function testMethodGetPolicy(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "Hourly backups", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "services" => array(), - "resources" => array(), - "retention" => 7, - "schedule" => "0 * * * *", - "enabled" => true); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "Hourly backups" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"services" => array() +,"resources" => array() +,"retention" => 7 +,"schedule" => "0 * * * *" +,"enabled" => true +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -162,21 +189,22 @@ public function testMethodGetPolicy(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } public function testMethodUpdatePolicy(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "Hourly backups", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "services" => array(), - "resources" => array(), - "retention" => 7, - "schedule" => "0 * * * *", - "enabled" => true); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "Hourly backups" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"services" => array() +,"resources" => array() +,"retention" => 7 +,"schedule" => "0 * * * *" +,"enabled" => true +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -186,11 +214,11 @@ public function testMethodUpdatePolicy(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } public function testMethodDeletePolicy(): void { - + $data = ''; $this->client @@ -201,23 +229,24 @@ public function testMethodDeletePolicy(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreateRestoration(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "archiveId" => "did8jx6ws45jana098ab7", - "policyId" => "did8jx6ws45jana098ab7", - "status" => "completed", - "startedAt" => "2020-10-15T06:38:00.000+00:00", - "migrationId" => "did8jx6ws45jana098ab7", - "services" => array(), - "resources" => array(), - "options" => "{databases.database[{oldId, newId, newName}]}"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"archiveId" => "did8jx6ws45jana098ab7" +,"policyId" => "did8jx6ws45jana098ab7" +,"status" => "completed" +,"startedAt" => "2020-10-15T06:38:00.000+00:00" +,"migrationId" => "did8jx6ws45jana098ab7" +,"services" => array() +,"resources" => array() +,"options" => "{databases.database[{oldId, newId, newName}]}" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -228,14 +257,27 @@ public function testMethodCreateRestoration(): void { array(BackupServices::DATABASES()) ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupRestoration::class, $response); + } public function testMethodListRestorations(): void { - - $data = array( - "total" => 5, - "restorations" => array()); + + $data = array("total" => 5 +,"restorations" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"archiveId" => "did8jx6ws45jana098ab7" +,"policyId" => "did8jx6ws45jana098ab7" +,"status" => "completed" +,"startedAt" => "2020-10-15T06:38:00.000+00:00" +,"migrationId" => "did8jx6ws45jana098ab7" +,"services" => array() +,"resources" => array() +,"options" => "{databases.database[{oldId, newId, newName}]}" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -244,23 +286,24 @@ public function testMethodListRestorations(): void { $response = $this->backups->listRestorations( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupRestorationList::class, $response); + } public function testMethodGetRestoration(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "archiveId" => "did8jx6ws45jana098ab7", - "policyId" => "did8jx6ws45jana098ab7", - "status" => "completed", - "startedAt" => "2020-10-15T06:38:00.000+00:00", - "migrationId" => "did8jx6ws45jana098ab7", - "services" => array(), - "resources" => array(), - "options" => "{databases.database[{oldId, newId, newName}]}"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"archiveId" => "did8jx6ws45jana098ab7" +,"policyId" => "did8jx6ws45jana098ab7" +,"status" => "completed" +,"startedAt" => "2020-10-15T06:38:00.000+00:00" +,"migrationId" => "did8jx6ws45jana098ab7" +,"services" => array() +,"resources" => array() +,"options" => "{databases.database[{oldId, newId, newName}]}" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -270,7 +313,7 @@ public function testMethodGetRestoration(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupRestoration::class, $response); + } } diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index 7c7098d..373a749 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -21,10 +21,53 @@ protected function setUp(): void { } public function testMethodList(): void { - - $data = array( - "total" => 5, - "databases" => array()); + + $data = array("total" => 5 +,"databases" => array(array("\$id" => "5e5ea5c16897e" +,"name" => "My Database" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"enabled" => true +,"type" => "legacy" +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -33,20 +76,54 @@ public function testMethodList(): void { $response = $this->databases->list( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DatabaseList::class, $response); + } public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "My Database" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"enabled" => true +,"type" => "legacy" +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -57,14 +134,22 @@ public function testMethodCreate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } public function testMethodListTransactions(): void { - - $data = array( - "total" => 5, - "transactions" => array()); + + $data = array("total" => 5 +,"transactions" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -73,18 +158,19 @@ public function testMethodListTransactions(): void { $response = $this->databases->listTransactions( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TransactionList::class, $response); + } public function testMethodCreateTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -93,18 +179,19 @@ public function testMethodCreateTransaction(): void { $response = $this->databases->createTransaction( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } public function testMethodGetTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -114,18 +201,19 @@ public function testMethodGetTransaction(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } public function testMethodUpdateTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -135,11 +223,11 @@ public function testMethodUpdateTransaction(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } public function testMethodDeleteTransaction(): void { - + $data = ''; $this->client @@ -150,18 +238,19 @@ public function testMethodDeleteTransaction(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreateOperations(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -171,20 +260,54 @@ public function testMethodCreateOperations(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "My Database" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"enabled" => true +,"type" => "legacy" +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -194,20 +317,54 @@ public function testMethodGet(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "My Database" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"enabled" => true +,"type" => "legacy" +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -217,11 +374,11 @@ public function testMethodUpdate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -232,14 +389,38 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListCollections(): void { - - $data = array( - "total" => 5, - "collections" => array()); + + $data = array("total" => 5 +,"collections" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -249,24 +430,35 @@ public function testMethodListCollections(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\CollectionList::class, $response); + } public function testMethodCreateCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -278,24 +470,35 @@ public function testMethodCreateCollection(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } public function testMethodGetCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -306,24 +509,35 @@ public function testMethodGetCollection(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } public function testMethodUpdateCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -334,11 +548,11 @@ public function testMethodUpdateCollection(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } public function testMethodDeleteCollection(): void { - + $data = ''; $this->client @@ -350,14 +564,15 @@ public function testMethodDeleteCollection(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListAttributes(): void { - - $data = array( - "total" => 5, - "attributes" => array()); + + $data = array("total" => 5 +,"attributes" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -368,19 +583,20 @@ public function testMethodListAttributes(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeList::class, $response); + } public function testMethodCreateBooleanAttribute(): void { - - $data = array( - "key" => "isEnabled", - "type" => "boolean", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "isEnabled" +,"type" => "boolean" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -393,19 +609,20 @@ public function testMethodCreateBooleanAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); + } public function testMethodUpdateBooleanAttribute(): void { - - $data = array( - "key" => "isEnabled", - "type" => "boolean", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "isEnabled" +,"type" => "boolean" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -419,20 +636,21 @@ public function testMethodUpdateBooleanAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); + } public function testMethodCreateDatetimeAttribute(): void { - - $data = array( - "key" => "birthDay", - "type" => "datetime", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime"); + + $data = array("key" => "birthDay" +,"type" => "datetime" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "datetime" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -445,20 +663,21 @@ public function testMethodCreateDatetimeAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeDatetime::class, $response); + } public function testMethodUpdateDatetimeAttribute(): void { - - $data = array( - "key" => "birthDay", - "type" => "datetime", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime"); + + $data = array("key" => "birthDay" +,"type" => "datetime" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "datetime" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -469,23 +688,24 @@ public function testMethodUpdateDatetimeAttribute(): void { "", "", true, - "" + "2020-10-15T06:38:00.000+00:00" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeDatetime::class, $response); + } public function testMethodCreateEmailAttribute(): void { - - $data = array( - "key" => "userEmail", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email"); + + $data = array("key" => "userEmail" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "email" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -498,20 +718,21 @@ public function testMethodCreateEmailAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeEmail::class, $response); + } public function testMethodUpdateEmailAttribute(): void { - - $data = array( - "key" => "userEmail", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email"); + + $data = array("key" => "userEmail" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "email" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -525,21 +746,22 @@ public function testMethodUpdateEmailAttribute(): void { "email@example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeEmail::class, $response); + } public function testMethodCreateEnumAttribute(): void { - - $data = array( - "key" => "status", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "elements" => array(), - "format" => "enum"); + + $data = array("key" => "status" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"elements" => array() +,"format" => "enum" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -553,21 +775,22 @@ public function testMethodCreateEnumAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeEnum::class, $response); + } public function testMethodUpdateEnumAttribute(): void { - - $data = array( - "key" => "status", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "elements" => array(), - "format" => "enum"); + + $data = array("key" => "status" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"elements" => array() +,"format" => "enum" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -582,19 +805,20 @@ public function testMethodUpdateEnumAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeEnum::class, $response); + } public function testMethodCreateFloatAttribute(): void { - - $data = array( - "key" => "percentageCompleted", - "type" => "double", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "percentageCompleted" +,"type" => "double" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -607,19 +831,20 @@ public function testMethodCreateFloatAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeFloat::class, $response); + } public function testMethodUpdateFloatAttribute(): void { - - $data = array( - "key" => "percentageCompleted", - "type" => "double", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "percentageCompleted" +,"type" => "double" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -633,19 +858,20 @@ public function testMethodUpdateFloatAttribute(): void { 1.0 ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeFloat::class, $response); + } public function testMethodCreateIntegerAttribute(): void { - - $data = array( - "key" => "count", - "type" => "integer", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "count" +,"type" => "integer" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -658,19 +884,20 @@ public function testMethodCreateIntegerAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeInteger::class, $response); + } public function testMethodUpdateIntegerAttribute(): void { - - $data = array( - "key" => "count", - "type" => "integer", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "count" +,"type" => "integer" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -684,20 +911,21 @@ public function testMethodUpdateIntegerAttribute(): void { 1 ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeInteger::class, $response); + } public function testMethodCreateIpAttribute(): void { - - $data = array( - "key" => "ipAddress", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip"); + + $data = array("key" => "ipAddress" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "ip" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -710,20 +938,21 @@ public function testMethodCreateIpAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeIp::class, $response); + } public function testMethodUpdateIpAttribute(): void { - - $data = array( - "key" => "ipAddress", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip"); + + $data = array("key" => "ipAddress" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "ip" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -737,19 +966,20 @@ public function testMethodUpdateIpAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeIp::class, $response); + } public function testMethodCreateLineAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -762,19 +992,20 @@ public function testMethodCreateLineAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeLine::class, $response); + } public function testMethodUpdateLineAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -787,19 +1018,20 @@ public function testMethodUpdateLineAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeLine::class, $response); + } public function testMethodCreateLongtextAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -812,19 +1044,20 @@ public function testMethodCreateLongtextAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeLongtext::class, $response); + } public function testMethodUpdateLongtextAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -838,19 +1071,20 @@ public function testMethodUpdateLongtextAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeLongtext::class, $response); + } public function testMethodCreateMediumtextAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -863,19 +1097,20 @@ public function testMethodCreateMediumtextAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeMediumtext::class, $response); + } public function testMethodUpdateMediumtextAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -889,19 +1124,20 @@ public function testMethodUpdateMediumtextAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeMediumtext::class, $response); + } public function testMethodCreatePointAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -914,19 +1150,20 @@ public function testMethodCreatePointAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributePoint::class, $response); + } public function testMethodUpdatePointAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -939,19 +1176,20 @@ public function testMethodUpdatePointAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributePoint::class, $response); + } public function testMethodCreatePolygonAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -964,19 +1202,20 @@ public function testMethodCreatePolygonAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributePolygon::class, $response); + } public function testMethodUpdatePolygonAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -989,25 +1228,26 @@ public function testMethodUpdatePolygonAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributePolygon::class, $response); + } public function testMethodCreateRelationshipAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "relatedCollection" => "collection", - "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", - "twoWay" => true, - "twoWayKey" => "string", - "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"relatedCollection" => "collection" +,"relationType" => "oneToOne|oneToMany|manyToOne|manyToMany" +,"twoWay" => true +,"twoWayKey" => "string" +,"onDelete" => "restrict|cascade|setNull" +,"side" => "parent|child" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1020,25 +1260,26 @@ public function testMethodCreateRelationshipAttribute(): void { RelationshipType::ONETOONE() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeRelationship::class, $response); + } public function testMethodUpdateRelationshipAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "relatedCollection" => "collection", - "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", - "twoWay" => true, - "twoWayKey" => "string", - "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"relatedCollection" => "collection" +,"relationType" => "oneToOne|oneToMany|manyToOne|manyToMany" +,"twoWay" => true +,"twoWayKey" => "string" +,"onDelete" => "restrict|cascade|setNull" +,"side" => "parent|child" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1050,20 +1291,21 @@ public function testMethodUpdateRelationshipAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeRelationship::class, $response); + } public function testMethodCreateStringAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"size" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1077,20 +1319,21 @@ public function testMethodCreateStringAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeString::class, $response); + } public function testMethodUpdateStringAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"size" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1104,19 +1347,20 @@ public function testMethodUpdateStringAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeString::class, $response); + } public function testMethodCreateTextAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1129,19 +1373,20 @@ public function testMethodCreateTextAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeText::class, $response); + } public function testMethodUpdateTextAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1155,20 +1400,21 @@ public function testMethodUpdateTextAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeText::class, $response); + } public function testMethodCreateUrlAttribute(): void { - - $data = array( - "key" => "githubUrl", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url"); + + $data = array("key" => "githubUrl" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "url" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1181,20 +1427,21 @@ public function testMethodCreateUrlAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeUrl::class, $response); + } public function testMethodUpdateUrlAttribute(): void { - - $data = array( - "key" => "githubUrl", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url"); + + $data = array("key" => "githubUrl" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "url" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1208,20 +1455,21 @@ public function testMethodUpdateUrlAttribute(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeUrl::class, $response); + } public function testMethodCreateVarcharAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"size" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1235,20 +1483,21 @@ public function testMethodCreateVarcharAttribute(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeVarchar::class, $response); + } public function testMethodUpdateVarcharAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"size" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1262,19 +1511,20 @@ public function testMethodUpdateVarcharAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeVarchar::class, $response); + } public function testMethodGetAttribute(): void { - - $data = array( - "key" => "isEnabled", - "type" => "boolean", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "isEnabled" +,"type" => "boolean" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1286,11 +1536,11 @@ public function testMethodGetAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); + } public function testMethodDeleteAttribute(): void { - + $data = ''; $this->client @@ -1303,14 +1553,23 @@ public function testMethodDeleteAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); + + $data = array("total" => 5 +,"documents" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1321,19 +1580,20 @@ public function testMethodListDocuments(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } public function testMethodCreateDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1346,14 +1606,23 @@ public function testMethodCreateDocument(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } public function testMethodCreateDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); + + $data = array("total" => 5 +,"documents" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1365,14 +1634,23 @@ public function testMethodCreateDocuments(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } public function testMethodUpsertDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); + + $data = array("total" => 5 +,"documents" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1384,14 +1662,23 @@ public function testMethodUpsertDocuments(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } public function testMethodUpdateDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); + + $data = array("total" => 5 +,"documents" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1402,14 +1689,23 @@ public function testMethodUpdateDocuments(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } public function testMethodDeleteDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); + + $data = array("total" => 5 +,"documents" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1420,19 +1716,20 @@ public function testMethodDeleteDocuments(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } public function testMethodGetDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1444,19 +1741,20 @@ public function testMethodGetDocument(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } public function testMethodUpsertDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1468,19 +1766,20 @@ public function testMethodUpsertDocument(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } public function testMethodUpdateDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1492,11 +1791,11 @@ public function testMethodUpdateDocument(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } public function testMethodDeleteDocument(): void { - + $data = ''; $this->client @@ -1509,19 +1808,20 @@ public function testMethodDeleteDocument(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodDecrementDocumentAttribute(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1534,19 +1834,20 @@ public function testMethodDecrementDocumentAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } public function testMethodIncrementDocumentAttribute(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$collectionId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1559,14 +1860,25 @@ public function testMethodIncrementDocumentAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } public function testMethodListIndexes(): void { - - $data = array( - "total" => 5, - "indexes" => array()); + + $data = array("total" => 5 +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1577,21 +1889,22 @@ public function testMethodListIndexes(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\IndexList::class, $response); + } public function testMethodCreateIndex(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1605,21 +1918,22 @@ public function testMethodCreateIndex(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); + } public function testMethodGetIndex(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1631,11 +1945,11 @@ public function testMethodGetIndex(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); + } public function testMethodDeleteIndex(): void { - + $data = ''; $this->client @@ -1648,7 +1962,7 @@ public function testMethodDeleteIndex(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 5d15b59..aec3c76 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -23,10 +23,51 @@ protected function setUp(): void { } public function testMethodList(): void { - - $data = array( - "total" => 5, - "functions" => array()); + + $data = array("total" => 5 +,"functions" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"execute" => array() +,"name" => "My Function" +,"enabled" => true +,"live" => true +,"logging" => true +,"runtime" => "python-3.8" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"scopes" => array() +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"events" => array() +,"schedule" => "5 4 * * *" +,"timeout" => 300 +,"entrypoint" => "index.js" +,"commands" => "npm install" +,"version" => "v2" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "functions/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -35,42 +76,52 @@ public function testMethodList(): void { $response = $this->functions->list( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FunctionList::class, $response); + } public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "execute" => array(), - "name" => "My Function", - "enabled" => true, - "live" => true, - "logging" => true, - "runtime" => "python-3.8", - "deploymentRetention" => 7, - "deploymentId" => "5e5ea5c16897e", - "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentId" => "5e5ea5c16897e", - "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentStatus" => "ready", - "scopes" => array(), - "vars" => array(), - "events" => array(), - "schedule" => "5 4 * * *", - "timeout" => 300, - "entrypoint" => "index.js", - "commands" => "npm install", - "version" => "v2", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true, - "buildSpecification" => "s-1vcpu-512mb", - "runtimeSpecification" => "s-1vcpu-512mb"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"execute" => array() +,"name" => "My Function" +,"enabled" => true +,"live" => true +,"logging" => true +,"runtime" => "python-3.8" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"scopes" => array() +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"events" => array() +,"schedule" => "5 4 * * *" +,"timeout" => 300 +,"entrypoint" => "index.js" +,"commands" => "npm install" +,"version" => "v2" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "functions/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -82,14 +133,24 @@ public function testMethodCreate(): void { Runtime::NODE145() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); + } public function testMethodListRuntimes(): void { - - $data = array( - "total" => 5, - "runtimes" => array()); + + $data = array("total" => 5 +,"runtimes" => array(array("\$id" => "python-3.8" +,"key" => "python" +,"name" => "Python" +,"version" => "3.8" +,"base" => "python:3.8-alpine" +,"image" => "appwrite\\/runtime-for-python:3.8" +,"logo" => "python.png" +,"supports" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -98,14 +159,20 @@ public function testMethodListRuntimes(): void { $response = $this->functions->listRuntimes( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RuntimeList::class, $response); + } public function testMethodListSpecifications(): void { - - $data = array( - "total" => 5, - "specifications" => array()); + + $data = array("total" => 5 +,"specifications" => array(array("memory" => 512 +,"cpus" => 1 +,"enabled" => true +,"slug" => "s-1vcpu-512mb" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -114,42 +181,52 @@ public function testMethodListSpecifications(): void { $response = $this->functions->listSpecifications( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\SpecificationList::class, $response); + } public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "execute" => array(), - "name" => "My Function", - "enabled" => true, - "live" => true, - "logging" => true, - "runtime" => "python-3.8", - "deploymentRetention" => 7, - "deploymentId" => "5e5ea5c16897e", - "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentId" => "5e5ea5c16897e", - "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentStatus" => "ready", - "scopes" => array(), - "vars" => array(), - "events" => array(), - "schedule" => "5 4 * * *", - "timeout" => 300, - "entrypoint" => "index.js", - "commands" => "npm install", - "version" => "v2", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true, - "buildSpecification" => "s-1vcpu-512mb", - "runtimeSpecification" => "s-1vcpu-512mb"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"execute" => array() +,"name" => "My Function" +,"enabled" => true +,"live" => true +,"logging" => true +,"runtime" => "python-3.8" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"scopes" => array() +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"events" => array() +,"schedule" => "5 4 * * *" +,"timeout" => 300 +,"entrypoint" => "index.js" +,"commands" => "npm install" +,"version" => "v2" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "functions/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -159,42 +236,52 @@ public function testMethodGet(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); + } public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "execute" => array(), - "name" => "My Function", - "enabled" => true, - "live" => true, - "logging" => true, - "runtime" => "python-3.8", - "deploymentRetention" => 7, - "deploymentId" => "5e5ea5c16897e", - "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentId" => "5e5ea5c16897e", - "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentStatus" => "ready", - "scopes" => array(), - "vars" => array(), - "events" => array(), - "schedule" => "5 4 * * *", - "timeout" => 300, - "entrypoint" => "index.js", - "commands" => "npm install", - "version" => "v2", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true, - "buildSpecification" => "s-1vcpu-512mb", - "runtimeSpecification" => "s-1vcpu-512mb"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"execute" => array() +,"name" => "My Function" +,"enabled" => true +,"live" => true +,"logging" => true +,"runtime" => "python-3.8" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"scopes" => array() +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"events" => array() +,"schedule" => "5 4 * * *" +,"timeout" => 300 +,"entrypoint" => "index.js" +,"commands" => "npm install" +,"version" => "v2" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "functions/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -205,11 +292,11 @@ public function testMethodUpdate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -220,42 +307,52 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateFunctionDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "execute" => array(), - "name" => "My Function", - "enabled" => true, - "live" => true, - "logging" => true, - "runtime" => "python-3.8", - "deploymentRetention" => 7, - "deploymentId" => "5e5ea5c16897e", - "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentId" => "5e5ea5c16897e", - "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentStatus" => "ready", - "scopes" => array(), - "vars" => array(), - "events" => array(), - "schedule" => "5 4 * * *", - "timeout" => 300, - "entrypoint" => "index.js", - "commands" => "npm install", - "version" => "v2", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true, - "buildSpecification" => "s-1vcpu-512mb", - "runtimeSpecification" => "s-1vcpu-512mb"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"execute" => array() +,"name" => "My Function" +,"enabled" => true +,"live" => true +,"logging" => true +,"runtime" => "python-3.8" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"scopes" => array() +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"events" => array() +,"schedule" => "5 4 * * *" +,"timeout" => 300 +,"entrypoint" => "index.js" +,"commands" => "npm install" +,"version" => "v2" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "functions/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -266,14 +363,43 @@ public function testMethodUpdateFunctionDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); + } public function testMethodListDeployments(): void { - - $data = array( - "total" => 5, - "deployments" => array()); + + $data = array("total" => 5 +,"deployments" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -283,39 +409,40 @@ public function testMethodListDeployments(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DeploymentList::class, $response); + } public function testMethodCreateDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -327,39 +454,40 @@ public function testMethodCreateDeployment(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodCreateDuplicateDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -370,39 +498,40 @@ public function testMethodCreateDuplicateDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodCreateTemplateDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -417,39 +546,40 @@ public function testMethodCreateTemplateDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodCreateVcsDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -461,39 +591,40 @@ public function testMethodCreateVcsDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodGetDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -504,11 +635,11 @@ public function testMethodGetDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodDeleteDeployment(): void { - + $data = ''; $this->client @@ -520,11 +651,11 @@ public function testMethodDeleteDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetDeploymentDownload(): void { - + $data = ''; $this->client @@ -536,39 +667,40 @@ public function testMethodGetDeploymentDownload(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateDeploymentStatus(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -579,14 +711,39 @@ public function testMethodUpdateDeploymentStatus(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodListExecutions(): void { - - $data = array( - "total" => 5, - "executions" => array()); + + $data = array("total" => 5 +,"executions" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"functionId" => "5e5ea6g16897e" +,"deploymentId" => "5e5ea5c16897e" +,"trigger" => "http" +,"status" => "waiting" +,"requestMethod" => "GET" +,"requestPath" => "/articles?id=5" +,"requestHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"responseStatusCode" => 200 +,"responseBody" => "[RESPONSEBODY]" +,"responseHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"logs" => "[LOGS]" +,"errors" => "[ERRORS]" +,"duration" => 0.4 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -596,29 +753,36 @@ public function testMethodListExecutions(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ExecutionList::class, $response); + } public function testMethodCreateExecution(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "functionId" => "5e5ea6g16897e", - "deploymentId" => "5e5ea5c16897e", - "trigger" => "http", - "status" => "processing", - "requestMethod" => "GET", - "requestPath" => "/articles?id=5", - "requestHeaders" => array(), - "responseStatusCode" => 200, - "responseBody" => "", - "responseHeaders" => array(), - "logs" => "", - "errors" => "", - "duration" => 0.4); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"functionId" => "5e5ea6g16897e" +,"deploymentId" => "5e5ea5c16897e" +,"trigger" => "http" +,"status" => "waiting" +,"requestMethod" => "GET" +,"requestPath" => "/articles?id=5" +,"requestHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"responseStatusCode" => 200 +,"responseBody" => "[RESPONSEBODY]" +,"responseHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"logs" => "[LOGS]" +,"errors" => "[ERRORS]" +,"duration" => 0.4 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -628,29 +792,36 @@ public function testMethodCreateExecution(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); + } public function testMethodGetExecution(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "functionId" => "5e5ea6g16897e", - "deploymentId" => "5e5ea5c16897e", - "trigger" => "http", - "status" => "processing", - "requestMethod" => "GET", - "requestPath" => "/articles?id=5", - "requestHeaders" => array(), - "responseStatusCode" => 200, - "responseBody" => "", - "responseHeaders" => array(), - "logs" => "", - "errors" => "", - "duration" => 0.4); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"functionId" => "5e5ea6g16897e" +,"deploymentId" => "5e5ea5c16897e" +,"trigger" => "http" +,"status" => "waiting" +,"requestMethod" => "GET" +,"requestPath" => "/articles?id=5" +,"requestHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"responseStatusCode" => 200 +,"responseBody" => "[RESPONSEBODY]" +,"responseHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"logs" => "[LOGS]" +,"errors" => "[ERRORS]" +,"duration" => 0.4 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -661,11 +832,11 @@ public function testMethodGetExecution(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); + } public function testMethodDeleteExecution(): void { - + $data = ''; $this->client @@ -677,14 +848,24 @@ public function testMethodDeleteExecution(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListVariables(): void { - - $data = array( - "total" => 5, - "variables" => array()); + + $data = array("total" => 5 +,"variables" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -694,20 +875,21 @@ public function testMethodListVariables(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); + } public function testMethodCreateVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -719,20 +901,21 @@ public function testMethodCreateVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodGetVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -743,20 +926,21 @@ public function testMethodGetVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodUpdateVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -768,11 +952,11 @@ public function testMethodUpdateVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodDeleteVariable(): void { - + $data = ''; $this->client @@ -784,7 +968,7 @@ public function testMethodDeleteVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/GraphqlTest.php b/tests/Appwrite/Services/GraphqlTest.php index 669edf9..6422466 100644 --- a/tests/Appwrite/Services/GraphqlTest.php +++ b/tests/Appwrite/Services/GraphqlTest.php @@ -17,7 +17,7 @@ protected function setUp(): void { } public function testMethodQuery(): void { - + $data = array(); $this->client @@ -28,11 +28,11 @@ public function testMethodQuery(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodMutation(): void { - + $data = array(); $this->client @@ -43,7 +43,7 @@ public function testMethodMutation(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php index e8ec1c1..17ae667 100644 --- a/tests/Appwrite/Services/HealthTest.php +++ b/tests/Appwrite/Services/HealthTest.php @@ -18,11 +18,12 @@ protected function setUp(): void { } public function testMethodGet(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass"); + + $data = array("name" => "database" +,"ping" => 128 +,"status" => "pass" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -31,14 +32,15 @@ public function testMethodGet(): void { $response = $this->health->get( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); + } public function testMethodGetAntivirus(): void { - - $data = array( - "version" => "1.0.0", - "status" => "online"); + + $data = array("version" => "1.0.0" +,"status" => "disabled" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -47,14 +49,19 @@ public function testMethodGetAntivirus(): void { $response = $this->health->getAntivirus( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthAntivirus::class, $response); + } public function testMethodGetCache(): void { - - $data = array( - "total" => 5, - "statuses" => array()); + + $data = array("total" => 5 +,"statuses" => array(array("name" => "database" +,"ping" => 128 +,"status" => "pass" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -63,18 +70,19 @@ public function testMethodGetCache(): void { $response = $this->health->getCache( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); + } public function testMethodGetCertificate(): void { - - $data = array( - "name" => "/CN=www.google.com", - "subjectSN" => "", - "issuerOrganisation" => "", - "validFrom" => "1704200998", - "validTo" => "1711458597", - "signatureTypeSN" => "RSA-SHA256"); + + $data = array("name" => "/CN=www.google.com" +,"subjectSN" => "[SUBJECTSN]" +,"issuerOrganisation" => "[ISSUERORGANISATION]" +,"validFrom" => "1704200998" +,"validTo" => "1711458597" +,"signatureTypeSN" => "RSA-SHA256" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -83,15 +91,16 @@ public function testMethodGetCertificate(): void { $response = $this->health->getCertificate( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthCertificate::class, $response); + } public function testMethodGetConsolePausing(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass"); + + $data = array("name" => "database" +,"ping" => 128 +,"status" => "pass" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -100,14 +109,19 @@ public function testMethodGetConsolePausing(): void { $response = $this->health->getConsolePausing( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); + } public function testMethodGetDB(): void { - - $data = array( - "total" => 5, - "statuses" => array()); + + $data = array("total" => 5 +,"statuses" => array(array("name" => "database" +,"ping" => 128 +,"status" => "pass" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -116,14 +130,19 @@ public function testMethodGetDB(): void { $response = $this->health->getDB( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); + } public function testMethodGetPubSub(): void { - - $data = array( - "total" => 5, - "statuses" => array()); + + $data = array("total" => 5 +,"statuses" => array(array("name" => "database" +,"ping" => 128 +,"status" => "pass" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -132,13 +151,14 @@ public function testMethodGetPubSub(): void { $response = $this->health->getPubSub( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); + } public function testMethodGetQueueAudits(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -147,13 +167,14 @@ public function testMethodGetQueueAudits(): void { $response = $this->health->getQueueAudits( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueBuilds(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -162,13 +183,14 @@ public function testMethodGetQueueBuilds(): void { $response = $this->health->getQueueBuilds( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueCertificates(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -177,13 +199,14 @@ public function testMethodGetQueueCertificates(): void { $response = $this->health->getQueueCertificates( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueDatabases(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -192,13 +215,14 @@ public function testMethodGetQueueDatabases(): void { $response = $this->health->getQueueDatabases( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueDeletes(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -207,13 +231,14 @@ public function testMethodGetQueueDeletes(): void { $response = $this->health->getQueueDeletes( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetFailedJobs(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -223,13 +248,14 @@ public function testMethodGetFailedJobs(): void { Name::V1DATABASE() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueFunctions(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -238,13 +264,14 @@ public function testMethodGetQueueFunctions(): void { $response = $this->health->getQueueFunctions( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueLogs(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -253,13 +280,14 @@ public function testMethodGetQueueLogs(): void { $response = $this->health->getQueueLogs( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueMails(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -268,13 +296,14 @@ public function testMethodGetQueueMails(): void { $response = $this->health->getQueueMails( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueMessaging(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -283,13 +312,14 @@ public function testMethodGetQueueMessaging(): void { $response = $this->health->getQueueMessaging( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueMigrations(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -298,13 +328,14 @@ public function testMethodGetQueueMigrations(): void { $response = $this->health->getQueueMigrations( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueStatsResources(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -313,13 +344,14 @@ public function testMethodGetQueueStatsResources(): void { $response = $this->health->getQueueStatsResources( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueUsage(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -328,13 +360,14 @@ public function testMethodGetQueueUsage(): void { $response = $this->health->getQueueUsage( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetQueueWebhooks(): void { - - $data = array( - "size" => 8); + + $data = array("size" => 8 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -343,15 +376,16 @@ public function testMethodGetQueueWebhooks(): void { $response = $this->health->getQueueWebhooks( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } public function testMethodGetStorage(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass"); + + $data = array("name" => "database" +,"ping" => 128 +,"status" => "pass" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -360,15 +394,16 @@ public function testMethodGetStorage(): void { $response = $this->health->getStorage( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); + } public function testMethodGetStorageLocal(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass"); + + $data = array("name" => "database" +,"ping" => 128 +,"status" => "pass" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -377,15 +412,16 @@ public function testMethodGetStorageLocal(): void { $response = $this->health->getStorageLocal( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); + } public function testMethodGetTime(): void { - - $data = array( - "remoteTime" => 1639490751, - "localTime" => 1639490844, - "diff" => 93); + + $data = array("remoteTime" => 1639490751 +,"localTime" => 1639490844 +,"diff" => 93 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -394,7 +430,7 @@ public function testMethodGetTime(): void { $response = $this->health->getTime( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthTime::class, $response); + } } diff --git a/tests/Appwrite/Services/LocaleTest.php b/tests/Appwrite/Services/LocaleTest.php index 88af7d5..ea71838 100644 --- a/tests/Appwrite/Services/LocaleTest.php +++ b/tests/Appwrite/Services/LocaleTest.php @@ -17,15 +17,16 @@ protected function setUp(): void { } public function testMethodGet(): void { - - $data = array( - "ip" => "127.0.0.1", - "countryCode" => "US", - "country" => "United States", - "continentCode" => "NA", - "continent" => "North America", - "eu" => true, - "currency" => "USD"); + + $data = array("ip" => "127.0.0.1" +,"countryCode" => "US" +,"country" => "United States" +,"continentCode" => "NA" +,"continent" => "North America" +,"eu" => true +,"currency" => "USD" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -34,14 +35,18 @@ public function testMethodGet(): void { $response = $this->locale->get( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Locale::class, $response); + } public function testMethodListCodes(): void { - - $data = array( - "total" => 5, - "localeCodes" => array()); + + $data = array("total" => 5 +,"localeCodes" => array(array("code" => "en-us" +,"name" => "US" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -50,14 +55,18 @@ public function testMethodListCodes(): void { $response = $this->locale->listCodes( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LocaleCodeList::class, $response); + } public function testMethodListContinents(): void { - - $data = array( - "total" => 5, - "continents" => array()); + + $data = array("total" => 5 +,"continents" => array(array("name" => "Europe" +,"code" => "EU" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -66,14 +75,18 @@ public function testMethodListContinents(): void { $response = $this->locale->listContinents( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ContinentList::class, $response); + } public function testMethodListCountries(): void { - - $data = array( - "total" => 5, - "countries" => array()); + + $data = array("total" => 5 +,"countries" => array(array("name" => "United States" +,"code" => "US" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -82,14 +95,18 @@ public function testMethodListCountries(): void { $response = $this->locale->listCountries( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\CountryList::class, $response); + } public function testMethodListCountriesEU(): void { - - $data = array( - "total" => 5, - "countries" => array()); + + $data = array("total" => 5 +,"countries" => array(array("name" => "United States" +,"code" => "US" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -98,14 +115,19 @@ public function testMethodListCountriesEU(): void { $response = $this->locale->listCountriesEU( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\CountryList::class, $response); + } public function testMethodListCountriesPhones(): void { - - $data = array( - "total" => 5, - "phones" => array()); + + $data = array("total" => 5 +,"phones" => array(array("code" => "+1" +,"countryCode" => "US" +,"countryName" => "United States" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -114,14 +136,23 @@ public function testMethodListCountriesPhones(): void { $response = $this->locale->listCountriesPhones( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\PhoneList::class, $response); + } public function testMethodListCurrencies(): void { - - $data = array( - "total" => 5, - "currencies" => array()); + + $data = array("total" => 5 +,"currencies" => array(array("symbol" => "\$" +,"name" => "US dollar" +,"symbolNative" => "\$" +,"decimalDigits" => 2 +,"rounding" => 0 +,"code" => "USD" +,"namePlural" => "US dollars" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -130,14 +161,19 @@ public function testMethodListCurrencies(): void { $response = $this->locale->listCurrencies( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\CurrencyList::class, $response); + } public function testMethodListLanguages(): void { - - $data = array( - "total" => 5, - "languages" => array()); + + $data = array("total" => 5 +,"languages" => array(array("name" => "Italian" +,"code" => "it" +,"nativeName" => "Italiano" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -146,7 +182,7 @@ public function testMethodListLanguages(): void { $response = $this->locale->listLanguages( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LanguageList::class, $response); + } } diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php index 3bc8e69..f420373 100644 --- a/tests/Appwrite/Services/MessagingTest.php +++ b/tests/Appwrite/Services/MessagingTest.php @@ -19,10 +19,22 @@ protected function setUp(): void { } public function testMethodListMessages(): void { - - $data = array( - "total" => 5, - "messages" => array()); + + $data = array("total" => 5 +,"messages" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"providerType" => "email" +,"topics" => array() +,"users" => array() +,"targets" => array() +,"deliveredTotal" => 1 +,"data" => array() +,"status" => "draft" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -31,22 +43,23 @@ public function testMethodListMessages(): void { $response = $this->messaging->listMessages( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MessageList::class, $response); + } public function testMethodCreateEmail(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "processing"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"providerType" => "email" +,"topics" => array() +,"users" => array() +,"targets" => array() +,"deliveredTotal" => 1 +,"data" => array() +,"status" => "draft" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -58,22 +71,23 @@ public function testMethodCreateEmail(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } public function testMethodUpdateEmail(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "processing"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"providerType" => "email" +,"topics" => array() +,"users" => array() +,"targets" => array() +,"deliveredTotal" => 1 +,"data" => array() +,"status" => "draft" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -83,22 +97,23 @@ public function testMethodUpdateEmail(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } public function testMethodCreatePush(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "processing"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"providerType" => "email" +,"topics" => array() +,"users" => array() +,"targets" => array() +,"deliveredTotal" => 1 +,"data" => array() +,"status" => "draft" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -108,22 +123,23 @@ public function testMethodCreatePush(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } public function testMethodUpdatePush(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "processing"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"providerType" => "email" +,"topics" => array() +,"users" => array() +,"targets" => array() +,"deliveredTotal" => 1 +,"data" => array() +,"status" => "draft" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -133,22 +149,23 @@ public function testMethodUpdatePush(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } public function testMethodCreateSMS(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "processing"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"providerType" => "email" +,"topics" => array() +,"users" => array() +,"targets" => array() +,"deliveredTotal" => 1 +,"data" => array() +,"status" => "draft" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -159,22 +176,23 @@ public function testMethodCreateSMS(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } public function testMethodUpdateSMS(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "processing"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"providerType" => "email" +,"topics" => array() +,"users" => array() +,"targets" => array() +,"deliveredTotal" => 1 +,"data" => array() +,"status" => "draft" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -184,22 +202,23 @@ public function testMethodUpdateSMS(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } public function testMethodGetMessage(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "processing"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"providerType" => "email" +,"topics" => array() +,"users" => array() +,"targets" => array() +,"deliveredTotal" => 1 +,"data" => array() +,"status" => "draft" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -209,11 +228,11 @@ public function testMethodGetMessage(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -224,14 +243,37 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListMessageLogs(): void { - - $data = array( - "total" => 5, - "logs" => array()); + + $data = array("total" => 5 +,"logs" => array(array("event" => "account.sessions.create" +,"userId" => "610fc2f985ee0" +,"userEmail" => "john@appwrite.io" +,"userName" => "John Doe" +,"mode" => "admin" +,"ip" => "127.0.0.1" +,"time" => "2020-10-15T06:38:00.000+00:00" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -241,14 +283,24 @@ public function testMethodListMessageLogs(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } public function testMethodListTargets(): void { - - $data = array( - "total" => 5, - "targets" => array()); + + $data = array("total" => 5 +,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -258,14 +310,24 @@ public function testMethodListTargets(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TargetList::class, $response); + } public function testMethodListProviders(): void { - - $data = array( - "total" => 5, - "providers" => array()); + + $data = array("total" => 5 +,"providers" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -274,20 +336,21 @@ public function testMethodListProviders(): void { $response = $this->messaging->listProviders( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ProviderList::class, $response); + } public function testMethodCreateAPNSProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -298,20 +361,21 @@ public function testMethodCreateAPNSProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateAPNSProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -321,20 +385,21 @@ public function testMethodUpdateAPNSProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateFCMProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -345,20 +410,21 @@ public function testMethodCreateFCMProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateFCMProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -368,20 +434,21 @@ public function testMethodUpdateFCMProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateMailgunProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -392,20 +459,21 @@ public function testMethodCreateMailgunProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateMailgunProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -415,20 +483,21 @@ public function testMethodUpdateMailgunProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateMsg91Provider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -439,20 +508,21 @@ public function testMethodCreateMsg91Provider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateMsg91Provider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -462,20 +532,21 @@ public function testMethodUpdateMsg91Provider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateResendProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -486,20 +557,21 @@ public function testMethodCreateResendProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateResendProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -509,20 +581,21 @@ public function testMethodUpdateResendProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateSendgridProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -533,20 +606,21 @@ public function testMethodCreateSendgridProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateSendgridProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -556,20 +630,21 @@ public function testMethodUpdateSendgridProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateSMTPProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -581,20 +656,21 @@ public function testMethodCreateSMTPProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateSMTPProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -604,20 +680,21 @@ public function testMethodUpdateSMTPProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateTelesignProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -628,20 +705,21 @@ public function testMethodCreateTelesignProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateTelesignProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -651,20 +729,21 @@ public function testMethodUpdateTelesignProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateTextmagicProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -675,20 +754,21 @@ public function testMethodCreateTextmagicProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateTextmagicProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -698,20 +778,21 @@ public function testMethodUpdateTextmagicProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateTwilioProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -722,20 +803,21 @@ public function testMethodCreateTwilioProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateTwilioProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -745,20 +827,21 @@ public function testMethodUpdateTwilioProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateVonageProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -769,20 +852,21 @@ public function testMethodCreateVonageProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodUpdateVonageProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -792,20 +876,21 @@ public function testMethodUpdateVonageProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodGetProvider(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Mailgun", - "provider" => "mailgun", - "enabled" => true, - "type" => "sms", - "credentials" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Mailgun" +,"provider" => "mailgun" +,"enabled" => true +,"type" => "sms" +,"credentials" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -815,11 +900,11 @@ public function testMethodGetProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodDeleteProvider(): void { - + $data = ''; $this->client @@ -830,14 +915,37 @@ public function testMethodDeleteProvider(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListProviderLogs(): void { - - $data = array( - "total" => 5, - "logs" => array()); + + $data = array("total" => 5 +,"logs" => array(array("event" => "account.sessions.create" +,"userId" => "610fc2f985ee0" +,"userEmail" => "john@appwrite.io" +,"userName" => "John Doe" +,"mode" => "admin" +,"ip" => "127.0.0.1" +,"time" => "2020-10-15T06:38:00.000+00:00" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -847,14 +955,37 @@ public function testMethodListProviderLogs(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } public function testMethodListSubscriberLogs(): void { - - $data = array( - "total" => 5, - "logs" => array()); + + $data = array("total" => 5 +,"logs" => array(array("event" => "account.sessions.create" +,"userId" => "610fc2f985ee0" +,"userEmail" => "john@appwrite.io" +,"userName" => "John Doe" +,"mode" => "admin" +,"ip" => "127.0.0.1" +,"time" => "2020-10-15T06:38:00.000+00:00" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -864,14 +995,24 @@ public function testMethodListSubscriberLogs(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } public function testMethodListTopics(): void { - - $data = array( - "total" => 5, - "topics" => array()); + + $data = array("total" => 5 +,"topics" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "events" +,"emailTotal" => 100 +,"smsTotal" => 100 +,"pushTotal" => 100 +,"subscribe" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -880,20 +1021,21 @@ public function testMethodListTopics(): void { $response = $this->messaging->listTopics( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TopicList::class, $response); + } public function testMethodCreateTopic(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "events", - "emailTotal" => 100, - "smsTotal" => 100, - "pushTotal" => 100, - "subscribe" => array()); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "events" +,"emailTotal" => 100 +,"smsTotal" => 100 +,"pushTotal" => 100 +,"subscribe" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -904,20 +1046,21 @@ public function testMethodCreateTopic(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); + } public function testMethodGetTopic(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "events", - "emailTotal" => 100, - "smsTotal" => 100, - "pushTotal" => 100, - "subscribe" => array()); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "events" +,"emailTotal" => 100 +,"smsTotal" => 100 +,"pushTotal" => 100 +,"subscribe" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -927,20 +1070,21 @@ public function testMethodGetTopic(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); + } public function testMethodUpdateTopic(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "events", - "emailTotal" => 100, - "smsTotal" => 100, - "pushTotal" => 100, - "subscribe" => array()); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "events" +,"emailTotal" => 100 +,"smsTotal" => 100 +,"pushTotal" => 100 +,"subscribe" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -950,11 +1094,11 @@ public function testMethodUpdateTopic(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); + } public function testMethodDeleteTopic(): void { - + $data = ''; $this->client @@ -965,14 +1109,37 @@ public function testMethodDeleteTopic(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListTopicLogs(): void { - - $data = array( - "total" => 5, - "logs" => array()); + + $data = array("total" => 5 +,"logs" => array(array("event" => "account.sessions.create" +,"userId" => "610fc2f985ee0" +,"userEmail" => "john@appwrite.io" +,"userName" => "John Doe" +,"mode" => "admin" +,"ip" => "127.0.0.1" +,"time" => "2020-10-15T06:38:00.000+00:00" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -982,14 +1149,34 @@ public function testMethodListTopicLogs(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } public function testMethodListSubscribers(): void { - - $data = array( - "total" => 5, - "subscribers" => array()); + + $data = array("total" => 5 +,"subscribers" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"targetId" => "259125845563242502" +,"target" => array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) + + ,"userId" => "5e5ea5c16897e" +,"userName" => "Aegon Targaryen" +,"topicId" => "259125845563242502" +,"providerType" => "email" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -999,21 +1186,31 @@ public function testMethodListSubscribers(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\SubscriberList::class, $response); + } public function testMethodCreateSubscriber(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "targetId" => "259125845563242502", - "target" => array(), - "userId" => "5e5ea5c16897e", - "userName" => "Aegon Targaryen", - "topicId" => "259125845563242502", - "providerType" => "email"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"targetId" => "259125845563242502" +,"target" => array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) + + ,"userId" => "5e5ea5c16897e" +,"userName" => "Aegon Targaryen" +,"topicId" => "259125845563242502" +,"providerType" => "email" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1025,21 +1222,31 @@ public function testMethodCreateSubscriber(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Subscriber::class, $response); + } public function testMethodGetSubscriber(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "targetId" => "259125845563242502", - "target" => array(), - "userId" => "5e5ea5c16897e", - "userName" => "Aegon Targaryen", - "topicId" => "259125845563242502", - "providerType" => "email"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"targetId" => "259125845563242502" +,"target" => array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) + + ,"userId" => "5e5ea5c16897e" +,"userName" => "Aegon Targaryen" +,"topicId" => "259125845563242502" +,"providerType" => "email" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1050,11 +1257,11 @@ public function testMethodGetSubscriber(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Subscriber::class, $response); + } public function testMethodDeleteSubscriber(): void { - + $data = ''; $this->client @@ -1066,7 +1273,7 @@ public function testMethodDeleteSubscriber(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/ProjectTest.php b/tests/Appwrite/Services/ProjectTest.php index 2562a52..f5844eb 100644 --- a/tests/Appwrite/Services/ProjectTest.php +++ b/tests/Appwrite/Services/ProjectTest.php @@ -17,10 +17,20 @@ protected function setUp(): void { } public function testMethodListVariables(): void { - - $data = array( - "total" => 5, - "variables" => array()); + + $data = array("total" => 5 +,"variables" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -29,20 +39,21 @@ public function testMethodListVariables(): void { $response = $this->project->listVariables( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); + } public function testMethodCreateVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -54,20 +65,21 @@ public function testMethodCreateVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodGetVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -77,20 +89,21 @@ public function testMethodGetVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodUpdateVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -100,11 +113,11 @@ public function testMethodUpdateVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodDeleteVariable(): void { - + $data = ''; $this->client @@ -115,7 +128,7 @@ public function testMethodDeleteVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index 5d67fd3..df73fb1 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -23,10 +23,53 @@ protected function setUp(): void { } public function testMethodList(): void { - - $data = array( - "total" => 5, - "sites" => array()); + + $data = array("total" => 5 +,"sites" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Site" +,"enabled" => true +,"live" => true +,"logging" => true +,"framework" => "react" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"deploymentScreenshotLight" => "5e5ea5c16897e" +,"deploymentScreenshotDark" => "5e5ea5c16897e" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"timeout" => 300 +,"installCommand" => "npm install" +,"buildCommand" => "npm run build" +,"startCommand" => "node custom-server.mjs" +,"outputDirectory" => "build" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "sites/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +,"buildRuntime" => "node-22" +,"adapter" => "static" +,"fallbackFile" => "index.html" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -35,44 +78,54 @@ public function testMethodList(): void { $response = $this->sites->list( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\SiteList::class, $response); + } public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Site", - "enabled" => true, - "live" => true, - "logging" => true, - "framework" => "react", - "deploymentRetention" => 7, - "deploymentId" => "5e5ea5c16897e", - "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "deploymentScreenshotLight" => "5e5ea5c16897e", - "deploymentScreenshotDark" => "5e5ea5c16897e", - "latestDeploymentId" => "5e5ea5c16897e", - "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentStatus" => "ready", - "vars" => array(), - "timeout" => 300, - "installCommand" => "npm install", - "buildCommand" => "npm run build", - "startCommand" => "node custom-server.mjs", - "outputDirectory" => "build", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "sites/helloWorld", - "providerSilentMode" => true, - "buildSpecification" => "s-1vcpu-512mb", - "runtimeSpecification" => "s-1vcpu-512mb", - "buildRuntime" => "node-22", - "adapter" => "static", - "fallbackFile" => "index.html"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Site" +,"enabled" => true +,"live" => true +,"logging" => true +,"framework" => "react" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"deploymentScreenshotLight" => "5e5ea5c16897e" +,"deploymentScreenshotDark" => "5e5ea5c16897e" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"timeout" => 300 +,"installCommand" => "npm install" +,"buildCommand" => "npm run build" +,"startCommand" => "node custom-server.mjs" +,"outputDirectory" => "build" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "sites/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +,"buildRuntime" => "node-22" +,"adapter" => "static" +,"fallbackFile" => "index.html" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -85,14 +138,27 @@ public function testMethodCreate(): void { BuildRuntime::NODE145() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); + } public function testMethodListFrameworks(): void { - - $data = array( - "total" => 5, - "frameworks" => array()); + + $data = array("total" => 5 +,"frameworks" => array(array("key" => "sveltekit" +,"name" => "SvelteKit" +,"buildRuntime" => "node-22" +,"runtimes" => array() +,"adapters" => array(array("key" => "static" +,"installCommand" => "npm install" +,"buildCommand" => "npm run build" +,"outputDirectory" => "./dist" +,"fallbackFile" => "index.html" +) +) + ) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -101,14 +167,20 @@ public function testMethodListFrameworks(): void { $response = $this->sites->listFrameworks( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FrameworkList::class, $response); + } public function testMethodListSpecifications(): void { - - $data = array( - "total" => 5, - "specifications" => array()); + + $data = array("total" => 5 +,"specifications" => array(array("memory" => 512 +,"cpus" => 1 +,"enabled" => true +,"slug" => "s-1vcpu-512mb" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -117,44 +189,54 @@ public function testMethodListSpecifications(): void { $response = $this->sites->listSpecifications( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\SpecificationList::class, $response); + } public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Site", - "enabled" => true, - "live" => true, - "logging" => true, - "framework" => "react", - "deploymentRetention" => 7, - "deploymentId" => "5e5ea5c16897e", - "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "deploymentScreenshotLight" => "5e5ea5c16897e", - "deploymentScreenshotDark" => "5e5ea5c16897e", - "latestDeploymentId" => "5e5ea5c16897e", - "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentStatus" => "ready", - "vars" => array(), - "timeout" => 300, - "installCommand" => "npm install", - "buildCommand" => "npm run build", - "startCommand" => "node custom-server.mjs", - "outputDirectory" => "build", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "sites/helloWorld", - "providerSilentMode" => true, - "buildSpecification" => "s-1vcpu-512mb", - "runtimeSpecification" => "s-1vcpu-512mb", - "buildRuntime" => "node-22", - "adapter" => "static", - "fallbackFile" => "index.html"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Site" +,"enabled" => true +,"live" => true +,"logging" => true +,"framework" => "react" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"deploymentScreenshotLight" => "5e5ea5c16897e" +,"deploymentScreenshotDark" => "5e5ea5c16897e" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"timeout" => 300 +,"installCommand" => "npm install" +,"buildCommand" => "npm run build" +,"startCommand" => "node custom-server.mjs" +,"outputDirectory" => "build" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "sites/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +,"buildRuntime" => "node-22" +,"adapter" => "static" +,"fallbackFile" => "index.html" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -164,44 +246,54 @@ public function testMethodGet(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); + } public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Site", - "enabled" => true, - "live" => true, - "logging" => true, - "framework" => "react", - "deploymentRetention" => 7, - "deploymentId" => "5e5ea5c16897e", - "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "deploymentScreenshotLight" => "5e5ea5c16897e", - "deploymentScreenshotDark" => "5e5ea5c16897e", - "latestDeploymentId" => "5e5ea5c16897e", - "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentStatus" => "ready", - "vars" => array(), - "timeout" => 300, - "installCommand" => "npm install", - "buildCommand" => "npm run build", - "startCommand" => "node custom-server.mjs", - "outputDirectory" => "build", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "sites/helloWorld", - "providerSilentMode" => true, - "buildSpecification" => "s-1vcpu-512mb", - "runtimeSpecification" => "s-1vcpu-512mb", - "buildRuntime" => "node-22", - "adapter" => "static", - "fallbackFile" => "index.html"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Site" +,"enabled" => true +,"live" => true +,"logging" => true +,"framework" => "react" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"deploymentScreenshotLight" => "5e5ea5c16897e" +,"deploymentScreenshotDark" => "5e5ea5c16897e" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"timeout" => 300 +,"installCommand" => "npm install" +,"buildCommand" => "npm run build" +,"startCommand" => "node custom-server.mjs" +,"outputDirectory" => "build" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "sites/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +,"buildRuntime" => "node-22" +,"adapter" => "static" +,"fallbackFile" => "index.html" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -213,11 +305,11 @@ public function testMethodUpdate(): void { Framework::ANALOG() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -228,44 +320,54 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateSiteDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Site", - "enabled" => true, - "live" => true, - "logging" => true, - "framework" => "react", - "deploymentRetention" => 7, - "deploymentId" => "5e5ea5c16897e", - "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "deploymentScreenshotLight" => "5e5ea5c16897e", - "deploymentScreenshotDark" => "5e5ea5c16897e", - "latestDeploymentId" => "5e5ea5c16897e", - "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", - "latestDeploymentStatus" => "ready", - "vars" => array(), - "timeout" => 300, - "installCommand" => "npm install", - "buildCommand" => "npm run build", - "startCommand" => "node custom-server.mjs", - "outputDirectory" => "build", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "sites/helloWorld", - "providerSilentMode" => true, - "buildSpecification" => "s-1vcpu-512mb", - "runtimeSpecification" => "s-1vcpu-512mb", - "buildRuntime" => "node-22", - "adapter" => "static", - "fallbackFile" => "index.html"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Site" +,"enabled" => true +,"live" => true +,"logging" => true +,"framework" => "react" +,"deploymentRetention" => 7 +,"deploymentId" => "5e5ea5c16897e" +,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"deploymentScreenshotLight" => "5e5ea5c16897e" +,"deploymentScreenshotDark" => "5e5ea5c16897e" +,"latestDeploymentId" => "5e5ea5c16897e" +,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" +,"latestDeploymentStatus" => "ready" +,"vars" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ,"timeout" => 300 +,"installCommand" => "npm install" +,"buildCommand" => "npm run build" +,"startCommand" => "node custom-server.mjs" +,"outputDirectory" => "build" +,"installationId" => "6m40at4ejk5h2u9s1hboo" +,"providerRepositoryId" => "appwrite" +,"providerBranch" => "main" +,"providerRootDirectory" => "sites/helloWorld" +,"providerSilentMode" => true +,"buildSpecification" => "s-1vcpu-512mb" +,"runtimeSpecification" => "s-1vcpu-512mb" +,"buildRuntime" => "node-22" +,"adapter" => "static" +,"fallbackFile" => "index.html" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -276,14 +378,43 @@ public function testMethodUpdateSiteDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); + } public function testMethodListDeployments(): void { - - $data = array( - "total" => 5, - "deployments" => array()); + + $data = array("total" => 5 +,"deployments" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -293,39 +424,40 @@ public function testMethodListDeployments(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DeploymentList::class, $response); + } public function testMethodCreateDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -336,39 +468,40 @@ public function testMethodCreateDeployment(): void { InputFile::withData('', "image/png") ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodCreateDuplicateDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -379,39 +512,40 @@ public function testMethodCreateDuplicateDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodCreateTemplateDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -426,39 +560,40 @@ public function testMethodCreateTemplateDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodCreateVcsDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -470,39 +605,40 @@ public function testMethodCreateVcsDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodGetDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -513,11 +649,11 @@ public function testMethodGetDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodDeleteDeployment(): void { - + $data = ''; $this->client @@ -529,11 +665,11 @@ public function testMethodDeleteDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetDeploymentDownload(): void { - + $data = ''; $this->client @@ -545,39 +681,40 @@ public function testMethodGetDeploymentDownload(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateDeploymentStatus(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "sourceSize" => 128, - "buildSize" => 128, - "totalSize" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "screenshotLight" => "5e5ea5c16897e", - "screenshotDark" => "5e5ea5c16897e", - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildDuration" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"type" => "vcs" +,"resourceId" => "5e5ea6g16897e" +,"resourceType" => "functions" +,"entrypoint" => "index.js" +,"sourceSize" => 128 +,"buildSize" => 128 +,"totalSize" => 128 +,"buildId" => "5e5ea5c16897e" +,"activate" => true +,"screenshotLight" => "5e5ea5c16897e" +,"screenshotDark" => "5e5ea5c16897e" +,"status" => "waiting" +,"buildLogs" => "Compiling source files..." +,"buildDuration" => 128 +,"providerRepositoryName" => "database" +,"providerRepositoryOwner" => "utopia" +,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" +,"providerCommitHash" => "7c3f25d" +,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" +,"providerCommitAuthor" => "Khushboo Verma" +,"providerCommitMessage" => "Update index.js" +,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" +,"providerBranch" => "0.7.x" +,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -588,14 +725,39 @@ public function testMethodUpdateDeploymentStatus(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } public function testMethodListLogs(): void { - - $data = array( - "total" => 5, - "executions" => array()); + + $data = array("total" => 5 +,"executions" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"functionId" => "5e5ea6g16897e" +,"deploymentId" => "5e5ea5c16897e" +,"trigger" => "http" +,"status" => "waiting" +,"requestMethod" => "GET" +,"requestPath" => "/articles?id=5" +,"requestHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"responseStatusCode" => 200 +,"responseBody" => "[RESPONSEBODY]" +,"responseHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"logs" => "[LOGS]" +,"errors" => "[ERRORS]" +,"duration" => 0.4 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -605,29 +767,36 @@ public function testMethodListLogs(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ExecutionList::class, $response); + } public function testMethodGetLog(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "functionId" => "5e5ea6g16897e", - "deploymentId" => "5e5ea5c16897e", - "trigger" => "http", - "status" => "processing", - "requestMethod" => "GET", - "requestPath" => "/articles?id=5", - "requestHeaders" => array(), - "responseStatusCode" => 200, - "responseBody" => "", - "responseHeaders" => array(), - "logs" => "", - "errors" => "", - "duration" => 0.4); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"functionId" => "5e5ea6g16897e" +,"deploymentId" => "5e5ea5c16897e" +,"trigger" => "http" +,"status" => "waiting" +,"requestMethod" => "GET" +,"requestPath" => "/articles?id=5" +,"requestHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"responseStatusCode" => 200 +,"responseBody" => "[RESPONSEBODY]" +,"responseHeaders" => array(array("name" => "Content-Type" +,"value" => "application/json" +) +) + ,"logs" => "[LOGS]" +,"errors" => "[ERRORS]" +,"duration" => 0.4 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -638,11 +807,11 @@ public function testMethodGetLog(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); + } public function testMethodDeleteLog(): void { - + $data = ''; $this->client @@ -654,14 +823,24 @@ public function testMethodDeleteLog(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListVariables(): void { - - $data = array( - "total" => 5, - "variables" => array()); + + $data = array("total" => 5 +,"variables" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -671,20 +850,21 @@ public function testMethodListVariables(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); + } public function testMethodCreateVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -696,20 +876,21 @@ public function testMethodCreateVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodGetVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -720,20 +901,21 @@ public function testMethodGetVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodUpdateVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "secret" => true, - "resourceType" => "function", - "resourceId" => "myAwesomeFunction"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "API_KEY" +,"value" => "myPa\$\$word1" +,"secret" => true +,"resourceType" => "function" +,"resourceId" => "myAwesomeFunction" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -745,11 +927,11 @@ public function testMethodUpdateVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } public function testMethodDeleteVariable(): void { - + $data = ''; $this->client @@ -761,7 +943,7 @@ public function testMethodDeleteVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/StorageTest.php b/tests/Appwrite/Services/StorageTest.php index 4d01dae..8ec4075 100644 --- a/tests/Appwrite/Services/StorageTest.php +++ b/tests/Appwrite/Services/StorageTest.php @@ -20,10 +20,26 @@ protected function setUp(): void { } public function testMethodListBuckets(): void { - - $data = array( - "total" => 5, - "buckets" => array()); + + $data = array("total" => 5 +,"buckets" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"fileSecurity" => true +,"name" => "Documents" +,"enabled" => true +,"maximumFileSize" => 100 +,"allowedFileExtensions" => array() +,"compression" => "gzip" +,"encryption" => true +,"antivirus" => true +,"transformations" => true +,"totalSize" => 128 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -32,26 +48,27 @@ public function testMethodListBuckets(): void { $response = $this->storage->listBuckets( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BucketList::class, $response); + } public function testMethodCreateBucket(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "fileSecurity" => true, - "name" => "Documents", - "enabled" => true, - "maximumFileSize" => 100, - "allowedFileExtensions" => array(), - "compression" => "gzip", - "encryption" => true, - "antivirus" => true, - "transformations" => true, - "totalSize" => 128); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"fileSecurity" => true +,"name" => "Documents" +,"enabled" => true +,"maximumFileSize" => 100 +,"allowedFileExtensions" => array() +,"compression" => "gzip" +,"encryption" => true +,"antivirus" => true +,"transformations" => true +,"totalSize" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -62,26 +79,27 @@ public function testMethodCreateBucket(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); + } public function testMethodGetBucket(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "fileSecurity" => true, - "name" => "Documents", - "enabled" => true, - "maximumFileSize" => 100, - "allowedFileExtensions" => array(), - "compression" => "gzip", - "encryption" => true, - "antivirus" => true, - "transformations" => true, - "totalSize" => 128); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"fileSecurity" => true +,"name" => "Documents" +,"enabled" => true +,"maximumFileSize" => 100 +,"allowedFileExtensions" => array() +,"compression" => "gzip" +,"encryption" => true +,"antivirus" => true +,"transformations" => true +,"totalSize" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -91,26 +109,27 @@ public function testMethodGetBucket(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); + } public function testMethodUpdateBucket(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "fileSecurity" => true, - "name" => "Documents", - "enabled" => true, - "maximumFileSize" => 100, - "allowedFileExtensions" => array(), - "compression" => "gzip", - "encryption" => true, - "antivirus" => true, - "transformations" => true, - "totalSize" => 128); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"fileSecurity" => true +,"name" => "Documents" +,"enabled" => true +,"maximumFileSize" => 100 +,"allowedFileExtensions" => array() +,"compression" => "gzip" +,"encryption" => true +,"antivirus" => true +,"transformations" => true +,"totalSize" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -121,11 +140,11 @@ public function testMethodUpdateBucket(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); + } public function testMethodDeleteBucket(): void { - + $data = ''; $this->client @@ -136,14 +155,29 @@ public function testMethodDeleteBucket(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListFiles(): void { - - $data = array( - "total" => 5, - "files" => array()); + + $data = array("total" => 5 +,"files" => array(array("\$id" => "5e5ea5c16897e" +,"bucketId" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"name" => "Pink.png" +,"signature" => "5d529fd02b544198ae075bd57c1762bb" +,"mimeType" => "image/png" +,"sizeOriginal" => 17890 +,"chunksTotal" => 17890 +,"chunksUploaded" => 17890 +,"encryption" => true +,"compression" => "gzip" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -153,25 +187,26 @@ public function testMethodListFiles(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FileList::class, $response); + } public function testMethodCreateFile(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "bucketId" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "name" => "Pink.png", - "signature" => "5d529fd02b544198ae075bd57c1762bb", - "mimeType" => "image/png", - "sizeOriginal" => 17890, - "chunksTotal" => 17890, - "chunksUploaded" => 17890, - "encryption" => true, - "compression" => "gzip"); + + $data = array("\$id" => "5e5ea5c16897e" +,"bucketId" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"name" => "Pink.png" +,"signature" => "5d529fd02b544198ae075bd57c1762bb" +,"mimeType" => "image/png" +,"sizeOriginal" => 17890 +,"chunksTotal" => 17890 +,"chunksUploaded" => 17890 +,"encryption" => true +,"compression" => "gzip" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -183,25 +218,26 @@ public function testMethodCreateFile(): void { InputFile::withData('', "image/png") ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\File::class, $response); + } public function testMethodGetFile(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "bucketId" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "name" => "Pink.png", - "signature" => "5d529fd02b544198ae075bd57c1762bb", - "mimeType" => "image/png", - "sizeOriginal" => 17890, - "chunksTotal" => 17890, - "chunksUploaded" => 17890, - "encryption" => true, - "compression" => "gzip"); + + $data = array("\$id" => "5e5ea5c16897e" +,"bucketId" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"name" => "Pink.png" +,"signature" => "5d529fd02b544198ae075bd57c1762bb" +,"mimeType" => "image/png" +,"sizeOriginal" => 17890 +,"chunksTotal" => 17890 +,"chunksUploaded" => 17890 +,"encryption" => true +,"compression" => "gzip" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -212,25 +248,26 @@ public function testMethodGetFile(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\File::class, $response); + } public function testMethodUpdateFile(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "bucketId" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "name" => "Pink.png", - "signature" => "5d529fd02b544198ae075bd57c1762bb", - "mimeType" => "image/png", - "sizeOriginal" => 17890, - "chunksTotal" => 17890, - "chunksUploaded" => 17890, - "encryption" => true, - "compression" => "gzip"); + + $data = array("\$id" => "5e5ea5c16897e" +,"bucketId" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"name" => "Pink.png" +,"signature" => "5d529fd02b544198ae075bd57c1762bb" +,"mimeType" => "image/png" +,"sizeOriginal" => 17890 +,"chunksTotal" => 17890 +,"chunksUploaded" => 17890 +,"encryption" => true +,"compression" => "gzip" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -241,11 +278,11 @@ public function testMethodUpdateFile(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\File::class, $response); + } public function testMethodDeleteFile(): void { - + $data = ''; $this->client @@ -257,11 +294,11 @@ public function testMethodDeleteFile(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetFileDownload(): void { - + $data = ''; $this->client @@ -273,11 +310,11 @@ public function testMethodGetFileDownload(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetFilePreview(): void { - + $data = ''; $this->client @@ -289,11 +326,11 @@ public function testMethodGetFilePreview(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodGetFileView(): void { - + $data = ''; $this->client @@ -305,7 +342,7 @@ public function testMethodGetFileView(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index faa8129..52ae5f1 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -21,10 +21,53 @@ protected function setUp(): void { } public function testMethodList(): void { - - $data = array( - "total" => 5, - "databases" => array()); + + $data = array("total" => 5 +,"databases" => array(array("\$id" => "5e5ea5c16897e" +,"name" => "My Database" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"enabled" => true +,"type" => "legacy" +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -33,20 +76,54 @@ public function testMethodList(): void { $response = $this->tablesDB->list( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DatabaseList::class, $response); + } public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "My Database" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"enabled" => true +,"type" => "legacy" +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -57,14 +134,22 @@ public function testMethodCreate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } public function testMethodListTransactions(): void { - - $data = array( - "total" => 5, - "transactions" => array()); + + $data = array("total" => 5 +,"transactions" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -73,18 +158,19 @@ public function testMethodListTransactions(): void { $response = $this->tablesDB->listTransactions( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TransactionList::class, $response); + } public function testMethodCreateTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -93,18 +179,19 @@ public function testMethodCreateTransaction(): void { $response = $this->tablesDB->createTransaction( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } public function testMethodGetTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -114,18 +201,19 @@ public function testMethodGetTransaction(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } public function testMethodUpdateTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -135,11 +223,11 @@ public function testMethodUpdateTransaction(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } public function testMethodDeleteTransaction(): void { - + $data = ''; $this->client @@ -150,18 +238,19 @@ public function testMethodDeleteTransaction(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreateOperations(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"status" => "pending" +,"operations" => 5 +,"expiresAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -171,20 +260,54 @@ public function testMethodCreateOperations(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "My Database" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"enabled" => true +,"type" => "legacy" +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -194,20 +317,54 @@ public function testMethodGet(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"name" => "My Database" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"enabled" => true +,"type" => "legacy" +,"policies" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"archives" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Collection" +,"enabled" => true +,"documentSecurity" => true +,"attributes" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"attributes" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -217,11 +374,11 @@ public function testMethodUpdate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -232,14 +389,38 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListTables(): void { - - $data = array( - "total" => 5, - "tables" => array()); + + $data = array("total" => 5 +,"tables" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Table" +,"enabled" => true +,"rowSecurity" => true +,"columns" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"columns" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -249,24 +430,35 @@ public function testMethodListTables(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TableList::class, $response); + } public function testMethodCreateTable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Table", - "enabled" => true, - "rowSecurity" => true, - "columns" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Table" +,"enabled" => true +,"rowSecurity" => true +,"columns" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"columns" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -278,24 +470,35 @@ public function testMethodCreateTable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); + } public function testMethodGetTable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Table", - "enabled" => true, - "rowSecurity" => true, - "columns" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Table" +,"enabled" => true +,"rowSecurity" => true +,"columns" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"columns" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -306,24 +509,35 @@ public function testMethodGetTable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); + } public function testMethodUpdateTable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Table", - "enabled" => true, - "rowSecurity" => true, - "columns" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +,"databaseId" => "5e5ea5c16897e" +,"name" => "My Table" +,"enabled" => true +,"rowSecurity" => true +,"columns" => array() +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"columns" => array() +,"lengths" => array() +) +) + ,"bytesMax" => 65535 +,"bytesUsed" => 1500 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -334,11 +548,11 @@ public function testMethodUpdateTable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); + } public function testMethodDeleteTable(): void { - + $data = ''; $this->client @@ -350,14 +564,15 @@ public function testMethodDeleteTable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListColumns(): void { - - $data = array( - "total" => 5, - "columns" => array()); + + $data = array("total" => 5 +,"columns" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -368,19 +583,20 @@ public function testMethodListColumns(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnList::class, $response); + } public function testMethodCreateBooleanColumn(): void { - - $data = array( - "key" => "isEnabled", - "type" => "boolean", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "isEnabled" +,"type" => "boolean" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -393,19 +609,20 @@ public function testMethodCreateBooleanColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); + } public function testMethodUpdateBooleanColumn(): void { - - $data = array( - "key" => "isEnabled", - "type" => "boolean", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "isEnabled" +,"type" => "boolean" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -419,20 +636,21 @@ public function testMethodUpdateBooleanColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); + } public function testMethodCreateDatetimeColumn(): void { - - $data = array( - "key" => "birthDay", - "type" => "datetime", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime"); + + $data = array("key" => "birthDay" +,"type" => "datetime" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "datetime" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -445,20 +663,21 @@ public function testMethodCreateDatetimeColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnDatetime::class, $response); + } public function testMethodUpdateDatetimeColumn(): void { - - $data = array( - "key" => "birthDay", - "type" => "datetime", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime"); + + $data = array("key" => "birthDay" +,"type" => "datetime" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "datetime" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -469,23 +688,24 @@ public function testMethodUpdateDatetimeColumn(): void { "", "", true, - "" + "2020-10-15T06:38:00.000+00:00" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnDatetime::class, $response); + } public function testMethodCreateEmailColumn(): void { - - $data = array( - "key" => "userEmail", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email"); + + $data = array("key" => "userEmail" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "email" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -498,20 +718,21 @@ public function testMethodCreateEmailColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnEmail::class, $response); + } public function testMethodUpdateEmailColumn(): void { - - $data = array( - "key" => "userEmail", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email"); + + $data = array("key" => "userEmail" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "email" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -525,21 +746,22 @@ public function testMethodUpdateEmailColumn(): void { "email@example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnEmail::class, $response); + } public function testMethodCreateEnumColumn(): void { - - $data = array( - "key" => "status", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "elements" => array(), - "format" => "enum"); + + $data = array("key" => "status" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"elements" => array() +,"format" => "enum" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -553,21 +775,22 @@ public function testMethodCreateEnumColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnEnum::class, $response); + } public function testMethodUpdateEnumColumn(): void { - - $data = array( - "key" => "status", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "elements" => array(), - "format" => "enum"); + + $data = array("key" => "status" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"elements" => array() +,"format" => "enum" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -582,19 +805,20 @@ public function testMethodUpdateEnumColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnEnum::class, $response); + } public function testMethodCreateFloatColumn(): void { - - $data = array( - "key" => "percentageCompleted", - "type" => "double", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "percentageCompleted" +,"type" => "double" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -607,19 +831,20 @@ public function testMethodCreateFloatColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnFloat::class, $response); + } public function testMethodUpdateFloatColumn(): void { - - $data = array( - "key" => "percentageCompleted", - "type" => "double", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "percentageCompleted" +,"type" => "double" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -633,19 +858,20 @@ public function testMethodUpdateFloatColumn(): void { 1.0 ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnFloat::class, $response); + } public function testMethodCreateIntegerColumn(): void { - - $data = array( - "key" => "count", - "type" => "integer", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "count" +,"type" => "integer" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -658,19 +884,20 @@ public function testMethodCreateIntegerColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnInteger::class, $response); + } public function testMethodUpdateIntegerColumn(): void { - - $data = array( - "key" => "count", - "type" => "integer", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "count" +,"type" => "integer" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -684,20 +911,21 @@ public function testMethodUpdateIntegerColumn(): void { 1 ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnInteger::class, $response); + } public function testMethodCreateIpColumn(): void { - - $data = array( - "key" => "ipAddress", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip"); + + $data = array("key" => "ipAddress" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "ip" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -710,20 +938,21 @@ public function testMethodCreateIpColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIp::class, $response); + } public function testMethodUpdateIpColumn(): void { - - $data = array( - "key" => "ipAddress", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip"); + + $data = array("key" => "ipAddress" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "ip" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -737,19 +966,20 @@ public function testMethodUpdateIpColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIp::class, $response); + } public function testMethodCreateLineColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -762,19 +992,20 @@ public function testMethodCreateLineColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnLine::class, $response); + } public function testMethodUpdateLineColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -787,19 +1018,20 @@ public function testMethodUpdateLineColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnLine::class, $response); + } public function testMethodCreateLongtextColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -812,19 +1044,20 @@ public function testMethodCreateLongtextColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnLongtext::class, $response); + } public function testMethodUpdateLongtextColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -838,19 +1071,20 @@ public function testMethodUpdateLongtextColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnLongtext::class, $response); + } public function testMethodCreateMediumtextColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -863,19 +1097,20 @@ public function testMethodCreateMediumtextColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnMediumtext::class, $response); + } public function testMethodUpdateMediumtextColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -889,19 +1124,20 @@ public function testMethodUpdateMediumtextColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnMediumtext::class, $response); + } public function testMethodCreatePointColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -914,19 +1150,20 @@ public function testMethodCreatePointColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnPoint::class, $response); + } public function testMethodUpdatePointColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -939,19 +1176,20 @@ public function testMethodUpdatePointColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnPoint::class, $response); + } public function testMethodCreatePolygonColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -964,19 +1202,20 @@ public function testMethodCreatePolygonColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnPolygon::class, $response); + } public function testMethodUpdatePolygonColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -989,25 +1228,26 @@ public function testMethodUpdatePolygonColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnPolygon::class, $response); + } public function testMethodCreateRelationshipColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "relatedTable" => "table", - "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", - "twoWay" => true, - "twoWayKey" => "string", - "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"relatedTable" => "table" +,"relationType" => "oneToOne|oneToMany|manyToOne|manyToMany" +,"twoWay" => true +,"twoWayKey" => "string" +,"onDelete" => "restrict|cascade|setNull" +,"side" => "parent|child" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1020,20 +1260,21 @@ public function testMethodCreateRelationshipColumn(): void { RelationshipType::ONETOONE() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnRelationship::class, $response); + } public function testMethodCreateStringColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"size" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1047,20 +1288,21 @@ public function testMethodCreateStringColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnString::class, $response); + } public function testMethodUpdateStringColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"size" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1074,19 +1316,20 @@ public function testMethodUpdateStringColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnString::class, $response); + } public function testMethodCreateTextColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1099,19 +1342,20 @@ public function testMethodCreateTextColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnText::class, $response); + } public function testMethodUpdateTextColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1125,20 +1369,21 @@ public function testMethodUpdateTextColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnText::class, $response); + } public function testMethodCreateUrlColumn(): void { - - $data = array( - "key" => "githubUrl", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url"); + + $data = array("key" => "githubUrl" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "url" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1151,20 +1396,21 @@ public function testMethodCreateUrlColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnUrl::class, $response); + } public function testMethodUpdateUrlColumn(): void { - - $data = array( - "key" => "githubUrl", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url"); + + $data = array("key" => "githubUrl" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"format" => "url" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1178,20 +1424,21 @@ public function testMethodUpdateUrlColumn(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnUrl::class, $response); + } public function testMethodCreateVarcharColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"size" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1205,20 +1452,21 @@ public function testMethodCreateVarcharColumn(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnVarchar::class, $response); + } public function testMethodUpdateVarcharColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"size" => 128 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1232,19 +1480,20 @@ public function testMethodUpdateVarcharColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnVarchar::class, $response); + } public function testMethodGetColumn(): void { - - $data = array( - "key" => "isEnabled", - "type" => "boolean", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("key" => "isEnabled" +,"type" => "boolean" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1256,11 +1505,11 @@ public function testMethodGetColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); + } public function testMethodDeleteColumn(): void { - + $data = ''; $this->client @@ -1273,25 +1522,26 @@ public function testMethodDeleteColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateRelationshipColumn(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "relatedTable" => "table", - "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", - "twoWay" => true, - "twoWayKey" => "string", - "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child"); + + $data = array("key" => "fullName" +,"type" => "string" +,"status" => "available" +,"error" => "string" +,"required" => true +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"relatedTable" => "table" +,"relationType" => "oneToOne|oneToMany|manyToOne|manyToMany" +,"twoWay" => true +,"twoWayKey" => "string" +,"onDelete" => "restrict|cascade|setNull" +,"side" => "parent|child" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1303,14 +1553,25 @@ public function testMethodUpdateRelationshipColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnRelationship::class, $response); + } public function testMethodListIndexes(): void { - - $data = array( - "total" => 5, - "indexes" => array()); + + $data = array("total" => 5 +,"indexes" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"columns" => array() +,"lengths" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1321,21 +1582,22 @@ public function testMethodListIndexes(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIndexList::class, $response); + } public function testMethodCreateIndex(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "columns" => array(), - "lengths" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"columns" => array() +,"lengths" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1349,21 +1611,22 @@ public function testMethodCreateIndex(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIndex::class, $response); + } public function testMethodGetIndex(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "columns" => array(), - "lengths" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"key" => "index1" +,"type" => "primary" +,"status" => "available" +,"error" => "string" +,"columns" => array() +,"lengths" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1375,11 +1638,11 @@ public function testMethodGetIndex(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIndex::class, $response); + } public function testMethodDeleteIndex(): void { - + $data = ''; $this->client @@ -1392,14 +1655,23 @@ public function testMethodDeleteIndex(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListRows(): void { - - $data = array( - "total" => 5, - "rows" => array()); + + $data = array("total" => 5 +,"rows" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1410,19 +1682,20 @@ public function testMethodListRows(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } public function testMethodCreateRow(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$tableId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1435,14 +1708,23 @@ public function testMethodCreateRow(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } public function testMethodCreateRows(): void { - - $data = array( - "total" => 5, - "rows" => array()); + + $data = array("total" => 5 +,"rows" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1454,14 +1736,23 @@ public function testMethodCreateRows(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } public function testMethodUpsertRows(): void { - - $data = array( - "total" => 5, - "rows" => array()); + + $data = array("total" => 5 +,"rows" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1473,14 +1764,23 @@ public function testMethodUpsertRows(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } public function testMethodUpdateRows(): void { - - $data = array( - "total" => 5, - "rows" => array()); + + $data = array("total" => 5 +,"rows" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1491,14 +1791,23 @@ public function testMethodUpdateRows(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } public function testMethodDeleteRows(): void { - - $data = array( - "total" => 5, - "rows" => array()); + + $data = array("total" => 5 +,"rows" => array(array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1509,19 +1818,20 @@ public function testMethodDeleteRows(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } public function testMethodGetRow(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$tableId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1533,19 +1843,20 @@ public function testMethodGetRow(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } public function testMethodUpsertRow(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$tableId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1557,19 +1868,20 @@ public function testMethodUpsertRow(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } public function testMethodUpdateRow(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$tableId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1581,11 +1893,11 @@ public function testMethodUpdateRow(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } public function testMethodDeleteRow(): void { - + $data = ''; $this->client @@ -1598,19 +1910,20 @@ public function testMethodDeleteRow(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodDecrementRowColumn(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$tableId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1623,19 +1936,20 @@ public function testMethodDecrementRowColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } public function testMethodIncrementRowColumn(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$tableId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$sequence" => "1" +,"\$tableId" => "5e5ea5c15117e" +,"\$databaseId" => "5e5ea5c15117e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"\$permissions" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1648,7 +1962,7 @@ public function testMethodIncrementRowColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } } diff --git a/tests/Appwrite/Services/TeamsTest.php b/tests/Appwrite/Services/TeamsTest.php index d909af5..02cfda4 100644 --- a/tests/Appwrite/Services/TeamsTest.php +++ b/tests/Appwrite/Services/TeamsTest.php @@ -17,10 +17,19 @@ protected function setUp(): void { } public function testMethodList(): void { - - $data = array( - "total" => 5, - "teams" => array()); + + $data = array("total" => 5 +,"teams" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "VIP" +,"total" => 7 +,"prefs" => array() + + ) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -29,18 +38,20 @@ public function testMethodList(): void { $response = $this->teams->list( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TeamList::class, $response); + } public function testMethodCreate(): void { + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "VIP" +,"total" => 7 +,"prefs" => array() - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "VIP", - "total" => 7, - "prefs" => array()); + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -51,18 +62,20 @@ public function testMethodCreate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); + } public function testMethodGet(): void { + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "VIP" +,"total" => 7 +,"prefs" => array() - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "VIP", - "total" => 7, - "prefs" => array()); + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -72,18 +85,20 @@ public function testMethodGet(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); + } public function testMethodUpdateName(): void { + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "VIP" +,"total" => 7 +,"prefs" => array() - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "VIP", - "total" => 7, - "prefs" => array()); + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -94,11 +109,11 @@ public function testMethodUpdateName(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -109,14 +124,29 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListMemberships(): void { - - $data = array( - "total" => 5, - "memberships" => array()); + + $data = array("total" => 5 +,"memberships" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c16897e" +,"userName" => "John Doe" +,"userEmail" => "john@appwrite.io" +,"teamId" => "5e5ea5c16897e" +,"teamName" => "VIP" +,"invited" => "2020-10-15T06:38:00.000+00:00" +,"joined" => "2020-10-15T06:38:00.000+00:00" +,"confirm" => true +,"mfa" => true +,"roles" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -126,25 +156,26 @@ public function testMethodListMemberships(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MembershipList::class, $response); + } public function testMethodCreateMembership(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c16897e", - "userName" => "John Doe", - "userEmail" => "john@appwrite.io", - "teamId" => "5e5ea5c16897e", - "teamName" => "VIP", - "invited" => "2020-10-15T06:38:00.000+00:00", - "joined" => "2020-10-15T06:38:00.000+00:00", - "confirm" => true, - "mfa" => true, - "roles" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c16897e" +,"userName" => "John Doe" +,"userEmail" => "john@appwrite.io" +,"teamId" => "5e5ea5c16897e" +,"teamName" => "VIP" +,"invited" => "2020-10-15T06:38:00.000+00:00" +,"joined" => "2020-10-15T06:38:00.000+00:00" +,"confirm" => true +,"mfa" => true +,"roles" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -155,25 +186,26 @@ public function testMethodCreateMembership(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); + } public function testMethodGetMembership(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c16897e", - "userName" => "John Doe", - "userEmail" => "john@appwrite.io", - "teamId" => "5e5ea5c16897e", - "teamName" => "VIP", - "invited" => "2020-10-15T06:38:00.000+00:00", - "joined" => "2020-10-15T06:38:00.000+00:00", - "confirm" => true, - "mfa" => true, - "roles" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c16897e" +,"userName" => "John Doe" +,"userEmail" => "john@appwrite.io" +,"teamId" => "5e5ea5c16897e" +,"teamName" => "VIP" +,"invited" => "2020-10-15T06:38:00.000+00:00" +,"joined" => "2020-10-15T06:38:00.000+00:00" +,"confirm" => true +,"mfa" => true +,"roles" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -184,25 +216,26 @@ public function testMethodGetMembership(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); + } public function testMethodUpdateMembership(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c16897e", - "userName" => "John Doe", - "userEmail" => "john@appwrite.io", - "teamId" => "5e5ea5c16897e", - "teamName" => "VIP", - "invited" => "2020-10-15T06:38:00.000+00:00", - "joined" => "2020-10-15T06:38:00.000+00:00", - "confirm" => true, - "mfa" => true, - "roles" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c16897e" +,"userName" => "John Doe" +,"userEmail" => "john@appwrite.io" +,"teamId" => "5e5ea5c16897e" +,"teamName" => "VIP" +,"invited" => "2020-10-15T06:38:00.000+00:00" +,"joined" => "2020-10-15T06:38:00.000+00:00" +,"confirm" => true +,"mfa" => true +,"roles" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -214,11 +247,11 @@ public function testMethodUpdateMembership(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); + } public function testMethodDeleteMembership(): void { - + $data = ''; $this->client @@ -230,25 +263,26 @@ public function testMethodDeleteMembership(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateMembershipStatus(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c16897e", - "userName" => "John Doe", - "userEmail" => "john@appwrite.io", - "teamId" => "5e5ea5c16897e", - "teamName" => "VIP", - "invited" => "2020-10-15T06:38:00.000+00:00", - "joined" => "2020-10-15T06:38:00.000+00:00", - "confirm" => true, - "mfa" => true, - "roles" => array()); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c16897e" +,"userName" => "John Doe" +,"userEmail" => "john@appwrite.io" +,"teamId" => "5e5ea5c16897e" +,"teamName" => "VIP" +,"invited" => "2020-10-15T06:38:00.000+00:00" +,"joined" => "2020-10-15T06:38:00.000+00:00" +,"confirm" => true +,"mfa" => true +,"roles" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -261,12 +295,13 @@ public function testMethodUpdateMembershipStatus(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); + } public function testMethodGetPrefs(): void { - - $data = array(); + + $data = array() +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -276,12 +311,13 @@ public function testMethodGetPrefs(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } public function testMethodUpdatePrefs(): void { - - $data = array(); + + $data = array() +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -292,7 +328,7 @@ public function testMethodUpdatePrefs(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } } diff --git a/tests/Appwrite/Services/TokensTest.php b/tests/Appwrite/Services/TokensTest.php index 59dff5a..33a0bfc 100644 --- a/tests/Appwrite/Services/TokensTest.php +++ b/tests/Appwrite/Services/TokensTest.php @@ -17,10 +17,19 @@ protected function setUp(): void { } public function testMethodList(): void { - - $data = array( - "total" => 5, - "tokens" => array()); + + $data = array("total" => 5 +,"tokens" => array(array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8" +,"resourceType" => "files" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" +,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -31,19 +40,20 @@ public function testMethodList(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ResourceTokenList::class, $response); + } public function testMethodCreateFileToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8", - "resourceType" => "files", - "expire" => "2020-10-15T06:38:00.000+00:00", - "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8" +,"resourceType" => "files" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" +,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -54,19 +64,20 @@ public function testMethodCreateFileToken(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); + } public function testMethodGet(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8", - "resourceType" => "files", - "expire" => "2020-10-15T06:38:00.000+00:00", - "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8" +,"resourceType" => "files" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" +,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -76,19 +87,20 @@ public function testMethodGet(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); + } public function testMethodUpdate(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8", - "resourceType" => "files", - "expire" => "2020-10-15T06:38:00.000+00:00", - "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8" +,"resourceType" => "files" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" +,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -98,11 +110,11 @@ public function testMethodUpdate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -113,7 +125,7 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index a6a34ae..651e59c 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -20,10 +20,38 @@ protected function setUp(): void { } public function testMethodList(): void { - - $data = array( - "total" => 5, - "users" => array()); + + $data = array("total" => 5 +,"users" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -32,28 +60,39 @@ public function testMethodList(): void { $response = $this->users->list( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\UserList::class, $response); + } public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -63,28 +102,39 @@ public function testMethodCreate(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateArgon2User(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -96,28 +146,39 @@ public function testMethodCreateArgon2User(): void { "password" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateBcryptUser(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -129,14 +190,26 @@ public function testMethodCreateBcryptUser(): void { "password" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodListIdentities(): void { - - $data = array( - "total" => 5, - "identities" => array()); + + $data = array("total" => 5 +,"identities" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"provider" => "email" +,"providerUid" => "5e5bb8c16897e" +,"providerEmail" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -145,11 +218,11 @@ public function testMethodListIdentities(): void { $response = $this->users->listIdentities( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\IdentityList::class, $response); + } public function testMethodDeleteIdentity(): void { - + $data = ''; $this->client @@ -160,28 +233,39 @@ public function testMethodDeleteIdentity(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreateMD5User(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -193,28 +277,39 @@ public function testMethodCreateMD5User(): void { "password" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreatePHPassUser(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -226,28 +321,39 @@ public function testMethodCreatePHPassUser(): void { "password" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateScryptUser(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -264,28 +370,39 @@ public function testMethodCreateScryptUser(): void { 1 ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateScryptModifiedUser(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -300,28 +417,39 @@ public function testMethodCreateScryptModifiedUser(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateSHAUser(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -333,28 +461,39 @@ public function testMethodCreateSHAUser(): void { "password" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -364,11 +503,11 @@ public function testMethodGet(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -379,28 +518,39 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateEmail(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -411,28 +561,39 @@ public function testMethodUpdateEmail(): void { "email@example.com" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodUpdateImpersonator(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -443,13 +604,14 @@ public function testMethodUpdateImpersonator(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodCreateJWT(): void { - - $data = array( - "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"); + + $data = array("jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -459,28 +621,39 @@ public function testMethodCreateJWT(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Jwt::class, $response); + } public function testMethodUpdateLabels(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -491,14 +664,37 @@ public function testMethodUpdateLabels(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodListLogs(): void { - - $data = array( - "total" => 5, - "logs" => array()); + + $data = array("total" => 5 +,"logs" => array(array("event" => "account.sessions.create" +,"userId" => "610fc2f985ee0" +,"userEmail" => "john@appwrite.io" +,"userName" => "John Doe" +,"mode" => "admin" +,"ip" => "127.0.0.1" +,"time" => "2020-10-15T06:38:00.000+00:00" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -508,14 +704,29 @@ public function testMethodListLogs(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } public function testMethodListMemberships(): void { - - $data = array( - "total" => 5, - "memberships" => array()); + + $data = array("total" => 5 +,"memberships" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c16897e" +,"userName" => "John Doe" +,"userEmail" => "john@appwrite.io" +,"teamId" => "5e5ea5c16897e" +,"teamName" => "VIP" +,"invited" => "2020-10-15T06:38:00.000+00:00" +,"joined" => "2020-10-15T06:38:00.000+00:00" +,"confirm" => true +,"mfa" => true +,"roles" => array() +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -525,28 +736,39 @@ public function testMethodListMemberships(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MembershipList::class, $response); + } public function testMethodUpdateMFA(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -557,11 +779,11 @@ public function testMethodUpdateMFA(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodDeleteMFAAuthenticator(): void { - + $data = ''; $this->client @@ -573,16 +795,17 @@ public function testMethodDeleteMFAAuthenticator(): void { AuthenticatorType::TOTP() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodListMFAFactors(): void { - - $data = array( - "totp" => true, - "phone" => true, - "email" => true, - "recoveryCode" => true); + + $data = array("totp" => true +,"phone" => true +,"email" => true +,"recoveryCode" => true +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -592,13 +815,14 @@ public function testMethodListMFAFactors(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaFactors::class, $response); + } public function testMethodGetMFARecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array()); + + $data = array("recoveryCodes" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -608,13 +832,14 @@ public function testMethodGetMFARecoveryCodes(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } public function testMethodUpdateMFARecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array()); + + $data = array("recoveryCodes" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -624,13 +849,14 @@ public function testMethodUpdateMFARecoveryCodes(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } public function testMethodCreateMFARecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array()); + + $data = array("recoveryCodes" => array() +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -640,28 +866,39 @@ public function testMethodCreateMFARecoveryCodes(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } public function testMethodUpdateName(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -672,28 +909,39 @@ public function testMethodUpdateName(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodUpdatePassword(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -704,28 +952,39 @@ public function testMethodUpdatePassword(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodUpdatePhone(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -736,12 +995,13 @@ public function testMethodUpdatePhone(): void { "+12065550100" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodGetPrefs(): void { - - $data = array(); + + $data = array() +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -751,12 +1011,13 @@ public function testMethodGetPrefs(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } public function testMethodUpdatePrefs(): void { - - $data = array(); + + $data = array() +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -767,14 +1028,45 @@ public function testMethodUpdatePrefs(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } public function testMethodListSessions(): void { - - $data = array( - "total" => 5, - "sessions" => array()); + + $data = array("total" => 5 +,"sessions" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -784,41 +1076,42 @@ public function testMethodListSessions(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\SessionList::class, $response); + } public function testMethodCreateSession(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5bb8c16897e", - "expire" => "2020-10-15T06:38:00.000+00:00", - "provider" => "email", - "providerUid" => "user@example.com", - "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", - "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", - "ip" => "127.0.0.1", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", - "countryCode" => "US", - "countryName" => "United States", - "current" => true, - "factors" => array(), - "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5bb8c16897e" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"provider" => "email" +,"providerUid" => "user@example.com" +,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" +,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" +,"ip" => "127.0.0.1" +,"osCode" => "Mac" +,"osName" => "Mac" +,"osVersion" => "Mac" +,"clientType" => "browser" +,"clientCode" => "CM" +,"clientName" => "Chrome Mobile iOS" +,"clientVersion" => "84.0" +,"clientEngine" => "WebKit" +,"clientEngineVersion" => "605.1.15" +,"deviceName" => "smartphone" +,"deviceBrand" => "Google" +,"deviceModel" => "Nexus 5" +,"countryCode" => "US" +,"countryName" => "United States" +,"current" => true +,"factors" => array() +,"secret" => "5e5bb8c16897e" +,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -828,11 +1121,11 @@ public function testMethodCreateSession(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodDeleteSessions(): void { - + $data = ''; $this->client @@ -843,11 +1136,11 @@ public function testMethodDeleteSessions(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodDeleteSession(): void { - + $data = ''; $this->client @@ -859,28 +1152,39 @@ public function testMethodDeleteSession(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateStatus(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -891,14 +1195,24 @@ public function testMethodUpdateStatus(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodListTargets(): void { - - $data = array( - "total" => 5, - "targets" => array()); + + $data = array("total" => 5 +,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -908,20 +1222,21 @@ public function testMethodListTargets(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TargetList::class, $response); + } public function testMethodCreateTarget(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Apple iPhone 12", - "userId" => "259125845563242502", - "providerType" => "email", - "identifier" => "token", - "expired" => true); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -934,20 +1249,21 @@ public function testMethodCreateTarget(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); + } public function testMethodGetTarget(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Apple iPhone 12", - "userId" => "259125845563242502", - "providerType" => "email", - "identifier" => "token", - "expired" => true); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -958,20 +1274,21 @@ public function testMethodGetTarget(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); + } public function testMethodUpdateTarget(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Apple iPhone 12", - "userId" => "259125845563242502", - "providerType" => "email", - "identifier" => "token", - "expired" => true); + + $data = array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -982,11 +1299,11 @@ public function testMethodUpdateTarget(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); + } public function testMethodDeleteTarget(): void { - + $data = ''; $this->client @@ -998,18 +1315,19 @@ public function testMethodDeleteTarget(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodCreateToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "secret" => "", - "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox"); + + $data = array("\$id" => "bb8ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"userId" => "5e5ea5c168bb8" +,"secret" => "[SECRET]" +,"expire" => "2020-10-15T06:38:00.000+00:00" +,"phrase" => "Golden Fox" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1019,28 +1337,39 @@ public function testMethodCreateToken(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodUpdateEmailVerification(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1051,28 +1380,39 @@ public function testMethodUpdateEmailVerification(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } public function testMethodUpdatePhoneVerification(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "John Doe" +,"registration" => "2020-10-15T06:38:00.000+00:00" +,"status" => true +,"labels" => array() +,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" +,"email" => "john@appwrite.io" +,"phone" => "+4930901820" +,"emailVerification" => true +,"phoneVerification" => true +,"mfa" => true +,"prefs" => array() + + ,"targets" => array(array("\$id" => "259125845563242502" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "Apple iPhone 12" +,"userId" => "259125845563242502" +,"providerType" => "email" +,"identifier" => "token" +,"expired" => true +) +) + ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1083,7 +1423,7 @@ public function testMethodUpdatePhoneVerification(): void { true ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } } diff --git a/tests/Appwrite/Services/WebhooksTest.php b/tests/Appwrite/Services/WebhooksTest.php index 095a902..c9dc67b 100644 --- a/tests/Appwrite/Services/WebhooksTest.php +++ b/tests/Appwrite/Services/WebhooksTest.php @@ -17,10 +17,25 @@ protected function setUp(): void { } public function testMethodList(): void { - - $data = array( - "total" => 5, - "webhooks" => array()); + + $data = array("total" => 5 +,"webhooks" => array(array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Webhook" +,"url" => "https://example.com/webhook" +,"events" => array() +,"security" => true +,"httpUser" => "username" +,"httpPass" => "password" +,"signatureKey" => "ad3d581ca230e2b7059c545e5a" +,"enabled" => true +,"logs" => "Failed to connect to remote server." +,"attempts" => 10 +) +) + ) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -29,25 +44,26 @@ public function testMethodList(): void { $response = $this->webhooks->list( ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\WebhookList::class, $response); + } public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "security" => true, - "httpUser" => "username", - "httpPass" => "password", - "signatureKey" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Webhook" +,"url" => "https://example.com/webhook" +,"events" => array() +,"security" => true +,"httpUser" => "username" +,"httpPass" => "password" +,"signatureKey" => "ad3d581ca230e2b7059c545e5a" +,"enabled" => true +,"logs" => "Failed to connect to remote server." +,"attempts" => 10 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -60,25 +76,26 @@ public function testMethodCreate(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); + } public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "security" => true, - "httpUser" => "username", - "httpPass" => "password", - "signatureKey" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Webhook" +,"url" => "https://example.com/webhook" +,"events" => array() +,"security" => true +,"httpUser" => "username" +,"httpPass" => "password" +,"signatureKey" => "ad3d581ca230e2b7059c545e5a" +,"enabled" => true +,"logs" => "Failed to connect to remote server." +,"attempts" => 10 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -88,25 +105,26 @@ public function testMethodGet(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); + } public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "security" => true, - "httpUser" => "username", - "httpPass" => "password", - "signatureKey" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Webhook" +,"url" => "https://example.com/webhook" +,"events" => array() +,"security" => true +,"httpUser" => "username" +,"httpPass" => "password" +,"signatureKey" => "ad3d581ca230e2b7059c545e5a" +,"enabled" => true +,"logs" => "Failed to connect to remote server." +,"attempts" => 10 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -119,11 +137,11 @@ public function testMethodUpdate(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); + } public function testMethodDelete(): void { - + $data = ''; $this->client @@ -134,25 +152,26 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } public function testMethodUpdateSignature(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "security" => true, - "httpUser" => "username", - "httpPass" => "password", - "signatureKey" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10); + + $data = array("\$id" => "5e5ea5c16897e" +,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" +,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" +,"name" => "My Webhook" +,"url" => "https://example.com/webhook" +,"events" => array() +,"security" => true +,"httpUser" => "username" +,"httpPass" => "password" +,"signatureKey" => "ad3d581ca230e2b7059c545e5a" +,"enabled" => true +,"logs" => "Failed to connect to remote server." +,"attempts" => 10 +) +; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -162,7 +181,7 @@ public function testMethodUpdateSignature(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); + } } From 5c080dc1af5841b06f741b94a3dd562d2a73a021 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 3 Apr 2026 18:06:54 +0530 Subject: [PATCH 2/5] chore: update PHP SDK to 22.0.0 --- src/Appwrite/Models/Collection.php | 2 +- src/Appwrite/Models/Database.php | 2 +- src/Appwrite/Models/Deployment.php | 2 +- src/Appwrite/Models/Execution.php | 2 +- src/Appwrite/Models/FunctionModel.php | 8 ++++---- src/Appwrite/Models/Locale.php | 2 +- src/Appwrite/Models/Site.php | 8 ++++---- src/Appwrite/Models/Table.php | 2 +- src/Appwrite/Models/Variable.php | 4 ++-- src/Appwrite/Services/Account.php | 8 ++++---- src/Appwrite/Services/Activities.php | 8 ++++---- src/Appwrite/Services/Avatars.php | 8 ++++---- src/Appwrite/Services/Backups.php | 8 ++++---- src/Appwrite/Services/Databases.php | 8 ++++---- src/Appwrite/Services/Functions.php | 8 ++++---- src/Appwrite/Services/Graphql.php | 8 ++++---- src/Appwrite/Services/Health.php | 8 ++++---- src/Appwrite/Services/Locale.php | 8 ++++---- src/Appwrite/Services/Messaging.php | 8 ++++---- src/Appwrite/Services/Project.php | 8 ++++---- src/Appwrite/Services/Sites.php | 8 ++++---- src/Appwrite/Services/Storage.php | 8 ++++---- src/Appwrite/Services/TablesDB.php | 8 ++++---- src/Appwrite/Services/Teams.php | 8 ++++---- src/Appwrite/Services/Tokens.php | 8 ++++---- src/Appwrite/Services/Users.php | 8 ++++---- src/Appwrite/Services/Webhooks.php | 8 ++++---- 27 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/Appwrite/Models/Collection.php b/src/Appwrite/Models/Collection.php index 103b37c..eec66ab 100644 --- a/src/Appwrite/Models/Collection.php +++ b/src/Appwrite/Models/Collection.php @@ -35,7 +35,7 @@ * @param array $permissions collection permissions. [learn more about permissions](https://appwrite.io/docs/permissions). * @param string $databaseId database id. * @param string $name collection name. - * @param bool $enabled collection enabled. can be 'enabled' or 'disabled'. when disabled, the collection is inaccessible to users, but remains accessible to server sdks using api keys. + * @param bool $enabled collection enabled. can be 'enabled' or 'disabled'. when disabled, the collection is inaccessible to users, but remains accessible to server sdks using api keys. * @param bool $documentSecurity whether document-level permissions are enabled. [learn more about permissions](https://appwrite.io/docs/permissions). * @param array $attributes collection attributes. * @param list $indexes collection indexes. diff --git a/src/Appwrite/Models/Database.php b/src/Appwrite/Models/Database.php index 4d705c5..96c180d 100644 --- a/src/Appwrite/Models/Database.php +++ b/src/Appwrite/Models/Database.php @@ -35,7 +35,7 @@ * @param string $name database name. * @param string $createdAt database creation date in iso 8601 format. * @param string $updatedAt database update date in iso 8601 format. - * @param bool $enabled if database is enabled. can be 'enabled' or 'disabled'. when disabled, the database is inaccessible to users, but remains accessible to server sdks using api keys. + * @param bool $enabled if database is enabled. can be 'enabled' or 'disabled'. when disabled, the database is inaccessible to users, but remains accessible to server sdks using api keys. * @param DatabaseType $type database type. * @param list $policies database backup policies. * @param list $archives database backup archives. diff --git a/src/Appwrite/Models/Deployment.php b/src/Appwrite/Models/Deployment.php index 2e985fc..6843ec2 100644 --- a/src/Appwrite/Models/Deployment.php +++ b/src/Appwrite/Models/Deployment.php @@ -37,7 +37,7 @@ * @param bool $activate whether the deployment should be automatically activated. * @param string $screenshotLight screenshot with light theme preference file id. * @param string $screenshotDark screenshot with dark theme preference file id. - * @param DeploymentStatus $status the deployment status. possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". + * @param DeploymentStatus $status the deployment status. possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". * @param string $buildLogs the build logs. * @param int $buildDuration the current build time in seconds. * @param string $providerRepositoryName the name of the vcs provider repository diff --git a/src/Appwrite/Models/Execution.php b/src/Appwrite/Models/Execution.php index 5b01b32..fae1e52 100644 --- a/src/Appwrite/Models/Execution.php +++ b/src/Appwrite/Models/Execution.php @@ -38,7 +38,7 @@ * @param string $updatedAt execution update date in iso 8601 format. * @param array $permissions execution roles. * @param string $functionId function id. - * @param string $deploymentId function's deployment id used to create the execution. + * @param string $deploymentId function's deployment id used to create the execution. * @param ExecutionTrigger $trigger the trigger that caused the function to execute. possible values can be: `http`, `schedule`, or `event`. * @param ExecutionStatus $status the status of the function execution. possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. * @param string $requestMethod http request method type. diff --git a/src/Appwrite/Models/FunctionModel.php b/src/Appwrite/Models/FunctionModel.php index 79d6624..6bb7c68 100644 --- a/src/Appwrite/Models/FunctionModel.php +++ b/src/Appwrite/Models/FunctionModel.php @@ -34,15 +34,15 @@ * @param array $execute execution permissions. * @param string $name function name. * @param bool $enabled function enabled. - * @param bool $live is the function deployed with the latest configuration? this is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. when the value is false, redeploy the function to update it with the latest configuration. + * @param bool $live is the function deployed with the latest configuration? this is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. when the value is false, redeploy the function to update it with the latest configuration. * @param bool $logging when disabled, executions will exclude logs and errors, and will be slightly faster. * @param string $runtime function execution and build runtime. * @param int $deploymentRetention how many days to keep the non-active deployments before they will be automatically deleted. - * @param string $deploymentId function's active deployment id. + * @param string $deploymentId function's active deployment id. * @param string $deploymentCreatedAt active deployment creation date in iso 8601 format. - * @param string $latestDeploymentId function's latest deployment id. + * @param string $latestDeploymentId function's latest deployment id. * @param string $latestDeploymentCreatedAt latest deployment creation date in iso 8601 format. - * @param string $latestDeploymentStatus status of latest deployment. possible values are "waiting", "processing", "building", "ready", and "failed". + * @param string $latestDeploymentStatus status of latest deployment. possible values are "waiting", "processing", "building", "ready", and "failed". * @param array $scopes allowed permission scopes. * @param list $vars function variables. * @param array $events function trigger events. diff --git a/src/Appwrite/Models/Locale.php b/src/Appwrite/Models/Locale.php index 9a47580..9ca5981 100644 --- a/src/Appwrite/Models/Locale.php +++ b/src/Appwrite/Models/Locale.php @@ -15,7 +15,7 @@ * @param string $ip user ip address. * @param string $countryCode country code in [iso 3166-1](http://en.wikipedia.org/wiki/iso_3166-1) two-character format * @param string $country country name. this field support localization. - * @param string $continentCode continent code. a two character continent code "af" for africa, "an" for antarctica, "as" for asia, "eu" for europe, "na" for north america, "oc" for oceania, and "sa" for south america. + * @param string $continentCode continent code. a two character continent code "af" for africa, "an" for antarctica, "as" for asia, "eu" for europe, "na" for north america, "oc" for oceania, and "sa" for south america. * @param string $continent continent name. this field support localization. * @param bool $eu true if country is part of the european union. * @param string $currency currency code in [iso 4217-1](http://en.wikipedia.org/wiki/iso_4217) three-character format diff --git a/src/Appwrite/Models/Site.php b/src/Appwrite/Models/Site.php index 1c0212d..616ee4c 100644 --- a/src/Appwrite/Models/Site.php +++ b/src/Appwrite/Models/Site.php @@ -33,17 +33,17 @@ * @param string $updatedAt site update date in iso 8601 format. * @param string $name site name. * @param bool $enabled site enabled. - * @param bool $live is the site deployed with the latest configuration? this is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. when the value is false, redeploy the site to update it with the latest configuration. + * @param bool $live is the site deployed with the latest configuration? this is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. when the value is false, redeploy the site to update it with the latest configuration. * @param bool $logging when disabled, request logs will exclude logs and errors, and site responses will be slightly faster. * @param string $framework site framework. * @param int $deploymentRetention how many days to keep the non-active deployments before they will be automatically deleted. - * @param string $deploymentId site's active deployment id. + * @param string $deploymentId site's active deployment id. * @param string $deploymentCreatedAt active deployment creation date in iso 8601 format. * @param string $deploymentScreenshotLight screenshot of active deployment with light theme preference file id. * @param string $deploymentScreenshotDark screenshot of active deployment with dark theme preference file id. - * @param string $latestDeploymentId site's latest deployment id. + * @param string $latestDeploymentId site's latest deployment id. * @param string $latestDeploymentCreatedAt latest deployment creation date in iso 8601 format. - * @param string $latestDeploymentStatus status of latest deployment. possible values are "waiting", "processing", "building", "ready", and "failed". + * @param string $latestDeploymentStatus status of latest deployment. possible values are "waiting", "processing", "building", "ready", and "failed". * @param list $vars site variables. * @param int $timeout site request timeout in seconds. * @param string $installCommand the install command used to install the site dependencies. diff --git a/src/Appwrite/Models/Table.php b/src/Appwrite/Models/Table.php index b5db6d0..cd7c800 100644 --- a/src/Appwrite/Models/Table.php +++ b/src/Appwrite/Models/Table.php @@ -35,7 +35,7 @@ * @param array $permissions table permissions. [learn more about permissions](https://appwrite.io/docs/permissions). * @param string $databaseId database id. * @param string $name table name. - * @param bool $enabled table enabled. can be 'enabled' or 'disabled'. when disabled, the table is inaccessible to users, but remains accessible to server sdks using api keys. + * @param bool $enabled table enabled. can be 'enabled' or 'disabled'. when disabled, the table is inaccessible to users, but remains accessible to server sdks using api keys. * @param bool $rowSecurity whether row-level permissions are enabled. [learn more about permissions](https://appwrite.io/docs/permissions). * @param array $columns table columns. * @param list $indexes table indexes. diff --git a/src/Appwrite/Models/Variable.php b/src/Appwrite/Models/Variable.php index a010b9d..c609eef 100644 --- a/src/Appwrite/Models/Variable.php +++ b/src/Appwrite/Models/Variable.php @@ -27,8 +27,8 @@ * @param string $key variable key. * @param string $value variable value. * @param bool $secret variable secret flag. secret variables can only be updated or deleted, but never read. - * @param string $resourceType service to which the variable belongs. possible values are "project", "function" - * @param string $resourceId id of resource to which the variable belongs. if resourcetype is "project", it is empty. if resourcetype is "function", it is id of the function. + * @param string $resourceType service to which the variable belongs. possible values are "project", "function" + * @param string $resourceId id of resource to which the variable belongs. if resourcetype is "project", it is empty. if resourcetype is "function", it is id of the function. */ public function __construct( public string $id, diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 91a68dd..78eb902 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -12,10 +12,10 @@ class Account extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get the currently logged in user. diff --git a/src/Appwrite/Services/Activities.php b/src/Appwrite/Services/Activities.php index d1aecb5..5d09bcb 100644 --- a/src/Appwrite/Services/Activities.php +++ b/src/Appwrite/Services/Activities.php @@ -9,10 +9,10 @@ class Activities extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * List all events for selected filters. diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php index f3de7c3..71184f1 100644 --- a/src/Appwrite/Services/Avatars.php +++ b/src/Appwrite/Services/Avatars.php @@ -16,10 +16,10 @@ class Avatars extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * You can use this endpoint to show different browser icons to your users. diff --git a/src/Appwrite/Services/Backups.php b/src/Appwrite/Services/Backups.php index f850ed3..1d21081 100644 --- a/src/Appwrite/Services/Backups.php +++ b/src/Appwrite/Services/Backups.php @@ -10,10 +10,10 @@ class Backups extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * List all archives for a project. diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 816d194..ce718dc 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -13,10 +13,10 @@ class Databases extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all databases from the current Appwrite project. You can use diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index b2f7d6d..fcc035b 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -15,10 +15,10 @@ class Functions extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all the project's functions. You can use the query params to diff --git a/src/Appwrite/Services/Graphql.php b/src/Appwrite/Services/Graphql.php index 7df7a94..e412caf 100644 --- a/src/Appwrite/Services/Graphql.php +++ b/src/Appwrite/Services/Graphql.php @@ -9,10 +9,10 @@ class Graphql extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Execute a GraphQL mutation. diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index 84a0422..f37e094 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -10,10 +10,10 @@ class Health extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Check the Appwrite HTTP server is up and responsive. diff --git a/src/Appwrite/Services/Locale.php b/src/Appwrite/Services/Locale.php index 8019808..ae2e44d 100644 --- a/src/Appwrite/Services/Locale.php +++ b/src/Appwrite/Services/Locale.php @@ -9,10 +9,10 @@ class Locale extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get the current user location based on IP. Returns an object with user diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index d5d8fd8..3b2fe2a 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -11,10 +11,10 @@ class Messaging extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all messages from the current Appwrite project. diff --git a/src/Appwrite/Services/Project.php b/src/Appwrite/Services/Project.php index fca2f75..e82fbb6 100644 --- a/src/Appwrite/Services/Project.php +++ b/src/Appwrite/Services/Project.php @@ -9,10 +9,10 @@ class Project extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all project environment variables. diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index db8f18d..b656a52 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -15,10 +15,10 @@ class Sites extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all the project's sites. You can use the query params to diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 3a0cb17..bcc245b 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -12,10 +12,10 @@ class Storage extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all the storage buckets. You can use the query params to diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index cfab672..391a8ba 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -13,10 +13,10 @@ class TablesDB extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all databases from the current Appwrite project. You can use diff --git a/src/Appwrite/Services/Teams.php b/src/Appwrite/Services/Teams.php index 5f2f3c4..9060489 100644 --- a/src/Appwrite/Services/Teams.php +++ b/src/Appwrite/Services/Teams.php @@ -9,10 +9,10 @@ class Teams extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all the teams in which the current user is a member. You can diff --git a/src/Appwrite/Services/Tokens.php b/src/Appwrite/Services/Tokens.php index fac89ab..684d650 100644 --- a/src/Appwrite/Services/Tokens.php +++ b/src/Appwrite/Services/Tokens.php @@ -9,10 +9,10 @@ class Tokens extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * List all the tokens created for a specific file or bucket. You can use the diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index bd01c8a..9779252 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -12,10 +12,10 @@ class Users extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all the project's users. You can use the query params to diff --git a/src/Appwrite/Services/Webhooks.php b/src/Appwrite/Services/Webhooks.php index 5d6e81e..4ad755d 100644 --- a/src/Appwrite/Services/Webhooks.php +++ b/src/Appwrite/Services/Webhooks.php @@ -9,10 +9,10 @@ class Webhooks extends Service { - public function __construct(Client $client) - { - parent::__construct($client); - } + public function __construct(Client $client) + { + parent::__construct($client); + } /** * Get a list of all webhooks belonging to the project. You can use the query From e51956ae43e7b5a932d2f7c4c38e8f39e50684a3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 3 Apr 2026 18:37:10 +0530 Subject: [PATCH 3/5] chore: update PHP SDK to 22.0.0 --- tests/Appwrite/Services/AccountTest.php | 1919 ++++++++--------- tests/Appwrite/Services/ActivitiesTest.php | 169 +- tests/Appwrite/Services/AvatarsTest.php | 73 +- tests/Appwrite/Services/BackupsTest.php | 391 ++-- tests/Appwrite/Services/DatabasesTest.php | 2271 ++++++++++---------- tests/Appwrite/Services/FunctionsTest.php | 1409 ++++++------ tests/Appwrite/Services/GraphqlTest.php | 22 +- tests/Appwrite/Services/HealthTest.php | 479 ++--- tests/Appwrite/Services/LocaleTest.php | 240 ++- tests/Appwrite/Services/MessagingTest.php | 1579 +++++++------- tests/Appwrite/Services/ProjectTest.php | 143 +- tests/Appwrite/Services/SitesTest.php | 1377 ++++++------ tests/Appwrite/Services/StorageTest.php | 393 ++-- tests/Appwrite/Services/TablesDBTest.php | 2271 ++++++++++---------- tests/Appwrite/Services/TeamsTest.php | 363 ++-- tests/Appwrite/Services/TokensTest.php | 132 +- tests/Appwrite/Services/UsersTest.php | 1958 ++++++++--------- tests/Appwrite/Services/WebhooksTest.php | 223 +- 18 files changed, 7821 insertions(+), 7591 deletions(-) diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index 01af207..65a2fc4 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -10,86 +10,89 @@ use Appwrite\Enums\AuthenticationFactor; use Appwrite\Enums\OAuthProvider; -final class AccountTest extends TestCase { +final class AccountTest extends TestCase +{ private $client; private $account; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->account = new Account($this->client); } - public function testMethodGet(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->get( - ); - - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodCreate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $response = $this->account->get(); + + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodCreate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -101,39 +104,40 @@ public function testMethodCreate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodUpdateEmail(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodUpdateEmail(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -144,39 +148,40 @@ public function testMethodUpdateEmail(): void { "password" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodListIdentities(): void { - - $data = array("total" => 5 -,"identities" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"provider" => "email" -,"providerUid" => "5e5bb8c16897e" -,"providerEmail" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodListIdentities(): void + { + $data = array( + "total" => 5, + "identities" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "provider" => "email", + "providerUid" => "5e5bb8c16897e", + "providerEmail" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->listIdentities( - ); + $response = $this->account->listIdentities(); - $this->assertInstanceOf(\Appwrite\Models\IdentityList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\IdentityList::class, $response); + } - public function testMethodDeleteIdentity(): void { - + public function testMethodDeleteIdentity(): void + { $data = ''; $this->client @@ -187,94 +192,95 @@ public function testMethodDeleteIdentity(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodCreateJWT(): void { - - $data = array("jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" -) -; + public function testMethodCreateJWT(): void + { + $data = array( + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->createJWT( - ); - - $this->assertInstanceOf(\Appwrite\Models\Jwt::class, $response); - } - - public function testMethodListLogs(): void { - - $data = array("total" => 5 -,"logs" => array(array("event" => "account.sessions.create" -,"userId" => "610fc2f985ee0" -,"userEmail" => "john@appwrite.io" -,"userName" => "John Doe" -,"mode" => "admin" -,"ip" => "127.0.0.1" -,"time" => "2020-10-15T06:38:00.000+00:00" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -) -) - ) -; + $response = $this->account->createJWT(); + + $this->assertInstanceOf(\Appwrite\Models\Jwt::class, $response); + } + + public function testMethodListLogs(): void + { + $data = array( + "total" => 5, + "logs" => array( + array( + "event" => "account.sessions.create", + "userId" => "610fc2f985ee0", + "userEmail" => "john@appwrite.io", + "userName" => "John Doe", + "mode" => "admin", + "ip" => "127.0.0.1", + "time" => "2020-10-15T06:38:00.000+00:00", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->listLogs( - ); - - $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); - } - - public function testMethodUpdateMFA(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $response = $this->account->listLogs(); + + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } + + public function testMethodUpdateMFA(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -284,15 +290,15 @@ public function testMethodUpdateMFA(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodCreateMFAAuthenticator(): void { - - $data = array("secret" => "[SHARED_SECRET]" -,"uri" => "otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite" -) -; + public function testMethodCreateMFAAuthenticator(): void + { + $data = array( + "secret" => "[SHARED_SECRET]", + "uri" => "otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -302,39 +308,40 @@ public function testMethodCreateMFAAuthenticator(): void { AuthenticatorType::TOTP() ); - $this->assertInstanceOf(\Appwrite\Models\MfaType::class, $response); - } - - public function testMethodUpdateMFAAuthenticator(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\MfaType::class, $response); + } + + public function testMethodUpdateMFAAuthenticator(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -345,11 +352,11 @@ public function testMethodUpdateMFAAuthenticator(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodDeleteMFAAuthenticator(): void { - + public function testMethodDeleteMFAAuthenticator(): void + { $data = ''; $this->client @@ -360,17 +367,17 @@ public function testMethodDeleteMFAAuthenticator(): void { AuthenticatorType::TOTP() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodCreateMFAChallenge(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"expire" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateMFAChallenge(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "expire" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -380,42 +387,42 @@ public function testMethodCreateMFAChallenge(): void { AuthenticationFactor::EMAIL() ); - $this->assertInstanceOf(\Appwrite\Models\MfaChallenge::class, $response); - } - - public function testMethodUpdateMFAChallenge(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\MfaChallenge::class, $response); + } + + public function testMethodUpdateMFAChallenge(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -426,106 +433,103 @@ public function testMethodUpdateMFAChallenge(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } - public function testMethodListMFAFactors(): void { - - $data = array("totp" => true -,"phone" => true -,"email" => true -,"recoveryCode" => true -) -; + public function testMethodListMFAFactors(): void + { + $data = array( + "totp" => true, + "phone" => true, + "email" => true, + "recoveryCode" => true + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->listMFAFactors( - ); + $response = $this->account->listMFAFactors(); - $this->assertInstanceOf(\Appwrite\Models\MfaFactors::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaFactors::class, $response); + } - public function testMethodGetMFARecoveryCodes(): void { - - $data = array("recoveryCodes" => array() -) -; + public function testMethodGetMFARecoveryCodes(): void + { + $data = array( + "recoveryCodes" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->getMFARecoveryCodes( - ); + $response = $this->account->getMFARecoveryCodes(); - $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } - public function testMethodCreateMFARecoveryCodes(): void { - - $data = array("recoveryCodes" => array() -) -; + public function testMethodCreateMFARecoveryCodes(): void + { + $data = array( + "recoveryCodes" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->createMFARecoveryCodes( - ); + $response = $this->account->createMFARecoveryCodes(); - $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } - public function testMethodUpdateMFARecoveryCodes(): void { - - $data = array("recoveryCodes" => array() -) -; + public function testMethodUpdateMFARecoveryCodes(): void + { + $data = array( + "recoveryCodes" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->updateMFARecoveryCodes( - ); - - $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); - } - - public function testMethodUpdateName(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $response = $this->account->updateMFARecoveryCodes(); + + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } + + public function testMethodUpdateName(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -535,39 +539,40 @@ public function testMethodUpdateName(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodUpdatePassword(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodUpdatePassword(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -577,39 +582,40 @@ public function testMethodUpdatePassword(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodUpdatePhone(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodUpdatePhone(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -620,54 +626,53 @@ public function testMethodUpdatePhone(): void { "password" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodGetPrefs(): void { - - $data = array() -; + public function testMethodGetPrefs(): void + { + $data = array(); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->getPrefs( - ); - - $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); - } - - public function testMethodUpdatePrefs(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $response = $this->account->getPrefs(); + + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } + + public function testMethodUpdatePrefs(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -677,19 +682,19 @@ public function testMethodUpdatePrefs(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodCreateRecovery(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodCreateRecovery(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -700,19 +705,19 @@ public function testMethodCreateRecovery(): void { "https://example.com" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodUpdateRecovery(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodUpdateRecovery(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -724,147 +729,146 @@ public function testMethodUpdateRecovery(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } - - public function testMethodListSessions(): void { - - $data = array("total" => 5 -,"sessions" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } + + public function testMethodListSessions(): void + { + $data = array( + "total" => 5, + "sessions" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->listSessions( - ); + $response = $this->account->listSessions(); - $this->assertInstanceOf(\Appwrite\Models\SessionList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\SessionList::class, $response); + } - public function testMethodDeleteSessions(): void { - + public function testMethodDeleteSessions(): void + { $data = ''; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->deleteSessions( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateAnonymousSession(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $response = $this->account->deleteSessions(); + + $this->assertSame($data, $response); + } + + public function testMethodCreateAnonymousSession(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->createAnonymousSession( - ); - - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } - - public function testMethodCreateEmailPasswordSession(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $response = $this->account->createAnonymousSession(); + + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } + + public function testMethodCreateEmailPasswordSession(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -875,42 +879,42 @@ public function testMethodCreateEmailPasswordSession(): void { "password" ); - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } - - public function testMethodUpdateMagicURLSession(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } + + public function testMethodUpdateMagicURLSession(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -921,42 +925,42 @@ public function testMethodUpdateMagicURLSession(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } - - public function testMethodUpdatePhoneSession(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } + + public function testMethodUpdatePhoneSession(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -967,42 +971,42 @@ public function testMethodUpdatePhoneSession(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } - - public function testMethodCreateSession(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } + + public function testMethodCreateSession(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1013,42 +1017,42 @@ public function testMethodCreateSession(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } - - public function testMethodGetSession(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } + + public function testMethodGetSession(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1058,42 +1062,42 @@ public function testMethodGetSession(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } - - public function testMethodUpdateSession(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } + + public function testMethodUpdateSession(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1103,11 +1107,11 @@ public function testMethodUpdateSession(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } - public function testMethodDeleteSession(): void { - + public function testMethodDeleteSession(): void + { $data = ''; $this->client @@ -1118,60 +1122,60 @@ public function testMethodDeleteSession(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateStatus(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateStatus(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->updateStatus( - ); + $response = $this->account->updateStatus(); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodCreateEmailToken(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodCreateEmailToken(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1182,19 +1186,19 @@ public function testMethodCreateEmailToken(): void { "email@example.com" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodCreateMagicURLToken(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodCreateMagicURLToken(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1205,11 +1209,11 @@ public function testMethodCreateMagicURLToken(): void { "email@example.com" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodCreateOAuth2Token(): void { - + public function testMethodCreateOAuth2Token(): void + { $data = ''; $this->client @@ -1220,19 +1224,19 @@ public function testMethodCreateOAuth2Token(): void { OAuthProvider::AMAZON() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodCreatePhoneToken(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodCreatePhoneToken(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1243,19 +1247,19 @@ public function testMethodCreatePhoneToken(): void { "+12065550100" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodCreateEmailVerification(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodCreateEmailVerification(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1265,19 +1269,19 @@ public function testMethodCreateEmailVerification(): void { "https://example.com" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodCreateVerification(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodCreateVerification(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1287,19 +1291,19 @@ public function testMethodCreateVerification(): void { "https://example.com" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodUpdateEmailVerification(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodUpdateEmailVerification(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1310,19 +1314,19 @@ public function testMethodUpdateEmailVerification(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodUpdateVerification(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodUpdateVerification(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1333,40 +1337,39 @@ public function testMethodUpdateVerification(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodCreatePhoneVerification(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodCreatePhoneVerification(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->account->createPhoneVerification( - ); + $response = $this->account->createPhoneVerification(); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } - public function testMethodUpdatePhoneVerification(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodUpdatePhoneVerification(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1377,7 +1380,7 @@ public function testMethodUpdatePhoneVerification(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } } diff --git a/tests/Appwrite/Services/ActivitiesTest.php b/tests/Appwrite/Services/ActivitiesTest.php index bdd346e..caa1067 100644 --- a/tests/Appwrite/Services/ActivitiesTest.php +++ b/tests/Appwrite/Services/ActivitiesTest.php @@ -7,101 +7,104 @@ use Mockery; use PHPUnit\Framework\TestCase; -final class ActivitiesTest extends TestCase { +final class ActivitiesTest extends TestCase +{ private $client; private $activities; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->activities = new Activities($this->client); } - public function testMethodListEvents(): void { - - $data = array("total" => 5 -,"events" => array(array("\$id" => "5e5ea5c16897e" -,"userType" => "user" -,"userId" => "610fc2f985ee0" -,"userEmail" => "john@appwrite.io" -,"userName" => "John Doe" -,"resourceParent" => "database/ID" -,"resourceType" => "collection" -,"resourceId" => "610fc2f985ee0" -,"resource" => "collections/610fc2f985ee0" -,"event" => "account.sessions.create" -,"userAgent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" -,"ip" => "127.0.0.1" -,"mode" => "admin" -,"country" => "US" -,"time" => "2020-10-15T06:38:00.000+00:00" -,"projectId" => "610fc2f985ee0" -,"teamId" => "610fc2f985ee0" -,"hostname" => "appwrite.io" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -) -) - ) -; + public function testMethodListEvents(): void + { + $data = array( + "total" => 5, + "events" => array( + array( + "\$id" => "5e5ea5c16897e", + "userType" => "user", + "userId" => "610fc2f985ee0", + "userEmail" => "john@appwrite.io", + "userName" => "John Doe", + "resourceParent" => "database/ID", + "resourceType" => "collection", + "resourceId" => "610fc2f985ee0", + "resource" => "collections/610fc2f985ee0", + "event" => "account.sessions.create", + "userAgent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36", + "ip" => "127.0.0.1", + "mode" => "admin", + "country" => "US", + "time" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "610fc2f985ee0", + "teamId" => "610fc2f985ee0", + "hostname" => "appwrite.io", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->activities->listEvents( - ); + $response = $this->activities->listEvents(); - $this->assertInstanceOf(\Appwrite\Models\ActivityEventList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ActivityEventList::class, $response); + } - public function testMethodGetEvent(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"userType" => "user" -,"userId" => "610fc2f985ee0" -,"userEmail" => "john@appwrite.io" -,"userName" => "John Doe" -,"resourceParent" => "database/ID" -,"resourceType" => "collection" -,"resourceId" => "610fc2f985ee0" -,"resource" => "collections/610fc2f985ee0" -,"event" => "account.sessions.create" -,"userAgent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" -,"ip" => "127.0.0.1" -,"mode" => "admin" -,"country" => "US" -,"time" => "2020-10-15T06:38:00.000+00:00" -,"projectId" => "610fc2f985ee0" -,"teamId" => "610fc2f985ee0" -,"hostname" => "appwrite.io" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -) -; + public function testMethodGetEvent(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "userType" => "user", + "userId" => "610fc2f985ee0", + "userEmail" => "john@appwrite.io", + "userName" => "John Doe", + "resourceParent" => "database/ID", + "resourceType" => "collection", + "resourceId" => "610fc2f985ee0", + "resource" => "collections/610fc2f985ee0", + "event" => "account.sessions.create", + "userAgent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36", + "ip" => "127.0.0.1", + "mode" => "admin", + "country" => "US", + "time" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "610fc2f985ee0", + "teamId" => "610fc2f985ee0", + "hostname" => "appwrite.io", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -111,7 +114,7 @@ public function testMethodGetEvent(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ActivityEvent::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ActivityEvent::class, $response); + } } diff --git a/tests/Appwrite/Services/AvatarsTest.php b/tests/Appwrite/Services/AvatarsTest.php index 6ce0a6d..caf80ee 100644 --- a/tests/Appwrite/Services/AvatarsTest.php +++ b/tests/Appwrite/Services/AvatarsTest.php @@ -14,17 +14,19 @@ use Appwrite\Enums\BrowserPermission; use Appwrite\Enums\ImageFormat; -final class AvatarsTest extends TestCase { +final class AvatarsTest extends TestCase +{ private $client; private $avatars; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->avatars = new Avatars($this->client); } - public function testMethodGetBrowser(): void { - + public function testMethodGetBrowser(): void + { $data = ''; $this->client @@ -35,11 +37,11 @@ public function testMethodGetBrowser(): void { Browser::AVANTBROWSER() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetCreditCard(): void { - + public function testMethodGetCreditCard(): void + { $data = ''; $this->client @@ -50,11 +52,11 @@ public function testMethodGetCreditCard(): void { CreditCard::AMERICANEXPRESS() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetFavicon(): void { - + public function testMethodGetFavicon(): void + { $data = ''; $this->client @@ -65,11 +67,11 @@ public function testMethodGetFavicon(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetFlag(): void { - + public function testMethodGetFlag(): void + { $data = ''; $this->client @@ -80,11 +82,11 @@ public function testMethodGetFlag(): void { Flag::AFGHANISTAN() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetImage(): void { - + public function testMethodGetImage(): void + { $data = ''; $this->client @@ -95,25 +97,24 @@ public function testMethodGetImage(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetInitials(): void { - + public function testMethodGetInitials(): void + { $data = ''; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->avatars->getInitials( - ); + $response = $this->avatars->getInitials(); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetQR(): void { - + public function testMethodGetQR(): void + { $data = ''; $this->client @@ -124,11 +125,11 @@ public function testMethodGetQR(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetScreenshot(): void { - + public function testMethodGetScreenshot(): void + { $data = ''; $this->client @@ -139,7 +140,7 @@ public function testMethodGetScreenshot(): void { "https://example.com" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/BackupsTest.php b/tests/Appwrite/Services/BackupsTest.php index cb05146..8c20148 100644 --- a/tests/Appwrite/Services/BackupsTest.php +++ b/tests/Appwrite/Services/BackupsTest.php @@ -8,57 +8,60 @@ use PHPUnit\Framework\TestCase; use Appwrite\Enums\BackupServices; -final class BackupsTest extends TestCase { +final class BackupsTest extends TestCase +{ private $client; private $backups; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->backups = new Backups($this->client); } - public function testMethodListArchives(): void { - - $data = array("total" => 5 -,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"policyId" => "did8jx6ws45jana098ab7" -,"size" => 100000 -,"status" => "completed" -,"startedAt" => "2020-10-15T06:38:00.000+00:00" -,"migrationId" => "did8jx6ws45jana098ab7" -,"services" => array() -,"resources" => array() -) -) - ) -; + public function testMethodListArchives(): void + { + $data = array( + "total" => 5, + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->backups->listArchives( - ); + $response = $this->backups->listArchives(); - $this->assertInstanceOf(\Appwrite\Models\BackupArchiveList::class, $response); - } - - public function testMethodCreateArchive(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"policyId" => "did8jx6ws45jana098ab7" -,"size" => 100000 -,"status" => "completed" -,"startedAt" => "2020-10-15T06:38:00.000+00:00" -,"migrationId" => "did8jx6ws45jana098ab7" -,"services" => array() -,"resources" => array() -) -; + $this->assertInstanceOf(\Appwrite\Models\BackupArchiveList::class, $response); + } + + public function testMethodCreateArchive(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -68,23 +71,23 @@ public function testMethodCreateArchive(): void { array(BackupServices::DATABASES()) ); - $this->assertInstanceOf(\Appwrite\Models\BackupArchive::class, $response); - } - - public function testMethodGetArchive(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"policyId" => "did8jx6ws45jana098ab7" -,"size" => 100000 -,"status" => "completed" -,"startedAt" => "2020-10-15T06:38:00.000+00:00" -,"migrationId" => "did8jx6ws45jana098ab7" -,"services" => array() -,"resources" => array() -) -; + $this->assertInstanceOf(\Appwrite\Models\BackupArchive::class, $response); + } + + public function testMethodGetArchive(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -94,11 +97,11 @@ public function testMethodGetArchive(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\BackupArchive::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupArchive::class, $response); + } - public function testMethodDeleteArchive(): void { - + public function testMethodDeleteArchive(): void + { $data = ''; $this->client @@ -109,49 +112,50 @@ public function testMethodDeleteArchive(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListPolicies(): void { - - $data = array("total" => 5 -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"name" => "Hourly backups" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"services" => array() -,"resources" => array() -,"retention" => 7 -,"schedule" => "0 * * * *" -,"enabled" => true -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListPolicies(): void + { + $data = array( + "total" => 5, + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->backups->listPolicies( - ); + $response = $this->backups->listPolicies(); - $this->assertInstanceOf(\Appwrite\Models\BackupPolicyList::class, $response); - } - - public function testMethodCreatePolicy(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "Hourly backups" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"services" => array() -,"resources" => array() -,"retention" => 7 -,"schedule" => "0 * * * *" -,"enabled" => true -) -; + $this->assertInstanceOf(\Appwrite\Models\BackupPolicyList::class, $response); + } + + public function testMethodCreatePolicy(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -164,22 +168,22 @@ public function testMethodCreatePolicy(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); - } - - public function testMethodGetPolicy(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "Hourly backups" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"services" => array() -,"resources" => array() -,"retention" => 7 -,"schedule" => "0 * * * *" -,"enabled" => true -) -; + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + + public function testMethodGetPolicy(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -189,22 +193,22 @@ public function testMethodGetPolicy(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); - } - - public function testMethodUpdatePolicy(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "Hourly backups" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"services" => array() -,"resources" => array() -,"retention" => 7 -,"schedule" => "0 * * * *" -,"enabled" => true -) -; + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + + public function testMethodUpdatePolicy(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -214,11 +218,11 @@ public function testMethodUpdatePolicy(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } - public function testMethodDeletePolicy(): void { - + public function testMethodDeletePolicy(): void + { $data = ''; $this->client @@ -229,24 +233,24 @@ public function testMethodDeletePolicy(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodCreateRestoration(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"archiveId" => "did8jx6ws45jana098ab7" -,"policyId" => "did8jx6ws45jana098ab7" -,"status" => "completed" -,"startedAt" => "2020-10-15T06:38:00.000+00:00" -,"migrationId" => "did8jx6ws45jana098ab7" -,"services" => array() -,"resources" => array() -,"options" => "{databases.database[{oldId, newId, newName}]}" -) -; + $this->assertSame($data, $response); + } + + public function testMethodCreateRestoration(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "archiveId" => "did8jx6ws45jana098ab7", + "policyId" => "did8jx6ws45jana098ab7", + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array(), + "options" => "{databases.database[{oldId, newId, newName}]}" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -257,53 +261,54 @@ public function testMethodCreateRestoration(): void { array(BackupServices::DATABASES()) ); - $this->assertInstanceOf(\Appwrite\Models\BackupRestoration::class, $response); - } - - public function testMethodListRestorations(): void { - - $data = array("total" => 5 -,"restorations" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"archiveId" => "did8jx6ws45jana098ab7" -,"policyId" => "did8jx6ws45jana098ab7" -,"status" => "completed" -,"startedAt" => "2020-10-15T06:38:00.000+00:00" -,"migrationId" => "did8jx6ws45jana098ab7" -,"services" => array() -,"resources" => array() -,"options" => "{databases.database[{oldId, newId, newName}]}" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\BackupRestoration::class, $response); + } + + public function testMethodListRestorations(): void + { + $data = array( + "total" => 5, + "restorations" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "archiveId" => "did8jx6ws45jana098ab7", + "policyId" => "did8jx6ws45jana098ab7", + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array(), + "options" => "{databases.database[{oldId, newId, newName}]}" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->backups->listRestorations( - ); + $response = $this->backups->listRestorations(); - $this->assertInstanceOf(\Appwrite\Models\BackupRestorationList::class, $response); - } - - public function testMethodGetRestoration(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"archiveId" => "did8jx6ws45jana098ab7" -,"policyId" => "did8jx6ws45jana098ab7" -,"status" => "completed" -,"startedAt" => "2020-10-15T06:38:00.000+00:00" -,"migrationId" => "did8jx6ws45jana098ab7" -,"services" => array() -,"resources" => array() -,"options" => "{databases.database[{oldId, newId, newName}]}" -) -; + $this->assertInstanceOf(\Appwrite\Models\BackupRestorationList::class, $response); + } + + public function testMethodGetRestoration(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "archiveId" => "did8jx6ws45jana098ab7", + "policyId" => "did8jx6ws45jana098ab7", + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array(), + "options" => "{databases.database[{oldId, newId, newName}]}" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -313,7 +318,7 @@ public function testMethodGetRestoration(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\BackupRestoration::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\BackupRestoration::class, $response); + } } diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index 373a749..5432604 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -11,119 +11,134 @@ use Appwrite\Enums\DatabasesIndexType; use Appwrite\Enums\OrderBy; -final class DatabasesTest extends TestCase { +final class DatabasesTest extends TestCase +{ private $client; private $databases; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->databases = new Databases($this->client); } - public function testMethodList(): void { - - $data = array("total" => 5 -,"databases" => array(array("\$id" => "5e5ea5c16897e" -,"name" => "My Database" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"enabled" => true -,"type" => "legacy" -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -) - ) -; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->list( - ); - - $this->assertInstanceOf(\Appwrite\Models\DatabaseList::class, $response); - } - - public function testMethodCreate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "My Database" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"enabled" => true -,"type" => "legacy" -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -; + public function testMethodList(): void + { + $data = array( + "total" => 5, + "databases" => array( + array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->list(); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseList::class, $response); + } + + public function testMethodCreate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -134,64 +149,64 @@ public function testMethodCreate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } - public function testMethodListTransactions(): void { - - $data = array("total" => 5 -,"transactions" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -) - ) -; + public function testMethodListTransactions(): void + { + $data = array( + "total" => 5, + "transactions" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->databases->listTransactions( - ); + $response = $this->databases->listTransactions(); - $this->assertInstanceOf(\Appwrite\Models\TransactionList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TransactionList::class, $response); + } - public function testMethodCreateTransaction(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateTransaction(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->databases->createTransaction( - ); + $response = $this->databases->createTransaction(); - $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } - public function testMethodGetTransaction(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodGetTransaction(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -201,19 +216,19 @@ public function testMethodGetTransaction(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } - public function testMethodUpdateTransaction(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateTransaction(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -223,11 +238,11 @@ public function testMethodUpdateTransaction(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } - public function testMethodDeleteTransaction(): void { - + public function testMethodDeleteTransaction(): void + { $data = ''; $this->client @@ -238,19 +253,19 @@ public function testMethodDeleteTransaction(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodCreateOperations(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateOperations(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -260,54 +275,60 @@ public function testMethodCreateOperations(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); - } - - public function testMethodGet(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "My Database" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"enabled" => true -,"type" => "legacy" -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -317,54 +338,60 @@ public function testMethodGet(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); - } - - public function testMethodUpdate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "My Database" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"enabled" => true -,"type" => "legacy" -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } + + public function testMethodUpdate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -374,11 +401,11 @@ public function testMethodUpdate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -389,38 +416,42 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListCollections(): void { - - $data = array("total" => 5 -,"collections" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListCollections(): void + { + $data = array( + "total" => 5, + "collections" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -430,35 +461,37 @@ public function testMethodListCollections(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\CollectionList::class, $response); - } - - public function testMethodCreateCollection(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -; + $this->assertInstanceOf(\Appwrite\Models\CollectionList::class, $response); + } + + public function testMethodCreateCollection(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -470,35 +503,37 @@ public function testMethodCreateCollection(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); - } - - public function testMethodGetCollection(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -; + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } + + public function testMethodGetCollection(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -509,35 +544,37 @@ public function testMethodGetCollection(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); - } - - public function testMethodUpdateCollection(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -; + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } + + public function testMethodUpdateCollection(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -548,11 +585,11 @@ public function testMethodUpdateCollection(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } - public function testMethodDeleteCollection(): void { - + public function testMethodDeleteCollection(): void + { $data = ''; $this->client @@ -564,15 +601,15 @@ public function testMethodDeleteCollection(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodListAttributes(): void { - - $data = array("total" => 5 -,"attributes" => array() -) -; + public function testMethodListAttributes(): void + { + $data = array( + "total" => 5, + "attributes" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -583,20 +620,20 @@ public function testMethodListAttributes(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeList::class, $response); + } - public function testMethodCreateBooleanAttribute(): void { - - $data = array("key" => "isEnabled" -,"type" => "boolean" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateBooleanAttribute(): void + { + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -609,20 +646,20 @@ public function testMethodCreateBooleanAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); + } - public function testMethodUpdateBooleanAttribute(): void { - - $data = array("key" => "isEnabled" -,"type" => "boolean" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateBooleanAttribute(): void + { + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -636,21 +673,21 @@ public function testMethodUpdateBooleanAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); + } - public function testMethodCreateDatetimeAttribute(): void { - - $data = array("key" => "birthDay" -,"type" => "datetime" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "datetime" -) -; + public function testMethodCreateDatetimeAttribute(): void + { + $data = array( + "key" => "birthDay", + "type" => "datetime", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "datetime" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -663,21 +700,21 @@ public function testMethodCreateDatetimeAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeDatetime::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeDatetime::class, $response); + } - public function testMethodUpdateDatetimeAttribute(): void { - - $data = array("key" => "birthDay" -,"type" => "datetime" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "datetime" -) -; + public function testMethodUpdateDatetimeAttribute(): void + { + $data = array( + "key" => "birthDay", + "type" => "datetime", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "datetime" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -691,21 +728,21 @@ public function testMethodUpdateDatetimeAttribute(): void { "2020-10-15T06:38:00.000+00:00" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeDatetime::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeDatetime::class, $response); + } - public function testMethodCreateEmailAttribute(): void { - - $data = array("key" => "userEmail" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "email" -) -; + public function testMethodCreateEmailAttribute(): void + { + $data = array( + "key" => "userEmail", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "email" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -718,21 +755,21 @@ public function testMethodCreateEmailAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeEmail::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeEmail::class, $response); + } - public function testMethodUpdateEmailAttribute(): void { - - $data = array("key" => "userEmail" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "email" -) -; + public function testMethodUpdateEmailAttribute(): void + { + $data = array( + "key" => "userEmail", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "email" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -746,22 +783,22 @@ public function testMethodUpdateEmailAttribute(): void { "email@example.com" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeEmail::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeEmail::class, $response); + } - public function testMethodCreateEnumAttribute(): void { - - $data = array("key" => "status" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"elements" => array() -,"format" => "enum" -) -; + public function testMethodCreateEnumAttribute(): void + { + $data = array( + "key" => "status", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "elements" => array(), + "format" => "enum" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -775,22 +812,22 @@ public function testMethodCreateEnumAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeEnum::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeEnum::class, $response); + } - public function testMethodUpdateEnumAttribute(): void { - - $data = array("key" => "status" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"elements" => array() -,"format" => "enum" -) -; + public function testMethodUpdateEnumAttribute(): void + { + $data = array( + "key" => "status", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "elements" => array(), + "format" => "enum" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -805,20 +842,20 @@ public function testMethodUpdateEnumAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeEnum::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeEnum::class, $response); + } - public function testMethodCreateFloatAttribute(): void { - - $data = array("key" => "percentageCompleted" -,"type" => "double" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateFloatAttribute(): void + { + $data = array( + "key" => "percentageCompleted", + "type" => "double", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -831,20 +868,20 @@ public function testMethodCreateFloatAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeFloat::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeFloat::class, $response); + } - public function testMethodUpdateFloatAttribute(): void { - - $data = array("key" => "percentageCompleted" -,"type" => "double" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateFloatAttribute(): void + { + $data = array( + "key" => "percentageCompleted", + "type" => "double", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -858,20 +895,20 @@ public function testMethodUpdateFloatAttribute(): void { 1.0 ); - $this->assertInstanceOf(\Appwrite\Models\AttributeFloat::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeFloat::class, $response); + } - public function testMethodCreateIntegerAttribute(): void { - - $data = array("key" => "count" -,"type" => "integer" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateIntegerAttribute(): void + { + $data = array( + "key" => "count", + "type" => "integer", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -884,20 +921,20 @@ public function testMethodCreateIntegerAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeInteger::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeInteger::class, $response); + } - public function testMethodUpdateIntegerAttribute(): void { - - $data = array("key" => "count" -,"type" => "integer" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateIntegerAttribute(): void + { + $data = array( + "key" => "count", + "type" => "integer", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -911,21 +948,21 @@ public function testMethodUpdateIntegerAttribute(): void { 1 ); - $this->assertInstanceOf(\Appwrite\Models\AttributeInteger::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeInteger::class, $response); + } - public function testMethodCreateIpAttribute(): void { - - $data = array("key" => "ipAddress" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "ip" -) -; + public function testMethodCreateIpAttribute(): void + { + $data = array( + "key" => "ipAddress", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "ip" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -938,21 +975,21 @@ public function testMethodCreateIpAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeIp::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeIp::class, $response); + } - public function testMethodUpdateIpAttribute(): void { - - $data = array("key" => "ipAddress" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "ip" -) -; + public function testMethodUpdateIpAttribute(): void + { + $data = array( + "key" => "ipAddress", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "ip" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -966,20 +1003,20 @@ public function testMethodUpdateIpAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeIp::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeIp::class, $response); + } - public function testMethodCreateLineAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateLineAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -992,20 +1029,20 @@ public function testMethodCreateLineAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeLine::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeLine::class, $response); + } - public function testMethodUpdateLineAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateLineAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1018,20 +1055,20 @@ public function testMethodUpdateLineAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeLine::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeLine::class, $response); + } - public function testMethodCreateLongtextAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateLongtextAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1044,20 +1081,20 @@ public function testMethodCreateLongtextAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeLongtext::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeLongtext::class, $response); + } - public function testMethodUpdateLongtextAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateLongtextAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1071,20 +1108,20 @@ public function testMethodUpdateLongtextAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeLongtext::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeLongtext::class, $response); + } - public function testMethodCreateMediumtextAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateMediumtextAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1097,20 +1134,20 @@ public function testMethodCreateMediumtextAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeMediumtext::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeMediumtext::class, $response); + } - public function testMethodUpdateMediumtextAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateMediumtextAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1124,20 +1161,20 @@ public function testMethodUpdateMediumtextAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeMediumtext::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeMediumtext::class, $response); + } - public function testMethodCreatePointAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreatePointAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1150,20 +1187,20 @@ public function testMethodCreatePointAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributePoint::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributePoint::class, $response); + } - public function testMethodUpdatePointAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdatePointAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1176,20 +1213,20 @@ public function testMethodUpdatePointAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributePoint::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributePoint::class, $response); + } - public function testMethodCreatePolygonAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreatePolygonAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1202,20 +1239,20 @@ public function testMethodCreatePolygonAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributePolygon::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributePolygon::class, $response); + } - public function testMethodUpdatePolygonAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdatePolygonAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1228,26 +1265,26 @@ public function testMethodUpdatePolygonAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributePolygon::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributePolygon::class, $response); + } - public function testMethodCreateRelationshipAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"relatedCollection" => "collection" -,"relationType" => "oneToOne|oneToMany|manyToOne|manyToMany" -,"twoWay" => true -,"twoWayKey" => "string" -,"onDelete" => "restrict|cascade|setNull" -,"side" => "parent|child" -) -; + public function testMethodCreateRelationshipAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "relatedCollection" => "collection", + "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", + "twoWay" => true, + "twoWayKey" => "string", + "onDelete" => "restrict|cascade|setNull", + "side" => "parent|child" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1260,26 +1297,26 @@ public function testMethodCreateRelationshipAttribute(): void { RelationshipType::ONETOONE() ); - $this->assertInstanceOf(\Appwrite\Models\AttributeRelationship::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeRelationship::class, $response); + } - public function testMethodUpdateRelationshipAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"relatedCollection" => "collection" -,"relationType" => "oneToOne|oneToMany|manyToOne|manyToMany" -,"twoWay" => true -,"twoWayKey" => "string" -,"onDelete" => "restrict|cascade|setNull" -,"side" => "parent|child" -) -; + public function testMethodUpdateRelationshipAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "relatedCollection" => "collection", + "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", + "twoWay" => true, + "twoWayKey" => "string", + "onDelete" => "restrict|cascade|setNull", + "side" => "parent|child" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1291,21 +1328,21 @@ public function testMethodUpdateRelationshipAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeRelationship::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeRelationship::class, $response); + } - public function testMethodCreateStringAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"size" => 128 -) -; + public function testMethodCreateStringAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1319,21 +1356,21 @@ public function testMethodCreateStringAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeString::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeString::class, $response); + } - public function testMethodUpdateStringAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"size" => 128 -) -; + public function testMethodUpdateStringAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1347,20 +1384,20 @@ public function testMethodUpdateStringAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeString::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeString::class, $response); + } - public function testMethodCreateTextAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateTextAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1373,20 +1410,20 @@ public function testMethodCreateTextAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeText::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeText::class, $response); + } - public function testMethodUpdateTextAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateTextAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1400,21 +1437,21 @@ public function testMethodUpdateTextAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeText::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeText::class, $response); + } - public function testMethodCreateUrlAttribute(): void { - - $data = array("key" => "githubUrl" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "url" -) -; + public function testMethodCreateUrlAttribute(): void + { + $data = array( + "key" => "githubUrl", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "url" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1427,21 +1464,21 @@ public function testMethodCreateUrlAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeUrl::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeUrl::class, $response); + } - public function testMethodUpdateUrlAttribute(): void { - - $data = array("key" => "githubUrl" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "url" -) -; + public function testMethodUpdateUrlAttribute(): void + { + $data = array( + "key" => "githubUrl", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "url" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1455,21 +1492,21 @@ public function testMethodUpdateUrlAttribute(): void { "https://example.com" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeUrl::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeUrl::class, $response); + } - public function testMethodCreateVarcharAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"size" => 128 -) -; + public function testMethodCreateVarcharAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1483,21 +1520,21 @@ public function testMethodCreateVarcharAttribute(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\AttributeVarchar::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeVarchar::class, $response); + } - public function testMethodUpdateVarcharAttribute(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"size" => 128 -) -; + public function testMethodUpdateVarcharAttribute(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1511,20 +1548,20 @@ public function testMethodUpdateVarcharAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeVarchar::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeVarchar::class, $response); + } - public function testMethodGetAttribute(): void { - - $data = array("key" => "isEnabled" -,"type" => "boolean" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodGetAttribute(): void + { + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1536,11 +1573,11 @@ public function testMethodGetAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\AttributeBoolean::class, $response); + } - public function testMethodDeleteAttribute(): void { - + public function testMethodDeleteAttribute(): void + { $data = ''; $this->client @@ -1553,23 +1590,25 @@ public function testMethodDeleteAttribute(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodListDocuments(): void { - - $data = array("total" => 5 -,"documents" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodListDocuments(): void + { + $data = array( + "total" => 5, + "documents" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1580,20 +1619,20 @@ public function testMethodListDocuments(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } - public function testMethodCreateDocument(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodCreateDocument(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1606,23 +1645,25 @@ public function testMethodCreateDocument(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } - public function testMethodCreateDocuments(): void { - - $data = array("total" => 5 -,"documents" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodCreateDocuments(): void + { + $data = array( + "total" => 5, + "documents" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1634,23 +1675,25 @@ public function testMethodCreateDocuments(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } - public function testMethodUpsertDocuments(): void { - - $data = array("total" => 5 -,"documents" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodUpsertDocuments(): void + { + $data = array( + "total" => 5, + "documents" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1662,23 +1705,25 @@ public function testMethodUpsertDocuments(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } - public function testMethodUpdateDocuments(): void { - - $data = array("total" => 5 -,"documents" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodUpdateDocuments(): void + { + $data = array( + "total" => 5, + "documents" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1689,23 +1734,25 @@ public function testMethodUpdateDocuments(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } - public function testMethodDeleteDocuments(): void { - - $data = array("total" => 5 -,"documents" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodDeleteDocuments(): void + { + $data = array( + "total" => 5, + "documents" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1716,20 +1763,20 @@ public function testMethodDeleteDocuments(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } - public function testMethodGetDocument(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodGetDocument(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1741,20 +1788,20 @@ public function testMethodGetDocument(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } - public function testMethodUpsertDocument(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodUpsertDocument(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1766,20 +1813,20 @@ public function testMethodUpsertDocument(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } - public function testMethodUpdateDocument(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodUpdateDocument(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1791,11 +1838,11 @@ public function testMethodUpdateDocument(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } - public function testMethodDeleteDocument(): void { - + public function testMethodDeleteDocument(): void + { $data = ''; $this->client @@ -1808,20 +1855,20 @@ public function testMethodDeleteDocument(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodDecrementDocumentAttribute(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodDecrementDocumentAttribute(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1834,20 +1881,20 @@ public function testMethodDecrementDocumentAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } - public function testMethodIncrementDocumentAttribute(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$collectionId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodIncrementDocumentAttribute(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1860,25 +1907,27 @@ public function testMethodIncrementDocumentAttribute(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } - public function testMethodListIndexes(): void { - - $data = array("total" => 5 -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ) -; + public function testMethodListIndexes(): void + { + $data = array( + "total" => 5, + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1889,22 +1938,22 @@ public function testMethodListIndexes(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\IndexList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\IndexList::class, $response); + } - public function testMethodCreateIndex(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -; + public function testMethodCreateIndex(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1918,22 +1967,22 @@ public function testMethodCreateIndex(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); + } - public function testMethodGetIndex(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -; + public function testMethodGetIndex(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1945,11 +1994,11 @@ public function testMethodGetIndex(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); + } - public function testMethodDeleteIndex(): void { - + public function testMethodDeleteIndex(): void + { $data = ''; $this->client @@ -1962,7 +2011,7 @@ public function testMethodDeleteIndex(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index aec3c76..988c1b6 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -13,115 +13,122 @@ use Appwrite\Enums\DeploymentDownloadType; use Appwrite\Enums\ExecutionMethod; -final class FunctionsTest extends TestCase { +final class FunctionsTest extends TestCase +{ private $client; private $functions; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->functions = new Functions($this->client); } - public function testMethodList(): void { - - $data = array("total" => 5 -,"functions" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"execute" => array() -,"name" => "My Function" -,"enabled" => true -,"live" => true -,"logging" => true -,"runtime" => "python-3.8" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"scopes" => array() -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"events" => array() -,"schedule" => "5 4 * * *" -,"timeout" => 300 -,"entrypoint" => "index.js" -,"commands" => "npm install" -,"version" => "v2" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "functions/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -) -) - ) -; + public function testMethodList(): void + { + $data = array( + "total" => 5, + "functions" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "scopes" => array(), + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->functions->list( - ); - - $this->assertInstanceOf(\Appwrite\Models\FunctionList::class, $response); - } - - public function testMethodCreate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"execute" => array() -,"name" => "My Function" -,"enabled" => true -,"live" => true -,"logging" => true -,"runtime" => "python-3.8" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"scopes" => array() -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"events" => array() -,"schedule" => "5 4 * * *" -,"timeout" => 300 -,"entrypoint" => "index.js" -,"commands" => "npm install" -,"version" => "v2" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "functions/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -) -; + $response = $this->functions->list(); + + $this->assertInstanceOf(\Appwrite\Models\FunctionList::class, $response); + } + + public function testMethodCreate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "scopes" => array(), + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -133,100 +140,104 @@ public function testMethodCreate(): void { Runtime::NODE145() ); - $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); - } - - public function testMethodListRuntimes(): void { - - $data = array("total" => 5 -,"runtimes" => array(array("\$id" => "python-3.8" -,"key" => "python" -,"name" => "Python" -,"version" => "3.8" -,"base" => "python:3.8-alpine" -,"image" => "appwrite\\/runtime-for-python:3.8" -,"logo" => "python.png" -,"supports" => array() -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); + } + + public function testMethodListRuntimes(): void + { + $data = array( + "total" => 5, + "runtimes" => array( + array( + "\$id" => "python-3.8", + "key" => "python", + "name" => "Python", + "version" => "3.8", + "base" => "python:3.8-alpine", + "image" => "appwrite\\/runtime-for-python:3.8", + "logo" => "python.png", + "supports" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->functions->listRuntimes( - ); + $response = $this->functions->listRuntimes(); - $this->assertInstanceOf(\Appwrite\Models\RuntimeList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RuntimeList::class, $response); + } - public function testMethodListSpecifications(): void { - - $data = array("total" => 5 -,"specifications" => array(array("memory" => 512 -,"cpus" => 1 -,"enabled" => true -,"slug" => "s-1vcpu-512mb" -) -) - ) -; + public function testMethodListSpecifications(): void + { + $data = array( + "total" => 5, + "specifications" => array( + array( + "memory" => 512, + "cpus" => 1, + "enabled" => true, + "slug" => "s-1vcpu-512mb" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->functions->listSpecifications( - ); - - $this->assertInstanceOf(\Appwrite\Models\SpecificationList::class, $response); - } - - public function testMethodGet(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"execute" => array() -,"name" => "My Function" -,"enabled" => true -,"live" => true -,"logging" => true -,"runtime" => "python-3.8" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"scopes" => array() -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"events" => array() -,"schedule" => "5 4 * * *" -,"timeout" => 300 -,"entrypoint" => "index.js" -,"commands" => "npm install" -,"version" => "v2" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "functions/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -) -; + $response = $this->functions->listSpecifications(); + + $this->assertInstanceOf(\Appwrite\Models\SpecificationList::class, $response); + } + + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "scopes" => array(), + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -236,52 +247,54 @@ public function testMethodGet(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); - } - - public function testMethodUpdate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"execute" => array() -,"name" => "My Function" -,"enabled" => true -,"live" => true -,"logging" => true -,"runtime" => "python-3.8" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"scopes" => array() -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"events" => array() -,"schedule" => "5 4 * * *" -,"timeout" => 300 -,"entrypoint" => "index.js" -,"commands" => "npm install" -,"version" => "v2" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "functions/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -) -; + $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); + } + + public function testMethodUpdate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "scopes" => array(), + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -292,11 +305,11 @@ public function testMethodUpdate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -307,52 +320,54 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateFunctionDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"execute" => array() -,"name" => "My Function" -,"enabled" => true -,"live" => true -,"logging" => true -,"runtime" => "python-3.8" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"scopes" => array() -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"events" => array() -,"schedule" => "5 4 * * *" -,"timeout" => 300 -,"entrypoint" => "index.js" -,"commands" => "npm install" -,"version" => "v2" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "functions/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateFunctionDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "scopes" => array(), + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -363,43 +378,45 @@ public function testMethodUpdateFunctionDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); - } - - public function testMethodListDeployments(): void { - - $data = array("total" => 5 -,"deployments" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\FunctionModel::class, $response); + } + + public function testMethodListDeployments(): void + { + $data = array( + "total" => 5, + "deployments" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -409,40 +426,40 @@ public function testMethodListDeployments(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\DeploymentList::class, $response); - } - - public function testMethodCreateDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\DeploymentList::class, $response); + } + + public function testMethodCreateDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -450,44 +467,44 @@ public function testMethodCreateDeployment(): void { $response = $this->functions->createDeployment( "", - InputFile::withData('', "image/png"), + InputFile::withData('', 'image/png'), true ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodCreateDuplicateDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodCreateDuplicateDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -498,40 +515,40 @@ public function testMethodCreateDuplicateDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodCreateTemplateDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodCreateTemplateDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -546,40 +563,40 @@ public function testMethodCreateTemplateDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodCreateVcsDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodCreateVcsDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -591,40 +608,40 @@ public function testMethodCreateVcsDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodGetDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodGetDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -635,11 +652,11 @@ public function testMethodGetDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } - public function testMethodDeleteDeployment(): void { - + public function testMethodDeleteDeployment(): void + { $data = ''; $this->client @@ -651,11 +668,11 @@ public function testMethodDeleteDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetDeploymentDownload(): void { - + public function testMethodGetDeploymentDownload(): void + { $data = ''; $this->client @@ -667,40 +684,40 @@ public function testMethodGetDeploymentDownload(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateDeploymentStatus(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateDeploymentStatus(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -711,39 +728,45 @@ public function testMethodUpdateDeploymentStatus(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodListExecutions(): void { - - $data = array("total" => 5 -,"executions" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"functionId" => "5e5ea6g16897e" -,"deploymentId" => "5e5ea5c16897e" -,"trigger" => "http" -,"status" => "waiting" -,"requestMethod" => "GET" -,"requestPath" => "/articles?id=5" -,"requestHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"responseStatusCode" => 200 -,"responseBody" => "[RESPONSEBODY]" -,"responseHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"logs" => "[LOGS]" -,"errors" => "[ERRORS]" -,"duration" => 0.4 -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodListExecutions(): void + { + $data = array( + "total" => 5, + "executions" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "functionId" => "5e5ea6g16897e", + "deploymentId" => "5e5ea5c16897e", + "trigger" => "http", + "status" => "waiting", + "requestMethod" => "GET", + "requestPath" => "/articles?id=5", + "requestHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "responseStatusCode" => 200, + "responseBody" => "[RESPONSEBODY]", + "responseHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "logs" => "[LOGS]", + "errors" => "[ERRORS]", + "duration" => 0.4 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -753,36 +776,40 @@ public function testMethodListExecutions(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ExecutionList::class, $response); - } - - public function testMethodCreateExecution(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"functionId" => "5e5ea6g16897e" -,"deploymentId" => "5e5ea5c16897e" -,"trigger" => "http" -,"status" => "waiting" -,"requestMethod" => "GET" -,"requestPath" => "/articles?id=5" -,"requestHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"responseStatusCode" => 200 -,"responseBody" => "[RESPONSEBODY]" -,"responseHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"logs" => "[LOGS]" -,"errors" => "[ERRORS]" -,"duration" => 0.4 -) -; + $this->assertInstanceOf(\Appwrite\Models\ExecutionList::class, $response); + } + + public function testMethodCreateExecution(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "functionId" => "5e5ea6g16897e", + "deploymentId" => "5e5ea5c16897e", + "trigger" => "http", + "status" => "waiting", + "requestMethod" => "GET", + "requestPath" => "/articles?id=5", + "requestHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "responseStatusCode" => 200, + "responseBody" => "[RESPONSEBODY]", + "responseHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "logs" => "[LOGS]", + "errors" => "[ERRORS]", + "duration" => 0.4 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -792,36 +819,40 @@ public function testMethodCreateExecution(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); - } - - public function testMethodGetExecution(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"functionId" => "5e5ea6g16897e" -,"deploymentId" => "5e5ea5c16897e" -,"trigger" => "http" -,"status" => "waiting" -,"requestMethod" => "GET" -,"requestPath" => "/articles?id=5" -,"requestHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"responseStatusCode" => 200 -,"responseBody" => "[RESPONSEBODY]" -,"responseHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"logs" => "[LOGS]" -,"errors" => "[ERRORS]" -,"duration" => 0.4 -) -; + $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); + } + + public function testMethodGetExecution(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "functionId" => "5e5ea6g16897e", + "deploymentId" => "5e5ea5c16897e", + "trigger" => "http", + "status" => "waiting", + "requestMethod" => "GET", + "requestPath" => "/articles?id=5", + "requestHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "responseStatusCode" => 200, + "responseBody" => "[RESPONSEBODY]", + "responseHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "logs" => "[LOGS]", + "errors" => "[ERRORS]", + "duration" => 0.4 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -832,11 +863,11 @@ public function testMethodGetExecution(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); + } - public function testMethodDeleteExecution(): void { - + public function testMethodDeleteExecution(): void + { $data = ''; $this->client @@ -848,24 +879,26 @@ public function testMethodDeleteExecution(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListVariables(): void { - - $data = array("total" => 5 -,"variables" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListVariables(): void + { + $data = array( + "total" => 5, + "variables" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -875,21 +908,21 @@ public function testMethodListVariables(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); + } - public function testMethodCreateVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + public function testMethodCreateVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -901,21 +934,21 @@ public function testMethodCreateVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } - public function testMethodGetVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + public function testMethodGetVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -926,21 +959,21 @@ public function testMethodGetVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } - public function testMethodUpdateVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + public function testMethodUpdateVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -952,11 +985,11 @@ public function testMethodUpdateVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } - public function testMethodDeleteVariable(): void { - + public function testMethodDeleteVariable(): void + { $data = ''; $this->client @@ -968,7 +1001,7 @@ public function testMethodDeleteVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/GraphqlTest.php b/tests/Appwrite/Services/GraphqlTest.php index 6422466..0ffb26f 100644 --- a/tests/Appwrite/Services/GraphqlTest.php +++ b/tests/Appwrite/Services/GraphqlTest.php @@ -7,17 +7,19 @@ use Mockery; use PHPUnit\Framework\TestCase; -final class GraphqlTest extends TestCase { +final class GraphqlTest extends TestCase +{ private $client; private $graphql; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->graphql = new Graphql($this->client); } - public function testMethodQuery(): void { - + public function testMethodQuery(): void + { $data = array(); $this->client @@ -28,11 +30,11 @@ public function testMethodQuery(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodMutation(): void { - + public function testMethodMutation(): void + { $data = array(); $this->client @@ -43,7 +45,7 @@ public function testMethodMutation(): void { array() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php index 17ae667..6d86f92 100644 --- a/tests/Appwrite/Services/HealthTest.php +++ b/tests/Appwrite/Services/HealthTest.php @@ -8,237 +8,233 @@ use PHPUnit\Framework\TestCase; use Appwrite\Enums\Name; -final class HealthTest extends TestCase { +final class HealthTest extends TestCase +{ private $client; private $health; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->health = new Health($this->client); } - public function testMethodGet(): void { - - $data = array("name" => "database" -,"ping" => 128 -,"status" => "pass" -) -; + public function testMethodGet(): void + { + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->get( - ); + $response = $this->health->get(); - $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); + } - public function testMethodGetAntivirus(): void { - - $data = array("version" => "1.0.0" -,"status" => "disabled" -) -; + public function testMethodGetAntivirus(): void + { + $data = array( + "version" => "1.0.0", + "status" => "disabled" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getAntivirus( - ); + $response = $this->health->getAntivirus(); - $this->assertInstanceOf(\Appwrite\Models\HealthAntivirus::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthAntivirus::class, $response); + } - public function testMethodGetCache(): void { - - $data = array("total" => 5 -,"statuses" => array(array("name" => "database" -,"ping" => 128 -,"status" => "pass" -) -) - ) -; + public function testMethodGetCache(): void + { + $data = array( + "total" => 5, + "statuses" => array( + array( + "name" => "database", + "ping" => 128, + "status" => "pass" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getCache( - ); + $response = $this->health->getCache(); - $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); + } - public function testMethodGetCertificate(): void { - - $data = array("name" => "/CN=www.google.com" -,"subjectSN" => "[SUBJECTSN]" -,"issuerOrganisation" => "[ISSUERORGANISATION]" -,"validFrom" => "1704200998" -,"validTo" => "1711458597" -,"signatureTypeSN" => "RSA-SHA256" -) -; + public function testMethodGetCertificate(): void + { + $data = array( + "name" => "/CN=www.google.com", + "subjectSN" => "[SUBJECTSN]", + "issuerOrganisation" => "[ISSUERORGANISATION]", + "validFrom" => "1704200998", + "validTo" => "1711458597", + "signatureTypeSN" => "RSA-SHA256" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getCertificate( - ); + $response = $this->health->getCertificate(); - $this->assertInstanceOf(\Appwrite\Models\HealthCertificate::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthCertificate::class, $response); + } - public function testMethodGetConsolePausing(): void { - - $data = array("name" => "database" -,"ping" => 128 -,"status" => "pass" -) -; + public function testMethodGetConsolePausing(): void + { + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getConsolePausing( - ); + $response = $this->health->getConsolePausing(); - $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); + } - public function testMethodGetDB(): void { - - $data = array("total" => 5 -,"statuses" => array(array("name" => "database" -,"ping" => 128 -,"status" => "pass" -) -) - ) -; + public function testMethodGetDB(): void + { + $data = array( + "total" => 5, + "statuses" => array( + array( + "name" => "database", + "ping" => 128, + "status" => "pass" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getDB( - ); + $response = $this->health->getDB(); - $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); + } - public function testMethodGetPubSub(): void { - - $data = array("total" => 5 -,"statuses" => array(array("name" => "database" -,"ping" => 128 -,"status" => "pass" -) -) - ) -; + public function testMethodGetPubSub(): void + { + $data = array( + "total" => 5, + "statuses" => array( + array( + "name" => "database", + "ping" => 128, + "status" => "pass" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getPubSub( - ); + $response = $this->health->getPubSub(); - $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatusList::class, $response); + } - public function testMethodGetQueueAudits(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueAudits(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueAudits( - ); + $response = $this->health->getQueueAudits(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueBuilds(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueBuilds(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueBuilds( - ); + $response = $this->health->getQueueBuilds(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueCertificates(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueCertificates(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueCertificates( - ); + $response = $this->health->getQueueCertificates(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueDatabases(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueDatabases(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueDatabases( - ); + $response = $this->health->getQueueDatabases(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueDeletes(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueDeletes(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueDeletes( - ); + $response = $this->health->getQueueDeletes(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetFailedJobs(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetFailedJobs(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -248,189 +244,178 @@ public function testMethodGetFailedJobs(): void { Name::V1DATABASE() ); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueFunctions(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueFunctions(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueFunctions( - ); + $response = $this->health->getQueueFunctions(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueLogs(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueLogs(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueLogs( - ); + $response = $this->health->getQueueLogs(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueMails(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueMails(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueMails( - ); + $response = $this->health->getQueueMails(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueMessaging(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueMessaging(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueMessaging( - ); + $response = $this->health->getQueueMessaging(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueMigrations(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueMigrations(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueMigrations( - ); + $response = $this->health->getQueueMigrations(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueStatsResources(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueStatsResources(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueStatsResources( - ); + $response = $this->health->getQueueStatsResources(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueUsage(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueUsage(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueUsage( - ); + $response = $this->health->getQueueUsage(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetQueueWebhooks(): void { - - $data = array("size" => 8 -) -; + public function testMethodGetQueueWebhooks(): void + { + $data = array( + "size" => 8 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getQueueWebhooks( - ); + $response = $this->health->getQueueWebhooks(); - $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthQueue::class, $response); + } - public function testMethodGetStorage(): void { - - $data = array("name" => "database" -,"ping" => 128 -,"status" => "pass" -) -; + public function testMethodGetStorage(): void + { + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getStorage( - ); + $response = $this->health->getStorage(); - $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); + } - public function testMethodGetStorageLocal(): void { - - $data = array("name" => "database" -,"ping" => 128 -,"status" => "pass" -) -; + public function testMethodGetStorageLocal(): void + { + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getStorageLocal( - ); + $response = $this->health->getStorageLocal(); - $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthStatus::class, $response); + } - public function testMethodGetTime(): void { - - $data = array("remoteTime" => 1639490751 -,"localTime" => 1639490844 -,"diff" => 93 -) -; + public function testMethodGetTime(): void + { + $data = array( + "remoteTime" => 1639490751, + "localTime" => 1639490844, + "diff" => 93 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->health->getTime( - ); + $response = $this->health->getTime(); - $this->assertInstanceOf(\Appwrite\Models\HealthTime::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\HealthTime::class, $response); + } } diff --git a/tests/Appwrite/Services/LocaleTest.php b/tests/Appwrite/Services/LocaleTest.php index ea71838..549f3f2 100644 --- a/tests/Appwrite/Services/LocaleTest.php +++ b/tests/Appwrite/Services/LocaleTest.php @@ -7,182 +7,190 @@ use Mockery; use PHPUnit\Framework\TestCase; -final class LocaleTest extends TestCase { +final class LocaleTest extends TestCase +{ private $client; private $locale; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->locale = new Locale($this->client); } - public function testMethodGet(): void { - - $data = array("ip" => "127.0.0.1" -,"countryCode" => "US" -,"country" => "United States" -,"continentCode" => "NA" -,"continent" => "North America" -,"eu" => true -,"currency" => "USD" -) -; + public function testMethodGet(): void + { + $data = array( + "ip" => "127.0.0.1", + "countryCode" => "US", + "country" => "United States", + "continentCode" => "NA", + "continent" => "North America", + "eu" => true, + "currency" => "USD" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->locale->get( - ); + $response = $this->locale->get(); - $this->assertInstanceOf(\Appwrite\Models\Locale::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Locale::class, $response); + } - public function testMethodListCodes(): void { - - $data = array("total" => 5 -,"localeCodes" => array(array("code" => "en-us" -,"name" => "US" -) -) - ) -; + public function testMethodListCodes(): void + { + $data = array( + "total" => 5, + "localeCodes" => array( + array( + "code" => "en-us", + "name" => "US" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->locale->listCodes( - ); + $response = $this->locale->listCodes(); - $this->assertInstanceOf(\Appwrite\Models\LocaleCodeList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LocaleCodeList::class, $response); + } - public function testMethodListContinents(): void { - - $data = array("total" => 5 -,"continents" => array(array("name" => "Europe" -,"code" => "EU" -) -) - ) -; + public function testMethodListContinents(): void + { + $data = array( + "total" => 5, + "continents" => array( + array( + "name" => "Europe", + "code" => "EU" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->locale->listContinents( - ); + $response = $this->locale->listContinents(); - $this->assertInstanceOf(\Appwrite\Models\ContinentList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ContinentList::class, $response); + } - public function testMethodListCountries(): void { - - $data = array("total" => 5 -,"countries" => array(array("name" => "United States" -,"code" => "US" -) -) - ) -; + public function testMethodListCountries(): void + { + $data = array( + "total" => 5, + "countries" => array( + array( + "name" => "United States", + "code" => "US" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->locale->listCountries( - ); + $response = $this->locale->listCountries(); - $this->assertInstanceOf(\Appwrite\Models\CountryList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\CountryList::class, $response); + } - public function testMethodListCountriesEU(): void { - - $data = array("total" => 5 -,"countries" => array(array("name" => "United States" -,"code" => "US" -) -) - ) -; + public function testMethodListCountriesEU(): void + { + $data = array( + "total" => 5, + "countries" => array( + array( + "name" => "United States", + "code" => "US" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->locale->listCountriesEU( - ); + $response = $this->locale->listCountriesEU(); - $this->assertInstanceOf(\Appwrite\Models\CountryList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\CountryList::class, $response); + } - public function testMethodListCountriesPhones(): void { - - $data = array("total" => 5 -,"phones" => array(array("code" => "+1" -,"countryCode" => "US" -,"countryName" => "United States" -) -) - ) -; + public function testMethodListCountriesPhones(): void + { + $data = array( + "total" => 5, + "phones" => array( + array( + "code" => "+1", + "countryCode" => "US", + "countryName" => "United States" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->locale->listCountriesPhones( - ); + $response = $this->locale->listCountriesPhones(); + + $this->assertInstanceOf(\Appwrite\Models\PhoneList::class, $response); + } - $this->assertInstanceOf(\Appwrite\Models\PhoneList::class, $response); - } - - public function testMethodListCurrencies(): void { - - $data = array("total" => 5 -,"currencies" => array(array("symbol" => "\$" -,"name" => "US dollar" -,"symbolNative" => "\$" -,"decimalDigits" => 2 -,"rounding" => 0 -,"code" => "USD" -,"namePlural" => "US dollars" -) -) - ) -; + public function testMethodListCurrencies(): void + { + $data = array( + "total" => 5, + "currencies" => array( + array( + "symbol" => "\$", + "name" => "US dollar", + "symbolNative" => "\$", + "decimalDigits" => 2, + "rounding" => 0, + "code" => "USD", + "namePlural" => "US dollars" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->locale->listCurrencies( - ); + $response = $this->locale->listCurrencies(); - $this->assertInstanceOf(\Appwrite\Models\CurrencyList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\CurrencyList::class, $response); + } - public function testMethodListLanguages(): void { - - $data = array("total" => 5 -,"languages" => array(array("name" => "Italian" -,"code" => "it" -,"nativeName" => "Italiano" -) -) - ) -; + public function testMethodListLanguages(): void + { + $data = array( + "total" => 5, + "languages" => array( + array( + "name" => "Italian", + "code" => "it", + "nativeName" => "Italiano" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->locale->listLanguages( - ); + $response = $this->locale->listLanguages(); - $this->assertInstanceOf(\Appwrite\Models\LanguageList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\LanguageList::class, $response); + } } diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php index f420373..f1bcb19 100644 --- a/tests/Appwrite/Services/MessagingTest.php +++ b/tests/Appwrite/Services/MessagingTest.php @@ -9,57 +9,60 @@ use Appwrite\Enums\MessagePriority; use Appwrite\Enums\SmtpEncryption; -final class MessagingTest extends TestCase { +final class MessagingTest extends TestCase +{ private $client; private $messaging; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->messaging = new Messaging($this->client); } - public function testMethodListMessages(): void { - - $data = array("total" => 5 -,"messages" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"providerType" => "email" -,"topics" => array() -,"users" => array() -,"targets" => array() -,"deliveredTotal" => 1 -,"data" => array() -,"status" => "draft" -) -) - ) -; + public function testMethodListMessages(): void + { + $data = array( + "total" => 5, + "messages" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "draft" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->messaging->listMessages( - ); + $response = $this->messaging->listMessages(); - $this->assertInstanceOf(\Appwrite\Models\MessageList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MessageList::class, $response); + } - public function testMethodCreateEmail(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"providerType" => "email" -,"topics" => array() -,"users" => array() -,"targets" => array() -,"deliveredTotal" => 1 -,"data" => array() -,"status" => "draft" -) -; + public function testMethodCreateEmail(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "draft" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -71,23 +74,23 @@ public function testMethodCreateEmail(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); - } - - public function testMethodUpdateEmail(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"providerType" => "email" -,"topics" => array() -,"users" => array() -,"targets" => array() -,"deliveredTotal" => 1 -,"data" => array() -,"status" => "draft" -) -; + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } + + public function testMethodUpdateEmail(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "draft" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -97,23 +100,23 @@ public function testMethodUpdateEmail(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); - } - - public function testMethodCreatePush(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"providerType" => "email" -,"topics" => array() -,"users" => array() -,"targets" => array() -,"deliveredTotal" => 1 -,"data" => array() -,"status" => "draft" -) -; + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } + + public function testMethodCreatePush(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "draft" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -123,23 +126,23 @@ public function testMethodCreatePush(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); - } - - public function testMethodUpdatePush(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"providerType" => "email" -,"topics" => array() -,"users" => array() -,"targets" => array() -,"deliveredTotal" => 1 -,"data" => array() -,"status" => "draft" -) -; + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } + + public function testMethodUpdatePush(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "draft" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -149,23 +152,23 @@ public function testMethodUpdatePush(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); - } - - public function testMethodCreateSMS(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"providerType" => "email" -,"topics" => array() -,"users" => array() -,"targets" => array() -,"deliveredTotal" => 1 -,"data" => array() -,"status" => "draft" -) -; + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } + + public function testMethodCreateSMS(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "draft" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -176,23 +179,23 @@ public function testMethodCreateSMS(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); - } - - public function testMethodUpdateSMS(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"providerType" => "email" -,"topics" => array() -,"users" => array() -,"targets" => array() -,"deliveredTotal" => 1 -,"data" => array() -,"status" => "draft" -) -; + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } + + public function testMethodUpdateSMS(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "draft" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -202,23 +205,23 @@ public function testMethodUpdateSMS(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); - } - - public function testMethodGetMessage(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"providerType" => "email" -,"topics" => array() -,"users" => array() -,"targets" => array() -,"deliveredTotal" => 1 -,"data" => array() -,"status" => "draft" -) -; + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } + + public function testMethodGetMessage(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "draft" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -228,11 +231,11 @@ public function testMethodGetMessage(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Message::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -243,37 +246,39 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListMessageLogs(): void { - - $data = array("total" => 5 -,"logs" => array(array("event" => "account.sessions.create" -,"userId" => "610fc2f985ee0" -,"userEmail" => "john@appwrite.io" -,"userName" => "John Doe" -,"mode" => "admin" -,"ip" => "127.0.0.1" -,"time" => "2020-10-15T06:38:00.000+00:00" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListMessageLogs(): void + { + $data = array( + "total" => 5, + "logs" => array( + array( + "event" => "account.sessions.create", + "userId" => "610fc2f985ee0", + "userEmail" => "john@appwrite.io", + "userName" => "John Doe", + "mode" => "admin", + "ip" => "127.0.0.1", + "time" => "2020-10-15T06:38:00.000+00:00", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -283,24 +288,26 @@ public function testMethodListMessageLogs(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); - } - - public function testMethodListTargets(): void { - - $data = array("total" => 5 -,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } + + public function testMethodListTargets(): void + { + $data = array( + "total" => 5, + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -310,47 +317,48 @@ public function testMethodListTargets(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\TargetList::class, $response); - } - - public function testMethodListProviders(): void { - - $data = array("total" => 5 -,"providers" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\TargetList::class, $response); + } + + public function testMethodListProviders(): void + { + $data = array( + "total" => 5, + "providers" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->messaging->listProviders( - ); + $response = $this->messaging->listProviders(); - $this->assertInstanceOf(\Appwrite\Models\ProviderList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ProviderList::class, $response); + } - public function testMethodCreateAPNSProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateAPNSProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -361,21 +369,21 @@ public function testMethodCreateAPNSProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateAPNSProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateAPNSProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -385,21 +393,21 @@ public function testMethodUpdateAPNSProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateFCMProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateFCMProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -410,21 +418,21 @@ public function testMethodCreateFCMProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateFCMProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateFCMProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -434,21 +442,21 @@ public function testMethodUpdateFCMProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateMailgunProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateMailgunProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -459,21 +467,21 @@ public function testMethodCreateMailgunProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateMailgunProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateMailgunProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -483,21 +491,21 @@ public function testMethodUpdateMailgunProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateMsg91Provider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateMsg91Provider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -508,21 +516,21 @@ public function testMethodCreateMsg91Provider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateMsg91Provider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateMsg91Provider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -532,21 +540,21 @@ public function testMethodUpdateMsg91Provider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateResendProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateResendProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -557,21 +565,21 @@ public function testMethodCreateResendProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateResendProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateResendProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -581,21 +589,21 @@ public function testMethodUpdateResendProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateSendgridProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateSendgridProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -606,21 +614,21 @@ public function testMethodCreateSendgridProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateSendgridProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateSendgridProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -630,21 +638,21 @@ public function testMethodUpdateSendgridProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateSMTPProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateSMTPProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -656,21 +664,21 @@ public function testMethodCreateSMTPProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateSMTPProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateSMTPProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -680,21 +688,21 @@ public function testMethodUpdateSMTPProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateTelesignProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateTelesignProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -705,21 +713,21 @@ public function testMethodCreateTelesignProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateTelesignProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateTelesignProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -729,21 +737,21 @@ public function testMethodUpdateTelesignProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateTextmagicProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateTextmagicProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -754,21 +762,21 @@ public function testMethodCreateTextmagicProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateTextmagicProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateTextmagicProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -778,21 +786,21 @@ public function testMethodUpdateTextmagicProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateTwilioProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateTwilioProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -803,21 +811,21 @@ public function testMethodCreateTwilioProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateTwilioProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateTwilioProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -827,21 +835,21 @@ public function testMethodUpdateTwilioProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodCreateVonageProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodCreateVonageProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -852,21 +860,21 @@ public function testMethodCreateVonageProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodUpdateVonageProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodUpdateVonageProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -876,21 +884,21 @@ public function testMethodUpdateVonageProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodGetProvider(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Mailgun" -,"provider" => "mailgun" -,"enabled" => true -,"type" => "sms" -,"credentials" => array() -) -; + public function testMethodGetProvider(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -900,11 +908,11 @@ public function testMethodGetProvider(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } - public function testMethodDeleteProvider(): void { - + public function testMethodDeleteProvider(): void + { $data = ''; $this->client @@ -915,37 +923,39 @@ public function testMethodDeleteProvider(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListProviderLogs(): void { - - $data = array("total" => 5 -,"logs" => array(array("event" => "account.sessions.create" -,"userId" => "610fc2f985ee0" -,"userEmail" => "john@appwrite.io" -,"userName" => "John Doe" -,"mode" => "admin" -,"ip" => "127.0.0.1" -,"time" => "2020-10-15T06:38:00.000+00:00" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListProviderLogs(): void + { + $data = array( + "total" => 5, + "logs" => array( + array( + "event" => "account.sessions.create", + "userId" => "610fc2f985ee0", + "userEmail" => "john@appwrite.io", + "userName" => "John Doe", + "mode" => "admin", + "ip" => "127.0.0.1", + "time" => "2020-10-15T06:38:00.000+00:00", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -955,37 +965,39 @@ public function testMethodListProviderLogs(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); - } - - public function testMethodListSubscriberLogs(): void { - - $data = array("total" => 5 -,"logs" => array(array("event" => "account.sessions.create" -,"userId" => "610fc2f985ee0" -,"userEmail" => "john@appwrite.io" -,"userName" => "John Doe" -,"mode" => "admin" -,"ip" => "127.0.0.1" -,"time" => "2020-10-15T06:38:00.000+00:00" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } + + public function testMethodListSubscriberLogs(): void + { + $data = array( + "total" => 5, + "logs" => array( + array( + "event" => "account.sessions.create", + "userId" => "610fc2f985ee0", + "userEmail" => "john@appwrite.io", + "userName" => "John Doe", + "mode" => "admin", + "ip" => "127.0.0.1", + "time" => "2020-10-15T06:38:00.000+00:00", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -995,47 +1007,48 @@ public function testMethodListSubscriberLogs(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); - } - - public function testMethodListTopics(): void { - - $data = array("total" => 5 -,"topics" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "events" -,"emailTotal" => 100 -,"smsTotal" => 100 -,"pushTotal" => 100 -,"subscribe" => array() -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } + + public function testMethodListTopics(): void + { + $data = array( + "total" => 5, + "topics" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "events", + "emailTotal" => 100, + "smsTotal" => 100, + "pushTotal" => 100, + "subscribe" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->messaging->listTopics( - ); + $response = $this->messaging->listTopics(); - $this->assertInstanceOf(\Appwrite\Models\TopicList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TopicList::class, $response); + } - public function testMethodCreateTopic(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "events" -,"emailTotal" => 100 -,"smsTotal" => 100 -,"pushTotal" => 100 -,"subscribe" => array() -) -; + public function testMethodCreateTopic(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "events", + "emailTotal" => 100, + "smsTotal" => 100, + "pushTotal" => 100, + "subscribe" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1046,21 +1059,21 @@ public function testMethodCreateTopic(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); + } - public function testMethodGetTopic(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "events" -,"emailTotal" => 100 -,"smsTotal" => 100 -,"pushTotal" => 100 -,"subscribe" => array() -) -; + public function testMethodGetTopic(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "events", + "emailTotal" => 100, + "smsTotal" => 100, + "pushTotal" => 100, + "subscribe" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1070,21 +1083,21 @@ public function testMethodGetTopic(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); + } - public function testMethodUpdateTopic(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "events" -,"emailTotal" => 100 -,"smsTotal" => 100 -,"pushTotal" => 100 -,"subscribe" => array() -) -; + public function testMethodUpdateTopic(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "events", + "emailTotal" => 100, + "smsTotal" => 100, + "pushTotal" => 100, + "subscribe" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1094,11 +1107,11 @@ public function testMethodUpdateTopic(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Topic::class, $response); + } - public function testMethodDeleteTopic(): void { - + public function testMethodDeleteTopic(): void + { $data = ''; $this->client @@ -1109,37 +1122,39 @@ public function testMethodDeleteTopic(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListTopicLogs(): void { - - $data = array("total" => 5 -,"logs" => array(array("event" => "account.sessions.create" -,"userId" => "610fc2f985ee0" -,"userEmail" => "john@appwrite.io" -,"userName" => "John Doe" -,"mode" => "admin" -,"ip" => "127.0.0.1" -,"time" => "2020-10-15T06:38:00.000+00:00" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListTopicLogs(): void + { + $data = array( + "total" => 5, + "logs" => array( + array( + "event" => "account.sessions.create", + "userId" => "610fc2f985ee0", + "userEmail" => "john@appwrite.io", + "userName" => "John Doe", + "mode" => "admin", + "ip" => "127.0.0.1", + "time" => "2020-10-15T06:38:00.000+00:00", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1149,34 +1164,36 @@ public function testMethodListTopicLogs(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); - } - - public function testMethodListSubscribers(): void { - - $data = array("total" => 5 -,"subscribers" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"targetId" => "259125845563242502" -,"target" => array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) - - ,"userId" => "5e5ea5c16897e" -,"userName" => "Aegon Targaryen" -,"topicId" => "259125845563242502" -,"providerType" => "email" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } + + public function testMethodListSubscribers(): void + { + $data = array( + "total" => 5, + "subscribers" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "targetId" => "259125845563242502", + "target" => array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ), + "userId" => "5e5ea5c16897e", + "userName" => "Aegon Targaryen", + "topicId" => "259125845563242502", + "providerType" => "email" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1186,31 +1203,31 @@ public function testMethodListSubscribers(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\SubscriberList::class, $response); - } - - public function testMethodCreateSubscriber(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"targetId" => "259125845563242502" -,"target" => array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) - - ,"userId" => "5e5ea5c16897e" -,"userName" => "Aegon Targaryen" -,"topicId" => "259125845563242502" -,"providerType" => "email" -) -; + $this->assertInstanceOf(\Appwrite\Models\SubscriberList::class, $response); + } + + public function testMethodCreateSubscriber(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "targetId" => "259125845563242502", + "target" => array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ), + "userId" => "5e5ea5c16897e", + "userName" => "Aegon Targaryen", + "topicId" => "259125845563242502", + "providerType" => "email" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1222,31 +1239,31 @@ public function testMethodCreateSubscriber(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Subscriber::class, $response); - } - - public function testMethodGetSubscriber(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"targetId" => "259125845563242502" -,"target" => array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) - - ,"userId" => "5e5ea5c16897e" -,"userName" => "Aegon Targaryen" -,"topicId" => "259125845563242502" -,"providerType" => "email" -) -; + $this->assertInstanceOf(\Appwrite\Models\Subscriber::class, $response); + } + + public function testMethodGetSubscriber(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "targetId" => "259125845563242502", + "target" => array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ), + "userId" => "5e5ea5c16897e", + "userName" => "Aegon Targaryen", + "topicId" => "259125845563242502", + "providerType" => "email" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1257,11 +1274,11 @@ public function testMethodGetSubscriber(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Subscriber::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Subscriber::class, $response); + } - public function testMethodDeleteSubscriber(): void { - + public function testMethodDeleteSubscriber(): void + { $data = ''; $this->client @@ -1273,7 +1290,7 @@ public function testMethodDeleteSubscriber(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/ProjectTest.php b/tests/Appwrite/Services/ProjectTest.php index f5844eb..c6b648c 100644 --- a/tests/Appwrite/Services/ProjectTest.php +++ b/tests/Appwrite/Services/ProjectTest.php @@ -7,53 +7,56 @@ use Mockery; use PHPUnit\Framework\TestCase; -final class ProjectTest extends TestCase { +final class ProjectTest extends TestCase +{ private $client; private $project; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->project = new Project($this->client); } - public function testMethodListVariables(): void { - - $data = array("total" => 5 -,"variables" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ) -; + public function testMethodListVariables(): void + { + $data = array( + "total" => 5, + "variables" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->listVariables( - ); + $response = $this->project->listVariables(); - $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); - } - - public function testMethodCreateVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); + } + + public function testMethodCreateVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -65,21 +68,21 @@ public function testMethodCreateVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } - - public function testMethodGetVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } + + public function testMethodGetVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -89,21 +92,21 @@ public function testMethodGetVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } - - public function testMethodUpdateVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } + + public function testMethodUpdateVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -113,11 +116,11 @@ public function testMethodUpdateVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } - public function testMethodDeleteVariable(): void { - + public function testMethodDeleteVariable(): void + { $data = ''; $this->client @@ -128,7 +131,7 @@ public function testMethodDeleteVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index df73fb1..2fe7810 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -13,119 +13,126 @@ use Appwrite\Enums\VCSReferenceType; use Appwrite\Enums\DeploymentDownloadType; -final class SitesTest extends TestCase { +final class SitesTest extends TestCase +{ private $client; private $sites; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->sites = new Sites($this->client); } - public function testMethodList(): void { - - $data = array("total" => 5 -,"sites" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Site" -,"enabled" => true -,"live" => true -,"logging" => true -,"framework" => "react" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"deploymentScreenshotLight" => "5e5ea5c16897e" -,"deploymentScreenshotDark" => "5e5ea5c16897e" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"timeout" => 300 -,"installCommand" => "npm install" -,"buildCommand" => "npm run build" -,"startCommand" => "node custom-server.mjs" -,"outputDirectory" => "build" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "sites/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -,"buildRuntime" => "node-22" -,"adapter" => "static" -,"fallbackFile" => "index.html" -) -) - ) -; + public function testMethodList(): void + { + $data = array( + "total" => 5, + "sites" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Site", + "enabled" => true, + "live" => true, + "logging" => true, + "framework" => "react", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "deploymentScreenshotLight" => "5e5ea5c16897e", + "deploymentScreenshotDark" => "5e5ea5c16897e", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "timeout" => 300, + "installCommand" => "npm install", + "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", + "outputDirectory" => "build", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "sites/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", + "buildRuntime" => "node-22", + "adapter" => "static", + "fallbackFile" => "index.html" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->sites->list( - ); - - $this->assertInstanceOf(\Appwrite\Models\SiteList::class, $response); - } - - public function testMethodCreate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Site" -,"enabled" => true -,"live" => true -,"logging" => true -,"framework" => "react" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"deploymentScreenshotLight" => "5e5ea5c16897e" -,"deploymentScreenshotDark" => "5e5ea5c16897e" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"timeout" => 300 -,"installCommand" => "npm install" -,"buildCommand" => "npm run build" -,"startCommand" => "node custom-server.mjs" -,"outputDirectory" => "build" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "sites/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -,"buildRuntime" => "node-22" -,"adapter" => "static" -,"fallbackFile" => "index.html" -) -; + $response = $this->sites->list(); + + $this->assertInstanceOf(\Appwrite\Models\SiteList::class, $response); + } + + public function testMethodCreate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Site", + "enabled" => true, + "live" => true, + "logging" => true, + "framework" => "react", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "deploymentScreenshotLight" => "5e5ea5c16897e", + "deploymentScreenshotDark" => "5e5ea5c16897e", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "timeout" => 300, + "installCommand" => "npm install", + "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", + "outputDirectory" => "build", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "sites/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", + "buildRuntime" => "node-22", + "adapter" => "static", + "fallbackFile" => "index.html" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -138,105 +145,111 @@ public function testMethodCreate(): void { BuildRuntime::NODE145() ); - $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); - } - - public function testMethodListFrameworks(): void { - - $data = array("total" => 5 -,"frameworks" => array(array("key" => "sveltekit" -,"name" => "SvelteKit" -,"buildRuntime" => "node-22" -,"runtimes" => array() -,"adapters" => array(array("key" => "static" -,"installCommand" => "npm install" -,"buildCommand" => "npm run build" -,"outputDirectory" => "./dist" -,"fallbackFile" => "index.html" -) -) - ) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); + } + + public function testMethodListFrameworks(): void + { + $data = array( + "total" => 5, + "frameworks" => array( + array( + "key" => "sveltekit", + "name" => "SvelteKit", + "buildRuntime" => "node-22", + "runtimes" => array(), + "adapters" => array( + array( + "key" => "static", + "installCommand" => "npm install", + "buildCommand" => "npm run build", + "outputDirectory" => "./dist", + "fallbackFile" => "index.html" + ) + ) + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->sites->listFrameworks( - ); + $response = $this->sites->listFrameworks(); - $this->assertInstanceOf(\Appwrite\Models\FrameworkList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\FrameworkList::class, $response); + } - public function testMethodListSpecifications(): void { - - $data = array("total" => 5 -,"specifications" => array(array("memory" => 512 -,"cpus" => 1 -,"enabled" => true -,"slug" => "s-1vcpu-512mb" -) -) - ) -; + public function testMethodListSpecifications(): void + { + $data = array( + "total" => 5, + "specifications" => array( + array( + "memory" => 512, + "cpus" => 1, + "enabled" => true, + "slug" => "s-1vcpu-512mb" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->sites->listSpecifications( - ); - - $this->assertInstanceOf(\Appwrite\Models\SpecificationList::class, $response); - } - - public function testMethodGet(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Site" -,"enabled" => true -,"live" => true -,"logging" => true -,"framework" => "react" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"deploymentScreenshotLight" => "5e5ea5c16897e" -,"deploymentScreenshotDark" => "5e5ea5c16897e" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"timeout" => 300 -,"installCommand" => "npm install" -,"buildCommand" => "npm run build" -,"startCommand" => "node custom-server.mjs" -,"outputDirectory" => "build" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "sites/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -,"buildRuntime" => "node-22" -,"adapter" => "static" -,"fallbackFile" => "index.html" -) -; + $response = $this->sites->listSpecifications(); + + $this->assertInstanceOf(\Appwrite\Models\SpecificationList::class, $response); + } + + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Site", + "enabled" => true, + "live" => true, + "logging" => true, + "framework" => "react", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "deploymentScreenshotLight" => "5e5ea5c16897e", + "deploymentScreenshotDark" => "5e5ea5c16897e", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "timeout" => 300, + "installCommand" => "npm install", + "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", + "outputDirectory" => "build", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "sites/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", + "buildRuntime" => "node-22", + "adapter" => "static", + "fallbackFile" => "index.html" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -246,54 +259,56 @@ public function testMethodGet(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); - } - - public function testMethodUpdate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Site" -,"enabled" => true -,"live" => true -,"logging" => true -,"framework" => "react" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"deploymentScreenshotLight" => "5e5ea5c16897e" -,"deploymentScreenshotDark" => "5e5ea5c16897e" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"timeout" => 300 -,"installCommand" => "npm install" -,"buildCommand" => "npm run build" -,"startCommand" => "node custom-server.mjs" -,"outputDirectory" => "build" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "sites/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -,"buildRuntime" => "node-22" -,"adapter" => "static" -,"fallbackFile" => "index.html" -) -; + $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); + } + + public function testMethodUpdate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Site", + "enabled" => true, + "live" => true, + "logging" => true, + "framework" => "react", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "deploymentScreenshotLight" => "5e5ea5c16897e", + "deploymentScreenshotDark" => "5e5ea5c16897e", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "timeout" => 300, + "installCommand" => "npm install", + "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", + "outputDirectory" => "build", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "sites/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", + "buildRuntime" => "node-22", + "adapter" => "static", + "fallbackFile" => "index.html" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -305,11 +320,11 @@ public function testMethodUpdate(): void { Framework::ANALOG() ); - $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -320,54 +335,56 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateSiteDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Site" -,"enabled" => true -,"live" => true -,"logging" => true -,"framework" => "react" -,"deploymentRetention" => 7 -,"deploymentId" => "5e5ea5c16897e" -,"deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"deploymentScreenshotLight" => "5e5ea5c16897e" -,"deploymentScreenshotDark" => "5e5ea5c16897e" -,"latestDeploymentId" => "5e5ea5c16897e" -,"latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00" -,"latestDeploymentStatus" => "ready" -,"vars" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ,"timeout" => 300 -,"installCommand" => "npm install" -,"buildCommand" => "npm run build" -,"startCommand" => "node custom-server.mjs" -,"outputDirectory" => "build" -,"installationId" => "6m40at4ejk5h2u9s1hboo" -,"providerRepositoryId" => "appwrite" -,"providerBranch" => "main" -,"providerRootDirectory" => "sites/helloWorld" -,"providerSilentMode" => true -,"buildSpecification" => "s-1vcpu-512mb" -,"runtimeSpecification" => "s-1vcpu-512mb" -,"buildRuntime" => "node-22" -,"adapter" => "static" -,"fallbackFile" => "index.html" -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateSiteDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Site", + "enabled" => true, + "live" => true, + "logging" => true, + "framework" => "react", + "deploymentRetention" => 7, + "deploymentId" => "5e5ea5c16897e", + "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "deploymentScreenshotLight" => "5e5ea5c16897e", + "deploymentScreenshotDark" => "5e5ea5c16897e", + "latestDeploymentId" => "5e5ea5c16897e", + "latestDeploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", + "latestDeploymentStatus" => "ready", + "vars" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ), + "timeout" => 300, + "installCommand" => "npm install", + "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", + "outputDirectory" => "build", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "sites/helloWorld", + "providerSilentMode" => true, + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", + "buildRuntime" => "node-22", + "adapter" => "static", + "fallbackFile" => "index.html" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -378,43 +395,45 @@ public function testMethodUpdateSiteDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); - } - - public function testMethodListDeployments(): void { - - $data = array("total" => 5 -,"deployments" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Site::class, $response); + } + + public function testMethodListDeployments(): void + { + $data = array( + "total" => 5, + "deployments" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -424,40 +443,40 @@ public function testMethodListDeployments(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\DeploymentList::class, $response); - } - - public function testMethodCreateDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\DeploymentList::class, $response); + } + + public function testMethodCreateDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -465,43 +484,43 @@ public function testMethodCreateDeployment(): void { $response = $this->sites->createDeployment( "", - InputFile::withData('', "image/png") - ); - - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodCreateDuplicateDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + InputFile::withData('', 'image/png') + ); + + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodCreateDuplicateDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -512,40 +531,40 @@ public function testMethodCreateDuplicateDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodCreateTemplateDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodCreateTemplateDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -560,40 +579,40 @@ public function testMethodCreateTemplateDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodCreateVcsDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodCreateVcsDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -605,40 +624,40 @@ public function testMethodCreateVcsDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodGetDeployment(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodGetDeployment(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -649,11 +668,11 @@ public function testMethodGetDeployment(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } - public function testMethodDeleteDeployment(): void { - + public function testMethodDeleteDeployment(): void + { $data = ''; $this->client @@ -665,11 +684,11 @@ public function testMethodDeleteDeployment(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetDeploymentDownload(): void { - + public function testMethodGetDeploymentDownload(): void + { $data = ''; $this->client @@ -681,40 +700,40 @@ public function testMethodGetDeploymentDownload(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateDeploymentStatus(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"type" => "vcs" -,"resourceId" => "5e5ea6g16897e" -,"resourceType" => "functions" -,"entrypoint" => "index.js" -,"sourceSize" => 128 -,"buildSize" => 128 -,"totalSize" => 128 -,"buildId" => "5e5ea5c16897e" -,"activate" => true -,"screenshotLight" => "5e5ea5c16897e" -,"screenshotDark" => "5e5ea5c16897e" -,"status" => "waiting" -,"buildLogs" => "Compiling source files..." -,"buildDuration" => 128 -,"providerRepositoryName" => "database" -,"providerRepositoryOwner" => "utopia" -,"providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function" -,"providerCommitHash" => "7c3f25d" -,"providerCommitAuthorUrl" => "https://github.com/vermakhushboo" -,"providerCommitAuthor" => "Khushboo Verma" -,"providerCommitMessage" => "Update index.js" -,"providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb" -,"providerBranch" => "0.7.x" -,"providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateDeploymentStatus(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "sourceSize" => 128, + "buildSize" => 128, + "totalSize" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "screenshotLight" => "5e5ea5c16897e", + "screenshotDark" => "5e5ea5c16897e", + "status" => "waiting", + "buildLogs" => "Compiling source files...", + "buildDuration" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranch" => "0.7.x", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -725,39 +744,45 @@ public function testMethodUpdateDeploymentStatus(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); - } - - public function testMethodListLogs(): void { - - $data = array("total" => 5 -,"executions" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"functionId" => "5e5ea6g16897e" -,"deploymentId" => "5e5ea5c16897e" -,"trigger" => "http" -,"status" => "waiting" -,"requestMethod" => "GET" -,"requestPath" => "/articles?id=5" -,"requestHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"responseStatusCode" => 200 -,"responseBody" => "[RESPONSEBODY]" -,"responseHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"logs" => "[LOGS]" -,"errors" => "[ERRORS]" -,"duration" => 0.4 -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Deployment::class, $response); + } + + public function testMethodListLogs(): void + { + $data = array( + "total" => 5, + "executions" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "functionId" => "5e5ea6g16897e", + "deploymentId" => "5e5ea5c16897e", + "trigger" => "http", + "status" => "waiting", + "requestMethod" => "GET", + "requestPath" => "/articles?id=5", + "requestHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "responseStatusCode" => 200, + "responseBody" => "[RESPONSEBODY]", + "responseHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "logs" => "[LOGS]", + "errors" => "[ERRORS]", + "duration" => 0.4 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -767,36 +792,40 @@ public function testMethodListLogs(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ExecutionList::class, $response); - } - - public function testMethodGetLog(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"functionId" => "5e5ea6g16897e" -,"deploymentId" => "5e5ea5c16897e" -,"trigger" => "http" -,"status" => "waiting" -,"requestMethod" => "GET" -,"requestPath" => "/articles?id=5" -,"requestHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"responseStatusCode" => 200 -,"responseBody" => "[RESPONSEBODY]" -,"responseHeaders" => array(array("name" => "Content-Type" -,"value" => "application/json" -) -) - ,"logs" => "[LOGS]" -,"errors" => "[ERRORS]" -,"duration" => 0.4 -) -; + $this->assertInstanceOf(\Appwrite\Models\ExecutionList::class, $response); + } + + public function testMethodGetLog(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "functionId" => "5e5ea6g16897e", + "deploymentId" => "5e5ea5c16897e", + "trigger" => "http", + "status" => "waiting", + "requestMethod" => "GET", + "requestPath" => "/articles?id=5", + "requestHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "responseStatusCode" => 200, + "responseBody" => "[RESPONSEBODY]", + "responseHeaders" => array( + array( + "name" => "Content-Type", + "value" => "application/json" + ) + ), + "logs" => "[LOGS]", + "errors" => "[ERRORS]", + "duration" => 0.4 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -807,11 +836,11 @@ public function testMethodGetLog(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Execution::class, $response); + } - public function testMethodDeleteLog(): void { - + public function testMethodDeleteLog(): void + { $data = ''; $this->client @@ -823,24 +852,26 @@ public function testMethodDeleteLog(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListVariables(): void { - - $data = array("total" => 5 -,"variables" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListVariables(): void + { + $data = array( + "total" => 5, + "variables" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -850,21 +881,21 @@ public function testMethodListVariables(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\VariableList::class, $response); + } - public function testMethodCreateVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + public function testMethodCreateVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -876,21 +907,21 @@ public function testMethodCreateVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } - public function testMethodGetVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + public function testMethodGetVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -901,21 +932,21 @@ public function testMethodGetVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } - public function testMethodUpdateVariable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "API_KEY" -,"value" => "myPa\$\$word1" -,"secret" => true -,"resourceType" => "function" -,"resourceId" => "myAwesomeFunction" -) -; + public function testMethodUpdateVariable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -927,11 +958,11 @@ public function testMethodUpdateVariable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); + } - public function testMethodDeleteVariable(): void { - + public function testMethodDeleteVariable(): void + { $data = ''; $this->client @@ -943,7 +974,7 @@ public function testMethodDeleteVariable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/StorageTest.php b/tests/Appwrite/Services/StorageTest.php index 8ec4075..ac7c71f 100644 --- a/tests/Appwrite/Services/StorageTest.php +++ b/tests/Appwrite/Services/StorageTest.php @@ -10,65 +10,68 @@ use Appwrite\Enums\ImageGravity; use Appwrite\Enums\ImageFormat; -final class StorageTest extends TestCase { +final class StorageTest extends TestCase +{ private $client; private $storage; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->storage = new Storage($this->client); } - public function testMethodListBuckets(): void { - - $data = array("total" => 5 -,"buckets" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"fileSecurity" => true -,"name" => "Documents" -,"enabled" => true -,"maximumFileSize" => 100 -,"allowedFileExtensions" => array() -,"compression" => "gzip" -,"encryption" => true -,"antivirus" => true -,"transformations" => true -,"totalSize" => 128 -) -) - ) -; + public function testMethodListBuckets(): void + { + $data = array( + "total" => 5, + "buckets" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "fileSecurity" => true, + "name" => "Documents", + "enabled" => true, + "maximumFileSize" => 100, + "allowedFileExtensions" => array(), + "compression" => "gzip", + "encryption" => true, + "antivirus" => true, + "transformations" => true, + "totalSize" => 128 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->storage->listBuckets( - ); + $response = $this->storage->listBuckets(); + + $this->assertInstanceOf(\Appwrite\Models\BucketList::class, $response); + } - $this->assertInstanceOf(\Appwrite\Models\BucketList::class, $response); - } - - public function testMethodCreateBucket(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"fileSecurity" => true -,"name" => "Documents" -,"enabled" => true -,"maximumFileSize" => 100 -,"allowedFileExtensions" => array() -,"compression" => "gzip" -,"encryption" => true -,"antivirus" => true -,"transformations" => true -,"totalSize" => 128 -) -; + public function testMethodCreateBucket(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "fileSecurity" => true, + "name" => "Documents", + "enabled" => true, + "maximumFileSize" => 100, + "allowedFileExtensions" => array(), + "compression" => "gzip", + "encryption" => true, + "antivirus" => true, + "transformations" => true, + "totalSize" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -79,27 +82,27 @@ public function testMethodCreateBucket(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); - } - - public function testMethodGetBucket(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"fileSecurity" => true -,"name" => "Documents" -,"enabled" => true -,"maximumFileSize" => 100 -,"allowedFileExtensions" => array() -,"compression" => "gzip" -,"encryption" => true -,"antivirus" => true -,"transformations" => true -,"totalSize" => 128 -) -; + $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); + } + + public function testMethodGetBucket(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "fileSecurity" => true, + "name" => "Documents", + "enabled" => true, + "maximumFileSize" => 100, + "allowedFileExtensions" => array(), + "compression" => "gzip", + "encryption" => true, + "antivirus" => true, + "transformations" => true, + "totalSize" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -109,27 +112,27 @@ public function testMethodGetBucket(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); - } - - public function testMethodUpdateBucket(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"fileSecurity" => true -,"name" => "Documents" -,"enabled" => true -,"maximumFileSize" => 100 -,"allowedFileExtensions" => array() -,"compression" => "gzip" -,"encryption" => true -,"antivirus" => true -,"transformations" => true -,"totalSize" => 128 -) -; + $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); + } + + public function testMethodUpdateBucket(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "fileSecurity" => true, + "name" => "Documents", + "enabled" => true, + "maximumFileSize" => 100, + "allowedFileExtensions" => array(), + "compression" => "gzip", + "encryption" => true, + "antivirus" => true, + "transformations" => true, + "totalSize" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -140,11 +143,11 @@ public function testMethodUpdateBucket(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Bucket::class, $response); + } - public function testMethodDeleteBucket(): void { - + public function testMethodDeleteBucket(): void + { $data = ''; $this->client @@ -155,29 +158,31 @@ public function testMethodDeleteBucket(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListFiles(): void { - - $data = array("total" => 5 -,"files" => array(array("\$id" => "5e5ea5c16897e" -,"bucketId" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"name" => "Pink.png" -,"signature" => "5d529fd02b544198ae075bd57c1762bb" -,"mimeType" => "image/png" -,"sizeOriginal" => 17890 -,"chunksTotal" => 17890 -,"chunksUploaded" => 17890 -,"encryption" => true -,"compression" => "gzip" -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListFiles(): void + { + $data = array( + "total" => 5, + "files" => array( + array( + "\$id" => "5e5ea5c16897e", + "bucketId" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "name" => "Pink.png", + "signature" => "5d529fd02b544198ae075bd57c1762bb", + "mimeType" => "image/png", + "sizeOriginal" => 17890, + "chunksTotal" => 17890, + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -187,26 +192,26 @@ public function testMethodListFiles(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\FileList::class, $response); - } - - public function testMethodCreateFile(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"bucketId" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"name" => "Pink.png" -,"signature" => "5d529fd02b544198ae075bd57c1762bb" -,"mimeType" => "image/png" -,"sizeOriginal" => 17890 -,"chunksTotal" => 17890 -,"chunksUploaded" => 17890 -,"encryption" => true -,"compression" => "gzip" -) -; + $this->assertInstanceOf(\Appwrite\Models\FileList::class, $response); + } + + public function testMethodCreateFile(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "bucketId" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "name" => "Pink.png", + "signature" => "5d529fd02b544198ae075bd57c1762bb", + "mimeType" => "image/png", + "sizeOriginal" => 17890, + "chunksTotal" => 17890, + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -215,29 +220,29 @@ public function testMethodCreateFile(): void { $response = $this->storage->createFile( "", "", - InputFile::withData('', "image/png") + InputFile::withData('', 'image/png') ); - $this->assertInstanceOf(\Appwrite\Models\File::class, $response); - } - - public function testMethodGetFile(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"bucketId" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"name" => "Pink.png" -,"signature" => "5d529fd02b544198ae075bd57c1762bb" -,"mimeType" => "image/png" -,"sizeOriginal" => 17890 -,"chunksTotal" => 17890 -,"chunksUploaded" => 17890 -,"encryption" => true -,"compression" => "gzip" -) -; + $this->assertInstanceOf(\Appwrite\Models\File::class, $response); + } + + public function testMethodGetFile(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "bucketId" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "name" => "Pink.png", + "signature" => "5d529fd02b544198ae075bd57c1762bb", + "mimeType" => "image/png", + "sizeOriginal" => 17890, + "chunksTotal" => 17890, + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -248,26 +253,26 @@ public function testMethodGetFile(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\File::class, $response); - } - - public function testMethodUpdateFile(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"bucketId" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"name" => "Pink.png" -,"signature" => "5d529fd02b544198ae075bd57c1762bb" -,"mimeType" => "image/png" -,"sizeOriginal" => 17890 -,"chunksTotal" => 17890 -,"chunksUploaded" => 17890 -,"encryption" => true -,"compression" => "gzip" -) -; + $this->assertInstanceOf(\Appwrite\Models\File::class, $response); + } + + public function testMethodUpdateFile(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "bucketId" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "name" => "Pink.png", + "signature" => "5d529fd02b544198ae075bd57c1762bb", + "mimeType" => "image/png", + "sizeOriginal" => 17890, + "chunksTotal" => 17890, + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -278,11 +283,11 @@ public function testMethodUpdateFile(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\File::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\File::class, $response); + } - public function testMethodDeleteFile(): void { - + public function testMethodDeleteFile(): void + { $data = ''; $this->client @@ -294,11 +299,11 @@ public function testMethodDeleteFile(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetFileDownload(): void { - + public function testMethodGetFileDownload(): void + { $data = ''; $this->client @@ -310,11 +315,11 @@ public function testMethodGetFileDownload(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetFilePreview(): void { - + public function testMethodGetFilePreview(): void + { $data = ''; $this->client @@ -326,11 +331,11 @@ public function testMethodGetFilePreview(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodGetFileView(): void { - + public function testMethodGetFileView(): void + { $data = ''; $this->client @@ -342,7 +347,7 @@ public function testMethodGetFileView(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index 52ae5f1..ce78470 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -11,119 +11,134 @@ use Appwrite\Enums\TablesDBIndexType; use Appwrite\Enums\OrderBy; -final class TablesDBTest extends TestCase { +final class TablesDBTest extends TestCase +{ private $client; private $tablesDB; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->tablesDB = new TablesDB($this->client); } - public function testMethodList(): void { - - $data = array("total" => 5 -,"databases" => array(array("\$id" => "5e5ea5c16897e" -,"name" => "My Database" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"enabled" => true -,"type" => "legacy" -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -) - ) -; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->tablesDB->list( - ); - - $this->assertInstanceOf(\Appwrite\Models\DatabaseList::class, $response); - } - - public function testMethodCreate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "My Database" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"enabled" => true -,"type" => "legacy" -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -; + public function testMethodList(): void + { + $data = array( + "total" => 5, + "databases" => array( + array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->list(); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseList::class, $response); + } + + public function testMethodCreate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -134,64 +149,64 @@ public function testMethodCreate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } - public function testMethodListTransactions(): void { - - $data = array("total" => 5 -,"transactions" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -) - ) -; + public function testMethodListTransactions(): void + { + $data = array( + "total" => 5, + "transactions" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDB->listTransactions( - ); + $response = $this->tablesDB->listTransactions(); - $this->assertInstanceOf(\Appwrite\Models\TransactionList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TransactionList::class, $response); + } - public function testMethodCreateTransaction(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateTransaction(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDB->createTransaction( - ); + $response = $this->tablesDB->createTransaction(); - $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } - public function testMethodGetTransaction(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodGetTransaction(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -201,19 +216,19 @@ public function testMethodGetTransaction(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } - public function testMethodUpdateTransaction(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateTransaction(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -223,11 +238,11 @@ public function testMethodUpdateTransaction(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } - public function testMethodDeleteTransaction(): void { - + public function testMethodDeleteTransaction(): void + { $data = ''; $this->client @@ -238,19 +253,19 @@ public function testMethodDeleteTransaction(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodCreateOperations(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"status" => "pending" -,"operations" => 5 -,"expiresAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateOperations(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -260,54 +275,60 @@ public function testMethodCreateOperations(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); - } - - public function testMethodGet(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "My Database" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"enabled" => true -,"type" => "legacy" -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -317,54 +338,60 @@ public function testMethodGet(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); - } - - public function testMethodUpdate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"name" => "My Database" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"enabled" => true -,"type" => "legacy" -,"policies" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"archives" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Collection" -,"enabled" => true -,"documentSecurity" => true -,"attributes" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"attributes" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } + + public function testMethodUpdate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "archives" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -374,11 +401,11 @@ public function testMethodUpdate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -389,38 +416,42 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListTables(): void { - - $data = array("total" => 5 -,"tables" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Table" -,"enabled" => true -,"rowSecurity" => true -,"columns" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"columns" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListTables(): void + { + $data = array( + "total" => 5, + "tables" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Table", + "enabled" => true, + "rowSecurity" => true, + "columns" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "columns" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -430,35 +461,37 @@ public function testMethodListTables(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\TableList::class, $response); - } - - public function testMethodCreateTable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Table" -,"enabled" => true -,"rowSecurity" => true -,"columns" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"columns" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -; + $this->assertInstanceOf(\Appwrite\Models\TableList::class, $response); + } + + public function testMethodCreateTable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Table", + "enabled" => true, + "rowSecurity" => true, + "columns" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "columns" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -470,35 +503,37 @@ public function testMethodCreateTable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); - } - - public function testMethodGetTable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Table" -,"enabled" => true -,"rowSecurity" => true -,"columns" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"columns" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -; + $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); + } + + public function testMethodGetTable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Table", + "enabled" => true, + "rowSecurity" => true, + "columns" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "columns" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -509,35 +544,37 @@ public function testMethodGetTable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); - } - - public function testMethodUpdateTable(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -,"databaseId" => "5e5ea5c16897e" -,"name" => "My Table" -,"enabled" => true -,"rowSecurity" => true -,"columns" => array() -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"columns" => array() -,"lengths" => array() -) -) - ,"bytesMax" => 65535 -,"bytesUsed" => 1500 -) -; + $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); + } + + public function testMethodUpdateTable(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Table", + "enabled" => true, + "rowSecurity" => true, + "columns" => array(), + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "columns" => array(), + "lengths" => array() + ) + ), + "bytesMax" => 65535, + "bytesUsed" => 1500 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -548,11 +585,11 @@ public function testMethodUpdateTable(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Table::class, $response); + } - public function testMethodDeleteTable(): void { - + public function testMethodDeleteTable(): void + { $data = ''; $this->client @@ -564,15 +601,15 @@ public function testMethodDeleteTable(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodListColumns(): void { - - $data = array("total" => 5 -,"columns" => array() -) -; + public function testMethodListColumns(): void + { + $data = array( + "total" => 5, + "columns" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -583,20 +620,20 @@ public function testMethodListColumns(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnList::class, $response); + } - public function testMethodCreateBooleanColumn(): void { - - $data = array("key" => "isEnabled" -,"type" => "boolean" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateBooleanColumn(): void + { + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -609,20 +646,20 @@ public function testMethodCreateBooleanColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); + } - public function testMethodUpdateBooleanColumn(): void { - - $data = array("key" => "isEnabled" -,"type" => "boolean" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateBooleanColumn(): void + { + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -636,21 +673,21 @@ public function testMethodUpdateBooleanColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); + } - public function testMethodCreateDatetimeColumn(): void { - - $data = array("key" => "birthDay" -,"type" => "datetime" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "datetime" -) -; + public function testMethodCreateDatetimeColumn(): void + { + $data = array( + "key" => "birthDay", + "type" => "datetime", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "datetime" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -663,21 +700,21 @@ public function testMethodCreateDatetimeColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnDatetime::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnDatetime::class, $response); + } - public function testMethodUpdateDatetimeColumn(): void { - - $data = array("key" => "birthDay" -,"type" => "datetime" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "datetime" -) -; + public function testMethodUpdateDatetimeColumn(): void + { + $data = array( + "key" => "birthDay", + "type" => "datetime", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "datetime" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -691,21 +728,21 @@ public function testMethodUpdateDatetimeColumn(): void { "2020-10-15T06:38:00.000+00:00" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnDatetime::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnDatetime::class, $response); + } - public function testMethodCreateEmailColumn(): void { - - $data = array("key" => "userEmail" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "email" -) -; + public function testMethodCreateEmailColumn(): void + { + $data = array( + "key" => "userEmail", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "email" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -718,21 +755,21 @@ public function testMethodCreateEmailColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnEmail::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnEmail::class, $response); + } - public function testMethodUpdateEmailColumn(): void { - - $data = array("key" => "userEmail" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "email" -) -; + public function testMethodUpdateEmailColumn(): void + { + $data = array( + "key" => "userEmail", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "email" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -746,22 +783,22 @@ public function testMethodUpdateEmailColumn(): void { "email@example.com" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnEmail::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnEmail::class, $response); + } - public function testMethodCreateEnumColumn(): void { - - $data = array("key" => "status" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"elements" => array() -,"format" => "enum" -) -; + public function testMethodCreateEnumColumn(): void + { + $data = array( + "key" => "status", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "elements" => array(), + "format" => "enum" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -775,22 +812,22 @@ public function testMethodCreateEnumColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnEnum::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnEnum::class, $response); + } - public function testMethodUpdateEnumColumn(): void { - - $data = array("key" => "status" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"elements" => array() -,"format" => "enum" -) -; + public function testMethodUpdateEnumColumn(): void + { + $data = array( + "key" => "status", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "elements" => array(), + "format" => "enum" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -805,20 +842,20 @@ public function testMethodUpdateEnumColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnEnum::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnEnum::class, $response); + } - public function testMethodCreateFloatColumn(): void { - - $data = array("key" => "percentageCompleted" -,"type" => "double" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateFloatColumn(): void + { + $data = array( + "key" => "percentageCompleted", + "type" => "double", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -831,20 +868,20 @@ public function testMethodCreateFloatColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnFloat::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnFloat::class, $response); + } - public function testMethodUpdateFloatColumn(): void { - - $data = array("key" => "percentageCompleted" -,"type" => "double" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateFloatColumn(): void + { + $data = array( + "key" => "percentageCompleted", + "type" => "double", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -858,20 +895,20 @@ public function testMethodUpdateFloatColumn(): void { 1.0 ); - $this->assertInstanceOf(\Appwrite\Models\ColumnFloat::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnFloat::class, $response); + } - public function testMethodCreateIntegerColumn(): void { - - $data = array("key" => "count" -,"type" => "integer" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateIntegerColumn(): void + { + $data = array( + "key" => "count", + "type" => "integer", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -884,20 +921,20 @@ public function testMethodCreateIntegerColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnInteger::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnInteger::class, $response); + } - public function testMethodUpdateIntegerColumn(): void { - - $data = array("key" => "count" -,"type" => "integer" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateIntegerColumn(): void + { + $data = array( + "key" => "count", + "type" => "integer", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -911,21 +948,21 @@ public function testMethodUpdateIntegerColumn(): void { 1 ); - $this->assertInstanceOf(\Appwrite\Models\ColumnInteger::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnInteger::class, $response); + } - public function testMethodCreateIpColumn(): void { - - $data = array("key" => "ipAddress" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "ip" -) -; + public function testMethodCreateIpColumn(): void + { + $data = array( + "key" => "ipAddress", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "ip" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -938,21 +975,21 @@ public function testMethodCreateIpColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnIp::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIp::class, $response); + } - public function testMethodUpdateIpColumn(): void { - - $data = array("key" => "ipAddress" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "ip" -) -; + public function testMethodUpdateIpColumn(): void + { + $data = array( + "key" => "ipAddress", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "ip" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -966,20 +1003,20 @@ public function testMethodUpdateIpColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnIp::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIp::class, $response); + } - public function testMethodCreateLineColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateLineColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -992,20 +1029,20 @@ public function testMethodCreateLineColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnLine::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnLine::class, $response); + } - public function testMethodUpdateLineColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateLineColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1018,20 +1055,20 @@ public function testMethodUpdateLineColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnLine::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnLine::class, $response); + } - public function testMethodCreateLongtextColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateLongtextColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1044,20 +1081,20 @@ public function testMethodCreateLongtextColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnLongtext::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnLongtext::class, $response); + } - public function testMethodUpdateLongtextColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateLongtextColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1071,20 +1108,20 @@ public function testMethodUpdateLongtextColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnLongtext::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnLongtext::class, $response); + } - public function testMethodCreateMediumtextColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateMediumtextColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1097,20 +1134,20 @@ public function testMethodCreateMediumtextColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnMediumtext::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnMediumtext::class, $response); + } - public function testMethodUpdateMediumtextColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateMediumtextColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1124,20 +1161,20 @@ public function testMethodUpdateMediumtextColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnMediumtext::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnMediumtext::class, $response); + } - public function testMethodCreatePointColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreatePointColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1150,20 +1187,20 @@ public function testMethodCreatePointColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnPoint::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnPoint::class, $response); + } - public function testMethodUpdatePointColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdatePointColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1176,20 +1213,20 @@ public function testMethodUpdatePointColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnPoint::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnPoint::class, $response); + } - public function testMethodCreatePolygonColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreatePolygonColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1202,20 +1239,20 @@ public function testMethodCreatePolygonColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnPolygon::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnPolygon::class, $response); + } - public function testMethodUpdatePolygonColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdatePolygonColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1228,26 +1265,26 @@ public function testMethodUpdatePolygonColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnPolygon::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnPolygon::class, $response); + } - public function testMethodCreateRelationshipColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"relatedTable" => "table" -,"relationType" => "oneToOne|oneToMany|manyToOne|manyToMany" -,"twoWay" => true -,"twoWayKey" => "string" -,"onDelete" => "restrict|cascade|setNull" -,"side" => "parent|child" -) -; + public function testMethodCreateRelationshipColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "relatedTable" => "table", + "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", + "twoWay" => true, + "twoWayKey" => "string", + "onDelete" => "restrict|cascade|setNull", + "side" => "parent|child" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1260,21 +1297,21 @@ public function testMethodCreateRelationshipColumn(): void { RelationshipType::ONETOONE() ); - $this->assertInstanceOf(\Appwrite\Models\ColumnRelationship::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnRelationship::class, $response); + } - public function testMethodCreateStringColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"size" => 128 -) -; + public function testMethodCreateStringColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1288,21 +1325,21 @@ public function testMethodCreateStringColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnString::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnString::class, $response); + } - public function testMethodUpdateStringColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"size" => 128 -) -; + public function testMethodUpdateStringColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1316,20 +1353,20 @@ public function testMethodUpdateStringColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnString::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnString::class, $response); + } - public function testMethodCreateTextColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodCreateTextColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1342,20 +1379,20 @@ public function testMethodCreateTextColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnText::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnText::class, $response); + } - public function testMethodUpdateTextColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodUpdateTextColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1369,21 +1406,21 @@ public function testMethodUpdateTextColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnText::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnText::class, $response); + } - public function testMethodCreateUrlColumn(): void { - - $data = array("key" => "githubUrl" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "url" -) -; + public function testMethodCreateUrlColumn(): void + { + $data = array( + "key" => "githubUrl", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "url" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1396,21 +1433,21 @@ public function testMethodCreateUrlColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnUrl::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnUrl::class, $response); + } - public function testMethodUpdateUrlColumn(): void { - - $data = array("key" => "githubUrl" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"format" => "url" -) -; + public function testMethodUpdateUrlColumn(): void + { + $data = array( + "key" => "githubUrl", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "url" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1424,21 +1461,21 @@ public function testMethodUpdateUrlColumn(): void { "https://example.com" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnUrl::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnUrl::class, $response); + } - public function testMethodCreateVarcharColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"size" => 128 -) -; + public function testMethodCreateVarcharColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1452,21 +1489,21 @@ public function testMethodCreateVarcharColumn(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\ColumnVarchar::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnVarchar::class, $response); + } - public function testMethodUpdateVarcharColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"size" => 128 -) -; + public function testMethodUpdateVarcharColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1480,20 +1517,20 @@ public function testMethodUpdateVarcharColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnVarchar::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnVarchar::class, $response); + } - public function testMethodGetColumn(): void { - - $data = array("key" => "isEnabled" -,"type" => "boolean" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + public function testMethodGetColumn(): void + { + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1505,11 +1542,11 @@ public function testMethodGetColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnBoolean::class, $response); + } - public function testMethodDeleteColumn(): void { - + public function testMethodDeleteColumn(): void + { $data = ''; $this->client @@ -1522,26 +1559,26 @@ public function testMethodDeleteColumn(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodUpdateRelationshipColumn(): void { - - $data = array("key" => "fullName" -,"type" => "string" -,"status" => "available" -,"error" => "string" -,"required" => true -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"relatedTable" => "table" -,"relationType" => "oneToOne|oneToMany|manyToOne|manyToMany" -,"twoWay" => true -,"twoWayKey" => "string" -,"onDelete" => "restrict|cascade|setNull" -,"side" => "parent|child" -) -; + public function testMethodUpdateRelationshipColumn(): void + { + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "relatedTable" => "table", + "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", + "twoWay" => true, + "twoWayKey" => "string", + "onDelete" => "restrict|cascade|setNull", + "side" => "parent|child" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1553,25 +1590,27 @@ public function testMethodUpdateRelationshipColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnRelationship::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnRelationship::class, $response); + } - public function testMethodListIndexes(): void { - - $data = array("total" => 5 -,"indexes" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"columns" => array() -,"lengths" => array() -) -) - ) -; + public function testMethodListIndexes(): void + { + $data = array( + "total" => 5, + "indexes" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "columns" => array(), + "lengths" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1582,22 +1621,22 @@ public function testMethodListIndexes(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnIndexList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIndexList::class, $response); + } - public function testMethodCreateIndex(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"columns" => array() -,"lengths" => array() -) -; + public function testMethodCreateIndex(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "columns" => array(), + "lengths" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1611,22 +1650,22 @@ public function testMethodCreateIndex(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\ColumnIndex::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIndex::class, $response); + } - public function testMethodGetIndex(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"key" => "index1" -,"type" => "primary" -,"status" => "available" -,"error" => "string" -,"columns" => array() -,"lengths" => array() -) -; + public function testMethodGetIndex(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "columns" => array(), + "lengths" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1638,11 +1677,11 @@ public function testMethodGetIndex(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ColumnIndex::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ColumnIndex::class, $response); + } - public function testMethodDeleteIndex(): void { - + public function testMethodDeleteIndex(): void + { $data = ''; $this->client @@ -1655,23 +1694,25 @@ public function testMethodDeleteIndex(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodListRows(): void { - - $data = array("total" => 5 -,"rows" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodListRows(): void + { + $data = array( + "total" => 5, + "rows" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1682,20 +1723,20 @@ public function testMethodListRows(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } - public function testMethodCreateRow(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodCreateRow(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1708,23 +1749,25 @@ public function testMethodCreateRow(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } - public function testMethodCreateRows(): void { - - $data = array("total" => 5 -,"rows" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodCreateRows(): void + { + $data = array( + "total" => 5, + "rows" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1736,23 +1779,25 @@ public function testMethodCreateRows(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } - public function testMethodUpsertRows(): void { - - $data = array("total" => 5 -,"rows" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodUpsertRows(): void + { + $data = array( + "total" => 5, + "rows" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1764,23 +1809,25 @@ public function testMethodUpsertRows(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } - public function testMethodUpdateRows(): void { - - $data = array("total" => 5 -,"rows" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodUpdateRows(): void + { + $data = array( + "total" => 5, + "rows" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1791,23 +1838,25 @@ public function testMethodUpdateRows(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } - public function testMethodDeleteRows(): void { - - $data = array("total" => 5 -,"rows" => array(array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -) - ) -; + public function testMethodDeleteRows(): void + { + $data = array( + "total" => 5, + "rows" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1818,20 +1867,20 @@ public function testMethodDeleteRows(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\RowList::class, $response); + } - public function testMethodGetRow(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodGetRow(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1843,20 +1892,20 @@ public function testMethodGetRow(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } - public function testMethodUpsertRow(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodUpsertRow(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1868,20 +1917,20 @@ public function testMethodUpsertRow(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } - public function testMethodUpdateRow(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodUpdateRow(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1893,11 +1942,11 @@ public function testMethodUpdateRow(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } - public function testMethodDeleteRow(): void { - + public function testMethodDeleteRow(): void + { $data = ''; $this->client @@ -1910,20 +1959,20 @@ public function testMethodDeleteRow(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodDecrementRowColumn(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodDecrementRowColumn(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1936,20 +1985,20 @@ public function testMethodDecrementRowColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } - public function testMethodIncrementRowColumn(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$sequence" => "1" -,"\$tableId" => "5e5ea5c15117e" -,"\$databaseId" => "5e5ea5c15117e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"\$permissions" => array() -) -; + public function testMethodIncrementRowColumn(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$tableId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1962,7 +2011,7 @@ public function testMethodIncrementRowColumn(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); + } } diff --git a/tests/Appwrite/Services/TeamsTest.php b/tests/Appwrite/Services/TeamsTest.php index 02cfda4..0c72a69 100644 --- a/tests/Appwrite/Services/TeamsTest.php +++ b/tests/Appwrite/Services/TeamsTest.php @@ -7,51 +7,52 @@ use Mockery; use PHPUnit\Framework\TestCase; -final class TeamsTest extends TestCase { +final class TeamsTest extends TestCase +{ private $client; private $teams; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->teams = new Teams($this->client); } - public function testMethodList(): void { - - $data = array("total" => 5 -,"teams" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "VIP" -,"total" => 7 -,"prefs" => array() - - ) -) - ) -; + public function testMethodList(): void + { + $data = array( + "total" => 5, + "teams" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "VIP", + "total" => 7, + "prefs" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->teams->list( - ); - - $this->assertInstanceOf(\Appwrite\Models\TeamList::class, $response); - } + $response = $this->teams->list(); - public function testMethodCreate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "VIP" -,"total" => 7 -,"prefs" => array() + $this->assertInstanceOf(\Appwrite\Models\TeamList::class, $response); + } - ) -; + public function testMethodCreate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "VIP", + "total" => 7, + "prefs" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -62,20 +63,19 @@ public function testMethodCreate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); - } - - public function testMethodGet(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "VIP" -,"total" => 7 -,"prefs" => array() + $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); + } - ) -; + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "VIP", + "total" => 7, + "prefs" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -85,20 +85,19 @@ public function testMethodGet(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); - } - - public function testMethodUpdateName(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "VIP" -,"total" => 7 -,"prefs" => array() + $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); + } - ) -; + public function testMethodUpdateName(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "VIP", + "total" => 7, + "prefs" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -109,11 +108,11 @@ public function testMethodUpdateName(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Team::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -124,29 +123,31 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodListMemberships(): void { - - $data = array("total" => 5 -,"memberships" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c16897e" -,"userName" => "John Doe" -,"userEmail" => "john@appwrite.io" -,"teamId" => "5e5ea5c16897e" -,"teamName" => "VIP" -,"invited" => "2020-10-15T06:38:00.000+00:00" -,"joined" => "2020-10-15T06:38:00.000+00:00" -,"confirm" => true -,"mfa" => true -,"roles" => array() -) -) - ) -; + $this->assertSame($data, $response); + } + + public function testMethodListMemberships(): void + { + $data = array( + "total" => 5, + "memberships" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -156,26 +157,26 @@ public function testMethodListMemberships(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\MembershipList::class, $response); - } - - public function testMethodCreateMembership(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c16897e" -,"userName" => "John Doe" -,"userEmail" => "john@appwrite.io" -,"teamId" => "5e5ea5c16897e" -,"teamName" => "VIP" -,"invited" => "2020-10-15T06:38:00.000+00:00" -,"joined" => "2020-10-15T06:38:00.000+00:00" -,"confirm" => true -,"mfa" => true -,"roles" => array() -) -; + $this->assertInstanceOf(\Appwrite\Models\MembershipList::class, $response); + } + + public function testMethodCreateMembership(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -186,26 +187,26 @@ public function testMethodCreateMembership(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); - } - - public function testMethodGetMembership(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c16897e" -,"userName" => "John Doe" -,"userEmail" => "john@appwrite.io" -,"teamId" => "5e5ea5c16897e" -,"teamName" => "VIP" -,"invited" => "2020-10-15T06:38:00.000+00:00" -,"joined" => "2020-10-15T06:38:00.000+00:00" -,"confirm" => true -,"mfa" => true -,"roles" => array() -) -; + $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); + } + + public function testMethodGetMembership(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -216,26 +217,26 @@ public function testMethodGetMembership(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); - } - - public function testMethodUpdateMembership(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c16897e" -,"userName" => "John Doe" -,"userEmail" => "john@appwrite.io" -,"teamId" => "5e5ea5c16897e" -,"teamName" => "VIP" -,"invited" => "2020-10-15T06:38:00.000+00:00" -,"joined" => "2020-10-15T06:38:00.000+00:00" -,"confirm" => true -,"mfa" => true -,"roles" => array() -) -; + $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); + } + + public function testMethodUpdateMembership(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -247,11 +248,11 @@ public function testMethodUpdateMembership(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); + } - public function testMethodDeleteMembership(): void { - + public function testMethodDeleteMembership(): void + { $data = ''; $this->client @@ -263,26 +264,26 @@ public function testMethodDeleteMembership(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateMembershipStatus(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c16897e" -,"userName" => "John Doe" -,"userEmail" => "john@appwrite.io" -,"teamId" => "5e5ea5c16897e" -,"teamName" => "VIP" -,"invited" => "2020-10-15T06:38:00.000+00:00" -,"joined" => "2020-10-15T06:38:00.000+00:00" -,"confirm" => true -,"mfa" => true -,"roles" => array() -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateMembershipStatus(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -295,13 +296,12 @@ public function testMethodUpdateMembershipStatus(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Membership::class, $response); + } - public function testMethodGetPrefs(): void { - - $data = array() -; + public function testMethodGetPrefs(): void + { + $data = array(); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -311,13 +311,12 @@ public function testMethodGetPrefs(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } - public function testMethodUpdatePrefs(): void { - - $data = array() -; + public function testMethodUpdatePrefs(): void + { + $data = array(); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -328,7 +327,7 @@ public function testMethodUpdatePrefs(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } } diff --git a/tests/Appwrite/Services/TokensTest.php b/tests/Appwrite/Services/TokensTest.php index 33a0bfc..a03492a 100644 --- a/tests/Appwrite/Services/TokensTest.php +++ b/tests/Appwrite/Services/TokensTest.php @@ -7,29 +7,33 @@ use Mockery; use PHPUnit\Framework\TestCase; -final class TokensTest extends TestCase { +final class TokensTest extends TestCase +{ private $client; private $tokens; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->tokens = new Tokens($this->client); } - public function testMethodList(): void { - - $data = array("total" => 5 -,"tokens" => array(array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8" -,"resourceType" => "files" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" -,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -) - ) -; + public function testMethodList(): void + { + $data = array( + "total" => 5, + "tokens" => array( + array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8", + "resourceType" => "files", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -40,20 +44,20 @@ public function testMethodList(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ResourceTokenList::class, $response); - } - - public function testMethodCreateFileToken(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8" -,"resourceType" => "files" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" -,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\ResourceTokenList::class, $response); + } + + public function testMethodCreateFileToken(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8", + "resourceType" => "files", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -64,20 +68,20 @@ public function testMethodCreateFileToken(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); - } - - public function testMethodGet(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8" -,"resourceType" => "files" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" -,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); + } + + public function testMethodGet(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8", + "resourceType" => "files", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -87,20 +91,20 @@ public function testMethodGet(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); - } - - public function testMethodUpdate(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8" -,"resourceType" => "files" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" -,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); + } + + public function testMethodUpdate(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceId" => "5e5ea5c168bb8:5e5ea5c168bb8", + "resourceType" => "files", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -110,11 +114,11 @@ public function testMethodUpdate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\ResourceToken::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -125,7 +129,7 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } } diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index 651e59c..3b62c0e 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -10,89 +10,94 @@ use Appwrite\Enums\AuthenticatorType; use Appwrite\Enums\MessagingProviderType; -final class UsersTest extends TestCase { +final class UsersTest extends TestCase +{ private $client; private $users; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->users = new Users($this->client); } - public function testMethodList(): void { - - $data = array("total" => 5 -,"users" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -) - ) -; + public function testMethodList(): void + { + $data = array( + "total" => 5, + "users" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->users->list( - ); - - $this->assertInstanceOf(\Appwrite\Models\UserList::class, $response); - } - - public function testMethodCreate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $response = $this->users->list(); + + $this->assertInstanceOf(\Appwrite\Models\UserList::class, $response); + } + + public function testMethodCreate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -102,39 +107,40 @@ public function testMethodCreate(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodCreateArgon2User(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodCreateArgon2User(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -146,39 +152,40 @@ public function testMethodCreateArgon2User(): void { "password" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodCreateBcryptUser(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodCreateBcryptUser(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -190,39 +197,40 @@ public function testMethodCreateBcryptUser(): void { "password" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodListIdentities(): void { - - $data = array("total" => 5 -,"identities" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"provider" => "email" -,"providerUid" => "5e5bb8c16897e" -,"providerEmail" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodListIdentities(): void + { + $data = array( + "total" => 5, + "identities" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "provider" => "email", + "providerUid" => "5e5bb8c16897e", + "providerEmail" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->users->listIdentities( - ); + $response = $this->users->listIdentities(); - $this->assertInstanceOf(\Appwrite\Models\IdentityList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\IdentityList::class, $response); + } - public function testMethodDeleteIdentity(): void { - + public function testMethodDeleteIdentity(): void + { $data = ''; $this->client @@ -233,39 +241,40 @@ public function testMethodDeleteIdentity(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodCreateMD5User(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertSame($data, $response); + } + + public function testMethodCreateMD5User(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -277,39 +286,40 @@ public function testMethodCreateMD5User(): void { "password" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodCreatePHPassUser(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodCreatePHPassUser(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -321,39 +331,40 @@ public function testMethodCreatePHPassUser(): void { "password" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodCreateScryptUser(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodCreateScryptUser(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -370,39 +381,40 @@ public function testMethodCreateScryptUser(): void { 1 ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodCreateScryptModifiedUser(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodCreateScryptModifiedUser(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -417,39 +429,40 @@ public function testMethodCreateScryptModifiedUser(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodCreateSHAUser(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodCreateSHAUser(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -461,39 +474,40 @@ public function testMethodCreateSHAUser(): void { "password" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodGet(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -503,11 +517,11 @@ public function testMethodGet(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -518,39 +532,40 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateEmail(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateEmail(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -561,39 +576,40 @@ public function testMethodUpdateEmail(): void { "email@example.com" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodUpdateImpersonator(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodUpdateImpersonator(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -604,14 +620,14 @@ public function testMethodUpdateImpersonator(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodCreateJWT(): void { - - $data = array("jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" -) -; + public function testMethodCreateJWT(): void + { + $data = array( + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -621,39 +637,40 @@ public function testMethodCreateJWT(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Jwt::class, $response); - } - - public function testMethodUpdateLabels(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\Jwt::class, $response); + } + + public function testMethodUpdateLabels(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -664,37 +681,39 @@ public function testMethodUpdateLabels(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodListLogs(): void { - - $data = array("total" => 5 -,"logs" => array(array("event" => "account.sessions.create" -,"userId" => "610fc2f985ee0" -,"userEmail" => "john@appwrite.io" -,"userName" => "John Doe" -,"mode" => "admin" -,"ip" => "127.0.0.1" -,"time" => "2020-10-15T06:38:00.000+00:00" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodListLogs(): void + { + $data = array( + "total" => 5, + "logs" => array( + array( + "event" => "account.sessions.create", + "userId" => "610fc2f985ee0", + "userEmail" => "john@appwrite.io", + "userName" => "John Doe", + "mode" => "admin", + "ip" => "127.0.0.1", + "time" => "2020-10-15T06:38:00.000+00:00", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -704,29 +723,31 @@ public function testMethodListLogs(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); - } - - public function testMethodListMemberships(): void { - - $data = array("total" => 5 -,"memberships" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c16897e" -,"userName" => "John Doe" -,"userEmail" => "john@appwrite.io" -,"teamId" => "5e5ea5c16897e" -,"teamName" => "VIP" -,"invited" => "2020-10-15T06:38:00.000+00:00" -,"joined" => "2020-10-15T06:38:00.000+00:00" -,"confirm" => true -,"mfa" => true -,"roles" => array() -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\LogList::class, $response); + } + + public function testMethodListMemberships(): void + { + $data = array( + "total" => 5, + "memberships" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array() + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -736,39 +757,40 @@ public function testMethodListMemberships(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\MembershipList::class, $response); - } - - public function testMethodUpdateMFA(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\MembershipList::class, $response); + } + + public function testMethodUpdateMFA(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -779,11 +801,11 @@ public function testMethodUpdateMFA(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodDeleteMFAAuthenticator(): void { - + public function testMethodDeleteMFAAuthenticator(): void + { $data = ''; $this->client @@ -795,17 +817,17 @@ public function testMethodDeleteMFAAuthenticator(): void { AuthenticatorType::TOTP() ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodListMFAFactors(): void { - - $data = array("totp" => true -,"phone" => true -,"email" => true -,"recoveryCode" => true -) -; + public function testMethodListMFAFactors(): void + { + $data = array( + "totp" => true, + "phone" => true, + "email" => true, + "recoveryCode" => true + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -815,14 +837,14 @@ public function testMethodListMFAFactors(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\MfaFactors::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaFactors::class, $response); + } - public function testMethodGetMFARecoveryCodes(): void { - - $data = array("recoveryCodes" => array() -) -; + public function testMethodGetMFARecoveryCodes(): void + { + $data = array( + "recoveryCodes" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -832,14 +854,14 @@ public function testMethodGetMFARecoveryCodes(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } - public function testMethodUpdateMFARecoveryCodes(): void { - - $data = array("recoveryCodes" => array() -) -; + public function testMethodUpdateMFARecoveryCodes(): void + { + $data = array( + "recoveryCodes" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -849,14 +871,14 @@ public function testMethodUpdateMFARecoveryCodes(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } - public function testMethodCreateMFARecoveryCodes(): void { - - $data = array("recoveryCodes" => array() -) -; + public function testMethodCreateMFARecoveryCodes(): void + { + $data = array( + "recoveryCodes" => array() + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -866,39 +888,40 @@ public function testMethodCreateMFARecoveryCodes(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); - } - - public function testMethodUpdateName(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\MfaRecoveryCodes::class, $response); + } + + public function testMethodUpdateName(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -909,39 +932,40 @@ public function testMethodUpdateName(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodUpdatePassword(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodUpdatePassword(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -952,39 +976,40 @@ public function testMethodUpdatePassword(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodUpdatePhone(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodUpdatePhone(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -995,13 +1020,12 @@ public function testMethodUpdatePhone(): void { "+12065550100" ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } - public function testMethodGetPrefs(): void { - - $data = array() -; + public function testMethodGetPrefs(): void + { + $data = array(); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1011,13 +1035,12 @@ public function testMethodGetPrefs(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } - public function testMethodUpdatePrefs(): void { - - $data = array() -; + public function testMethodUpdatePrefs(): void + { + $data = array(); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1028,45 +1051,47 @@ public function testMethodUpdatePrefs(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); - } - - public function testMethodListSessions(): void { - - $data = array("total" => 5 -,"sessions" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\Preferences::class, $response); + } + + public function testMethodListSessions(): void + { + $data = array( + "total" => 5, + "sessions" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1076,42 +1101,42 @@ public function testMethodListSessions(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\SessionList::class, $response); - } - - public function testMethodCreateSession(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5bb8c16897e" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"provider" => "email" -,"providerUid" => "user@example.com" -,"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00" -,"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3" -,"ip" => "127.0.0.1" -,"osCode" => "Mac" -,"osName" => "Mac" -,"osVersion" => "Mac" -,"clientType" => "browser" -,"clientCode" => "CM" -,"clientName" => "Chrome Mobile iOS" -,"clientVersion" => "84.0" -,"clientEngine" => "WebKit" -,"clientEngineVersion" => "605.1.15" -,"deviceName" => "smartphone" -,"deviceBrand" => "Google" -,"deviceModel" => "Nexus 5" -,"countryCode" => "US" -,"countryName" => "United States" -,"current" => true -,"factors" => array() -,"secret" => "5e5bb8c16897e" -,"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\SessionList::class, $response); + } + + public function testMethodCreateSession(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1121,11 +1146,11 @@ public function testMethodCreateSession(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } - public function testMethodDeleteSessions(): void { - + public function testMethodDeleteSessions(): void + { $data = ''; $this->client @@ -1136,11 +1161,11 @@ public function testMethodDeleteSessions(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodDeleteSession(): void { - + public function testMethodDeleteSession(): void + { $data = ''; $this->client @@ -1152,39 +1177,40 @@ public function testMethodDeleteSession(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateStatus(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateStatus(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1195,24 +1221,26 @@ public function testMethodUpdateStatus(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodListTargets(): void { - - $data = array("total" => 5 -,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodListTargets(): void + { + $data = array( + "total" => 5, + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1222,21 +1250,21 @@ public function testMethodListTargets(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\TargetList::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\TargetList::class, $response); + } - public function testMethodCreateTarget(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -; + public function testMethodCreateTarget(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1249,21 +1277,21 @@ public function testMethodCreateTarget(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); + } - public function testMethodGetTarget(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -; + public function testMethodGetTarget(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1274,21 +1302,21 @@ public function testMethodGetTarget(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); + } - public function testMethodUpdateTarget(): void { - - $data = array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -; + public function testMethodUpdateTarget(): void + { + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1299,11 +1327,11 @@ public function testMethodUpdateTarget(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Target::class, $response); + } - public function testMethodDeleteTarget(): void { - + public function testMethodDeleteTarget(): void + { $data = ''; $this->client @@ -1315,19 +1343,19 @@ public function testMethodDeleteTarget(): void { "" ); - $this->assertSame($data, $response); - } + $this->assertSame($data, $response); + } - public function testMethodCreateToken(): void { - - $data = array("\$id" => "bb8ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"userId" => "5e5ea5c168bb8" -,"secret" => "[SECRET]" -,"expire" => "2020-10-15T06:38:00.000+00:00" -,"phrase" => "Golden Fox" -) -; + public function testMethodCreateToken(): void + { + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1337,39 +1365,40 @@ public function testMethodCreateToken(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); - } - - public function testMethodUpdateEmailVerification(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } + + public function testMethodUpdateEmailVerification(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1380,39 +1409,40 @@ public function testMethodUpdateEmailVerification(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } - - public function testMethodUpdatePhoneVerification(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "John Doe" -,"registration" => "2020-10-15T06:38:00.000+00:00" -,"status" => true -,"labels" => array() -,"passwordUpdate" => "2020-10-15T06:38:00.000+00:00" -,"email" => "john@appwrite.io" -,"phone" => "+4930901820" -,"emailVerification" => true -,"phoneVerification" => true -,"mfa" => true -,"prefs" => array() - - ,"targets" => array(array("\$id" => "259125845563242502" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "Apple iPhone 12" -,"userId" => "259125845563242502" -,"providerType" => "email" -,"identifier" => "token" -,"expired" => true -) -) - ,"accessedAt" => "2020-10-15T06:38:00.000+00:00" -) -; + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } + + public function testMethodUpdatePhoneVerification(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array( + array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ) + ), + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1423,7 +1453,7 @@ public function testMethodUpdatePhoneVerification(): void { true ); - $this->assertInstanceOf(\Appwrite\Models\User::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\User::class, $response); + } } diff --git a/tests/Appwrite/Services/WebhooksTest.php b/tests/Appwrite/Services/WebhooksTest.php index c9dc67b..fc8a7ce 100644 --- a/tests/Appwrite/Services/WebhooksTest.php +++ b/tests/Appwrite/Services/WebhooksTest.php @@ -7,63 +7,66 @@ use Mockery; use PHPUnit\Framework\TestCase; -final class WebhooksTest extends TestCase { +final class WebhooksTest extends TestCase +{ private $client; private $webhooks; - protected function setUp(): void { + protected function setUp(): void + { $this->client = Mockery::mock(Client::class); $this->webhooks = new Webhooks($this->client); } - public function testMethodList(): void { - - $data = array("total" => 5 -,"webhooks" => array(array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Webhook" -,"url" => "https://example.com/webhook" -,"events" => array() -,"security" => true -,"httpUser" => "username" -,"httpPass" => "password" -,"signatureKey" => "ad3d581ca230e2b7059c545e5a" -,"enabled" => true -,"logs" => "Failed to connect to remote server." -,"attempts" => 10 -) -) - ) -; + public function testMethodList(): void + { + $data = array( + "total" => 5, + "webhooks" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10 + ) + ) + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->webhooks->list( - ); + $response = $this->webhooks->list(); + + $this->assertInstanceOf(\Appwrite\Models\WebhookList::class, $response); + } - $this->assertInstanceOf(\Appwrite\Models\WebhookList::class, $response); - } - - public function testMethodCreate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Webhook" -,"url" => "https://example.com/webhook" -,"events" => array() -,"security" => true -,"httpUser" => "username" -,"httpPass" => "password" -,"signatureKey" => "ad3d581ca230e2b7059c545e5a" -,"enabled" => true -,"logs" => "Failed to connect to remote server." -,"attempts" => 10 -) -; + public function testMethodCreate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -76,26 +79,26 @@ public function testMethodCreate(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); - } - - public function testMethodGet(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Webhook" -,"url" => "https://example.com/webhook" -,"events" => array() -,"security" => true -,"httpUser" => "username" -,"httpPass" => "password" -,"signatureKey" => "ad3d581ca230e2b7059c545e5a" -,"enabled" => true -,"logs" => "Failed to connect to remote server." -,"attempts" => 10 -) -; + $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); + } + + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -105,26 +108,26 @@ public function testMethodGet(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); - } - - public function testMethodUpdate(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Webhook" -,"url" => "https://example.com/webhook" -,"events" => array() -,"security" => true -,"httpUser" => "username" -,"httpPass" => "password" -,"signatureKey" => "ad3d581ca230e2b7059c545e5a" -,"enabled" => true -,"logs" => "Failed to connect to remote server." -,"attempts" => 10 -) -; + $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); + } + + public function testMethodUpdate(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -137,11 +140,11 @@ public function testMethodUpdate(): void { array() ); - $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); + } - public function testMethodDelete(): void { - + public function testMethodDelete(): void + { $data = ''; $this->client @@ -152,26 +155,26 @@ public function testMethodDelete(): void { "" ); - $this->assertSame($data, $response); - } - - public function testMethodUpdateSignature(): void { - - $data = array("\$id" => "5e5ea5c16897e" -,"\$createdAt" => "2020-10-15T06:38:00.000+00:00" -,"\$updatedAt" => "2020-10-15T06:38:00.000+00:00" -,"name" => "My Webhook" -,"url" => "https://example.com/webhook" -,"events" => array() -,"security" => true -,"httpUser" => "username" -,"httpPass" => "password" -,"signatureKey" => "ad3d581ca230e2b7059c545e5a" -,"enabled" => true -,"logs" => "Failed to connect to remote server." -,"attempts" => 10 -) -; + $this->assertSame($data, $response); + } + + public function testMethodUpdateSignature(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10 + ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -181,7 +184,7 @@ public function testMethodUpdateSignature(): void { "" ); - $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); - } + $this->assertInstanceOf(\Appwrite\Models\Webhook::class, $response); + } } From 4157c475f7344969648ba4448673934848eb1a85 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 3 Apr 2026 18:55:43 +0530 Subject: [PATCH 4/5] chore: update PHP SDK to 22.0.0 --- README.md | 4 +++- src/Appwrite/Models/ArraySerializable.php | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 685f6e8..fabdf43 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ To install via [Composer](http://getcomposer.org/): composer require appwrite/appwrite ``` +Requires PHP 8.2 or later. + ## Getting Started @@ -93,4 +95,4 @@ This library is auto-generated by Appwrite custom [SDK Generator](https://github ## License -Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. diff --git a/src/Appwrite/Models/ArraySerializable.php b/src/Appwrite/Models/ArraySerializable.php index fbcd204..459dcdd 100644 --- a/src/Appwrite/Models/ArraySerializable.php +++ b/src/Appwrite/Models/ArraySerializable.php @@ -101,6 +101,16 @@ private static function hydrateValue(string $name, mixed $value, \ReflectionPara $arrayType = static::getArrayTypes()[$name] ?? null; if ($arrayType === null) { + foreach ($value as $item) { + if (is_array($item) || is_object($item)) { + @trigger_error( + 'Array property "' . $name . '" on ' . static::class . ' contains structured values but has no ARRAY_TYPES mapping. Values will remain unhydrated.', + E_USER_WARNING + ); + break; + } + } + return $value; } From c985958bd26f063fb1a65678bbd019958ed8aa0d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 3 Apr 2026 19:22:04 +0530 Subject: [PATCH 5/5] chore: update PHP SDK to 22.0.0 --- src/Appwrite/Models/ArraySerializable.php | 87 +++++++++++++++++++++-- 1 file changed, 82 insertions(+), 5 deletions(-) diff --git a/src/Appwrite/Models/ArraySerializable.php b/src/Appwrite/Models/ArraySerializable.php index 459dcdd..2fe332f 100644 --- a/src/Appwrite/Models/ArraySerializable.php +++ b/src/Appwrite/Models/ArraySerializable.php @@ -9,20 +9,22 @@ trait ArraySerializable */ public static function from(array $data): static { - $reflection = new \ReflectionClass(static::class); - $constructor = $reflection->getConstructor(); + $parameters = static::getConstructorParameters(); - if ($constructor === null) { + if ($parameters === []) { return new static(); } $arguments = []; + $additionalProperties = static::hasAdditionalProperties() + ? static::extractAdditionalProperties($data, $parameters) + : []; - foreach ($constructor->getParameters() as $parameter) { + foreach ($parameters as $parameter) { $name = $parameter->getName(); if ($name === 'data' && static::hasAdditionalProperties()) { - $arguments[$name] = isset($data['data']) && is_array($data['data']) ? $data['data'] : $data; + $arguments[$name] = $additionalProperties; continue; } @@ -51,6 +53,14 @@ public function toArray(): array $result = []; foreach (get_object_vars($this) as $name => $value) { + if ($name === 'data' && static::hasAdditionalProperties()) { + foreach (static::serializeAdditionalProperties($value) as $field => $fieldValue) { + $result[$field] = $fieldValue; + } + + continue; + } + $field = static::getFieldMap()[$name] ?? $name; $result[$field] = static::serializeValue($value); } @@ -79,6 +89,73 @@ private static function hasAdditionalProperties(): bool return defined(static::class . '::ADDITIONAL_PROPERTIES') && static::ADDITIONAL_PROPERTIES; } + /** + * @return array + */ + private static function getConstructorParameters(): array + { + /** @var array> $cache */ + static $cache = []; + + if (isset($cache[static::class])) { + return $cache[static::class]; + } + + $reflection = new \ReflectionClass(static::class); + $constructor = $reflection->getConstructor(); + + if ($constructor === null) { + $cache[static::class] = []; + return []; + } + + return $cache[static::class] = $constructor->getParameters(); + } + + /** + * @param array $data + * @param array $parameters + * @return array + */ + private static function extractAdditionalProperties(array $data, array $parameters): array + { + if (isset($data['data']) && is_array($data['data'])) { + return $data['data']; + } + + $knownFields = []; + + foreach ($parameters as $parameter) { + $name = $parameter->getName(); + + if ($name === 'data') { + continue; + } + + $knownFields[] = static::getFieldMap()[$name] ?? $name; + } + + return array_diff_key($data, array_flip($knownFields)); + } + + /** + * @return array + */ + private static function serializeAdditionalProperties(mixed $value): array + { + if (!is_array($value)) { + return []; + } + + $result = []; + + foreach ($value as $field => $fieldValue) { + $result[$field] = static::serializeValue($fieldValue); + } + + return $result; + } + private static function hydrateValue(string $name, mixed $value, \ReflectionParameter $parameter): mixed { if ($value === null) {