diff --git a/CHANGELOG.md b/CHANGELOG.md index 2837ae0c..a5d327a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 23.1.0 + +* Added: Introduced `bigint` create/update APIs for legacy Databases attributes +* Added: Introduced `bigint` create/update APIs for `TablesDB` columns +* Updated: Extended key-list query filters with `key`, `resourceType`, `resourceId`, and `secret` + ## 23.0.0 * [BREAKING] Renamed Webhook model fields: `security` → `tls`, `httpUser` → `authUsername`, `httpPass` → `authPassword`, `signatureKey` → `secret` diff --git a/README.md b/README.md index 1af96c04..b5f150d5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dart/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dart/releases).** > This is the Dart SDK for integrating with Appwrite from your Dart server-side code. If you're looking for the Flutter SDK you should check [appwrite/sdk-for-flutter](https://github.com/appwrite/sdk-for-flutter) @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - dart_appwrite: ^23.0.0 + dart_appwrite: ^23.1.0 ``` You can install packages from the command line: diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md new file mode 100644 index 00000000..2b4cb974 --- /dev/null +++ b/docs/examples/databases/create-big-int-attribute.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeBigint result = await databases.createBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); +``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md new file mode 100644 index 00000000..e885b89f --- /dev/null +++ b/docs/examples/databases/update-big-int-attribute.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeBigint result = await databases.updateBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: 0, + min: 0, // (optional) + max: 0, // (optional) + newKey: '', // (optional) +); +``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 7c7cf991..48d9ca80 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -10,6 +10,7 @@ Functions functions = Functions(client); Variable result = await functions.createVariable( functionId: '', + variableId: '', key: '', value: '', secret: false, // (optional) diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index c960e9bd..74456309 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -21,7 +21,7 @@ Func result = await functions.create( logging: false, // (optional) entrypoint: '', // (optional) commands: '', // (optional) - scopes: [enums.Scopes.sessionsWrite], // (optional) + scopes: [enums.Scopes.projectRead], // (optional) installationId: '', // (optional) providerRepositoryId: '', // (optional) providerBranch: '', // (optional) diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 0cbd895c..bd07b000 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -10,5 +10,7 @@ Functions functions = Functions(client); VariableList result = await functions.listVariables( functionId: '', + queries: [], // (optional) + total: false, // (optional) ); ``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index be5e0345..e933473f 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -11,7 +11,7 @@ Functions functions = Functions(client); Variable result = await functions.updateVariable( functionId: '', variableId: '', - key: '', + key: '', // (optional) value: '', // (optional) secret: false, // (optional) ); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index bd99c93f..904f8967 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -21,7 +21,7 @@ Func result = await functions.update( logging: false, // (optional) entrypoint: '', // (optional) commands: '', // (optional) - scopes: [enums.Scopes.sessionsWrite], // (optional) + scopes: [enums.Scopes.projectRead], // (optional) installationId: '', // (optional) providerRepositoryId: '', // (optional) providerBranch: '', // (optional) diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 00000000..50c950a6 --- /dev/null +++ b/docs/examples/presences/delete.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +await presences.delete( + presenceId: '', +); +``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md new file mode 100644 index 00000000..f8025297 --- /dev/null +++ b/docs/examples/presences/get.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +Presence result = await presences.get( + presenceId: '', +); +``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md new file mode 100644 index 00000000..d0a87bb1 --- /dev/null +++ b/docs/examples/presences/list.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +PresenceList result = await presences.list( + queries: [], // (optional) + total: false, // (optional) + ttl: 0, // (optional) +); +``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md new file mode 100644 index 00000000..445afd19 --- /dev/null +++ b/docs/examples/presences/update-presence.md @@ -0,0 +1,22 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/permission.dart'; +import 'package:dart_appwrite/role.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +Presence result = await presences.updatePresence( + presenceId: '', + userId: '', + status: '', // (optional) + expiresAt: '2020-10-15T06:38:00.000+00:00', // (optional) + metadata: {}, // (optional) + permissions: [Permission.read(Role.any())], // (optional) + purge: false, // (optional) +); +``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md new file mode 100644 index 00000000..7602a2eb --- /dev/null +++ b/docs/examples/presences/upsert.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/permission.dart'; +import 'package:dart_appwrite/role.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +Presence result = await presences.upsert( + presenceId: '', + userId: '', + status: '', + permissions: [Permission.read(Role.any())], // (optional) + expiresAt: '2020-10-15T06:38:00.000+00:00', // (optional) + metadata: {}, // (optional) +); +``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md new file mode 100644 index 00000000..dda5801e --- /dev/null +++ b/docs/examples/project/create-ephemeral-key.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +EphemeralKey result = await project.createEphemeralKey( + scopes: [enums.Scopes.projectRead], + duration: 600, +); +``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index 9c63e3bf..9e1d8e8e 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -12,7 +12,7 @@ Project project = Project(client); Key result = await project.createKey( keyId: '', name: '', - scopes: [enums.Scopes.sessionsWrite], + scopes: [enums.Scopes.projectRead], expire: '2020-10-15T06:38:00.000+00:00', // (optional) ); ``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md new file mode 100644 index 00000000..c73c4c2f --- /dev/null +++ b/docs/examples/project/create-mock-phone.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +MockNumber result = await project.createMockPhone( + number: '+12065550100', + otp: '', +); +``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md new file mode 100644 index 00000000..fac73da8 --- /dev/null +++ b/docs/examples/project/create-smtp-test.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + + result = await project.createSMTPTest( + emails: [], +); +``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md new file mode 100644 index 00000000..f47a2190 --- /dev/null +++ b/docs/examples/project/delete-mock-phone.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +await project.deleteMockPhone( + number: '+12065550100', +); +``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md new file mode 100644 index 00000000..3199e2db --- /dev/null +++ b/docs/examples/project/delete.md @@ -0,0 +1,12 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +await project.delete(); +``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md new file mode 100644 index 00000000..798a0186 --- /dev/null +++ b/docs/examples/project/get-email-template.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +EmailTemplate result = await project.getEmailTemplate( + templateId: enums.EmailTemplateType.verification, + locale: enums.EmailTemplateLocale.af, // (optional) +); +``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md new file mode 100644 index 00000000..e3ef61ff --- /dev/null +++ b/docs/examples/project/get-mock-phone.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +MockNumber result = await project.getMockPhone( + number: '+12065550100', +); +``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md new file mode 100644 index 00000000..77ccd41a --- /dev/null +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +dynamic result = await project.getOAuth2Provider( + providerId: enums.ProviderId.amazon, +); +``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md new file mode 100644 index 00000000..55eae16f --- /dev/null +++ b/docs/examples/project/get-policy.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +dynamic result = await project.getPolicy( + policyId: enums.PolicyId.passwordDictionary, +); +``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md new file mode 100644 index 00000000..0bd9ee7e --- /dev/null +++ b/docs/examples/project/list-email-templates.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +EmailTemplateList result = await project.listEmailTemplates( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md new file mode 100644 index 00000000..dac64397 --- /dev/null +++ b/docs/examples/project/list-mock-phones.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +MockNumberList result = await project.listMockPhones( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md new file mode 100644 index 00000000..b69c5273 --- /dev/null +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2ProviderList result = await project.listOAuth2Providers( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md new file mode 100644 index 00000000..5aba661c --- /dev/null +++ b/docs/examples/project/list-policies.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +PolicyList result = await project.listPolicies( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md new file mode 100644 index 00000000..94b5245d --- /dev/null +++ b/docs/examples/project/update-auth-method.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateAuthMethod( + methodId: enums.MethodId.emailPassword, + enabled: false, +); +``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md new file mode 100644 index 00000000..a378f794 --- /dev/null +++ b/docs/examples/project/update-email-template.md @@ -0,0 +1,22 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +EmailTemplate result = await project.updateEmailTemplate( + templateId: enums.EmailTemplateType.verification, + locale: enums.EmailTemplateLocale.af, // (optional) + subject: '', // (optional) + message: '', // (optional) + senderName: '', // (optional) + senderEmail: 'email@example.com', // (optional) + replyToEmail: 'email@example.com', // (optional) + replyToName: '', // (optional) +); +``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 83f4139c..86379d8c 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -12,7 +12,7 @@ Project project = Project(client); Key result = await project.updateKey( keyId: '', name: '', - scopes: [enums.Scopes.sessionsWrite], + scopes: [enums.Scopes.projectRead], expire: '2020-10-15T06:38:00.000+00:00', // (optional) ); ``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md new file mode 100644 index 00000000..df34e2c4 --- /dev/null +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -0,0 +1,18 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateMembershipPrivacyPolicy( + userId: false, // (optional) + userEmail: false, // (optional) + userPhone: false, // (optional) + userName: false, // (optional) + userMFA: false, // (optional) +); +``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md new file mode 100644 index 00000000..3f584d21 --- /dev/null +++ b/docs/examples/project/update-mock-phone.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +MockNumber result = await project.updateMockPhone( + number: '+12065550100', + otp: '', +); +``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md new file mode 100644 index 00000000..1821f5d8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-amazon.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Amazon result = await project.updateOAuth2Amazon( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md new file mode 100644 index 00000000..06f506e5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -0,0 +1,18 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Apple result = await project.updateOAuth2Apple( + serviceId: '', // (optional) + keyId: '', // (optional) + teamId: '', // (optional) + p8File: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md new file mode 100644 index 00000000..e00a5976 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Auth0 result = await project.updateOAuth2Auth0( + clientId: '', // (optional) + clientSecret: '', // (optional) + endpoint: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md new file mode 100644 index 00000000..73470273 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Authentik result = await project.updateOAuth2Authentik( + clientId: '', // (optional) + clientSecret: '', // (optional) + endpoint: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md new file mode 100644 index 00000000..1273e6e4 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-autodesk.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Autodesk result = await project.updateOAuth2Autodesk( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md new file mode 100644 index 00000000..2f9274a0 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Bitbucket result = await project.updateOAuth2Bitbucket( + key: '', // (optional) + secret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md new file mode 100644 index 00000000..5f03c82e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitly.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Bitly result = await project.updateOAuth2Bitly( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md new file mode 100644 index 00000000..b00ab7c5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-box.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Box result = await project.updateOAuth2Box( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md new file mode 100644 index 00000000..1117cf85 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dailymotion.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Dailymotion result = await project.updateOAuth2Dailymotion( + apiKey: '', // (optional) + apiSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md new file mode 100644 index 00000000..7e06450d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Discord result = await project.updateOAuth2Discord( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md new file mode 100644 index 00000000..42d62a82 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-disqus.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Disqus result = await project.updateOAuth2Disqus( + publicKey: '', // (optional) + secretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md new file mode 100644 index 00000000..20082912 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dropbox.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Dropbox result = await project.updateOAuth2Dropbox( + appKey: '', // (optional) + appSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md new file mode 100644 index 00000000..3e6118a1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-etsy.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Etsy result = await project.updateOAuth2Etsy( + keyString: '', // (optional) + sharedSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md new file mode 100644 index 00000000..48d282a9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-facebook.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Facebook result = await project.updateOAuth2Facebook( + appId: '', // (optional) + appSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md new file mode 100644 index 00000000..1b80d0e5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-figma.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Figma result = await project.updateOAuth2Figma( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md new file mode 100644 index 00000000..73c41171 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2FusionAuth result = await project.updateOAuth2FusionAuth( + clientId: '', // (optional) + clientSecret: '', // (optional) + endpoint: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md new file mode 100644 index 00000000..e2830382 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Github result = await project.updateOAuth2GitHub( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md new file mode 100644 index 00000000..1d7418d9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Gitlab result = await project.updateOAuth2Gitlab( + applicationId: '', // (optional) + secret: '', // (optional) + endpoint: 'https://example.com', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md new file mode 100644 index 00000000..c96f80e5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-google.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Google result = await project.updateOAuth2Google( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md new file mode 100644 index 00000000..b7195b82 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -0,0 +1,18 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Keycloak result = await project.updateOAuth2Keycloak( + clientId: '', // (optional) + clientSecret: '', // (optional) + endpoint: '', // (optional) + realmName: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md new file mode 100644 index 00000000..5cfdf9a4 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-kick.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Kick result = await project.updateOAuth2Kick( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md new file mode 100644 index 00000000..d69f1eaa --- /dev/null +++ b/docs/examples/project/update-o-auth-2-linkedin.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Linkedin result = await project.updateOAuth2Linkedin( + clientId: '', // (optional) + primaryClientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md new file mode 100644 index 00000000..7f1aa6ca --- /dev/null +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Microsoft result = await project.updateOAuth2Microsoft( + applicationId: '', // (optional) + applicationSecret: '', // (optional) + tenant: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md new file mode 100644 index 00000000..ba723ccc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-notion.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Notion result = await project.updateOAuth2Notion( + oauthClientId: '', // (optional) + oauthClientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md new file mode 100644 index 00000000..4784bf46 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -0,0 +1,20 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Oidc result = await project.updateOAuth2Oidc( + clientId: '', // (optional) + clientSecret: '', // (optional) + wellKnownURL: 'https://example.com', // (optional) + authorizationURL: 'https://example.com', // (optional) + tokenURL: 'https://example.com', // (optional) + userInfoURL: 'https://example.com', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md new file mode 100644 index 00000000..1b79a5e6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -0,0 +1,18 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Okta result = await project.updateOAuth2Okta( + clientId: '', // (optional) + clientSecret: '', // (optional) + domain: '', // (optional) + authorizationServerId: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md new file mode 100644 index 00000000..eda05f5e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Paypal result = await project.updateOAuth2PaypalSandbox( + clientId: '', // (optional) + secretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md new file mode 100644 index 00000000..120b5817 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Paypal result = await project.updateOAuth2Paypal( + clientId: '', // (optional) + secretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md new file mode 100644 index 00000000..9b5ee737 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-podio.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Podio result = await project.updateOAuth2Podio( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md new file mode 100644 index 00000000..6be026b4 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Salesforce result = await project.updateOAuth2Salesforce( + customerKey: '', // (optional) + customerSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md new file mode 100644 index 00000000..1032810c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-slack.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Slack result = await project.updateOAuth2Slack( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md new file mode 100644 index 00000000..8e7f9834 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-spotify.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Spotify result = await project.updateOAuth2Spotify( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md new file mode 100644 index 00000000..36746673 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-stripe.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Stripe result = await project.updateOAuth2Stripe( + clientId: '', // (optional) + apiSecretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md new file mode 100644 index 00000000..653abf6e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Tradeshift result = await project.updateOAuth2TradeshiftSandbox( + oauth2ClientId: '', // (optional) + oauth2ClientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md new file mode 100644 index 00000000..1e780bfc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Tradeshift result = await project.updateOAuth2Tradeshift( + oauth2ClientId: '', // (optional) + oauth2ClientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md new file mode 100644 index 00000000..93d29acd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-twitch.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Twitch result = await project.updateOAuth2Twitch( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md new file mode 100644 index 00000000..32e3495a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-word-press.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2WordPress result = await project.updateOAuth2WordPress( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md new file mode 100644 index 00000000..f08d5074 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yahoo.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Yahoo result = await project.updateOAuth2Yahoo( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md new file mode 100644 index 00000000..4106fe67 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yandex.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Yandex result = await project.updateOAuth2Yandex( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md new file mode 100644 index 00000000..69d44d8a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Zoho result = await project.updateOAuth2Zoho( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md new file mode 100644 index 00000000..d91ddcbd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoom.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Zoom result = await project.updateOAuth2Zoom( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md new file mode 100644 index 00000000..bf7e5f62 --- /dev/null +++ b/docs/examples/project/update-o-auth-2x.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2X result = await project.updateOAuth2X( + customerKey: '', // (optional) + secretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md new file mode 100644 index 00000000..9d07cff3 --- /dev/null +++ b/docs/examples/project/update-password-dictionary-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updatePasswordDictionaryPolicy( + enabled: false, +); +``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md new file mode 100644 index 00000000..2d5ca13e --- /dev/null +++ b/docs/examples/project/update-password-history-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updatePasswordHistoryPolicy( + total: 1, +); +``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md new file mode 100644 index 00000000..51680b7d --- /dev/null +++ b/docs/examples/project/update-password-personal-data-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updatePasswordPersonalDataPolicy( + enabled: false, +); +``` diff --git a/docs/examples/project/update-protocol-status.md b/docs/examples/project/update-protocol.md similarity index 89% rename from docs/examples/project/update-protocol-status.md rename to docs/examples/project/update-protocol.md index 721651af..86501059 100644 --- a/docs/examples/project/update-protocol-status.md +++ b/docs/examples/project/update-protocol.md @@ -9,7 +9,7 @@ Client client = Client() Project project = Project(client); -Project result = await project.updateProtocolStatus( +Project result = await project.updateProtocol( protocolId: enums.ProtocolId.rest, enabled: false, ); diff --git a/docs/examples/project/update-service-status.md b/docs/examples/project/update-service.md similarity index 89% rename from docs/examples/project/update-service-status.md rename to docs/examples/project/update-service.md index 59487ddd..828b640a 100644 --- a/docs/examples/project/update-service-status.md +++ b/docs/examples/project/update-service.md @@ -9,7 +9,7 @@ Client client = Client() Project project = Project(client); -Project result = await project.updateServiceStatus( +Project result = await project.updateService( serviceId: enums.ServiceId.account, enabled: false, ); diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md new file mode 100644 index 00000000..a3d892f0 --- /dev/null +++ b/docs/examples/project/update-session-alert-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSessionAlertPolicy( + enabled: false, +); +``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md new file mode 100644 index 00000000..5b102294 --- /dev/null +++ b/docs/examples/project/update-session-duration-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSessionDurationPolicy( + duration: 5, +); +``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md new file mode 100644 index 00000000..e38b5180 --- /dev/null +++ b/docs/examples/project/update-session-invalidation-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSessionInvalidationPolicy( + enabled: false, +); +``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md new file mode 100644 index 00000000..8726970e --- /dev/null +++ b/docs/examples/project/update-session-limit-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSessionLimitPolicy( + total: 1, +); +``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md new file mode 100644 index 00000000..ce64a691 --- /dev/null +++ b/docs/examples/project/update-smtp.md @@ -0,0 +1,24 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSMTP( + host: '', // (optional) + port: 0, // (optional) + username: '', // (optional) + password: '', // (optional) + senderEmail: 'email@example.com', // (optional) + senderName: '', // (optional) + replyToEmail: 'email@example.com', // (optional) + replyToName: '', // (optional) + secure: enums.Secure.tls, // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md new file mode 100644 index 00000000..b423abbe --- /dev/null +++ b/docs/examples/project/update-user-limit-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateUserLimitPolicy( + total: 1, +); +``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md new file mode 100644 index 00000000..cb63b308 --- /dev/null +++ b/docs/examples/proxy/create-api-rule.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.createAPIRule( + domain: '', +); +``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md new file mode 100644 index 00000000..64bbbab2 --- /dev/null +++ b/docs/examples/proxy/create-function-rule.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.createFunctionRule( + domain: '', + functionId: '', + branch: '', // (optional) +); +``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md new file mode 100644 index 00000000..31357162 --- /dev/null +++ b/docs/examples/proxy/create-redirect-rule.md @@ -0,0 +1,19 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.createRedirectRule( + domain: '', + url: 'https://example.com', + statusCode: enums.StatusCode.movedPermanently301, + resourceId: '', + resourceType: enums.ProxyResourceType.site, +); +``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md new file mode 100644 index 00000000..912c2acd --- /dev/null +++ b/docs/examples/proxy/create-site-rule.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.createSiteRule( + domain: '', + siteId: '', + branch: '', // (optional) +); +``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md new file mode 100644 index 00000000..6829f2a1 --- /dev/null +++ b/docs/examples/proxy/delete-rule.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +await proxy.deleteRule( + ruleId: '', +); +``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md new file mode 100644 index 00000000..6ade1647 --- /dev/null +++ b/docs/examples/proxy/get-rule.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.getRule( + ruleId: '', +); +``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md new file mode 100644 index 00000000..29931d1d --- /dev/null +++ b/docs/examples/proxy/list-rules.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRuleList result = await proxy.listRules( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md new file mode 100644 index 00000000..00c62dff --- /dev/null +++ b/docs/examples/proxy/update-rule-status.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.updateRuleStatus( + ruleId: '', +); +``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index d4c23fd6..0144bec0 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -10,6 +10,7 @@ Sites sites = Sites(client); Variable result = await sites.createVariable( siteId: '', + variableId: '', key: '', value: '', secret: false, // (optional) diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index 13777583..2f226ed6 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -10,5 +10,7 @@ Sites sites = Sites(client); VariableList result = await sites.listVariables( siteId: '', + queries: [], // (optional) + total: false, // (optional) ); ``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 8fb4b42d..24a135ea 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -11,7 +11,7 @@ Sites sites = Sites(client); Variable result = await sites.updateVariable( siteId: '', variableId: '', - key: '', + key: '', // (optional) value: '', // (optional) secret: false, // (optional) ); diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md new file mode 100644 index 00000000..c5d2656a --- /dev/null +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +TablesDB tablesDB = TablesDB(client); + +ColumnBigint result = await tablesDB.createBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); +``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md new file mode 100644 index 00000000..c96db0d0 --- /dev/null +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +TablesDB tablesDB = TablesDB(client); + +ColumnBigint result = await tablesDB.updateBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: 0, + min: 0, // (optional) + max: 0, // (optional) + newKey: '', // (optional) +); +``` diff --git a/lib/dart_appwrite.dart b/lib/dart_appwrite.dart index 371d4cab..eed40431 100644 --- a/lib/dart_appwrite.dart +++ b/lib/dart_appwrite.dart @@ -38,7 +38,9 @@ part 'services/graphql.dart'; part 'services/health.dart'; part 'services/locale.dart'; part 'services/messaging.dart'; +part 'services/presences.dart'; part 'services/project.dart'; +part 'services/proxy.dart'; part 'services/sites.dart'; part 'services/storage.dart'; part 'services/tables_db.dart'; diff --git a/lib/enums.dart b/lib/enums.dart index ac0ee55a..f628ed59 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -25,8 +25,16 @@ part 'src/enums/execution_method.dart'; part 'src/enums/name.dart'; part 'src/enums/message_priority.dart'; part 'src/enums/smtp_encryption.dart'; +part 'src/enums/method_id.dart'; +part 'src/enums/provider_id.dart'; +part 'src/enums/policy_id.dart'; part 'src/enums/protocol_id.dart'; part 'src/enums/service_id.dart'; +part 'src/enums/secure.dart'; +part 'src/enums/email_template_type.dart'; +part 'src/enums/email_template_locale.dart'; +part 'src/enums/status_code.dart'; +part 'src/enums/proxy_resource_type.dart'; part 'src/enums/framework.dart'; part 'src/enums/build_runtime.dart'; part 'src/enums/adapter.dart'; @@ -45,4 +53,6 @@ part 'src/enums/execution_status.dart'; part 'src/enums/platform_type.dart'; part 'src/enums/health_antivirus_status.dart'; part 'src/enums/health_check_status.dart'; +part 'src/enums/proxy_rule_deployment_resource_type.dart'; +part 'src/enums/proxy_rule_status.dart'; part 'src/enums/message_status.dart'; diff --git a/lib/models.dart b/lib/models.dart index 5af3de6c..26758564 100644 --- a/lib/models.dart +++ b/lib/models.dart @@ -6,6 +6,7 @@ import 'enums.dart' as enums; part 'src/models/model.dart'; part 'src/models/row_list.dart'; part 'src/models/document_list.dart'; +part 'src/models/presence_list.dart'; part 'src/models/table_list.dart'; part 'src/models/collection_list.dart'; part 'src/models/database_list.dart'; @@ -34,7 +35,11 @@ part 'src/models/language_list.dart'; part 'src/models/currency_list.dart'; part 'src/models/phone_list.dart'; part 'src/models/variable_list.dart'; +part 'src/models/mock_number_list.dart'; +part 'src/models/policy_list.dart'; +part 'src/models/email_template_list.dart'; part 'src/models/health_status_list.dart'; +part 'src/models/proxy_rule_list.dart'; part 'src/models/locale_code_list.dart'; part 'src/models/provider_list.dart'; part 'src/models/message_list.dart'; @@ -48,6 +53,7 @@ part 'src/models/collection.dart'; part 'src/models/attribute_list.dart'; part 'src/models/attribute_string.dart'; part 'src/models/attribute_integer.dart'; +part 'src/models/attribute_bigint.dart'; part 'src/models/attribute_float.dart'; part 'src/models/attribute_boolean.dart'; part 'src/models/attribute_email.dart'; @@ -67,6 +73,7 @@ part 'src/models/table.dart'; part 'src/models/column_list.dart'; part 'src/models/column_string.dart'; part 'src/models/column_integer.dart'; +part 'src/models/column_bigint.dart'; part 'src/models/column_float.dart'; part 'src/models/column_boolean.dart'; part 'src/models/column_email.dart'; @@ -86,6 +93,7 @@ part 'src/models/index.dart'; part 'src/models/column_index.dart'; part 'src/models/row.dart'; part 'src/models/document.dart'; +part 'src/models/presence.dart'; part 'src/models/log.dart'; part 'src/models/user.dart'; part 'src/models/algo_md5.dart'; @@ -117,8 +125,59 @@ part 'src/models/execution.dart'; part 'src/models/project.dart'; part 'src/models/webhook.dart'; part 'src/models/key.dart'; +part 'src/models/ephemeral_key.dart'; part 'src/models/dev_key.dart'; part 'src/models/mock_number.dart'; +part 'src/models/o_auth2_github.dart'; +part 'src/models/o_auth2_discord.dart'; +part 'src/models/o_auth2_figma.dart'; +part 'src/models/o_auth2_dropbox.dart'; +part 'src/models/o_auth2_dailymotion.dart'; +part 'src/models/o_auth2_bitbucket.dart'; +part 'src/models/o_auth2_bitly.dart'; +part 'src/models/o_auth2_box.dart'; +part 'src/models/o_auth2_autodesk.dart'; +part 'src/models/o_auth2_google.dart'; +part 'src/models/o_auth2_zoom.dart'; +part 'src/models/o_auth2_zoho.dart'; +part 'src/models/o_auth2_yandex.dart'; +part 'src/models/o_auth2_x.dart'; +part 'src/models/o_auth2_word_press.dart'; +part 'src/models/o_auth2_twitch.dart'; +part 'src/models/o_auth2_stripe.dart'; +part 'src/models/o_auth2_spotify.dart'; +part 'src/models/o_auth2_slack.dart'; +part 'src/models/o_auth2_podio.dart'; +part 'src/models/o_auth2_notion.dart'; +part 'src/models/o_auth2_salesforce.dart'; +part 'src/models/o_auth2_yahoo.dart'; +part 'src/models/o_auth2_linkedin.dart'; +part 'src/models/o_auth2_disqus.dart'; +part 'src/models/o_auth2_amazon.dart'; +part 'src/models/o_auth2_etsy.dart'; +part 'src/models/o_auth2_facebook.dart'; +part 'src/models/o_auth2_tradeshift.dart'; +part 'src/models/o_auth2_paypal.dart'; +part 'src/models/o_auth2_gitlab.dart'; +part 'src/models/o_auth2_authentik.dart'; +part 'src/models/o_auth2_auth0.dart'; +part 'src/models/o_auth2_fusion_auth.dart'; +part 'src/models/o_auth2_keycloak.dart'; +part 'src/models/o_auth2_oidc.dart'; +part 'src/models/o_auth2_okta.dart'; +part 'src/models/o_auth2_kick.dart'; +part 'src/models/o_auth2_apple.dart'; +part 'src/models/o_auth2_microsoft.dart'; +part 'src/models/o_auth2_provider_list.dart'; +part 'src/models/policy_password_dictionary.dart'; +part 'src/models/policy_password_history.dart'; +part 'src/models/policy_password_personal_data.dart'; +part 'src/models/policy_session_alert.dart'; +part 'src/models/policy_session_duration.dart'; +part 'src/models/policy_session_invalidation.dart'; +part 'src/models/policy_session_limit.dart'; +part 'src/models/policy_user_limit.dart'; +part 'src/models/policy_membership_privacy.dart'; part 'src/models/auth_provider.dart'; part 'src/models/platform_web.dart'; part 'src/models/platform_apple.dart'; @@ -139,6 +198,8 @@ part 'src/models/health_certificate.dart'; part 'src/models/health_time.dart'; part 'src/models/headers.dart'; part 'src/models/specification.dart'; +part 'src/models/proxy_rule.dart'; +part 'src/models/email_template.dart'; part 'src/models/mfa_challenge.dart'; part 'src/models/mfa_recovery_codes.dart'; part 'src/models/mfa_type.dart'; diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 76d6aa73..1fd2b527 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -386,6 +386,82 @@ class Databases extends Service { return models.AttributeList.fromMap(res.data); } + /// Create a bigint attribute. Optionally, minimum and maximum values can be + /// provided. + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead.') + Future createBigIntAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + int? min, + int? max, + int? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/bigint' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + if (array != null) 'array': array, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.AttributeBigint.fromMap(res.data); + } + + /// Update a bigint attribute. Changing the `default` value will not update + /// already existing documents. + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead.') + Future updateBigIntAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required int? xdefault, + int? min, + int? max, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); + + final Map apiParams = { + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'newKey': newKey, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.AttributeBigint.fromMap(res.data); + } + /// Create a boolean attribute. /// @Deprecated( diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e17e0f65..01426171 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -563,11 +563,14 @@ class Functions extends Service { /// Get a list of all variables of a specific function. Future listVariables( - {required String functionId}) async { + {required String functionId, List? queries, bool? total}) async { final String apiPath = '/functions/{functionId}/variables' .replaceAll('{functionId}', functionId); - final Map apiParams = {}; + final Map apiParams = { + if (queries != null) 'queries': queries, + if (total != null) 'total': total, + }; final Map apiHeaders = {}; @@ -581,6 +584,7 @@ class Functions extends Service { /// in the function at runtime as environment variables. Future createVariable( {required String functionId, + required String variableId, required String key, required String value, bool? secret}) async { @@ -588,6 +592,7 @@ class Functions extends Service { .replaceAll('{functionId}', functionId); final Map apiParams = { + 'variableId': variableId, 'key': key, 'value': value, if (secret != null) 'secret': secret, @@ -624,7 +629,7 @@ class Functions extends Service { Future updateVariable( {required String functionId, required String variableId, - required String key, + String? key, String? value, bool? secret}) async { final String apiPath = '/functions/{functionId}/variables/{variableId}' diff --git a/lib/services/presences.dart b/lib/services/presences.dart new file mode 100644 index 00000000..6be6db86 --- /dev/null +++ b/lib/services/presences.dart @@ -0,0 +1,116 @@ +part of '../dart_appwrite.dart'; + +class Presences extends Service { + Presences(super.client); + + /// List presence logs. + Future list( + {List? queries, bool? total, int? ttl}) async { + final String apiPath = '/presences'; + + final Map apiParams = { + if (queries != null) 'queries': queries, + if (total != null) 'total': total, + if (ttl != null) 'ttl': ttl, + }; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PresenceList.fromMap(res.data); + } + + /// Get a presence log by its unique ID. + Future get({required String presenceId}) async { + final String apiPath = + '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + + final Map apiParams = {}; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Presence.fromMap(res.data); + } + + /// Create or update a presence log by its unique ID. + Future upsert( + {required String presenceId, + required String? userId, + required String status, + List? permissions, + String? expiresAt, + Map? metadata}) async { + final String apiPath = + '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + + final Map apiParams = { + 'userId': userId, + 'status': status, + 'permissions': permissions, + 'expiresAt': expiresAt, + if (metadata != null) 'metadata': metadata, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Presence.fromMap(res.data); + } + + /// Update a presence log by its unique ID. + Future updatePresence( + {required String presenceId, + required String? userId, + String? status, + String? expiresAt, + Map? metadata, + List? permissions, + bool? purge}) async { + final String apiPath = + '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + + final Map apiParams = { + 'userId': userId, + 'status': status, + 'expiresAt': expiresAt, + 'metadata': metadata, + 'permissions': permissions, + if (purge != null) 'purge': purge, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Presence.fromMap(res.data); + } + + /// Delete a presence log by its unique ID. + Future delete({required String presenceId}) async { + final String apiPath = + '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + + final Map apiParams = {}; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + } +} diff --git a/lib/services/project.dart b/lib/services/project.dart index d47bb82d..92c1bb08 100644 --- a/lib/services/project.dart +++ b/lib/services/project.dart @@ -5,6 +5,43 @@ part of '../dart_appwrite.dart'; class Project extends Service { Project(super.client); + /// Delete a project. + Future delete() async { + final String apiPath = '/project'; + + final Map apiParams = {}; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + } + + /// Update properties of a specific auth method. Use this endpoint to enable or + /// disable a method in your project. + Future updateAuthMethod( + {required enums.MethodId methodId, required bool enabled}) async { + final String apiPath = '/project/auth-methods/{methodId}' + .replaceAll('{methodId}', methodId.value); + + final Map apiParams = { + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + /// Get a list of all API keys from the current project. Future listKeys({List? queries, bool? total}) async { final String apiPath = '/project/keys'; @@ -24,6 +61,9 @@ class Project extends Service { /// Create a new API key. It's recommended to have multiple API keys with /// strict scopes for separate functions within your project. + /// + /// You can also create an ephemeral API key if you need a short-lived key + /// instead. Future createKey( {required String keyId, required String name, @@ -48,6 +88,30 @@ class Project extends Service { return models.Key.fromMap(res.data); } + /// Create a new ephemeral API key. It's recommended to have multiple API keys + /// with strict scopes for separate functions within your project. + /// + /// You can also create a standard API key if you need a longer-lived key + /// instead. + Future createEphemeralKey( + {required List scopes, required int duration}) async { + final String apiPath = '/project/keys/ephemeral'; + + final Map apiParams = { + 'scopes': scopes.map((e) => e.value).toList(), + 'duration': duration, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.EphemeralKey.fromMap(res.data); + } + /// Get a key by its unique ID. Future getKey({required String keyId}) async { final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); @@ -98,29 +162,1226 @@ class Project extends Service { 'content-type': 'application/json', }; - final res = await client.call(HttpMethod.delete, + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + } + + /// Update the project labels. Labels can be used to easily filter projects in + /// an organization. + Future updateLabels({required List labels}) async { + final String apiPath = '/project/labels'; + + final Map apiParams = { + 'labels': labels, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Get a list of all mock phones in the project. This endpoint returns an + /// array of all mock phones and their OTPs. + Future listMockPhones( + {List? queries, bool? total}) async { + final String apiPath = '/project/mock-phones'; + + final Map apiParams = { + if (queries != null) 'queries': queries, + if (total != null) 'total': total, + }; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MockNumberList.fromMap(res.data); + } + + /// Create a new mock phone for your project. Use this endpoint to register a + /// mock phone number and its sign-in OTP for your testers. + Future createMockPhone( + {required String number, required String otp}) async { + final String apiPath = '/project/mock-phones'; + + final Map apiParams = { + 'number': number, + 'otp': otp, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MockNumber.fromMap(res.data); + } + + /// Get a mock phone by its unique number. This endpoint returns the mock + /// phone's OTP. + Future getMockPhone({required String number}) async { + final String apiPath = + '/project/mock-phones/{number}'.replaceAll('{number}', number); + + final Map apiParams = {}; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MockNumber.fromMap(res.data); + } + + /// Update a mock phone by its unique number. Use this endpoint to update the + /// mock phone's OTP. + Future updateMockPhone( + {required String number, required String otp}) async { + final String apiPath = + '/project/mock-phones/{number}'.replaceAll('{number}', number); + + final Map apiParams = { + 'otp': otp, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MockNumber.fromMap(res.data); + } + + /// Delete a mock phone by its unique number. This endpoint removes the mock + /// phone and its OTP configuration from the project. + Future deleteMockPhone({required String number}) async { + final String apiPath = + '/project/mock-phones/{number}'.replaceAll('{number}', number); + + final Map apiParams = {}; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + } + + /// Get a list of all OAuth2 providers supported by the server, along with the + /// project's configuration for each. Credential fields are write-only and + /// always returned empty. + Future listOAuth2Providers( + {List? queries, bool? total}) async { + final String apiPath = '/project/oauth2'; + + final Map apiParams = { + if (queries != null) 'queries': queries, + if (total != null) 'total': total, + }; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2ProviderList.fromMap(res.data); + } + + /// Get a single OAuth2 provider configuration. Credential fields (client + /// secret, p8 file, key/team IDs) are write-only and always returned empty. + Future getOAuth2Provider( + {required enums.ProviderId providerId}) async { + final String apiPath = '/project/oauth2/:provider'; + + final Map apiParams = { + 'providerId': providerId.value, + }; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return () { + if (res.data is! Map) { + throw StateError( + 'Unable to match response to any expected response model.'); + } + + final response = res.data as Map; + if (response['\$id'] == 'github') { + return models.OAuth2Github.fromMap(response); + } + if (response['\$id'] == 'discord') { + return models.OAuth2Discord.fromMap(response); + } + if (response['\$id'] == 'figma') { + return models.OAuth2Figma.fromMap(response); + } + if (response['\$id'] == 'dropbox') { + return models.OAuth2Dropbox.fromMap(response); + } + if (response['\$id'] == 'dailymotion') { + return models.OAuth2Dailymotion.fromMap(response); + } + if (response['\$id'] == 'bitbucket') { + return models.OAuth2Bitbucket.fromMap(response); + } + if (response['\$id'] == 'bitly') { + return models.OAuth2Bitly.fromMap(response); + } + if (response['\$id'] == 'box') { + return models.OAuth2Box.fromMap(response); + } + if (response['\$id'] == 'autodesk') { + return models.OAuth2Autodesk.fromMap(response); + } + if (response['\$id'] == 'google') { + return models.OAuth2Google.fromMap(response); + } + if (response['\$id'] == 'zoom') { + return models.OAuth2Zoom.fromMap(response); + } + if (response['\$id'] == 'zoho') { + return models.OAuth2Zoho.fromMap(response); + } + if (response['\$id'] == 'yandex') { + return models.OAuth2Yandex.fromMap(response); + } + if (response['\$id'] == 'x') { + return models.OAuth2X.fromMap(response); + } + if (response['\$id'] == 'wordpress') { + return models.OAuth2WordPress.fromMap(response); + } + if (response['\$id'] == 'twitch') { + return models.OAuth2Twitch.fromMap(response); + } + if (response['\$id'] == 'stripe') { + return models.OAuth2Stripe.fromMap(response); + } + if (response['\$id'] == 'spotify') { + return models.OAuth2Spotify.fromMap(response); + } + if (response['\$id'] == 'slack') { + return models.OAuth2Slack.fromMap(response); + } + if (response['\$id'] == 'podio') { + return models.OAuth2Podio.fromMap(response); + } + if (response['\$id'] == 'notion') { + return models.OAuth2Notion.fromMap(response); + } + if (response['\$id'] == 'salesforce') { + return models.OAuth2Salesforce.fromMap(response); + } + if (response['\$id'] == 'yahoo') { + return models.OAuth2Yahoo.fromMap(response); + } + if (response['\$id'] == 'linkedin') { + return models.OAuth2Linkedin.fromMap(response); + } + if (response['\$id'] == 'disqus') { + return models.OAuth2Disqus.fromMap(response); + } + if (response['\$id'] == 'amazon') { + return models.OAuth2Amazon.fromMap(response); + } + if (response['\$id'] == 'etsy') { + return models.OAuth2Etsy.fromMap(response); + } + if (response['\$id'] == 'facebook') { + return models.OAuth2Facebook.fromMap(response); + } + if (response['\$id'] == 'tradeshiftBox') { + return models.OAuth2Tradeshift.fromMap(response); + } + if (response['\$id'] == 'paypalSandbox') { + return models.OAuth2Paypal.fromMap(response); + } + if (response['\$id'] == 'gitlab') { + return models.OAuth2Gitlab.fromMap(response); + } + if (response['\$id'] == 'authentik') { + return models.OAuth2Authentik.fromMap(response); + } + if (response['\$id'] == 'auth0') { + return models.OAuth2Auth0.fromMap(response); + } + if (response['\$id'] == 'fusionauth') { + return models.OAuth2FusionAuth.fromMap(response); + } + if (response['\$id'] == 'keycloak') { + return models.OAuth2Keycloak.fromMap(response); + } + if (response['\$id'] == 'oidc') { + return models.OAuth2Oidc.fromMap(response); + } + if (response['\$id'] == 'apple') { + return models.OAuth2Apple.fromMap(response); + } + if (response['\$id'] == 'okta') { + return models.OAuth2Okta.fromMap(response); + } + if (response['\$id'] == 'kick') { + return models.OAuth2Kick.fromMap(response); + } + if (response['\$id'] == 'microsoft') { + return models.OAuth2Microsoft.fromMap(response); + } + + throw StateError( + 'Unable to match response to any expected response model.'); + }(); + } + + /// Update the project OAuth2 Amazon configuration. + Future updateOAuth2Amazon( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/amazon'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Amazon.fromMap(res.data); + } + + /// Update the project OAuth2 Apple configuration. + Future updateOAuth2Apple( + {String? serviceId, + String? keyId, + String? teamId, + String? p8File, + bool? enabled}) async { + final String apiPath = '/project/oauth2/apple'; + + final Map apiParams = { + 'serviceId': serviceId, + 'keyId': keyId, + 'teamId': teamId, + 'p8File': p8File, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Apple.fromMap(res.data); + } + + /// Update the project OAuth2 Auth0 configuration. + Future updateOAuth2Auth0( + {String? clientId, + String? clientSecret, + String? endpoint, + bool? enabled}) async { + final String apiPath = '/project/oauth2/auth0'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'endpoint': endpoint, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Auth0.fromMap(res.data); + } + + /// Update the project OAuth2 Authentik configuration. + Future updateOAuth2Authentik( + {String? clientId, + String? clientSecret, + String? endpoint, + bool? enabled}) async { + final String apiPath = '/project/oauth2/authentik'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'endpoint': endpoint, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Authentik.fromMap(res.data); + } + + /// Update the project OAuth2 Autodesk configuration. + Future updateOAuth2Autodesk( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/autodesk'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Autodesk.fromMap(res.data); + } + + /// Update the project OAuth2 Bitbucket configuration. + Future updateOAuth2Bitbucket( + {String? key, String? secret, bool? enabled}) async { + final String apiPath = '/project/oauth2/bitbucket'; + + final Map apiParams = { + 'key': key, + 'secret': secret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Bitbucket.fromMap(res.data); + } + + /// Update the project OAuth2 Bitly configuration. + Future updateOAuth2Bitly( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/bitly'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Bitly.fromMap(res.data); + } + + /// Update the project OAuth2 Box configuration. + Future updateOAuth2Box( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/box'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Box.fromMap(res.data); + } + + /// Update the project OAuth2 Dailymotion configuration. + Future updateOAuth2Dailymotion( + {String? apiKey, String? apiSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/dailymotion'; + + final Map apiParams = { + 'apiKey': apiKey, + 'apiSecret': apiSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Dailymotion.fromMap(res.data); + } + + /// Update the project OAuth2 Discord configuration. + Future updateOAuth2Discord( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/discord'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Discord.fromMap(res.data); + } + + /// Update the project OAuth2 Disqus configuration. + Future updateOAuth2Disqus( + {String? publicKey, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/disqus'; + + final Map apiParams = { + 'publicKey': publicKey, + 'secretKey': secretKey, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Disqus.fromMap(res.data); + } + + /// Update the project OAuth2 Dropbox configuration. + Future updateOAuth2Dropbox( + {String? appKey, String? appSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/dropbox'; + + final Map apiParams = { + 'appKey': appKey, + 'appSecret': appSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Dropbox.fromMap(res.data); + } + + /// Update the project OAuth2 Etsy configuration. + Future updateOAuth2Etsy( + {String? keyString, String? sharedSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/etsy'; + + final Map apiParams = { + 'keyString': keyString, + 'sharedSecret': sharedSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Etsy.fromMap(res.data); + } + + /// Update the project OAuth2 Facebook configuration. + Future updateOAuth2Facebook( + {String? appId, String? appSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/facebook'; + + final Map apiParams = { + 'appId': appId, + 'appSecret': appSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Facebook.fromMap(res.data); + } + + /// Update the project OAuth2 Figma configuration. + Future updateOAuth2Figma( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/figma'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Figma.fromMap(res.data); + } + + /// Update the project OAuth2 FusionAuth configuration. + Future updateOAuth2FusionAuth( + {String? clientId, + String? clientSecret, + String? endpoint, + bool? enabled}) async { + final String apiPath = '/project/oauth2/fusionauth'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'endpoint': endpoint, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2FusionAuth.fromMap(res.data); + } + + /// Update the project OAuth2 GitHub configuration. + Future updateOAuth2GitHub( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/github'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Github.fromMap(res.data); + } + + /// Update the project OAuth2 Gitlab configuration. + Future updateOAuth2Gitlab( + {String? applicationId, + String? secret, + String? endpoint, + bool? enabled}) async { + final String apiPath = '/project/oauth2/gitlab'; + + final Map apiParams = { + 'applicationId': applicationId, + 'secret': secret, + 'endpoint': endpoint, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Gitlab.fromMap(res.data); + } + + /// Update the project OAuth2 Google configuration. + Future updateOAuth2Google( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/google'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Google.fromMap(res.data); + } + + /// Update the project OAuth2 Keycloak configuration. + Future updateOAuth2Keycloak( + {String? clientId, + String? clientSecret, + String? endpoint, + String? realmName, + bool? enabled}) async { + final String apiPath = '/project/oauth2/keycloak'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'endpoint': endpoint, + 'realmName': realmName, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Keycloak.fromMap(res.data); + } + + /// Update the project OAuth2 Kick configuration. + Future updateOAuth2Kick( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/kick'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Kick.fromMap(res.data); + } + + /// Update the project OAuth2 Linkedin configuration. + Future updateOAuth2Linkedin( + {String? clientId, String? primaryClientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/linkedin'; + + final Map apiParams = { + 'clientId': clientId, + 'primaryClientSecret': primaryClientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Linkedin.fromMap(res.data); + } + + /// Update the project OAuth2 Microsoft configuration. + Future updateOAuth2Microsoft( + {String? applicationId, + String? applicationSecret, + String? tenant, + bool? enabled}) async { + final String apiPath = '/project/oauth2/microsoft'; + + final Map apiParams = { + 'applicationId': applicationId, + 'applicationSecret': applicationSecret, + 'tenant': tenant, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Microsoft.fromMap(res.data); + } + + /// Update the project OAuth2 Notion configuration. + Future updateOAuth2Notion( + {String? oauthClientId, String? oauthClientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/notion'; + + final Map apiParams = { + 'oauthClientId': oauthClientId, + 'oauthClientSecret': oauthClientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Notion.fromMap(res.data); + } + + /// Update the project OAuth2 Oidc configuration. + Future updateOAuth2Oidc( + {String? clientId, + String? clientSecret, + String? wellKnownURL, + String? authorizationURL, + String? tokenURL, + String? userInfoURL, + bool? enabled}) async { + final String apiPath = '/project/oauth2/oidc'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'wellKnownURL': wellKnownURL, + 'authorizationURL': authorizationURL, + 'tokenURL': tokenURL, + 'userInfoURL': userInfoURL, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Oidc.fromMap(res.data); + } + + /// Update the project OAuth2 Okta configuration. + Future updateOAuth2Okta( + {String? clientId, + String? clientSecret, + String? domain, + String? authorizationServerId, + bool? enabled}) async { + final String apiPath = '/project/oauth2/okta'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'domain': domain, + 'authorizationServerId': authorizationServerId, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Okta.fromMap(res.data); + } + + /// Update the project OAuth2 Paypal configuration. + Future updateOAuth2Paypal( + {String? clientId, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/paypal'; + + final Map apiParams = { + 'clientId': clientId, + 'secretKey': secretKey, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Paypal.fromMap(res.data); + } + + /// Update the project OAuth2 PaypalSandbox configuration. + Future updateOAuth2PaypalSandbox( + {String? clientId, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/paypalSandbox'; + + final Map apiParams = { + 'clientId': clientId, + 'secretKey': secretKey, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Paypal.fromMap(res.data); + } + + /// Update the project OAuth2 Podio configuration. + Future updateOAuth2Podio( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/podio'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Podio.fromMap(res.data); + } + + /// Update the project OAuth2 Salesforce configuration. + Future updateOAuth2Salesforce( + {String? customerKey, String? customerSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/salesforce'; + + final Map apiParams = { + 'customerKey': customerKey, + 'customerSecret': customerSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Salesforce.fromMap(res.data); + } + + /// Update the project OAuth2 Slack configuration. + Future updateOAuth2Slack( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/slack'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Slack.fromMap(res.data); + } + + /// Update the project OAuth2 Spotify configuration. + Future updateOAuth2Spotify( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/spotify'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Spotify.fromMap(res.data); + } + + /// Update the project OAuth2 Stripe configuration. + Future updateOAuth2Stripe( + {String? clientId, String? apiSecretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/stripe'; + + final Map apiParams = { + 'clientId': clientId, + 'apiSecretKey': apiSecretKey, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Stripe.fromMap(res.data); + } + + /// Update the project OAuth2 Tradeshift configuration. + Future updateOAuth2Tradeshift( + {String? oauth2ClientId, + String? oauth2ClientSecret, + bool? enabled}) async { + final String apiPath = '/project/oauth2/tradeshift'; + + final Map apiParams = { + 'oauth2ClientId': oauth2ClientId, + 'oauth2ClientSecret': oauth2ClientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Tradeshift.fromMap(res.data); + } + + /// Update the project OAuth2 Tradeshift Sandbox configuration. + Future updateOAuth2TradeshiftSandbox( + {String? oauth2ClientId, + String? oauth2ClientSecret, + bool? enabled}) async { + final String apiPath = '/project/oauth2/tradeshiftBox'; + + final Map apiParams = { + 'oauth2ClientId': oauth2ClientId, + 'oauth2ClientSecret': oauth2ClientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Tradeshift.fromMap(res.data); + } + + /// Update the project OAuth2 Twitch configuration. + Future updateOAuth2Twitch( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/twitch'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Twitch.fromMap(res.data); + } + + /// Update the project OAuth2 WordPress configuration. + Future updateOAuth2WordPress( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/wordpress'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2WordPress.fromMap(res.data); + } + + /// Update the project OAuth2 X configuration. + Future updateOAuth2X( + {String? customerKey, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/x'; + + final Map apiParams = { + 'customerKey': customerKey, + 'secretKey': secretKey, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2X.fromMap(res.data); + } + + /// Update the project OAuth2 Yahoo configuration. + Future updateOAuth2Yahoo( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/yahoo'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Yahoo.fromMap(res.data); + } + + /// Update the project OAuth2 Yandex configuration. + Future updateOAuth2Yandex( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/yandex'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Yandex.fromMap(res.data); + } + + /// Update the project OAuth2 Zoho configuration. + Future updateOAuth2Zoho( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/zoho'; + + final Map apiParams = { + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return res.data; + return models.OAuth2Zoho.fromMap(res.data); } - /// Update the project labels. Labels can be used to easily filter projects in - /// an organization. - Future updateLabels({required List labels}) async { - final String apiPath = '/project/labels'; + /// Update the project OAuth2 Zoom configuration. + Future updateOAuth2Zoom( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/zoom'; final Map apiParams = { - 'labels': labels, + 'clientId': clientId, + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', }; - final res = await client.call(HttpMethod.put, + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.Project.fromMap(res.data); + return models.OAuth2Zoom.fromMap(res.data); } /// Get a list of all platforms in the project. This endpoint returns an array @@ -446,11 +1707,284 @@ class Project extends Service { return res.data; } - /// Update the status of a specific protocol. Use this endpoint to enable or + /// Get a list of all project policies and their current configuration. + Future listPolicies( + {List? queries, bool? total}) async { + final String apiPath = '/project/policies'; + + final Map apiParams = { + if (queries != null) 'queries': queries, + if (total != null) 'total': total, + }; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PolicyList.fromMap(res.data); + } + + /// Updating this policy allows you to control if team members can see other + /// members information. When enabled, all team members can see ID, name, + /// email, phone number, and MFA status of other members.. + Future updateMembershipPrivacyPolicy( + {bool? userId, + bool? userEmail, + bool? userPhone, + bool? userName, + bool? userMFA}) async { + final String apiPath = '/project/policies/membership-privacy'; + + final Map apiParams = { + if (userId != null) 'userId': userId, + if (userEmail != null) 'userEmail': userEmail, + if (userPhone != null) 'userPhone': userPhone, + if (userName != null) 'userName': userName, + if (userMFA != null) 'userMFA': userMFA, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Updating this policy allows you to control if new passwords are checked + /// against most common passwords dictionary. When enabled, and user changes + /// their password, password must not be contained in the dictionary. + Future updatePasswordDictionaryPolicy( + {required bool enabled}) async { + final String apiPath = '/project/policies/password-dictionary'; + + final Map apiParams = { + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Updates one of password strength policies. Based on total length + /// configured, previous password hashes are stored, and users cannot choose a + /// new password that is already stored in the passwird history list, when + /// updating an user password, or setting new one through password recovery. + /// + /// Keep in mind, while password history policy is disabled, the history is not + /// being stored. Enabling the policy will not have any history on existing + /// users, and it will only start to collect and enforce the policy on password + /// changes since the policy is enabled. + Future updatePasswordHistoryPolicy( + {required int? total}) async { + final String apiPath = '/project/policies/password-history'; + + final Map apiParams = { + 'total': total, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Updating this policy allows you to control if password strength is checked + /// against personal data. When enabled, and user sets or changes their + /// password, the password must not contain user ID, name, email or phone + /// number. + Future updatePasswordPersonalDataPolicy( + {required bool enabled}) async { + final String apiPath = '/project/policies/password-personal-data'; + + final Map apiParams = { + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Updating this policy allows you to control if email alert is sent upon + /// session creation. When enabled, and user signs into their account, they + /// will be sent an email notification. There is an exception, the first + /// session after a new sign up does not trigger an alert, even if the policy + /// is enabled. + Future updateSessionAlertPolicy( + {required bool enabled}) async { + final String apiPath = '/project/policies/session-alert'; + + final Map apiParams = { + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Update maximum duration how long sessions created within a project should + /// stay active for. + Future updateSessionDurationPolicy( + {required int duration}) async { + final String apiPath = '/project/policies/session-duration'; + + final Map apiParams = { + 'duration': duration, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Updating this policy allows you to control if existing sessions should be + /// invalidated when a password of a user is changed. When enabled, and user + /// changes their password, they will be logged out of all their devices. + Future updateSessionInvalidationPolicy( + {required bool enabled}) async { + final String apiPath = '/project/policies/session-invalidation'; + + final Map apiParams = { + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Update the maximum number of sessions allowed per user. When the limit is + /// hit, the oldest session will be deleted to make room for new one. + Future updateSessionLimitPolicy({required int? total}) async { + final String apiPath = '/project/policies/session-limit'; + + final Map apiParams = { + 'total': total, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Update the maximum number of users in the project. When the limit is hit or + /// amount of existing users already exceeded the limit, all users remain + /// active, but new user sign up will be prohibited. + Future updateUserLimitPolicy({required int? total}) async { + final String apiPath = '/project/policies/user-limit'; + + final Map apiParams = { + 'total': total, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Get a policy by its unique ID. This endpoint returns the current + /// configuration for the requested project policy. + Future getPolicy({required enums.PolicyId policyId}) async { + final String apiPath = + '/project/policies/{policyId}'.replaceAll('{policyId}', policyId.value); + + final Map apiParams = {}; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return () { + if (res.data is! Map) { + throw StateError( + 'Unable to match response to any expected response model.'); + } + + final response = res.data as Map; + if (response['\$id'] == 'password-dictionary') { + return models.PolicyPasswordDictionary.fromMap(response); + } + if (response['\$id'] == 'password-history') { + return models.PolicyPasswordHistory.fromMap(response); + } + if (response['\$id'] == 'password-personal-data') { + return models.PolicyPasswordPersonalData.fromMap(response); + } + if (response['\$id'] == 'session-alert') { + return models.PolicySessionAlert.fromMap(response); + } + if (response['\$id'] == 'session-duration') { + return models.PolicySessionDuration.fromMap(response); + } + if (response['\$id'] == 'session-invalidation') { + return models.PolicySessionInvalidation.fromMap(response); + } + if (response['\$id'] == 'session-limit') { + return models.PolicySessionLimit.fromMap(response); + } + if (response['\$id'] == 'user-limit') { + return models.PolicyUserLimit.fromMap(response); + } + if (response['\$id'] == 'membership-privacy') { + return models.PolicyMembershipPrivacy.fromMap(response); + } + + throw StateError( + 'Unable to match response to any expected response model.'); + }(); + } + + /// Update properties of a specific protocol. Use this endpoint to enable or /// disable a protocol in your project. - Future updateProtocolStatus( + Future updateProtocol( {required enums.ProtocolId protocolId, required bool enabled}) async { - final String apiPath = '/project/protocols/{protocolId}/status' + final String apiPath = '/project/protocols/{protocolId}' .replaceAll('{protocolId}', protocolId.value); final Map apiParams = { @@ -467,11 +2001,11 @@ class Project extends Service { return models.Project.fromMap(res.data); } - /// Update the status of a specific service. Use this endpoint to enable or + /// Update properties of a specific service. Use this endpoint to enable or /// disable a service in your project. - Future updateServiceStatus( + Future updateService( {required enums.ServiceId serviceId, required bool enabled}) async { - final String apiPath = '/project/services/{serviceId}/status' + final String apiPath = '/project/services/{serviceId}' .replaceAll('{serviceId}', serviceId.value); final Map apiParams = { @@ -488,6 +2022,138 @@ class Project extends Service { return models.Project.fromMap(res.data); } + /// Update the SMTP configuration for your project. Use this endpoint to + /// configure your project's SMTP provider with your custom settings for + /// sending transactional emails. + Future updateSMTP( + {String? host, + int? port, + String? username, + String? password, + String? senderEmail, + String? senderName, + String? replyToEmail, + String? replyToName, + enums.Secure? secure, + bool? enabled}) async { + final String apiPath = '/project/smtp'; + + final Map apiParams = { + 'host': host, + 'port': port, + 'username': username, + 'password': password, + 'senderEmail': senderEmail, + 'senderName': senderName, + 'replyToEmail': replyToEmail, + 'replyToName': replyToName, + 'secure': secure?.value, + 'enabled': enabled, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + } + + /// Send a test email to verify SMTP configuration. + Future createSMTPTest({required List emails}) async { + final String apiPath = '/project/smtp/tests'; + + final Map apiParams = { + 'emails': emails, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + } + + /// Get a list of all custom email templates configured for the project. This + /// endpoint returns an array of all configured email templates and their + /// locales. + Future listEmailTemplates( + {List? queries, bool? total}) async { + final String apiPath = '/project/templates/email'; + + final Map apiParams = { + if (queries != null) 'queries': queries, + if (total != null) 'total': total, + }; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.EmailTemplateList.fromMap(res.data); + } + + /// Update a custom email template for the specified locale and type. Use this + /// endpoint to modify the content of your email templates. + Future updateEmailTemplate( + {required enums.EmailTemplateType templateId, + enums.EmailTemplateLocale? locale, + String? subject, + String? message, + String? senderName, + String? senderEmail, + String? replyToEmail, + String? replyToName}) async { + final String apiPath = '/project/templates/email'; + + final Map apiParams = { + 'templateId': templateId.value, + if (locale != null) 'locale': locale.value, + 'subject': subject, + 'message': message, + 'senderName': senderName, + 'senderEmail': senderEmail, + 'replyToEmail': replyToEmail, + 'replyToName': replyToName, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.EmailTemplate.fromMap(res.data); + } + + /// Get a custom email template for the specified locale and type. This + /// endpoint returns the template content, subject, and other configuration + /// details. + Future getEmailTemplate( + {required enums.EmailTemplateType templateId, + enums.EmailTemplateLocale? locale}) async { + final String apiPath = '/project/templates/email/{templateId}' + .replaceAll('{templateId}', templateId.value); + + final Map apiParams = { + if (locale != null) 'locale': locale.value, + }; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.EmailTemplate.fromMap(res.data); + } + /// Get a list of all project environment variables. Future listVariables( {List? queries, bool? total}) async { diff --git a/lib/services/proxy.dart b/lib/services/proxy.dart new file mode 100644 index 00000000..7780e710 --- /dev/null +++ b/lib/services/proxy.dart @@ -0,0 +1,180 @@ +part of '../dart_appwrite.dart'; + +/// The Proxy Service allows you to configure actions for your domains beyond +/// DNS configuration. +class Proxy extends Service { + Proxy(super.client); + + /// Get a list of all the proxy rules. You can use the query params to filter + /// your results. + Future listRules( + {List? queries, bool? total}) async { + final String apiPath = '/proxy/rules'; + + final Map apiParams = { + if (queries != null) 'queries': queries, + if (total != null) 'total': total, + }; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRuleList.fromMap(res.data); + } + + /// Create a new proxy rule for serving Appwrite's API on custom domain. + /// + /// Rule ID is automatically generated as MD5 hash of a rule domain for + /// performance purposes. + Future createAPIRule({required String domain}) async { + final String apiPath = '/proxy/rules/api'; + + final Map apiParams = { + 'domain': domain, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + } + + /// Create a new proxy rule for executing Appwrite Function on custom domain. + /// + /// Rule ID is automatically generated as MD5 hash of a rule domain for + /// performance purposes. + Future createFunctionRule( + {required String domain, + required String functionId, + String? branch}) async { + final String apiPath = '/proxy/rules/function'; + + final Map apiParams = { + 'domain': domain, + 'functionId': functionId, + if (branch != null) 'branch': branch, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + } + + /// Create a new proxy rule for to redirect from custom domain to another + /// domain. + /// + /// Rule ID is automatically generated as MD5 hash of a rule domain for + /// performance purposes. + Future createRedirectRule( + {required String domain, + required String url, + required enums.StatusCode statusCode, + required String resourceId, + required enums.ProxyResourceType resourceType}) async { + final String apiPath = '/proxy/rules/redirect'; + + final Map apiParams = { + 'domain': domain, + 'url': url, + 'statusCode': statusCode.value, + 'resourceId': resourceId, + 'resourceType': resourceType.value, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + } + + /// Create a new proxy rule for serving Appwrite Site on custom domain. + /// + /// Rule ID is automatically generated as MD5 hash of a rule domain for + /// performance purposes. + Future createSiteRule( + {required String domain, required String siteId, String? branch}) async { + final String apiPath = '/proxy/rules/site'; + + final Map apiParams = { + 'domain': domain, + 'siteId': siteId, + if (branch != null) 'branch': branch, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + } + + /// Get a proxy rule by its unique ID. + Future getRule({required String ruleId}) async { + final String apiPath = + '/proxy/rules/{ruleId}'.replaceAll('{ruleId}', ruleId); + + final Map apiParams = {}; + + final Map apiHeaders = {}; + + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + } + + /// Delete a proxy rule by its unique ID. + Future deleteRule({required String ruleId}) async { + final String apiPath = + '/proxy/rules/{ruleId}'.replaceAll('{ruleId}', ruleId); + + final Map apiParams = {}; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + } + + /// If not succeeded yet, retry verification process of a proxy rule domain. + /// This endpoint triggers domain verification by checking DNS records. If + /// verification is successful, a TLS certificate will be automatically + /// provisioned for the domain asynchronously in the background. + Future updateRuleStatus({required String ruleId}) async { + final String apiPath = + '/proxy/rules/{ruleId}/status'.replaceAll('{ruleId}', ruleId); + + final Map apiParams = {}; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + } +} diff --git a/lib/services/sites.dart b/lib/services/sites.dart index 80bd96f0..ec9a492b 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -516,11 +516,15 @@ class Sites extends Service { } /// Get a list of all variables of a specific site. - Future listVariables({required String siteId}) async { + Future listVariables( + {required String siteId, List? queries, bool? total}) async { final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); - final Map apiParams = {}; + final Map apiParams = { + if (queries != null) 'queries': queries, + if (total != null) 'total': total, + }; final Map apiHeaders = {}; @@ -534,6 +538,7 @@ class Sites extends Service { /// and runtime (server-side rendering) as environment variables. Future createVariable( {required String siteId, + required String variableId, required String key, required String value, bool? secret}) async { @@ -541,6 +546,7 @@ class Sites extends Service { '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'variableId': variableId, 'key': key, 'value': value, if (secret != null) 'secret': secret, @@ -577,7 +583,7 @@ class Sites extends Service { Future updateVariable( {required String siteId, required String variableId, - required String key, + String? key, String? value, bool? secret}) async { final String apiPath = '/sites/{siteId}/variables/{variableId}' diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 384b3804..c8a06ef6 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -361,6 +361,78 @@ class TablesDB extends Service { return models.ColumnList.fromMap(res.data); } + /// Create a bigint column. Optionally, minimum and maximum values can be + /// provided. + /// + Future createBigIntColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + int? min, + int? max, + int? xdefault, + bool? array}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); + + final Map apiParams = { + 'key': key, + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + if (array != null) 'array': array, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnBigint.fromMap(res.data); + } + + /// Update a bigint column. Changing the `default` value will not update + /// already existing rows. + /// + Future updateBigIntColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required int? xdefault, + int? min, + int? max, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); + + final Map apiParams = { + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + 'newKey': newKey, + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; + + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnBigint.fromMap(res.data); + } + /// Create a boolean column. /// Future createBooleanColumn( diff --git a/lib/src/client.dart b/lib/src/client.dart index 98cffb92..6f236f82 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -65,6 +65,16 @@ abstract class Client { /// The user agent string of the client that made the request Client setForwardedUserAgent(String value); + /// Set DevKey + /// + /// Your secret dev API key + Client setDevKey(String value); + + /// Set Cookie + /// + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + Client setCookie(String value); + /// Set ImpersonateUserId /// /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. diff --git a/lib/src/client_base.dart b/lib/src/client_base.dart index 772f1e40..a8e2e1b2 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -25,6 +25,14 @@ abstract class ClientBase implements Client { @override ClientBase setForwardedUserAgent(value); + /// Your secret dev API key + @override + ClientBase setDevKey(value); + + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + @override + ClientBase setCookie(value); + /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientBase setImpersonateUserId(value); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index d1a34e1c..3e4e7300 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -33,8 +33,8 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '23.0.0', - 'X-Appwrite-Response-Format': '1.9.1', + 'x-sdk-version': '23.1.0', + 'X-Appwrite-Response-Format': '1.9.4', }; config = {}; @@ -93,6 +93,22 @@ class ClientBrowser extends ClientBase with ClientMixin { return this; } + /// Your secret dev API key + @override + ClientBrowser setDevKey(value) { + config['devKey'] = value; + addHeader('X-Appwrite-Dev-Key', value); + return this; + } + + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + @override + ClientBrowser setCookie(value) { + config['cookie'] = value; + addHeader('Cookie', value); + return this; + } + /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientBrowser setImpersonateUserId(value) { diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 4f23d9c2..4f01b015 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -42,10 +42,10 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '23.0.0', + 'x-sdk-version': '23.1.0', 'user-agent': - 'AppwriteDartSDK/23.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.9.1', + 'AppwriteDartSDK/23.1.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.9.4', }; config = {}; @@ -104,6 +104,22 @@ class ClientIO extends ClientBase with ClientMixin { return this; } + /// Your secret dev API key + @override + ClientIO setDevKey(value) { + config['devKey'] = value; + addHeader('X-Appwrite-Dev-Key', value); + return this; + } + + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + @override + ClientIO setCookie(value) { + config['cookie'] = value; + addHeader('Cookie', value); + return this; + } + /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientIO setImpersonateUserId(value) { diff --git a/lib/src/enums/build_runtime.dart b/lib/src/enums/build_runtime.dart index df242bdf..abb0e080 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -81,6 +81,7 @@ enum BuildRuntime { go124(value: 'go-1.24'), go125(value: 'go-1.25'), go126(value: 'go-1.26'), + rust183(value: 'rust-1.83'), static1(value: 'static-1'), flutter324(value: 'flutter-3.24'), flutter327(value: 'flutter-3.27'), diff --git a/lib/src/enums/email_template_locale.dart b/lib/src/enums/email_template_locale.dart new file mode 100644 index 00000000..d79a7975 --- /dev/null +++ b/lib/src/enums/email_template_locale.dart @@ -0,0 +1,141 @@ +part of '../../enums.dart'; + +enum EmailTemplateLocale { + af(value: 'af'), + arAe(value: 'ar-ae'), + arBh(value: 'ar-bh'), + arDz(value: 'ar-dz'), + arEg(value: 'ar-eg'), + arIq(value: 'ar-iq'), + arJo(value: 'ar-jo'), + arKw(value: 'ar-kw'), + arLb(value: 'ar-lb'), + arLy(value: 'ar-ly'), + arMa(value: 'ar-ma'), + arOm(value: 'ar-om'), + arQa(value: 'ar-qa'), + arSa(value: 'ar-sa'), + arSy(value: 'ar-sy'), + arTn(value: 'ar-tn'), + arYe(value: 'ar-ye'), + xas(value: 'as'), + az(value: 'az'), + be(value: 'be'), + bg(value: 'bg'), + bh(value: 'bh'), + bn(value: 'bn'), + bs(value: 'bs'), + ca(value: 'ca'), + cs(value: 'cs'), + cy(value: 'cy'), + da(value: 'da'), + de(value: 'de'), + deAt(value: 'de-at'), + deCh(value: 'de-ch'), + deLi(value: 'de-li'), + deLu(value: 'de-lu'), + el(value: 'el'), + en(value: 'en'), + enAu(value: 'en-au'), + enBz(value: 'en-bz'), + enCa(value: 'en-ca'), + enGb(value: 'en-gb'), + enIe(value: 'en-ie'), + enJm(value: 'en-jm'), + enNz(value: 'en-nz'), + enTt(value: 'en-tt'), + enUs(value: 'en-us'), + enZa(value: 'en-za'), + eo(value: 'eo'), + es(value: 'es'), + esAr(value: 'es-ar'), + esBo(value: 'es-bo'), + esCl(value: 'es-cl'), + esCo(value: 'es-co'), + esCr(value: 'es-cr'), + esDo(value: 'es-do'), + esEc(value: 'es-ec'), + esGt(value: 'es-gt'), + esHn(value: 'es-hn'), + esMx(value: 'es-mx'), + esNi(value: 'es-ni'), + esPa(value: 'es-pa'), + esPe(value: 'es-pe'), + esPr(value: 'es-pr'), + esPy(value: 'es-py'), + esSv(value: 'es-sv'), + esUy(value: 'es-uy'), + esVe(value: 'es-ve'), + et(value: 'et'), + eu(value: 'eu'), + fa(value: 'fa'), + fi(value: 'fi'), + fo(value: 'fo'), + fr(value: 'fr'), + frBe(value: 'fr-be'), + frCa(value: 'fr-ca'), + frCh(value: 'fr-ch'), + frLu(value: 'fr-lu'), + ga(value: 'ga'), + gd(value: 'gd'), + he(value: 'he'), + hi(value: 'hi'), + hr(value: 'hr'), + hu(value: 'hu'), + id(value: 'id'), + xis(value: 'is'), + it(value: 'it'), + itCh(value: 'it-ch'), + ja(value: 'ja'), + ji(value: 'ji'), + ko(value: 'ko'), + ku(value: 'ku'), + lt(value: 'lt'), + lv(value: 'lv'), + mk(value: 'mk'), + ml(value: 'ml'), + ms(value: 'ms'), + mt(value: 'mt'), + nb(value: 'nb'), + ne(value: 'ne'), + nl(value: 'nl'), + nlBe(value: 'nl-be'), + nn(value: 'nn'), + no(value: 'no'), + pa(value: 'pa'), + pl(value: 'pl'), + pt(value: 'pt'), + ptBr(value: 'pt-br'), + rm(value: 'rm'), + ro(value: 'ro'), + roMd(value: 'ro-md'), + ru(value: 'ru'), + ruMd(value: 'ru-md'), + sb(value: 'sb'), + sk(value: 'sk'), + sl(value: 'sl'), + sq(value: 'sq'), + sr(value: 'sr'), + sv(value: 'sv'), + svFi(value: 'sv-fi'), + th(value: 'th'), + tn(value: 'tn'), + tr(value: 'tr'), + ts(value: 'ts'), + ua(value: 'ua'), + ur(value: 'ur'), + ve(value: 've'), + vi(value: 'vi'), + xh(value: 'xh'), + zhCn(value: 'zh-cn'), + zhHk(value: 'zh-hk'), + zhSg(value: 'zh-sg'), + zhTw(value: 'zh-tw'), + zu(value: 'zu'); + + const EmailTemplateLocale({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/email_template_type.dart b/lib/src/enums/email_template_type.dart new file mode 100644 index 00000000..2aaecb7d --- /dev/null +++ b/lib/src/enums/email_template_type.dart @@ -0,0 +1,17 @@ +part of '../../enums.dart'; + +enum EmailTemplateType { + verification(value: 'verification'), + magicSession(value: 'magicSession'), + recovery(value: 'recovery'), + invitation(value: 'invitation'), + mfaChallenge(value: 'mfaChallenge'), + sessionAlert(value: 'sessionAlert'), + otpSession(value: 'otpSession'); + + const EmailTemplateType({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/method_id.dart b/lib/src/enums/method_id.dart new file mode 100644 index 00000000..26a316d6 --- /dev/null +++ b/lib/src/enums/method_id.dart @@ -0,0 +1,17 @@ +part of '../../enums.dart'; + +enum MethodId { + emailPassword(value: 'email-password'), + magicUrl(value: 'magic-url'), + emailOtp(value: 'email-otp'), + anonymous(value: 'anonymous'), + invites(value: 'invites'), + jwt(value: 'jwt'), + phone(value: 'phone'); + + const MethodId({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/o_auth_provider.dart b/lib/src/enums/o_auth_provider.dart index dc08c932..b88e0a55 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -16,9 +16,12 @@ enum OAuthProvider { etsy(value: 'etsy'), facebook(value: 'facebook'), figma(value: 'figma'), + fusionauth(value: 'fusionauth'), github(value: 'github'), gitlab(value: 'gitlab'), google(value: 'google'), + keycloak(value: 'keycloak'), + kick(value: 'kick'), linkedin(value: 'linkedin'), microsoft(value: 'microsoft'), notion(value: 'notion'), diff --git a/lib/src/enums/policy_id.dart b/lib/src/enums/policy_id.dart new file mode 100644 index 00000000..ef8f54f0 --- /dev/null +++ b/lib/src/enums/policy_id.dart @@ -0,0 +1,19 @@ +part of '../../enums.dart'; + +enum PolicyId { + passwordDictionary(value: 'password-dictionary'), + passwordHistory(value: 'password-history'), + passwordPersonalData(value: 'password-personal-data'), + sessionAlert(value: 'session-alert'), + sessionDuration(value: 'session-duration'), + sessionInvalidation(value: 'session-invalidation'), + sessionLimit(value: 'session-limit'), + userLimit(value: 'user-limit'), + membershipPrivacy(value: 'membership-privacy'); + + const PolicyId({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/provider_id.dart b/lib/src/enums/provider_id.dart new file mode 100644 index 00000000..6137cae9 --- /dev/null +++ b/lib/src/enums/provider_id.dart @@ -0,0 +1,57 @@ +part of '../../enums.dart'; + +enum ProviderId { + amazon(value: 'amazon'), + apple(value: 'apple'), + auth0(value: 'auth0'), + authentik(value: 'authentik'), + autodesk(value: 'autodesk'), + bitbucket(value: 'bitbucket'), + bitly(value: 'bitly'), + box(value: 'box'), + dailymotion(value: 'dailymotion'), + discord(value: 'discord'), + disqus(value: 'disqus'), + dropbox(value: 'dropbox'), + etsy(value: 'etsy'), + facebook(value: 'facebook'), + figma(value: 'figma'), + fusionauth(value: 'fusionauth'), + github(value: 'github'), + gitlab(value: 'gitlab'), + google(value: 'google'), + keycloak(value: 'keycloak'), + kick(value: 'kick'), + linkedin(value: 'linkedin'), + microsoft(value: 'microsoft'), + notion(value: 'notion'), + oidc(value: 'oidc'), + okta(value: 'okta'), + paypal(value: 'paypal'), + paypalSandbox(value: 'paypalSandbox'), + podio(value: 'podio'), + salesforce(value: 'salesforce'), + slack(value: 'slack'), + spotify(value: 'spotify'), + stripe(value: 'stripe'), + tradeshift(value: 'tradeshift'), + tradeshiftBox(value: 'tradeshiftBox'), + twitch(value: 'twitch'), + wordpress(value: 'wordpress'), + x(value: 'x'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'), + mockUnverified(value: 'mock-unverified'), + githubImagine(value: 'githubImagine'), + googleImagine(value: 'googleImagine'); + + const ProviderId({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/proxy_resource_type.dart b/lib/src/enums/proxy_resource_type.dart new file mode 100644 index 00000000..129fed5a --- /dev/null +++ b/lib/src/enums/proxy_resource_type.dart @@ -0,0 +1,12 @@ +part of '../../enums.dart'; + +enum ProxyResourceType { + site(value: 'site'), + function(value: 'function'); + + const ProxyResourceType({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/proxy_rule_deployment_resource_type.dart b/lib/src/enums/proxy_rule_deployment_resource_type.dart new file mode 100644 index 00000000..aa2cda9f --- /dev/null +++ b/lib/src/enums/proxy_rule_deployment_resource_type.dart @@ -0,0 +1,12 @@ +part of '../../enums.dart'; + +enum ProxyRuleDeploymentResourceType { + function(value: 'function'), + site(value: 'site'); + + const ProxyRuleDeploymentResourceType({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/proxy_rule_status.dart b/lib/src/enums/proxy_rule_status.dart new file mode 100644 index 00000000..5ebf31ed --- /dev/null +++ b/lib/src/enums/proxy_rule_status.dart @@ -0,0 +1,13 @@ +part of '../../enums.dart'; + +enum ProxyRuleStatus { + unverified(value: 'unverified'), + verifying(value: 'verifying'), + verified(value: 'verified'); + + const ProxyRuleStatus({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/runtime.dart b/lib/src/enums/runtime.dart index 232aca0a..8acfd913 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -81,6 +81,7 @@ enum Runtime { go124(value: 'go-1.24'), go125(value: 'go-1.25'), go126(value: 'go-1.26'), + rust183(value: 'rust-1.83'), static1(value: 'static-1'), flutter324(value: 'flutter-3.24'), flutter327(value: 'flutter-3.27'), diff --git a/lib/src/enums/scopes.dart b/lib/src/enums/scopes.dart index 64a925ec..42844a2e 100644 --- a/lib/src/enums/scopes.dart +++ b/lib/src/enums/scopes.dart @@ -1,73 +1,88 @@ part of '../../enums.dart'; enum Scopes { - sessionsWrite(value: 'sessions.write'), + projectRead(value: 'project.read'), + projectWrite(value: 'project.write'), + keysRead(value: 'keys.read'), + keysWrite(value: 'keys.write'), + platformsRead(value: 'platforms.read'), + platformsWrite(value: 'platforms.write'), + mocksRead(value: 'mocks.read'), + mocksWrite(value: 'mocks.write'), + policiesRead(value: 'policies.read'), + policiesWrite(value: 'policies.write'), + projectPoliciesRead(value: 'project.policies.read'), + projectPoliciesWrite(value: 'project.policies.write'), + templatesRead(value: 'templates.read'), + templatesWrite(value: 'templates.write'), + oauth2Read(value: 'oauth2.read'), + oauth2Write(value: 'oauth2.write'), usersRead(value: 'users.read'), usersWrite(value: 'users.write'), + sessionsRead(value: 'sessions.read'), + sessionsWrite(value: 'sessions.write'), teamsRead(value: 'teams.read'), teamsWrite(value: 'teams.write'), databasesRead(value: 'databases.read'), databasesWrite(value: 'databases.write'), - collectionsRead(value: 'collections.read'), - collectionsWrite(value: 'collections.write'), tablesRead(value: 'tables.read'), tablesWrite(value: 'tables.write'), - attributesRead(value: 'attributes.read'), - attributesWrite(value: 'attributes.write'), columnsRead(value: 'columns.read'), columnsWrite(value: 'columns.write'), indexesRead(value: 'indexes.read'), indexesWrite(value: 'indexes.write'), - documentsRead(value: 'documents.read'), - documentsWrite(value: 'documents.write'), rowsRead(value: 'rows.read'), rowsWrite(value: 'rows.write'), - filesRead(value: 'files.read'), - filesWrite(value: 'files.write'), + collectionsRead(value: 'collections.read'), + collectionsWrite(value: 'collections.write'), + attributesRead(value: 'attributes.read'), + attributesWrite(value: 'attributes.write'), + documentsRead(value: 'documents.read'), + documentsWrite(value: 'documents.write'), bucketsRead(value: 'buckets.read'), bucketsWrite(value: 'buckets.write'), + filesRead(value: 'files.read'), + filesWrite(value: 'files.write'), + tokensRead(value: 'tokens.read'), + tokensWrite(value: 'tokens.write'), functionsRead(value: 'functions.read'), functionsWrite(value: 'functions.write'), + executionsRead(value: 'executions.read'), + executionsWrite(value: 'executions.write'), + executionRead(value: 'execution.read'), + executionWrite(value: 'execution.write'), sitesRead(value: 'sites.read'), sitesWrite(value: 'sites.write'), logRead(value: 'log.read'), logWrite(value: 'log.write'), - executionRead(value: 'execution.read'), - executionWrite(value: 'execution.write'), - localeRead(value: 'locale.read'), - avatarsRead(value: 'avatars.read'), - healthRead(value: 'health.read'), providersRead(value: 'providers.read'), providersWrite(value: 'providers.write'), - messagesRead(value: 'messages.read'), - messagesWrite(value: 'messages.write'), topicsRead(value: 'topics.read'), topicsWrite(value: 'topics.write'), subscribersRead(value: 'subscribers.read'), subscribersWrite(value: 'subscribers.write'), targetsRead(value: 'targets.read'), targetsWrite(value: 'targets.write'), + messagesRead(value: 'messages.read'), + messagesWrite(value: 'messages.write'), rulesRead(value: 'rules.read'), rulesWrite(value: 'rules.write'), - schedulesRead(value: 'schedules.read'), - schedulesWrite(value: 'schedules.write'), + webhooksRead(value: 'webhooks.read'), + webhooksWrite(value: 'webhooks.write'), + localeRead(value: 'locale.read'), + avatarsRead(value: 'avatars.read'), + healthRead(value: 'health.read'), + assistantRead(value: 'assistant.read'), migrationsRead(value: 'migrations.read'), migrationsWrite(value: 'migrations.write'), + schedulesRead(value: 'schedules.read'), + schedulesWrite(value: 'schedules.write'), vcsRead(value: 'vcs.read'), vcsWrite(value: 'vcs.write'), - assistantRead(value: 'assistant.read'), - tokensRead(value: 'tokens.read'), - tokensWrite(value: 'tokens.write'), - webhooksRead(value: 'webhooks.read'), - webhooksWrite(value: 'webhooks.write'), - projectRead(value: 'project.read'), - projectWrite(value: 'project.write'), - keysRead(value: 'keys.read'), - keysWrite(value: 'keys.write'), - platformsRead(value: 'platforms.read'), - platformsWrite(value: 'platforms.write'), - policiesWrite(value: 'policies.write'), - policiesRead(value: 'policies.read'), + presencesRead(value: 'presences.read'), + presencesWrite(value: 'presences.write'), + backupsPoliciesRead(value: 'backups.policies.read'), + backupsPoliciesWrite(value: 'backups.policies.write'), archivesRead(value: 'archives.read'), archivesWrite(value: 'archives.write'), restorationsRead(value: 'restorations.read'), diff --git a/lib/src/enums/secure.dart b/lib/src/enums/secure.dart new file mode 100644 index 00000000..a490e94f --- /dev/null +++ b/lib/src/enums/secure.dart @@ -0,0 +1,12 @@ +part of '../../enums.dart'; + +enum Secure { + tls(value: 'tls'), + ssl(value: 'ssl'); + + const Secure({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/enums/status_code.dart b/lib/src/enums/status_code.dart new file mode 100644 index 00000000..b4c7c591 --- /dev/null +++ b/lib/src/enums/status_code.dart @@ -0,0 +1,14 @@ +part of '../../enums.dart'; + +enum StatusCode { + movedPermanently301(value: '301'), + found302(value: '302'), + temporaryRedirect307(value: '307'), + permanentRedirect308(value: '308'); + + const StatusCode({required this.value}); + + final String value; + + String toJson() => value; +} diff --git a/lib/src/models/attribute_bigint.dart b/lib/src/models/attribute_bigint.dart new file mode 100644 index 00000000..b2c3da61 --- /dev/null +++ b/lib/src/models/attribute_bigint.dart @@ -0,0 +1,85 @@ +part of '../../models.dart'; + +/// AttributeBigInt +class AttributeBigint implements Model { + /// Attribute Key. + final String key; + + /// Attribute type. + final String type; + + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; + + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; + + /// Is attribute required? + final bool xrequired; + + /// Is attribute an array? + final bool? array; + + /// Attribute creation date in ISO 8601 format. + final String $createdAt; + + /// Attribute update date in ISO 8601 format. + final String $updatedAt; + + /// Minimum value to enforce for new documents. + final int? min; + + /// Maximum value to enforce for new documents. + final int? max; + + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final int? xdefault; + + AttributeBigint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); + + factory AttributeBigint.fromMap(Map map) { + return AttributeBigint( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } + + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } +} diff --git a/lib/src/models/auth_provider.dart b/lib/src/models/auth_provider.dart index 5ef17597..f2bb07c0 100644 --- a/lib/src/models/auth_provider.dart +++ b/lib/src/models/auth_provider.dart @@ -11,7 +11,7 @@ class AuthProvider implements Model { /// OAuth 2.0 application ID. final String appId; - /// OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. + /// OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. This property is write-only and always returned empty. final String secret; /// Auth Provider is active and can be used to create session. diff --git a/lib/src/models/backup_archive.dart b/lib/src/models/backup_archive.dart index 3c995f30..15ea9a24 100644 --- a/lib/src/models/backup_archive.dart +++ b/lib/src/models/backup_archive.dart @@ -17,7 +17,7 @@ class BackupArchive implements Model { /// Archive size in bytes. final int size; - /// The status of the archive creation. Possible values: pending, processing, uploading, completed, failed. + /// The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. final String status; /// The backup start time. diff --git a/lib/src/models/block.dart b/lib/src/models/block.dart index 448021a1..9825fd6e 100644 --- a/lib/src/models/block.dart +++ b/lib/src/models/block.dart @@ -17,12 +17,32 @@ class Block implements Model { /// Block expiration date in ISO 8601 format. Can be null if the block does not expire. final String? expiredAt; + /// Name of the project this block applies to. + final String projectName; + + /// Region of the project this block applies to. + final String region; + + /// Name of the organization that owns the project. + final String organizationName; + + /// ID of the organization that owns the project. + final String organizationId; + + /// Billing plan of the organization that owns the project. + final String billingPlan; + Block({ required this.$createdAt, required this.resourceType, required this.resourceId, this.reason, this.expiredAt, + required this.projectName, + required this.region, + required this.organizationName, + required this.organizationId, + required this.billingPlan, }); factory Block.fromMap(Map map) { @@ -32,6 +52,11 @@ class Block implements Model { resourceId: map['resourceId'].toString(), reason: map['reason']?.toString(), expiredAt: map['expiredAt']?.toString(), + projectName: map['projectName'].toString(), + region: map['region'].toString(), + organizationName: map['organizationName'].toString(), + organizationId: map['organizationId'].toString(), + billingPlan: map['billingPlan'].toString(), ); } @@ -43,6 +68,11 @@ class Block implements Model { "resourceId": resourceId, "reason": reason, "expiredAt": expiredAt, + "projectName": projectName, + "region": region, + "organizationName": organizationName, + "organizationId": organizationId, + "billingPlan": billingPlan, }; } } diff --git a/lib/src/models/column_bigint.dart b/lib/src/models/column_bigint.dart new file mode 100644 index 00000000..b95ecaf4 --- /dev/null +++ b/lib/src/models/column_bigint.dart @@ -0,0 +1,85 @@ +part of '../../models.dart'; + +/// ColumnBigInt +class ColumnBigint implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; + + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; + + /// Is column required? + final bool xrequired; + + /// Is column an array? + final bool? array; + + /// Column creation date in ISO 8601 format. + final String $createdAt; + + /// Column update date in ISO 8601 format. + final String $updatedAt; + + /// Minimum value to enforce for new documents. + final int? min; + + /// Maximum value to enforce for new documents. + final int? max; + + /// Default value for column when not provided. Cannot be set when column is required. + final int? xdefault; + + ColumnBigint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); + + factory ColumnBigint.fromMap(Map map) { + return ColumnBigint( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } + + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } +} diff --git a/lib/src/models/email_template.dart b/lib/src/models/email_template.dart new file mode 100644 index 00000000..286d351a --- /dev/null +++ b/lib/src/models/email_template.dart @@ -0,0 +1,66 @@ +part of '../../models.dart'; + +/// EmailTemplate +class EmailTemplate implements Model { + /// Template type + final String templateId; + + /// Template locale + final String locale; + + /// Template message + final String message; + + /// Name of the sender + final String senderName; + + /// Email of the sender + final String senderEmail; + + /// Reply to email address + final String replyToEmail; + + /// Reply to name + final String replyToName; + + /// Email subject + final String subject; + + EmailTemplate({ + required this.templateId, + required this.locale, + required this.message, + required this.senderName, + required this.senderEmail, + required this.replyToEmail, + required this.replyToName, + required this.subject, + }); + + factory EmailTemplate.fromMap(Map map) { + return EmailTemplate( + templateId: map['templateId'].toString(), + locale: map['locale'].toString(), + message: map['message'].toString(), + senderName: map['senderName'].toString(), + senderEmail: map['senderEmail'].toString(), + replyToEmail: map['replyToEmail'].toString(), + replyToName: map['replyToName'].toString(), + subject: map['subject'].toString(), + ); + } + + @override + Map toMap() { + return { + "templateId": templateId, + "locale": locale, + "message": message, + "senderName": senderName, + "senderEmail": senderEmail, + "replyToEmail": replyToEmail, + "replyToName": replyToName, + "subject": subject, + }; + } +} diff --git a/lib/src/models/email_template_list.dart b/lib/src/models/email_template_list.dart new file mode 100644 index 00000000..aef0db58 --- /dev/null +++ b/lib/src/models/email_template_list.dart @@ -0,0 +1,31 @@ +part of '../../models.dart'; + +/// Email Templates List +class EmailTemplateList implements Model { + /// Total number of templates that matched your query. + final int total; + + /// List of templates. + final List templates; + + EmailTemplateList({ + required this.total, + required this.templates, + }); + + factory EmailTemplateList.fromMap(Map map) { + return EmailTemplateList( + total: map['total'], + templates: List.from( + map['templates'].map((p) => EmailTemplate.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "total": total, + "templates": templates.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/lib/src/models/ephemeral_key.dart b/lib/src/models/ephemeral_key.dart new file mode 100644 index 00000000..899130d7 --- /dev/null +++ b/lib/src/models/ephemeral_key.dart @@ -0,0 +1,72 @@ +part of '../../models.dart'; + +/// Ephemeral Key +class EphemeralKey implements Model { + /// Key ID. + final String $id; + + /// Key creation date in ISO 8601 format. + final String $createdAt; + + /// Key update date in ISO 8601 format. + final String $updatedAt; + + /// Key name. + final String name; + + /// Key expiration date in ISO 8601 format. + final String expire; + + /// Allowed permission scopes. + final List scopes; + + /// Secret key. + final String secret; + + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; + + /// List of SDK user agents that used this key. + final List sdks; + + EphemeralKey({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.expire, + required this.scopes, + required this.secret, + required this.accessedAt, + required this.sdks, + }); + + factory EphemeralKey.fromMap(Map map) { + return EphemeralKey( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + expire: map['expire'].toString(), + scopes: List.from(map['scopes'] ?? []), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + sdks: List.from(map['sdks'] ?? []), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "expire": expire, + "scopes": scopes, + "secret": secret, + "accessedAt": accessedAt, + "sdks": sdks, + }; + } +} diff --git a/lib/src/models/membership.dart b/lib/src/models/membership.dart index 87c1755b..20091400 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -20,6 +20,9 @@ class Membership implements Model { /// User email address. Hide this attribute by toggling membership privacy in the Console. final String userEmail; + /// User phone number. Hide this attribute by toggling membership privacy in the Console. + final String userPhone; + /// Team ID. final String teamId; @@ -48,6 +51,7 @@ class Membership implements Model { required this.userId, required this.userName, required this.userEmail, + required this.userPhone, required this.teamId, required this.teamName, required this.invited, @@ -65,6 +69,7 @@ class Membership implements Model { userId: map['userId'].toString(), userName: map['userName'].toString(), userEmail: map['userEmail'].toString(), + userPhone: map['userPhone'].toString(), teamId: map['teamId'].toString(), teamName: map['teamName'].toString(), invited: map['invited'].toString(), @@ -84,6 +89,7 @@ class Membership implements Model { "userId": userId, "userName": userName, "userEmail": userEmail, + "userPhone": userPhone, "teamId": teamId, "teamName": teamName, "invited": invited, diff --git a/lib/src/models/mock_number.dart b/lib/src/models/mock_number.dart index a87a8281..0f256952 100644 --- a/lib/src/models/mock_number.dart +++ b/lib/src/models/mock_number.dart @@ -3,28 +3,40 @@ part of '../../models.dart'; /// Mock Number class MockNumber implements Model { /// Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. - final String phone; + final String number; /// Mock OTP for the number. final String otp; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; + + /// Attribute update date in ISO 8601 format. + final String $updatedAt; + MockNumber({ - required this.phone, + required this.number, required this.otp, + required this.$createdAt, + required this.$updatedAt, }); factory MockNumber.fromMap(Map map) { return MockNumber( - phone: map['phone'].toString(), + number: map['number'].toString(), otp: map['otp'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), ); } @override Map toMap() { return { - "phone": phone, + "number": number, "otp": otp, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, }; } } diff --git a/lib/src/models/mock_number_list.dart b/lib/src/models/mock_number_list.dart new file mode 100644 index 00000000..d3e421b7 --- /dev/null +++ b/lib/src/models/mock_number_list.dart @@ -0,0 +1,31 @@ +part of '../../models.dart'; + +/// Mock Numbers List +class MockNumberList implements Model { + /// Total number of mockNumbers that matched your query. + final int total; + + /// List of mockNumbers. + final List mockNumbers; + + MockNumberList({ + required this.total, + required this.mockNumbers, + }); + + factory MockNumberList.fromMap(Map map) { + return MockNumberList( + total: map['total'], + mockNumbers: List.from( + map['mockNumbers'].map((p) => MockNumber.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "total": total, + "mockNumbers": mockNumbers.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/lib/src/models/o_auth2_amazon.dart b/lib/src/models/o_auth2_amazon.dart new file mode 100644 index 00000000..c3d75928 --- /dev/null +++ b/lib/src/models/o_auth2_amazon.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Amazon +class OAuth2Amazon implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Amazon OAuth2 client ID. + final String clientId; + + /// Amazon OAuth2 client secret. + final String clientSecret; + + OAuth2Amazon({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Amazon.fromMap(Map map) { + return OAuth2Amazon( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_apple.dart b/lib/src/models/o_auth2_apple.dart new file mode 100644 index 00000000..d37e1d35 --- /dev/null +++ b/lib/src/models/o_auth2_apple.dart @@ -0,0 +1,54 @@ +part of '../../models.dart'; + +/// OAuth2Apple +class OAuth2Apple implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Apple OAuth2 service ID. + final String serviceId; + + /// Apple OAuth2 key ID. + final String keyId; + + /// Apple OAuth2 team ID. + final String teamId; + + /// Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. + final String p8File; + + OAuth2Apple({ + required this.$id, + required this.enabled, + required this.serviceId, + required this.keyId, + required this.teamId, + required this.p8File, + }); + + factory OAuth2Apple.fromMap(Map map) { + return OAuth2Apple( + $id: map['\$id'].toString(), + enabled: map['enabled'], + serviceId: map['serviceId'].toString(), + keyId: map['keyId'].toString(), + teamId: map['teamId'].toString(), + p8File: map['p8File'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "serviceId": serviceId, + "keyId": keyId, + "teamId": teamId, + "p8File": p8File, + }; + } +} diff --git a/lib/src/models/o_auth2_auth0.dart b/lib/src/models/o_auth2_auth0.dart new file mode 100644 index 00000000..3e7083da --- /dev/null +++ b/lib/src/models/o_auth2_auth0.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2Auth0 +class OAuth2Auth0 implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Auth0 OAuth2 client ID. + final String clientId; + + /// Auth0 OAuth2 client secret. + final String clientSecret; + + /// Auth0 OAuth2 endpoint domain. + final String endpoint; + + OAuth2Auth0({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2Auth0.fromMap(Map map) { + return OAuth2Auth0( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } +} diff --git a/lib/src/models/o_auth2_authentik.dart b/lib/src/models/o_auth2_authentik.dart new file mode 100644 index 00000000..52896e9c --- /dev/null +++ b/lib/src/models/o_auth2_authentik.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2Authentik +class OAuth2Authentik implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Authentik OAuth2 client ID. + final String clientId; + + /// Authentik OAuth2 client secret. + final String clientSecret; + + /// Authentik OAuth2 endpoint domain. + final String endpoint; + + OAuth2Authentik({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2Authentik.fromMap(Map map) { + return OAuth2Authentik( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } +} diff --git a/lib/src/models/o_auth2_autodesk.dart b/lib/src/models/o_auth2_autodesk.dart new file mode 100644 index 00000000..d3ed8ddd --- /dev/null +++ b/lib/src/models/o_auth2_autodesk.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Autodesk +class OAuth2Autodesk implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Autodesk OAuth2 client ID. + final String clientId; + + /// Autodesk OAuth2 client secret. + final String clientSecret; + + OAuth2Autodesk({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Autodesk.fromMap(Map map) { + return OAuth2Autodesk( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_bitbucket.dart b/lib/src/models/o_auth2_bitbucket.dart new file mode 100644 index 00000000..dfd6ab00 --- /dev/null +++ b/lib/src/models/o_auth2_bitbucket.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Bitbucket +class OAuth2Bitbucket implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Bitbucket OAuth2 key. + final String key; + + /// Bitbucket OAuth2 secret. + final String secret; + + OAuth2Bitbucket({ + required this.$id, + required this.enabled, + required this.key, + required this.secret, + }); + + factory OAuth2Bitbucket.fromMap(Map map) { + return OAuth2Bitbucket( + $id: map['\$id'].toString(), + enabled: map['enabled'], + key: map['key'].toString(), + secret: map['secret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "key": key, + "secret": secret, + }; + } +} diff --git a/lib/src/models/o_auth2_bitly.dart b/lib/src/models/o_auth2_bitly.dart new file mode 100644 index 00000000..0ab7d716 --- /dev/null +++ b/lib/src/models/o_auth2_bitly.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Bitly +class OAuth2Bitly implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Bitly OAuth2 client ID. + final String clientId; + + /// Bitly OAuth2 client secret. + final String clientSecret; + + OAuth2Bitly({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Bitly.fromMap(Map map) { + return OAuth2Bitly( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_box.dart b/lib/src/models/o_auth2_box.dart new file mode 100644 index 00000000..2c4b0f9d --- /dev/null +++ b/lib/src/models/o_auth2_box.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Box +class OAuth2Box implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Box OAuth2 client ID. + final String clientId; + + /// Box OAuth2 client secret. + final String clientSecret; + + OAuth2Box({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Box.fromMap(Map map) { + return OAuth2Box( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_dailymotion.dart b/lib/src/models/o_auth2_dailymotion.dart new file mode 100644 index 00000000..b91c29a0 --- /dev/null +++ b/lib/src/models/o_auth2_dailymotion.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Dailymotion +class OAuth2Dailymotion implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Dailymotion OAuth2 API key. + final String apiKey; + + /// Dailymotion OAuth2 API secret. + final String apiSecret; + + OAuth2Dailymotion({ + required this.$id, + required this.enabled, + required this.apiKey, + required this.apiSecret, + }); + + factory OAuth2Dailymotion.fromMap(Map map) { + return OAuth2Dailymotion( + $id: map['\$id'].toString(), + enabled: map['enabled'], + apiKey: map['apiKey'].toString(), + apiSecret: map['apiSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "apiKey": apiKey, + "apiSecret": apiSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_discord.dart b/lib/src/models/o_auth2_discord.dart new file mode 100644 index 00000000..6ca9e12f --- /dev/null +++ b/lib/src/models/o_auth2_discord.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Discord +class OAuth2Discord implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Discord OAuth2 client ID. + final String clientId; + + /// Discord OAuth2 client secret. + final String clientSecret; + + OAuth2Discord({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Discord.fromMap(Map map) { + return OAuth2Discord( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_disqus.dart b/lib/src/models/o_auth2_disqus.dart new file mode 100644 index 00000000..11f80f80 --- /dev/null +++ b/lib/src/models/o_auth2_disqus.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Disqus +class OAuth2Disqus implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Disqus OAuth2 public key. + final String publicKey; + + /// Disqus OAuth2 secret key. + final String secretKey; + + OAuth2Disqus({ + required this.$id, + required this.enabled, + required this.publicKey, + required this.secretKey, + }); + + factory OAuth2Disqus.fromMap(Map map) { + return OAuth2Disqus( + $id: map['\$id'].toString(), + enabled: map['enabled'], + publicKey: map['publicKey'].toString(), + secretKey: map['secretKey'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "publicKey": publicKey, + "secretKey": secretKey, + }; + } +} diff --git a/lib/src/models/o_auth2_dropbox.dart b/lib/src/models/o_auth2_dropbox.dart new file mode 100644 index 00000000..0ae842fb --- /dev/null +++ b/lib/src/models/o_auth2_dropbox.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Dropbox +class OAuth2Dropbox implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Dropbox OAuth2 app key. + final String appKey; + + /// Dropbox OAuth2 app secret. + final String appSecret; + + OAuth2Dropbox({ + required this.$id, + required this.enabled, + required this.appKey, + required this.appSecret, + }); + + factory OAuth2Dropbox.fromMap(Map map) { + return OAuth2Dropbox( + $id: map['\$id'].toString(), + enabled: map['enabled'], + appKey: map['appKey'].toString(), + appSecret: map['appSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "appKey": appKey, + "appSecret": appSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_etsy.dart b/lib/src/models/o_auth2_etsy.dart new file mode 100644 index 00000000..f166e516 --- /dev/null +++ b/lib/src/models/o_auth2_etsy.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Etsy +class OAuth2Etsy implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Etsy OAuth2 keystring. + final String keyString; + + /// Etsy OAuth2 shared secret. + final String sharedSecret; + + OAuth2Etsy({ + required this.$id, + required this.enabled, + required this.keyString, + required this.sharedSecret, + }); + + factory OAuth2Etsy.fromMap(Map map) { + return OAuth2Etsy( + $id: map['\$id'].toString(), + enabled: map['enabled'], + keyString: map['keyString'].toString(), + sharedSecret: map['sharedSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "keyString": keyString, + "sharedSecret": sharedSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_facebook.dart b/lib/src/models/o_auth2_facebook.dart new file mode 100644 index 00000000..3b59319e --- /dev/null +++ b/lib/src/models/o_auth2_facebook.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Facebook +class OAuth2Facebook implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Facebook OAuth2 app ID. + final String appId; + + /// Facebook OAuth2 app secret. + final String appSecret; + + OAuth2Facebook({ + required this.$id, + required this.enabled, + required this.appId, + required this.appSecret, + }); + + factory OAuth2Facebook.fromMap(Map map) { + return OAuth2Facebook( + $id: map['\$id'].toString(), + enabled: map['enabled'], + appId: map['appId'].toString(), + appSecret: map['appSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "appId": appId, + "appSecret": appSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_figma.dart b/lib/src/models/o_auth2_figma.dart new file mode 100644 index 00000000..446821e1 --- /dev/null +++ b/lib/src/models/o_auth2_figma.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Figma +class OAuth2Figma implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Figma OAuth2 client ID. + final String clientId; + + /// Figma OAuth2 client secret. + final String clientSecret; + + OAuth2Figma({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Figma.fromMap(Map map) { + return OAuth2Figma( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_fusion_auth.dart b/lib/src/models/o_auth2_fusion_auth.dart new file mode 100644 index 00000000..91944e9b --- /dev/null +++ b/lib/src/models/o_auth2_fusion_auth.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2FusionAuth +class OAuth2FusionAuth implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// FusionAuth OAuth2 client ID. + final String clientId; + + /// FusionAuth OAuth2 client secret. + final String clientSecret; + + /// FusionAuth OAuth2 endpoint domain. + final String endpoint; + + OAuth2FusionAuth({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2FusionAuth.fromMap(Map map) { + return OAuth2FusionAuth( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } +} diff --git a/lib/src/models/o_auth2_github.dart b/lib/src/models/o_auth2_github.dart new file mode 100644 index 00000000..d62e55da --- /dev/null +++ b/lib/src/models/o_auth2_github.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2GitHub +class OAuth2Github implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. + final String clientId; + + /// GitHub OAuth2 client secret. + final String clientSecret; + + OAuth2Github({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Github.fromMap(Map map) { + return OAuth2Github( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_gitlab.dart b/lib/src/models/o_auth2_gitlab.dart new file mode 100644 index 00000000..5418c044 --- /dev/null +++ b/lib/src/models/o_auth2_gitlab.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2Gitlab +class OAuth2Gitlab implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// GitLab OAuth2 application ID. + final String applicationId; + + /// GitLab OAuth2 secret. + final String secret; + + /// GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. + final String endpoint; + + OAuth2Gitlab({ + required this.$id, + required this.enabled, + required this.applicationId, + required this.secret, + required this.endpoint, + }); + + factory OAuth2Gitlab.fromMap(Map map) { + return OAuth2Gitlab( + $id: map['\$id'].toString(), + enabled: map['enabled'], + applicationId: map['applicationId'].toString(), + secret: map['secret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "applicationId": applicationId, + "secret": secret, + "endpoint": endpoint, + }; + } +} diff --git a/lib/src/models/o_auth2_google.dart b/lib/src/models/o_auth2_google.dart new file mode 100644 index 00000000..ec156dfa --- /dev/null +++ b/lib/src/models/o_auth2_google.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Google +class OAuth2Google implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Google OAuth2 client ID. + final String clientId; + + /// Google OAuth2 client secret. + final String clientSecret; + + OAuth2Google({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Google.fromMap(Map map) { + return OAuth2Google( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_keycloak.dart b/lib/src/models/o_auth2_keycloak.dart new file mode 100644 index 00000000..d5b16a7f --- /dev/null +++ b/lib/src/models/o_auth2_keycloak.dart @@ -0,0 +1,54 @@ +part of '../../models.dart'; + +/// OAuth2Keycloak +class OAuth2Keycloak implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Keycloak OAuth2 client ID. + final String clientId; + + /// Keycloak OAuth2 client secret. + final String clientSecret; + + /// Keycloak OAuth2 endpoint domain. + final String endpoint; + + /// Keycloak OAuth2 realm name. + final String realmName; + + OAuth2Keycloak({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + required this.realmName, + }); + + factory OAuth2Keycloak.fromMap(Map map) { + return OAuth2Keycloak( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + realmName: map['realmName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + "realmName": realmName, + }; + } +} diff --git a/lib/src/models/o_auth2_kick.dart b/lib/src/models/o_auth2_kick.dart new file mode 100644 index 00000000..2c9a10e4 --- /dev/null +++ b/lib/src/models/o_auth2_kick.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Kick +class OAuth2Kick implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Kick OAuth2 client ID. + final String clientId; + + /// Kick OAuth2 client secret. + final String clientSecret; + + OAuth2Kick({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Kick.fromMap(Map map) { + return OAuth2Kick( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_linkedin.dart b/lib/src/models/o_auth2_linkedin.dart new file mode 100644 index 00000000..cff3afb6 --- /dev/null +++ b/lib/src/models/o_auth2_linkedin.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Linkedin +class OAuth2Linkedin implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// LinkedIn OAuth2 client ID. + final String clientId; + + /// LinkedIn OAuth2 primary client secret. + final String primaryClientSecret; + + OAuth2Linkedin({ + required this.$id, + required this.enabled, + required this.clientId, + required this.primaryClientSecret, + }); + + factory OAuth2Linkedin.fromMap(Map map) { + return OAuth2Linkedin( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + primaryClientSecret: map['primaryClientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "primaryClientSecret": primaryClientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_microsoft.dart b/lib/src/models/o_auth2_microsoft.dart new file mode 100644 index 00000000..e6b4122a --- /dev/null +++ b/lib/src/models/o_auth2_microsoft.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2Microsoft +class OAuth2Microsoft implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Microsoft OAuth2 application ID. + final String applicationId; + + /// Microsoft OAuth2 application secret. + final String applicationSecret; + + /// Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. + final String tenant; + + OAuth2Microsoft({ + required this.$id, + required this.enabled, + required this.applicationId, + required this.applicationSecret, + required this.tenant, + }); + + factory OAuth2Microsoft.fromMap(Map map) { + return OAuth2Microsoft( + $id: map['\$id'].toString(), + enabled: map['enabled'], + applicationId: map['applicationId'].toString(), + applicationSecret: map['applicationSecret'].toString(), + tenant: map['tenant'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "applicationId": applicationId, + "applicationSecret": applicationSecret, + "tenant": tenant, + }; + } +} diff --git a/lib/src/models/o_auth2_notion.dart b/lib/src/models/o_auth2_notion.dart new file mode 100644 index 00000000..534a7ba7 --- /dev/null +++ b/lib/src/models/o_auth2_notion.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Notion +class OAuth2Notion implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Notion OAuth2 client ID. + final String oauthClientId; + + /// Notion OAuth2 client secret. + final String oauthClientSecret; + + OAuth2Notion({ + required this.$id, + required this.enabled, + required this.oauthClientId, + required this.oauthClientSecret, + }); + + factory OAuth2Notion.fromMap(Map map) { + return OAuth2Notion( + $id: map['\$id'].toString(), + enabled: map['enabled'], + oauthClientId: map['oauthClientId'].toString(), + oauthClientSecret: map['oauthClientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "oauthClientId": oauthClientId, + "oauthClientSecret": oauthClientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_oidc.dart b/lib/src/models/o_auth2_oidc.dart new file mode 100644 index 00000000..99537da7 --- /dev/null +++ b/lib/src/models/o_auth2_oidc.dart @@ -0,0 +1,66 @@ +part of '../../models.dart'; + +/// OAuth2Oidc +class OAuth2Oidc implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// OpenID Connect OAuth2 client ID. + final String clientId; + + /// OpenID Connect OAuth2 client secret. + final String clientSecret; + + /// OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. + final String wellKnownURL; + + /// OpenID Connect authorization endpoint URL. + final String authorizationURL; + + /// OpenID Connect token endpoint URL. + final String tokenURL; + + /// OpenID Connect user info endpoint URL. + final String userInfoURL; + + OAuth2Oidc({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.wellKnownURL, + required this.authorizationURL, + required this.tokenURL, + required this.userInfoURL, + }); + + factory OAuth2Oidc.fromMap(Map map) { + return OAuth2Oidc( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + wellKnownURL: map['wellKnownURL'].toString(), + authorizationURL: map['authorizationURL'].toString(), + tokenURL: map['tokenURL'].toString(), + userInfoURL: map['userInfoURL'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "wellKnownURL": wellKnownURL, + "authorizationURL": authorizationURL, + "tokenURL": tokenURL, + "userInfoURL": userInfoURL, + }; + } +} diff --git a/lib/src/models/o_auth2_okta.dart b/lib/src/models/o_auth2_okta.dart new file mode 100644 index 00000000..0a5bade7 --- /dev/null +++ b/lib/src/models/o_auth2_okta.dart @@ -0,0 +1,54 @@ +part of '../../models.dart'; + +/// OAuth2Okta +class OAuth2Okta implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Okta OAuth2 client ID. + final String clientId; + + /// Okta OAuth2 client secret. + final String clientSecret; + + /// Okta OAuth2 domain. + final String domain; + + /// Okta OAuth2 authorization server ID. + final String authorizationServerId; + + OAuth2Okta({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.domain, + required this.authorizationServerId, + }); + + factory OAuth2Okta.fromMap(Map map) { + return OAuth2Okta( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + domain: map['domain'].toString(), + authorizationServerId: map['authorizationServerId'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "domain": domain, + "authorizationServerId": authorizationServerId, + }; + } +} diff --git a/lib/src/models/o_auth2_paypal.dart b/lib/src/models/o_auth2_paypal.dart new file mode 100644 index 00000000..eb7be823 --- /dev/null +++ b/lib/src/models/o_auth2_paypal.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Paypal +class OAuth2Paypal implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// PayPal OAuth2 client ID. + final String clientId; + + /// PayPal OAuth2 secret key. + final String secretKey; + + OAuth2Paypal({ + required this.$id, + required this.enabled, + required this.clientId, + required this.secretKey, + }); + + factory OAuth2Paypal.fromMap(Map map) { + return OAuth2Paypal( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + secretKey: map['secretKey'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "secretKey": secretKey, + }; + } +} diff --git a/lib/src/models/o_auth2_podio.dart b/lib/src/models/o_auth2_podio.dart new file mode 100644 index 00000000..36aaa935 --- /dev/null +++ b/lib/src/models/o_auth2_podio.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Podio +class OAuth2Podio implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Podio OAuth2 client ID. + final String clientId; + + /// Podio OAuth2 client secret. + final String clientSecret; + + OAuth2Podio({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Podio.fromMap(Map map) { + return OAuth2Podio( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_provider_list.dart b/lib/src/models/o_auth2_provider_list.dart new file mode 100644 index 00000000..46c9dd1e --- /dev/null +++ b/lib/src/models/o_auth2_provider_list.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// OAuth2 Providers List +class OAuth2ProviderList implements Model { + /// Total number of OAuth2 providers in the given project. + final int total; + + /// List of OAuth2 providers. + final List providers; + + OAuth2ProviderList({ + required this.total, + required this.providers, + }); + + factory OAuth2ProviderList.fromMap(Map map) { + return OAuth2ProviderList( + total: map['total'], + providers: List.from(map['providers'] ?? []), + ); + } + + @override + Map toMap() { + return { + "total": total, + "providers": providers, + }; + } +} diff --git a/lib/src/models/o_auth2_salesforce.dart b/lib/src/models/o_auth2_salesforce.dart new file mode 100644 index 00000000..d796a1a8 --- /dev/null +++ b/lib/src/models/o_auth2_salesforce.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Salesforce +class OAuth2Salesforce implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Salesforce OAuth2 consumer key. + final String customerKey; + + /// Salesforce OAuth2 consumer secret. + final String customerSecret; + + OAuth2Salesforce({ + required this.$id, + required this.enabled, + required this.customerKey, + required this.customerSecret, + }); + + factory OAuth2Salesforce.fromMap(Map map) { + return OAuth2Salesforce( + $id: map['\$id'].toString(), + enabled: map['enabled'], + customerKey: map['customerKey'].toString(), + customerSecret: map['customerSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "customerKey": customerKey, + "customerSecret": customerSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_slack.dart b/lib/src/models/o_auth2_slack.dart new file mode 100644 index 00000000..c91d1434 --- /dev/null +++ b/lib/src/models/o_auth2_slack.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Slack +class OAuth2Slack implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Slack OAuth2 client ID. + final String clientId; + + /// Slack OAuth2 client secret. + final String clientSecret; + + OAuth2Slack({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Slack.fromMap(Map map) { + return OAuth2Slack( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_spotify.dart b/lib/src/models/o_auth2_spotify.dart new file mode 100644 index 00000000..2486978d --- /dev/null +++ b/lib/src/models/o_auth2_spotify.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Spotify +class OAuth2Spotify implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Spotify OAuth2 client ID. + final String clientId; + + /// Spotify OAuth2 client secret. + final String clientSecret; + + OAuth2Spotify({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Spotify.fromMap(Map map) { + return OAuth2Spotify( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_stripe.dart b/lib/src/models/o_auth2_stripe.dart new file mode 100644 index 00000000..c7cb6490 --- /dev/null +++ b/lib/src/models/o_auth2_stripe.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Stripe +class OAuth2Stripe implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Stripe OAuth2 client ID. + final String clientId; + + /// Stripe OAuth2 API secret key. + final String apiSecretKey; + + OAuth2Stripe({ + required this.$id, + required this.enabled, + required this.clientId, + required this.apiSecretKey, + }); + + factory OAuth2Stripe.fromMap(Map map) { + return OAuth2Stripe( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + apiSecretKey: map['apiSecretKey'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "apiSecretKey": apiSecretKey, + }; + } +} diff --git a/lib/src/models/o_auth2_tradeshift.dart b/lib/src/models/o_auth2_tradeshift.dart new file mode 100644 index 00000000..8c95905f --- /dev/null +++ b/lib/src/models/o_auth2_tradeshift.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Tradeshift +class OAuth2Tradeshift implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Tradeshift OAuth2 client ID. + final String oauth2ClientId; + + /// Tradeshift OAuth2 client secret. + final String oauth2ClientSecret; + + OAuth2Tradeshift({ + required this.$id, + required this.enabled, + required this.oauth2ClientId, + required this.oauth2ClientSecret, + }); + + factory OAuth2Tradeshift.fromMap(Map map) { + return OAuth2Tradeshift( + $id: map['\$id'].toString(), + enabled: map['enabled'], + oauth2ClientId: map['oauth2ClientId'].toString(), + oauth2ClientSecret: map['oauth2ClientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "oauth2ClientId": oauth2ClientId, + "oauth2ClientSecret": oauth2ClientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_twitch.dart b/lib/src/models/o_auth2_twitch.dart new file mode 100644 index 00000000..79657192 --- /dev/null +++ b/lib/src/models/o_auth2_twitch.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Twitch +class OAuth2Twitch implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Twitch OAuth2 client ID. + final String clientId; + + /// Twitch OAuth2 client secret. + final String clientSecret; + + OAuth2Twitch({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Twitch.fromMap(Map map) { + return OAuth2Twitch( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_word_press.dart b/lib/src/models/o_auth2_word_press.dart new file mode 100644 index 00000000..de659b78 --- /dev/null +++ b/lib/src/models/o_auth2_word_press.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2WordPress +class OAuth2WordPress implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// WordPress OAuth2 client ID. + final String clientId; + + /// WordPress OAuth2 client secret. + final String clientSecret; + + OAuth2WordPress({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2WordPress.fromMap(Map map) { + return OAuth2WordPress( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_x.dart b/lib/src/models/o_auth2_x.dart new file mode 100644 index 00000000..fac9f15f --- /dev/null +++ b/lib/src/models/o_auth2_x.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2X +class OAuth2X implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// X OAuth2 customer key. + final String customerKey; + + /// X OAuth2 secret key. + final String secretKey; + + OAuth2X({ + required this.$id, + required this.enabled, + required this.customerKey, + required this.secretKey, + }); + + factory OAuth2X.fromMap(Map map) { + return OAuth2X( + $id: map['\$id'].toString(), + enabled: map['enabled'], + customerKey: map['customerKey'].toString(), + secretKey: map['secretKey'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "customerKey": customerKey, + "secretKey": secretKey, + }; + } +} diff --git a/lib/src/models/o_auth2_yahoo.dart b/lib/src/models/o_auth2_yahoo.dart new file mode 100644 index 00000000..b7bc91a0 --- /dev/null +++ b/lib/src/models/o_auth2_yahoo.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Yahoo +class OAuth2Yahoo implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Yahoo OAuth2 client ID. + final String clientId; + + /// Yahoo OAuth2 client secret. + final String clientSecret; + + OAuth2Yahoo({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Yahoo.fromMap(Map map) { + return OAuth2Yahoo( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_yandex.dart b/lib/src/models/o_auth2_yandex.dart new file mode 100644 index 00000000..7ef040d0 --- /dev/null +++ b/lib/src/models/o_auth2_yandex.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Yandex +class OAuth2Yandex implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Yandex OAuth2 client ID. + final String clientId; + + /// Yandex OAuth2 client secret. + final String clientSecret; + + OAuth2Yandex({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Yandex.fromMap(Map map) { + return OAuth2Yandex( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_zoho.dart b/lib/src/models/o_auth2_zoho.dart new file mode 100644 index 00000000..ebe05c49 --- /dev/null +++ b/lib/src/models/o_auth2_zoho.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Zoho +class OAuth2Zoho implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Zoho OAuth2 client ID. + final String clientId; + + /// Zoho OAuth2 client secret. + final String clientSecret; + + OAuth2Zoho({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Zoho.fromMap(Map map) { + return OAuth2Zoho( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_zoom.dart b/lib/src/models/o_auth2_zoom.dart new file mode 100644 index 00000000..84f3e654 --- /dev/null +++ b/lib/src/models/o_auth2_zoom.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Zoom +class OAuth2Zoom implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Zoom OAuth2 client ID. + final String clientId; + + /// Zoom OAuth2 client secret. + final String clientSecret; + + OAuth2Zoom({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Zoom.fromMap(Map map) { + return OAuth2Zoom( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/policy_list.dart b/lib/src/models/policy_list.dart new file mode 100644 index 00000000..a8f4bff7 --- /dev/null +++ b/lib/src/models/policy_list.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policies List +class PolicyList implements Model { + /// Total number of policies in the given project. + final int total; + + /// List of policies. + final List policies; + + PolicyList({ + required this.total, + required this.policies, + }); + + factory PolicyList.fromMap(Map map) { + return PolicyList( + total: map['total'], + policies: List.from(map['policies'] ?? []), + ); + } + + @override + Map toMap() { + return { + "total": total, + "policies": policies, + }; + } +} diff --git a/lib/src/models/policy_membership_privacy.dart b/lib/src/models/policy_membership_privacy.dart new file mode 100644 index 00000000..5cda0af3 --- /dev/null +++ b/lib/src/models/policy_membership_privacy.dart @@ -0,0 +1,54 @@ +part of '../../models.dart'; + +/// Policy Membership Privacy +class PolicyMembershipPrivacy implements Model { + /// Policy ID. + final String $id; + + /// Whether user ID is visible in memberships. + final bool userId; + + /// Whether user email is visible in memberships. + final bool userEmail; + + /// Whether user phone is visible in memberships. + final bool userPhone; + + /// Whether user name is visible in memberships. + final bool userName; + + /// Whether user MFA status is visible in memberships. + final bool userMFA; + + PolicyMembershipPrivacy({ + required this.$id, + required this.userId, + required this.userEmail, + required this.userPhone, + required this.userName, + required this.userMFA, + }); + + factory PolicyMembershipPrivacy.fromMap(Map map) { + return PolicyMembershipPrivacy( + $id: map['\$id'].toString(), + userId: map['userId'], + userEmail: map['userEmail'], + userPhone: map['userPhone'], + userName: map['userName'], + userMFA: map['userMFA'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "userId": userId, + "userEmail": userEmail, + "userPhone": userPhone, + "userName": userName, + "userMFA": userMFA, + }; + } +} diff --git a/lib/src/models/policy_password_dictionary.dart b/lib/src/models/policy_password_dictionary.dart new file mode 100644 index 00000000..1d58cf1e --- /dev/null +++ b/lib/src/models/policy_password_dictionary.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Password Dictionary +class PolicyPasswordDictionary implements Model { + /// Policy ID. + final String $id; + + /// Whether password dictionary policy is enabled. + final bool enabled; + + PolicyPasswordDictionary({ + required this.$id, + required this.enabled, + }); + + factory PolicyPasswordDictionary.fromMap(Map map) { + return PolicyPasswordDictionary( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } +} diff --git a/lib/src/models/policy_password_history.dart b/lib/src/models/policy_password_history.dart new file mode 100644 index 00000000..54caebd0 --- /dev/null +++ b/lib/src/models/policy_password_history.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Password History +class PolicyPasswordHistory implements Model { + /// Policy ID. + final String $id; + + /// Password history length. A value of 0 means the policy is disabled. + final int total; + + PolicyPasswordHistory({ + required this.$id, + required this.total, + }); + + factory PolicyPasswordHistory.fromMap(Map map) { + return PolicyPasswordHistory( + $id: map['\$id'].toString(), + total: map['total'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } +} diff --git a/lib/src/models/policy_password_personal_data.dart b/lib/src/models/policy_password_personal_data.dart new file mode 100644 index 00000000..223df126 --- /dev/null +++ b/lib/src/models/policy_password_personal_data.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Password Personal Data +class PolicyPasswordPersonalData implements Model { + /// Policy ID. + final String $id; + + /// Whether password personal data policy is enabled. + final bool enabled; + + PolicyPasswordPersonalData({ + required this.$id, + required this.enabled, + }); + + factory PolicyPasswordPersonalData.fromMap(Map map) { + return PolicyPasswordPersonalData( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } +} diff --git a/lib/src/models/policy_session_alert.dart b/lib/src/models/policy_session_alert.dart new file mode 100644 index 00000000..05f9fe50 --- /dev/null +++ b/lib/src/models/policy_session_alert.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Session Alert +class PolicySessionAlert implements Model { + /// Policy ID. + final String $id; + + /// Whether session alert policy is enabled. + final bool enabled; + + PolicySessionAlert({ + required this.$id, + required this.enabled, + }); + + factory PolicySessionAlert.fromMap(Map map) { + return PolicySessionAlert( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } +} diff --git a/lib/src/models/policy_session_duration.dart b/lib/src/models/policy_session_duration.dart new file mode 100644 index 00000000..fc689d36 --- /dev/null +++ b/lib/src/models/policy_session_duration.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Session Duration +class PolicySessionDuration implements Model { + /// Policy ID. + final String $id; + + /// Session duration in seconds. + final int duration; + + PolicySessionDuration({ + required this.$id, + required this.duration, + }); + + factory PolicySessionDuration.fromMap(Map map) { + return PolicySessionDuration( + $id: map['\$id'].toString(), + duration: map['duration'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "duration": duration, + }; + } +} diff --git a/lib/src/models/policy_session_invalidation.dart b/lib/src/models/policy_session_invalidation.dart new file mode 100644 index 00000000..bae38cf6 --- /dev/null +++ b/lib/src/models/policy_session_invalidation.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Session Invalidation +class PolicySessionInvalidation implements Model { + /// Policy ID. + final String $id; + + /// Whether session invalidation policy is enabled. + final bool enabled; + + PolicySessionInvalidation({ + required this.$id, + required this.enabled, + }); + + factory PolicySessionInvalidation.fromMap(Map map) { + return PolicySessionInvalidation( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } +} diff --git a/lib/src/models/policy_session_limit.dart b/lib/src/models/policy_session_limit.dart new file mode 100644 index 00000000..e74aa69d --- /dev/null +++ b/lib/src/models/policy_session_limit.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Session Limit +class PolicySessionLimit implements Model { + /// Policy ID. + final String $id; + + /// Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. + final int total; + + PolicySessionLimit({ + required this.$id, + required this.total, + }); + + factory PolicySessionLimit.fromMap(Map map) { + return PolicySessionLimit( + $id: map['\$id'].toString(), + total: map['total'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } +} diff --git a/lib/src/models/policy_user_limit.dart b/lib/src/models/policy_user_limit.dart new file mode 100644 index 00000000..1df4e85d --- /dev/null +++ b/lib/src/models/policy_user_limit.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy User Limit +class PolicyUserLimit implements Model { + /// Policy ID. + final String $id; + + /// Maximum number of users allowed in the project. A value of 0 means the policy is disabled. + final int total; + + PolicyUserLimit({ + required this.$id, + required this.total, + }); + + factory PolicyUserLimit.fromMap(Map map) { + return PolicyUserLimit( + $id: map['\$id'].toString(), + total: map['total'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } +} diff --git a/lib/src/models/presence.dart b/lib/src/models/presence.dart new file mode 100644 index 00000000..5a722261 --- /dev/null +++ b/lib/src/models/presence.dart @@ -0,0 +1,85 @@ +part of '../../models.dart'; + +/// Presence +class Presence implements Model { + /// Presence ID. + final String $id; + + /// Presence sequence ID. + final String $sequence; + + /// Presence creation date in ISO 8601 format. + final String $createdAt; + + /// Presence update date in ISO 8601 format. + final String $updatedAt; + + /// Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; + + /// User internal ID. + final String userInternalId; + + /// User ID. + final String userId; + + /// Presence status. + final String? status; + + /// Presence source. + final String source; + + /// Presence expiry date in ISO 8601 format. + final String? expiresAt; + + final Map data; + + Presence({ + required this.$id, + required this.$sequence, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.userInternalId, + required this.userId, + this.status, + required this.source, + this.expiresAt, + required this.data, + }); + + factory Presence.fromMap(Map map) { + return Presence( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + userInternalId: map['userInternalId'].toString(), + userId: map['userId'].toString(), + status: map['status']?.toString(), + source: map['source'].toString(), + expiresAt: map['expiresAt']?.toString(), + data: map["data"] ?? map, + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$sequence": $sequence, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "userInternalId": userInternalId, + "userId": userId, + "status": status, + "source": source, + "expiresAt": expiresAt, + "data": data, + }; + } + + T convertTo(T Function(Map) fromJson) => fromJson(data); +} diff --git a/lib/src/models/presence_list.dart b/lib/src/models/presence_list.dart new file mode 100644 index 00000000..ddd87e31 --- /dev/null +++ b/lib/src/models/presence_list.dart @@ -0,0 +1,34 @@ +part of '../../models.dart'; + +/// Presences List +class PresenceList implements Model { + /// Total number of presences that matched your query. + final int total; + + /// List of presences. + final List presences; + + PresenceList({ + required this.total, + required this.presences, + }); + + factory PresenceList.fromMap(Map map) { + return PresenceList( + total: map['total'], + presences: + List.from(map['presences'].map((p) => Presence.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "total": total, + "presences": presences.map((p) => p.toMap()).toList(), + }; + } + + List convertTo(T Function(Map) fromJson) => + presences.map((d) => d.convertTo(fromJson)).toList(); +} diff --git a/lib/src/models/project.dart b/lib/src/models/project.dart index 10f84064..ccd476dc 100644 --- a/lib/src/models/project.dart +++ b/lib/src/models/project.dart @@ -86,6 +86,12 @@ class Project implements Model { /// Whether or not to show user MFA status in the teams membership response. final bool authMembershipsMfa; + /// Whether or not to show user IDs in the teams membership response. + final bool authMembershipsUserId; + + /// Whether or not to show user phone numbers in the teams membership response. + final bool authMembershipsUserPhone; + /// Whether or not all existing sessions should be invalidated on password change final bool authInvalidateSessions; @@ -113,8 +119,11 @@ class Project implements Model { /// SMTP sender email final String smtpSenderEmail; + /// SMTP reply to name + final String smtpReplyToName; + /// SMTP reply to email - final String smtpReplyTo; + final String smtpReplyToEmail; /// SMTP server host name final String smtpHost; @@ -125,7 +134,7 @@ class Project implements Model { /// SMTP server username final String smtpUsername; - /// SMTP server password + /// SMTP server password. This property is write-only and always returned empty. final String smtpPassword; /// SMTP server secure protocol @@ -265,6 +274,8 @@ class Project implements Model { required this.authMembershipsUserName, required this.authMembershipsUserEmail, required this.authMembershipsMfa, + required this.authMembershipsUserId, + required this.authMembershipsUserPhone, required this.authInvalidateSessions, required this.oAuthProviders, required this.platforms, @@ -274,7 +285,8 @@ class Project implements Model { required this.smtpEnabled, required this.smtpSenderName, required this.smtpSenderEmail, - required this.smtpReplyTo, + required this.smtpReplyToName, + required this.smtpReplyToEmail, required this.smtpHost, required this.smtpPort, required this.smtpUsername, @@ -348,6 +360,8 @@ class Project implements Model { authMembershipsUserName: map['authMembershipsUserName'], authMembershipsUserEmail: map['authMembershipsUserEmail'], authMembershipsMfa: map['authMembershipsMfa'], + authMembershipsUserId: map['authMembershipsUserId'], + authMembershipsUserPhone: map['authMembershipsUserPhone'], authInvalidateSessions: map['authInvalidateSessions'], oAuthProviders: List.from( map['oAuthProviders'].map((p) => AuthProvider.fromMap(p))), @@ -359,7 +373,8 @@ class Project implements Model { smtpEnabled: map['smtpEnabled'], smtpSenderName: map['smtpSenderName'].toString(), smtpSenderEmail: map['smtpSenderEmail'].toString(), - smtpReplyTo: map['smtpReplyTo'].toString(), + smtpReplyToName: map['smtpReplyToName'].toString(), + smtpReplyToEmail: map['smtpReplyToEmail'].toString(), smtpHost: map['smtpHost'].toString(), smtpPort: map['smtpPort'], smtpUsername: map['smtpUsername'].toString(), @@ -434,6 +449,8 @@ class Project implements Model { "authMembershipsUserName": authMembershipsUserName, "authMembershipsUserEmail": authMembershipsUserEmail, "authMembershipsMfa": authMembershipsMfa, + "authMembershipsUserId": authMembershipsUserId, + "authMembershipsUserPhone": authMembershipsUserPhone, "authInvalidateSessions": authInvalidateSessions, "oAuthProviders": oAuthProviders.map((p) => p.toMap()).toList(), "platforms": platforms, @@ -443,7 +460,8 @@ class Project implements Model { "smtpEnabled": smtpEnabled, "smtpSenderName": smtpSenderName, "smtpSenderEmail": smtpSenderEmail, - "smtpReplyTo": smtpReplyTo, + "smtpReplyToName": smtpReplyToName, + "smtpReplyToEmail": smtpReplyToEmail, "smtpHost": smtpHost, "smtpPort": smtpPort, "smtpUsername": smtpUsername, diff --git a/lib/src/models/proxy_rule.dart b/lib/src/models/proxy_rule.dart new file mode 100644 index 00000000..9e1945dc --- /dev/null +++ b/lib/src/models/proxy_rule.dart @@ -0,0 +1,113 @@ +part of '../../models.dart'; + +/// Rule +class ProxyRule implements Model { + /// Rule ID. + final String $id; + + /// Rule creation date in ISO 8601 format. + final String $createdAt; + + /// Rule update date in ISO 8601 format. + final String $updatedAt; + + /// Domain name. + final String domain; + + /// Action definition for the rule. Possible values are "api", "deployment", or "redirect" + final String type; + + /// Defines how the rule was created. Possible values are "manual" or "deployment" + final String trigger; + + /// URL to redirect to. Used if type is "redirect" + final String redirectUrl; + + /// Status code to apply during redirect. Used if type is "redirect" + final int redirectStatusCode; + + /// ID of deployment. Used if type is "deployment" + final String deploymentId; + + /// Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". + final enums.ProxyRuleDeploymentResourceType? deploymentResourceType; + + /// ID of deployment's resource (site or function ID). Used if type is "deployment" + final String deploymentResourceId; + + /// Name of Git branch that updates rule. Used if type is "deployment" + final String deploymentVcsProviderBranch; + + /// Domain verification status. Possible values are "unverified", "verifying", "verified" + final enums.ProxyRuleStatus status; + + /// Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. + final String logs; + + /// Certificate auto-renewal date in ISO 8601 format. + final String renewAt; + + ProxyRule({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.domain, + required this.type, + required this.trigger, + required this.redirectUrl, + required this.redirectStatusCode, + required this.deploymentId, + this.deploymentResourceType, + required this.deploymentResourceId, + required this.deploymentVcsProviderBranch, + required this.status, + required this.logs, + required this.renewAt, + }); + + factory ProxyRule.fromMap(Map map) { + return ProxyRule( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + domain: map['domain'].toString(), + type: map['type'].toString(), + trigger: map['trigger'].toString(), + redirectUrl: map['redirectUrl'].toString(), + redirectStatusCode: map['redirectStatusCode'], + deploymentId: map['deploymentId'].toString(), + deploymentResourceType: map['deploymentResourceType'] != null + ? enums.ProxyRuleDeploymentResourceType.values + .firstWhere((e) => e.value == map['deploymentResourceType']) + : null, + deploymentResourceId: map['deploymentResourceId'].toString(), + deploymentVcsProviderBranch: + map['deploymentVcsProviderBranch'].toString(), + status: enums.ProxyRuleStatus.values + .firstWhere((e) => e.value == map['status']), + logs: map['logs'].toString(), + renewAt: map['renewAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "domain": domain, + "type": type, + "trigger": trigger, + "redirectUrl": redirectUrl, + "redirectStatusCode": redirectStatusCode, + "deploymentId": deploymentId, + "deploymentResourceType": deploymentResourceType?.value, + "deploymentResourceId": deploymentResourceId, + "deploymentVcsProviderBranch": deploymentVcsProviderBranch, + "status": status.value, + "logs": logs, + "renewAt": renewAt, + }; + } +} diff --git a/lib/src/models/proxy_rule_list.dart b/lib/src/models/proxy_rule_list.dart new file mode 100644 index 00000000..1ae8951e --- /dev/null +++ b/lib/src/models/proxy_rule_list.dart @@ -0,0 +1,31 @@ +part of '../../models.dart'; + +/// Rule List +class ProxyRuleList implements Model { + /// Total number of rules that matched your query. + final int total; + + /// List of rules. + final List rules; + + ProxyRuleList({ + required this.total, + required this.rules, + }); + + factory ProxyRuleList.fromMap(Map map) { + return ProxyRuleList( + total: map['total'], + rules: + List.from(map['rules'].map((p) => ProxyRule.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "total": total, + "rules": rules.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 3a0aa782..b6889c67 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 23.0.0 +version: 23.1.0 description: Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-dart diff --git a/test/services/databases_test.dart b/test/services/databases_test.dart index 07d3f9f4..4781bf22 100644 --- a/test/services/databases_test.dart +++ b/test/services/databases_test.dart @@ -379,6 +379,55 @@ void main() { expect(response, isA()); }); + test('test method createBigIntAttribute()', () async { + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + + test('test method updateBigIntAttribute()', () async { + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + }); + test('test method createBooleanAttribute()', () async { final Map data = { 'key': 'isEnabled', diff --git a/test/services/functions_test.dart b/test/services/functions_test.dart index 917bc94d..69da7608 100644 --- a/test/services/functions_test.dart +++ b/test/services/functions_test.dart @@ -737,6 +737,7 @@ void main() { final response = await functions.createVariable( functionId: '', + variableId: '', key: '', value: '', ); @@ -785,7 +786,6 @@ void main() { final response = await functions.updateVariable( functionId: '', variableId: '', - key: '', ); expect(response, isA()); }); diff --git a/test/services/presences_test.dart b/test/services/presences_test.dart new file mode 100644 index 00000000..d867acf2 --- /dev/null +++ b/test/services/presences_test.dart @@ -0,0 +1,152 @@ +import 'package:test/test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:dart_appwrite/models.dart' as models; +import 'package:dart_appwrite/enums.dart' as enums; +import 'package:dart_appwrite/src/enums.dart'; +import 'package:dart_appwrite/src/response.dart'; +import 'dart:typed_data'; +import 'package:dart_appwrite/dart_appwrite.dart'; + +class MockClient extends Mock implements Client { + Map config = {'project': 'testproject'}; + String endPoint = 'https://localhost/v1'; + @override + Future call( + HttpMethod? method, { + String path = '', + Map headers = const {}, + Map params = const {}, + ResponseType? responseType, + }) async { + return super.noSuchMethod(Invocation.method(#call, [method]), + returnValue: Response()); + } + + @override + Future webAuth(Uri url) async { + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + } + + @override + Future chunkedUpload({ + String? path, + Map? params, + String? paramName, + String? idParamName, + Map? headers, + Function(UploadProgress)? onProgress, + }) async { + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); + } +} + +void main() { + group('Presences test', () { + late MockClient client; + late Presences presences; + + setUp(() { + client = MockClient(); + presences = Presences(client); + }); + + test('test method list()', () async { + final Map data = { + 'total': 5, + 'presences': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await presences.list(); + expect(response, isA()); + }); + + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await presences.get( + presenceId: '', + ); + expect(response, isA()); + }); + + test('test method upsert()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await presences.upsert( + presenceId: '', + userId: '', + status: '', + ); + expect(response, isA()); + }); + + test('test method updatePresence()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await presences.updatePresence( + presenceId: '', + userId: '', + ); + expect(response, isA()); + }); + + test('test method delete()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + final response = await presences.delete( + presenceId: '', + ); + }); + }); +} diff --git a/test/services/project_test.dart b/test/services/project_test.dart index 259d864c..745e3387 100644 --- a/test/services/project_test.dart +++ b/test/services/project_test.dart @@ -54,6 +54,121 @@ void main() { project = Project(client); }); + test('test method delete()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.delete(); + }); + + test('test method updateAuthMethod()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateAuthMethod( + methodId: enums.MethodId.emailPassword, + enabled: true, + ); + expect(response, isA()); + }); + test('test method listKeys()', () async { final Map data = { 'total': 5, @@ -88,11 +203,35 @@ void main() { final response = await project.createKey( keyId: '', name: '', - scopes: [enums.Scopes.sessionsWrite], + scopes: [enums.Scopes.projectRead], ); expect(response, isA()); }); + test('test method createEphemeralKey()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createEphemeralKey( + scopes: [enums.Scopes.projectRead], + duration: 1, + ); + expect(response, isA()); + }); + test('test method getKey()', () async { final Map data = { '\$id': '5e5ea5c16897e', @@ -136,7 +275,7 @@ void main() { final response = await project.updateKey( keyId: '', name: '', - scopes: [enums.Scopes.sessionsWrite], + scopes: [enums.Scopes.projectRead], ); expect(response, isA()); }); @@ -183,6 +322,8 @@ void main() { 'authMembershipsUserName': true, 'authMembershipsUserEmail': true, 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, 'authInvalidateSessions': true, 'oAuthProviders': [], 'platforms': [], @@ -192,11 +333,12 @@ void main() { 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyTo': 'support@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': 'securepassword', + 'smtpPassword': '', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', @@ -254,273 +396,2065 @@ void main() { expect(response, isA()); }); - test('test method listPlatforms()', () async { + test('test method listMockPhones()', () async { final Map data = { 'total': 5, - 'platforms': [], + 'mockNumbers': [], }; when(client.call( HttpMethod.get, )).thenAnswer((_) async => Response(data: data)); - final response = await project.listPlatforms(); - expect(response, isA()); + final response = await project.listMockPhones(); + expect(response, isA()); }); - test('test method createAndroidPlatform()', () async { + test('test method createMockPhone()', () async { final Map data = { - '\$id': '5e5ea5c16897e', + 'number': '+1612842323', + 'otp': '123456', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname', }; when(client.call( HttpMethod.post, )).thenAnswer((_) async => Response(data: data)); - final response = await project.createAndroidPlatform( - platformId: '', - name: '', - applicationId: '', + final response = await project.createMockPhone( + number: '+12065550100', + otp: '', ); - expect(response, isA()); + expect(response, isA()); }); - test('test method updateAndroidPlatform()', () async { + test('test method getMockPhone()', () async { final Map data = { - '\$id': '5e5ea5c16897e', + 'number': '+1612842323', + 'otp': '123456', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname', }; when(client.call( - HttpMethod.put, + HttpMethod.get, )).thenAnswer((_) async => Response(data: data)); - final response = await project.updateAndroidPlatform( - platformId: '', - name: '', - applicationId: '', + final response = await project.getMockPhone( + number: '+12065550100', ); - expect(response, isA()); + expect(response, isA()); }); - test('test method createApplePlatform()', () async { + test('test method updateMockPhone()', () async { final Map data = { - '\$id': '5e5ea5c16897e', + 'number': '+1612842323', + 'otp': '123456', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname', }; when(client.call( - HttpMethod.post, + HttpMethod.put, )).thenAnswer((_) async => Response(data: data)); - final response = await project.createApplePlatform( - platformId: '', - name: '', - bundleIdentifier: '', + final response = await project.updateMockPhone( + number: '+12065550100', + otp: '', ); - expect(response, isA()); + expect(response, isA()); }); - test('test method updateApplePlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname', - }; + test('test method deleteMockPhone()', () async { + final data = ''; when(client.call( - HttpMethod.put, + HttpMethod.delete, )).thenAnswer((_) async => Response(data: data)); - final response = await project.updateApplePlatform( - platformId: '', - name: '', - bundleIdentifier: '', + final response = await project.deleteMockPhone( + number: '+12065550100', ); - expect(response, isA()); }); - test('test method createLinuxPlatform()', () async { + test('test method listOAuth2Providers()', () async { final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname', + 'total': 5, + 'providers': [], }; when(client.call( - HttpMethod.post, + HttpMethod.get, )).thenAnswer((_) async => Response(data: data)); - final response = await project.createLinuxPlatform( - platformId: '', - name: '', - packageName: '', - ); - expect(response, isA()); + final response = await project.listOAuth2Providers(); + expect(response, isA()); }); - test('test method updateLinuxPlatform()', () async { + test('test method getOAuth2Provider()', () async { final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname', + '\$id': 'github', + 'enabled': true, + 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'tenant': 'common', }; when(client.call( - HttpMethod.put, + HttpMethod.get, )).thenAnswer((_) async => Response(data: data)); - final response = await project.updateLinuxPlatform( - platformId: '', - name: '', - packageName: '', + final response = await project.getOAuth2Provider( + providerId: enums.ProviderId.amazon, ); - expect(response, isA()); + expect(response, isA()); }); - test('test method createWebPlatform()', () async { + test('test method updateOAuth2Amazon()', () async { final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com', + '\$id': 'github', + 'enabled': true, + 'clientId': + 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', + 'clientSecret': + '79ffe4000000000000000000000000000000000000000000000000000002de55', }; when(client.call( - HttpMethod.post, + HttpMethod.patch, )).thenAnswer((_) async => Response(data: data)); - final response = await project.createWebPlatform( - platformId: '', - name: '', - hostname: 'app.example.com', - ); - expect(response, isA()); + final response = await project.updateOAuth2Amazon(); + expect(response, isA()); }); - test('test method updateWebPlatform()', () async { + test('test method updateOAuth2Apple()', () async { final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com', + '\$id': 'apple', + 'enabled': true, + 'serviceId': 'ip.appwrite.app.web', + 'keyId': 'P4000000N8', + 'teamId': 'D4000000R6', + 'p8File': + '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----', }; when(client.call( - HttpMethod.put, + HttpMethod.patch, )).thenAnswer((_) async => Response(data: data)); - final response = await project.updateWebPlatform( - platformId: '', - name: '', - hostname: 'app.example.com', - ); - expect(response, isA()); + final response = await project.updateOAuth2Apple(); + expect(response, isA()); }); - test('test method createWindowsPlatform()', () async { + test('test method updateOAuth2Auth0()', () async { final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname', + '\$id': 'github', + 'enabled': true, + 'clientId': 'OaOkIA000000000000000000005KLSYq', + 'clientSecret': + 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + 'endpoint': 'example.us.auth0.com', }; when(client.call( - HttpMethod.post, + HttpMethod.patch, )).thenAnswer((_) async => Response(data: data)); - final response = await project.createWindowsPlatform( - platformId: '', - name: '', - packageIdentifierName: '', - ); - expect(response, isA()); + final response = await project.updateOAuth2Auth0(); + expect(response, isA()); }); - test('test method updateWindowsPlatform()', () async { + test('test method updateOAuth2Authentik()', () async { final Map data = { - '\$id': '5e5ea5c16897e', + '\$id': 'github', + 'enabled': true, + 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', + 'clientSecret': + 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + 'endpoint': 'example.authentik.com', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Authentik(); + expect(response, isA()); + }); + + test('test method updateOAuth2Autodesk()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '5zw90v00000000000000000000kVYXN7', + 'clientSecret': '7I000000000000MW', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Autodesk(); + expect(response, isA()); + }); + + test('test method updateOAuth2Bitbucket()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'key': 'Knt70000000000ByRc', + 'secret': 'NMfLZJ00000000000000000000TLQdDx', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Bitbucket(); + expect(response, isA()); + }); + + test('test method updateOAuth2Bitly()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'd95151000000000000000000000000000067af9b', + 'clientSecret': 'a13e250000000000000000000000000000d73095', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Bitly(); + expect(response, isA()); + }); + + test('test method updateOAuth2Box()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'deglcs00000000000000000000x2og6y', + 'clientSecret': 'OKM1f100000000000000000000eshEif', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Box(); + expect(response, isA()); + }); + + test('test method updateOAuth2Dailymotion()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'apiKey': '07a9000000000000067f', + 'apiSecret': 'a399a90000000000000000000000000000d90639', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Dailymotion(); + expect(response, isA()); + }); + + test('test method updateOAuth2Discord()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '950722000000343754', + 'clientSecret': 'YmPXnM000000000000000000002zFg5D', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Discord(); + expect(response, isA()); + }); + + test('test method updateOAuth2Disqus()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'publicKey': + 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', + 'secretKey': + 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Disqus(); + expect(response, isA()); + }); + + test('test method updateOAuth2Dropbox()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'appKey': 'jl000000000009t', + 'appSecret': 'g200000000000vw', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Dropbox(); + expect(response, isA()); + }); + + test('test method updateOAuth2Etsy()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'keyString': 'nsgzxh0000000000008j85a2', + 'sharedSecret': 'tp000000ru', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Etsy(); + expect(response, isA()); + }); + + test('test method updateOAuth2Facebook()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'appId': '260600000007694', + 'appSecret': '2d0b2800000000000000000000d38af4', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Facebook(); + expect(response, isA()); + }); + + test('test method updateOAuth2Figma()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'byay5H0000000000VtiI40', + 'clientSecret': 'yEpOYn0000000000000000004iIsU5', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Figma(); + expect(response, isA()); + }); + + test('test method updateOAuth2FusionAuth()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'b2222c00-0000-0000-0000-000000862097', + 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', + 'endpoint': 'example.fusionauth.io', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2FusionAuth(); + expect(response, isA()); + }); + + test('test method updateOAuth2GitHub()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'e4d87900000000540733', + 'clientSecret': '5e07c00000000000000000000000000000198bcc', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2GitHub(); + expect(response, isA()); + }); + + test('test method updateOAuth2Gitlab()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': + 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', + 'secret': + 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + 'endpoint': 'https://gitlab.com', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Gitlab(); + expect(response, isA()); + }); + + test('test method updateOAuth2Google()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'your-google-client-id.apps.googleusercontent.com', + 'clientSecret': 'your-google-client-secret', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Google(); + expect(response, isA()); + }); + + test('test method updateOAuth2Keycloak()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'appwrite-o0000000st-app', + 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', + 'endpoint': 'keycloak.example.com', + 'realmName': 'appwrite-realm', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Keycloak(); + expect(response, isA()); + }); + + test('test method updateOAuth2Kick()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '01KQ7C00000000000001MFHS32', + 'clientSecret': + '34ac5600000000000000000000000000000000000000000000000000e830c8b', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Kick(); + expect(response, isA()); + }); + + test('test method updateOAuth2Linkedin()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '770000000000dv', + 'primaryClientSecret': 'your-linkedin-client-secret', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Linkedin(); + expect(response, isA()); + }); + + test('test method updateOAuth2Microsoft()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'tenant': 'common', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Microsoft(); + expect(response, isA()); + }); + + test('test method updateOAuth2Notion()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', + 'oauthClientSecret': + 'secret_dLUr4b000000000000000000000000000000lFHAa9', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Notion(); + expect(response, isA()); + }); + + test('test method updateOAuth2Oidc()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', + 'clientSecret': + 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', + 'authorizationURL': 'https://myoauth.com/oauth2/authorize', + 'tokenURL': 'https://myoauth.com/oauth2/token', + 'userInfoURL': 'https://myoauth.com/oauth2/userinfo', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Oidc(); + expect(response, isA()); + }); + + test('test method updateOAuth2Okta()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '0oa00000000000000698', + 'clientSecret': + 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + 'domain': 'trial-6400025.okta.com', + 'authorizationServerId': 'aus000000000000000h7z', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Okta(); + expect(response, isA()); + }); + + test('test method updateOAuth2Paypal()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + 'secretKey': + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Paypal(); + expect(response, isA()); + }); + + test('test method updateOAuth2PaypalSandbox()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + 'secretKey': + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2PaypalSandbox(); + expect(response, isA()); + }); + + test('test method updateOAuth2Podio()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'appwrite-oauth-test-app', + 'clientSecret': + 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Podio(); + expect(response, isA()); + }); + + test('test method updateOAuth2Salesforce()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'customerKey': + '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', + 'customerSecret': '3w000000000000e2', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Salesforce(); + expect(response, isA()); + }); + + test('test method updateOAuth2Slack()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '23000000089.15000000000023', + 'clientSecret': '81656000000000000000000000f3d2fd', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Slack(); + expect(response, isA()); + }); + + test('test method updateOAuth2Spotify()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6ec271000000000000000000009beace', + 'clientSecret': 'db068a000000000000000000008b5b9f', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Spotify(); + expect(response, isA()); + }); + + test('test method updateOAuth2Stripe()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'ca_UKibXX0000000000000000000006byvR', + 'apiSecretKey': + 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Stripe(); + expect(response, isA()); + }); + + test('test method updateOAuth2Tradeshift()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Tradeshift(); + expect(response, isA()); + }); + + test('test method updateOAuth2TradeshiftSandbox()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2TradeshiftSandbox(); + expect(response, isA()); + }); + + test('test method updateOAuth2Twitch()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'vvi0in000000000000000000ikmt9p', + 'clientSecret': 'pmapue000000000000000000zylw3v', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Twitch(); + expect(response, isA()); + }); + + test('test method updateOAuth2WordPress()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '130005', + 'clientSecret': + 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2WordPress(); + expect(response, isA()); + }); + + test('test method updateOAuth2X()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'customerKey': 'slzZV0000000000000NFLaWT', + 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2X(); + expect(response, isA()); + }); + + test('test method updateOAuth2Yahoo()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': + 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', + 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Yahoo(); + expect(response, isA()); + }); + + test('test method updateOAuth2Yandex()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6a8a6a0000000000000000000091483c', + 'clientSecret': 'bbf98500000000000000000000c75a63', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Yandex(); + expect(response, isA()); + }); + + test('test method updateOAuth2Zoho()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '1000.83C178000000000000000000RPNX0B', + 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Zoho(); + expect(response, isA()); + }); + + test('test method updateOAuth2Zoom()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'QMAC00000000000000w0AQ', + 'clientSecret': 'GAWsG4000000000000000000007U01ON', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Zoom(); + expect(response, isA()); + }); + + test('test method listPlatforms()', () async { + final Map data = { + 'total': 5, + 'platforms': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.listPlatforms(); + expect(response, isA()); + }); + + test('test method createAndroidPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'applicationId': 'com.company.appname', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createAndroidPlatform( + platformId: '', + name: '', + applicationId: '', + ); + expect(response, isA()); + }); + + test('test method updateAndroidPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'applicationId': 'com.company.appname', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateAndroidPlatform( + platformId: '', + name: '', + applicationId: '', + ); + expect(response, isA()); + }); + + test('test method createApplePlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'bundleIdentifier': 'com.company.appname', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createApplePlatform( + platformId: '', + name: '', + bundleIdentifier: '', + ); + expect(response, isA()); + }); + + test('test method updateApplePlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'bundleIdentifier': 'com.company.appname', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateApplePlatform( + platformId: '', + name: '', + bundleIdentifier: '', + ); + expect(response, isA()); + }); + + test('test method createLinuxPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createLinuxPlatform( + platformId: '', + name: '', + packageName: '', + ); + expect(response, isA()); + }); + + test('test method updateLinuxPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateLinuxPlatform( + platformId: '', + name: '', + packageName: '', + ); + expect(response, isA()); + }); + + test('test method createWebPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'hostname': 'app.example.com', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createWebPlatform( + platformId: '', + name: '', + hostname: 'app.example.com', + ); + expect(response, isA()); + }); + + test('test method updateWebPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'hostname': 'app.example.com', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateWebPlatform( + platformId: '', + name: '', + hostname: 'app.example.com', + ); + expect(response, isA()); + }); + + test('test method createWindowsPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageIdentifierName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createWindowsPlatform( + platformId: '', + name: '', + packageIdentifierName: '', + ); + expect(response, isA()); + }); + + test('test method updateWindowsPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageIdentifierName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateWindowsPlatform( + platformId: '', + name: '', + packageIdentifierName: '', + ); + expect(response, isA()); + }); + + test('test method getPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getPlatform( + platformId: '', + ); + expect(response, isA()); + }); + + test('test method deletePlatform()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.deletePlatform( + platformId: '', + ); + }); + + test('test method listPolicies()', () async { + final Map data = { + 'total': 9, + 'policies': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.listPolicies(); + expect(response, isA()); + }); + + test('test method updateMembershipPrivacyPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateMembershipPrivacyPolicy(); + expect(response, isA()); + }); + + test('test method updatePasswordDictionaryPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updatePasswordDictionaryPolicy( + enabled: true, + ); + expect(response, isA()); + }); + + test('test method updatePasswordHistoryPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updatePasswordHistoryPolicy( + total: 1, + ); + expect(response, isA()); + }); + + test('test method updatePasswordPersonalDataPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updatePasswordPersonalDataPolicy( + enabled: true, + ); + expect(response, isA()); + }); + + test('test method updateSessionAlertPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSessionAlertPolicy( + enabled: true, + ); + expect(response, isA()); + }); + + test('test method updateSessionDurationPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSessionDurationPolicy( + duration: 1, + ); + expect(response, isA()); + }); + + test('test method updateSessionInvalidationPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSessionInvalidationPolicy( + enabled: true, + ); + expect(response, isA()); + }); + + test('test method updateSessionLimitPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', }; when(client.call( - HttpMethod.put, + HttpMethod.patch, )).thenAnswer((_) async => Response(data: data)); - final response = await project.updateWindowsPlatform( - platformId: '', - name: '', - packageIdentifierName: '', + final response = await project.updateSessionLimitPolicy( + total: 1, ); - expect(response, isA()); + expect(response, isA()); }); - test('test method getPlatform()', () async { + test('test method updateUserLimitPolicy()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', }; when(client.call( - HttpMethod.get, + HttpMethod.patch, )).thenAnswer((_) async => Response(data: data)); - final response = await project.getPlatform( - platformId: '', + final response = await project.updateUserLimitPolicy( + total: 1, ); - expect(response, isA()); + expect(response, isA()); }); - test('test method deletePlatform()', () async { - final data = ''; + test('test method getPolicy()', () async { + final Map data = { + '\$id': 'password-dictionary', + 'userId': true, + 'userEmail': true, + 'userPhone': true, + 'userName': true, + 'userMFA': true, + }; when(client.call( - HttpMethod.delete, + HttpMethod.get, )).thenAnswer((_) async => Response(data: data)); - final response = await project.deletePlatform( - platformId: '', + final response = await project.getPolicy( + policyId: enums.PolicyId.passwordDictionary, ); + expect(response, isA()); }); - test('test method updateProtocolStatus()', () async { + test('test method updateProtocol()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -550,6 +2484,8 @@ void main() { 'authMembershipsUserName': true, 'authMembershipsUserEmail': true, 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, 'authInvalidateSessions': true, 'oAuthProviders': [], 'platforms': [], @@ -559,11 +2495,12 @@ void main() { 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyTo': 'support@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': 'securepassword', + 'smtpPassword': '', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', @@ -615,14 +2552,14 @@ void main() { HttpMethod.patch, )).thenAnswer((_) async => Response(data: data)); - final response = await project.updateProtocolStatus( + final response = await project.updateProtocol( protocolId: enums.ProtocolId.rest, enabled: true, ); expect(response, isA()); }); - test('test method updateServiceStatus()', () async { + test('test method updateService()', () async { final Map data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -652,6 +2589,8 @@ void main() { 'authMembershipsUserName': true, 'authMembershipsUserEmail': true, 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, 'authInvalidateSessions': true, 'oAuthProviders': [], 'platforms': [], @@ -661,11 +2600,12 @@ void main() { 'smtpEnabled': true, 'smtpSenderName': 'John Appwrite', 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyTo': 'support@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': 'securepassword', + 'smtpPassword': '', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', @@ -717,13 +2657,185 @@ void main() { HttpMethod.patch, )).thenAnswer((_) async => Response(data: data)); - final response = await project.updateServiceStatus( + final response = await project.updateService( serviceId: enums.ServiceId.account, enabled: true, ); expect(response, isA()); }); + test('test method updateSMTP()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSMTP(); + expect(response, isA()); + }); + + test('test method createSMTPTest()', () async { + final data = ''; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createSMTPTest( + emails: [], + ); + }); + + test('test method listEmailTemplates()', () async { + final Map data = { + 'total': 5, + 'templates': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.listEmailTemplates(); + expect(response, isA()); + }); + + test('test method updateEmailTemplate()', () async { + final Map data = { + 'templateId': 'verification', + 'locale': 'en_us', + 'message': 'Click on the link to verify your account.', + 'senderName': 'My User', + 'senderEmail': 'mail@appwrite.io', + 'replyToEmail': 'emails@appwrite.io', + 'replyToName': 'Support Team', + 'subject': 'Please verify your email address', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateEmailTemplate( + templateId: enums.EmailTemplateType.verification, + ); + expect(response, isA()); + }); + + test('test method getEmailTemplate()', () async { + final Map data = { + 'templateId': 'verification', + 'locale': 'en_us', + 'message': 'Click on the link to verify your account.', + 'senderName': 'My User', + 'senderEmail': 'mail@appwrite.io', + 'replyToEmail': 'emails@appwrite.io', + 'replyToName': 'Support Team', + 'subject': 'Please verify your email address', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getEmailTemplate( + templateId: enums.EmailTemplateType.verification, + ); + expect(response, isA()); + }); + test('test method listVariables()', () async { final Map data = { 'total': 5, diff --git a/test/services/proxy_test.dart b/test/services/proxy_test.dart new file mode 100644 index 00000000..5fe1334e --- /dev/null +++ b/test/services/proxy_test.dart @@ -0,0 +1,263 @@ +import 'package:test/test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:dart_appwrite/models.dart' as models; +import 'package:dart_appwrite/enums.dart' as enums; +import 'package:dart_appwrite/src/enums.dart'; +import 'package:dart_appwrite/src/response.dart'; +import 'dart:typed_data'; +import 'package:dart_appwrite/dart_appwrite.dart'; + +class MockClient extends Mock implements Client { + Map config = {'project': 'testproject'}; + String endPoint = 'https://localhost/v1'; + @override + Future call( + HttpMethod? method, { + String path = '', + Map headers = const {}, + Map params = const {}, + ResponseType? responseType, + }) async { + return super.noSuchMethod(Invocation.method(#call, [method]), + returnValue: Response()); + } + + @override + Future webAuth(Uri url) async { + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + } + + @override + Future chunkedUpload({ + String? path, + Map? params, + String? paramName, + String? idParamName, + Map? headers, + Function(UploadProgress)? onProgress, + }) async { + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); + } +} + +void main() { + group('Proxy test', () { + late MockClient client; + late Proxy proxy; + + setUp(() { + client = MockClient(); + proxy = Proxy(client); + }); + + test('test method listRules()', () async { + final Map data = { + 'total': 5, + 'rules': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.listRules(); + expect(response, isA()); + }); + + test('test method createAPIRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.createAPIRule( + domain: '', + ); + expect(response, isA()); + }); + + test('test method createFunctionRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.createFunctionRule( + domain: '', + functionId: '', + ); + expect(response, isA()); + }); + + test('test method createRedirectRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.createRedirectRule( + domain: '', + url: 'https://example.com', + statusCode: enums.StatusCode.movedPermanently301, + resourceId: '', + resourceType: enums.ProxyResourceType.site, + ); + expect(response, isA()); + }); + + test('test method createSiteRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.createSiteRule( + domain: '', + siteId: '', + ); + expect(response, isA()); + }); + + test('test method getRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.getRule( + ruleId: '', + ); + expect(response, isA()); + }); + + test('test method deleteRule()', () async { + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.deleteRule( + ruleId: '', + ); + }); + + test('test method updateRuleStatus()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.updateRuleStatus( + ruleId: '', + ); + expect(response, isA()); + }); + }); +} diff --git a/test/services/sites_test.dart b/test/services/sites_test.dart index 208a16b7..fdce85ec 100644 --- a/test/services/sites_test.dart +++ b/test/services/sites_test.dart @@ -715,6 +715,7 @@ void main() { final response = await sites.createVariable( siteId: '', + variableId: '', key: '', value: '', ); @@ -763,7 +764,6 @@ void main() { final response = await sites.updateVariable( siteId: '', variableId: '', - key: '', ); expect(response, isA()); }); diff --git a/test/services/tables_db_test.dart b/test/services/tables_db_test.dart index c434c3b4..d0d0a7e9 100644 --- a/test/services/tables_db_test.dart +++ b/test/services/tables_db_test.dart @@ -379,6 +379,55 @@ void main() { expect(response, isA()); }); + test('test method createBigIntColumn()', () async { + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + + test('test method updateBigIntColumn()', () async { + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + }); + test('test method createBooleanColumn()', () async { final Map data = { 'key': 'isEnabled', diff --git a/test/services/teams_test.dart b/test/services/teams_test.dart index b955fd52..c183f7cc 100644 --- a/test/services/teams_test.dart +++ b/test/services/teams_test.dart @@ -166,6 +166,7 @@ void main() { 'userId': '5e5ea5c16897e', 'userName': 'John Doe', 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', 'teamId': '5e5ea5c16897e', 'teamName': 'VIP', 'invited': '2020-10-15T06:38:00.000+00:00', @@ -194,6 +195,7 @@ void main() { 'userId': '5e5ea5c16897e', 'userName': 'John Doe', 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', 'teamId': '5e5ea5c16897e', 'teamName': 'VIP', 'invited': '2020-10-15T06:38:00.000+00:00', @@ -222,6 +224,7 @@ void main() { 'userId': '5e5ea5c16897e', 'userName': 'John Doe', 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', 'teamId': '5e5ea5c16897e', 'teamName': 'VIP', 'invited': '2020-10-15T06:38:00.000+00:00', @@ -264,6 +267,7 @@ void main() { 'userId': '5e5ea5c16897e', 'userName': 'John Doe', 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', 'teamId': '5e5ea5c16897e', 'teamName': 'VIP', 'invited': '2020-10-15T06:38:00.000+00:00', diff --git a/test/src/models/attribute_bigint_test.dart b/test/src/models/attribute_bigint_test.dart new file mode 100644 index 00000000..c56c8ddb --- /dev/null +++ b/test/src/models/attribute_bigint_test.dart @@ -0,0 +1,30 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:dart_appwrite/enums.dart'; +import 'package:test/test.dart'; + +void main() { + group('AttributeBigint', () { + test('model', () { + final model = AttributeBigint( + key: 'count', + type: 'bigint', + status: AttributeStatus.available, + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + ); + + final map = model.toMap(); + final result = AttributeBigint.fromMap(map); + + expect(result.key, 'count'); + expect(result.type, 'bigint'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); + }); +} diff --git a/test/src/models/auth_provider_test.dart b/test/src/models/auth_provider_test.dart index 90191db8..6031ccea 100644 --- a/test/src/models/auth_provider_test.dart +++ b/test/src/models/auth_provider_test.dart @@ -8,7 +8,7 @@ void main() { key: 'github', name: 'GitHub', appId: '259125845563242502', - secret: 'Bpw_g9c2TGXxfgLshDbSaL8tsCcqgczQ', + secret: '', enabled: true, ); @@ -18,7 +18,7 @@ void main() { expect(result.key, 'github'); expect(result.name, 'GitHub'); expect(result.appId, '259125845563242502'); - expect(result.secret, 'Bpw_g9c2TGXxfgLshDbSaL8tsCcqgczQ'); + expect(result.secret, ''); expect(result.enabled, true); }); }); diff --git a/test/src/models/block_test.dart b/test/src/models/block_test.dart index e407398a..7543c078 100644 --- a/test/src/models/block_test.dart +++ b/test/src/models/block_test.dart @@ -8,6 +8,11 @@ void main() { $createdAt: '2020-10-15T06:38:00.000+00:00', resourceType: 'project', resourceId: '5e5ea5c16897e', + projectName: 'My Project', + region: 'fra', + organizationName: 'Acme Inc.', + organizationId: '5e5ea5c16897e', + billingPlan: 'pro', ); final map = model.toMap(); @@ -16,6 +21,11 @@ void main() { expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); expect(result.resourceType, 'project'); expect(result.resourceId, '5e5ea5c16897e'); + expect(result.projectName, 'My Project'); + expect(result.region, 'fra'); + expect(result.organizationName, 'Acme Inc.'); + expect(result.organizationId, '5e5ea5c16897e'); + expect(result.billingPlan, 'pro'); }); }); } diff --git a/test/src/models/column_bigint_test.dart b/test/src/models/column_bigint_test.dart new file mode 100644 index 00000000..1cd181b3 --- /dev/null +++ b/test/src/models/column_bigint_test.dart @@ -0,0 +1,30 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:dart_appwrite/enums.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnBigint', () { + test('model', () { + final model = ColumnBigint( + key: 'count', + type: 'bigint', + status: ColumnStatus.available, + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + ); + + final map = model.toMap(); + final result = ColumnBigint.fromMap(map); + + expect(result.key, 'count'); + expect(result.type, 'bigint'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); + }); +} diff --git a/test/src/models/email_template_list_test.dart b/test/src/models/email_template_list_test.dart new file mode 100644 index 00000000..5cbb97e3 --- /dev/null +++ b/test/src/models/email_template_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('EmailTemplateList', () { + test('model', () { + final model = EmailTemplateList( + total: 5, + templates: [], + ); + + final map = model.toMap(); + final result = EmailTemplateList.fromMap(map); + + expect(result.total, 5); + expect(result.templates, []); + }); + }); +} diff --git a/test/src/models/email_template_test.dart b/test/src/models/email_template_test.dart new file mode 100644 index 00000000..d8ae307a --- /dev/null +++ b/test/src/models/email_template_test.dart @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('EmailTemplate', () { + test('model', () { + final model = EmailTemplate( + templateId: 'verification', + locale: 'en_us', + message: 'Click on the link to verify your account.', + senderName: 'My User', + senderEmail: 'mail@appwrite.io', + replyToEmail: 'emails@appwrite.io', + replyToName: 'Support Team', + subject: 'Please verify your email address', + ); + + final map = model.toMap(); + final result = EmailTemplate.fromMap(map); + + expect(result.templateId, 'verification'); + expect(result.locale, 'en_us'); + expect(result.message, 'Click on the link to verify your account.'); + expect(result.senderName, 'My User'); + expect(result.senderEmail, 'mail@appwrite.io'); + expect(result.replyToEmail, 'emails@appwrite.io'); + expect(result.replyToName, 'Support Team'); + expect(result.subject, 'Please verify your email address'); + }); + }); +} diff --git a/test/src/models/ephemeral_key_test.dart b/test/src/models/ephemeral_key_test.dart new file mode 100644 index 00000000..10b392f2 --- /dev/null +++ b/test/src/models/ephemeral_key_test.dart @@ -0,0 +1,33 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('EphemeralKey', () { + test('model', () { + final model = EphemeralKey( + $id: '5e5ea5c16897e', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + name: 'My API Key', + expire: '2020-10-15T06:38:00.000+00:00', + scopes: [], + secret: '919c2d18fb5d4...a2ae413da83346ad2', + accessedAt: '2020-10-15T06:38:00.000+00:00', + sdks: [], + ); + + final map = model.toMap(); + final result = EphemeralKey.fromMap(map); + + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My API Key'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.scopes, []); + expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.sdks, []); + }); + }); +} diff --git a/test/src/models/membership_test.dart b/test/src/models/membership_test.dart index b28fcff6..4e609f85 100644 --- a/test/src/models/membership_test.dart +++ b/test/src/models/membership_test.dart @@ -11,6 +11,7 @@ void main() { userId: '5e5ea5c16897e', userName: 'John Doe', userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', teamId: '5e5ea5c16897e', teamName: 'VIP', invited: '2020-10-15T06:38:00.000+00:00', @@ -29,6 +30,7 @@ void main() { expect(result.userId, '5e5ea5c16897e'); expect(result.userName, 'John Doe'); expect(result.userEmail, 'john@appwrite.io'); + expect(result.userPhone, '+1 555 555 5555'); expect(result.teamId, '5e5ea5c16897e'); expect(result.teamName, 'VIP'); expect(result.invited, '2020-10-15T06:38:00.000+00:00'); diff --git a/test/src/models/mock_number_list_test.dart b/test/src/models/mock_number_list_test.dart new file mode 100644 index 00000000..79224b0a --- /dev/null +++ b/test/src/models/mock_number_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('MockNumberList', () { + test('model', () { + final model = MockNumberList( + total: 5, + mockNumbers: [], + ); + + final map = model.toMap(); + final result = MockNumberList.fromMap(map); + + expect(result.total, 5); + expect(result.mockNumbers, []); + }); + }); +} diff --git a/test/src/models/mock_number_test.dart b/test/src/models/mock_number_test.dart index 9180847f..55f3c5ff 100644 --- a/test/src/models/mock_number_test.dart +++ b/test/src/models/mock_number_test.dart @@ -5,15 +5,19 @@ void main() { group('MockNumber', () { test('model', () { final model = MockNumber( - phone: '+1612842323', + number: '+1612842323', otp: '123456', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', ); final map = model.toMap(); final result = MockNumber.fromMap(map); - expect(result.phone, '+1612842323'); + expect(result.number, '+1612842323'); expect(result.otp, '123456'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); }); }); } diff --git a/test/src/models/o_auth2_amazon_test.dart b/test/src/models/o_auth2_amazon_test.dart new file mode 100644 index 00000000..d859f1d3 --- /dev/null +++ b/test/src/models/o_auth2_amazon_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Amazon', () { + test('model', () { + final model = OAuth2Amazon( + $id: 'github', + enabled: true, + clientId: + 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', + clientSecret: + '79ffe4000000000000000000000000000000000000000000000000000002de55', + ); + + final map = model.toMap(); + final result = OAuth2Amazon.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, + 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2'); + expect(result.clientSecret, + '79ffe4000000000000000000000000000000000000000000000000000002de55'); + }); + }); +} diff --git a/test/src/models/o_auth2_apple_test.dart b/test/src/models/o_auth2_apple_test.dart new file mode 100644 index 00000000..e95e59dc --- /dev/null +++ b/test/src/models/o_auth2_apple_test.dart @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Apple', () { + test('model', () { + final model = OAuth2Apple( + $id: 'apple', + enabled: true, + serviceId: 'ip.appwrite.app.web', + keyId: 'P4000000N8', + teamId: 'D4000000R6', + p8File: + '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----', + ); + + final map = model.toMap(); + final result = OAuth2Apple.fromMap(map); + + expect(result.$id, 'apple'); + expect(result.enabled, true); + expect(result.serviceId, 'ip.appwrite.app.web'); + expect(result.keyId, 'P4000000N8'); + expect(result.teamId, 'D4000000R6'); + expect(result.p8File, + '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----'); + }); + }); +} diff --git a/test/src/models/o_auth2_auth0_test.dart b/test/src/models/o_auth2_auth0_test.dart new file mode 100644 index 00000000..404fc1ed --- /dev/null +++ b/test/src/models/o_auth2_auth0_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Auth0', () { + test('model', () { + final model = OAuth2Auth0( + $id: 'github', + enabled: true, + clientId: 'OaOkIA000000000000000000005KLSYq', + clientSecret: + 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + endpoint: 'example.us.auth0.com', + ); + + final map = model.toMap(); + final result = OAuth2Auth0.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'OaOkIA000000000000000000005KLSYq'); + expect(result.clientSecret, + 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF'); + expect(result.endpoint, 'example.us.auth0.com'); + }); + }); +} diff --git a/test/src/models/o_auth2_authentik_test.dart b/test/src/models/o_auth2_authentik_test.dart new file mode 100644 index 00000000..1aefd251 --- /dev/null +++ b/test/src/models/o_auth2_authentik_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Authentik', () { + test('model', () { + final model = OAuth2Authentik( + $id: 'github', + enabled: true, + clientId: 'dTKOPa0000000000000000000000000000e7G8hv', + clientSecret: + 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + endpoint: 'example.authentik.com', + ); + + final map = model.toMap(); + final result = OAuth2Authentik.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'dTKOPa0000000000000000000000000000e7G8hv'); + expect(result.clientSecret, + 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK'); + expect(result.endpoint, 'example.authentik.com'); + }); + }); +} diff --git a/test/src/models/o_auth2_autodesk_test.dart b/test/src/models/o_auth2_autodesk_test.dart new file mode 100644 index 00000000..2dfcdc51 --- /dev/null +++ b/test/src/models/o_auth2_autodesk_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Autodesk', () { + test('model', () { + final model = OAuth2Autodesk( + $id: 'github', + enabled: true, + clientId: '5zw90v00000000000000000000kVYXN7', + clientSecret: '7I000000000000MW', + ); + + final map = model.toMap(); + final result = OAuth2Autodesk.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '5zw90v00000000000000000000kVYXN7'); + expect(result.clientSecret, '7I000000000000MW'); + }); + }); +} diff --git a/test/src/models/o_auth2_bitbucket_test.dart b/test/src/models/o_auth2_bitbucket_test.dart new file mode 100644 index 00000000..83900fc3 --- /dev/null +++ b/test/src/models/o_auth2_bitbucket_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Bitbucket', () { + test('model', () { + final model = OAuth2Bitbucket( + $id: 'github', + enabled: true, + key: 'Knt70000000000ByRc', + secret: 'NMfLZJ00000000000000000000TLQdDx', + ); + + final map = model.toMap(); + final result = OAuth2Bitbucket.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.key, 'Knt70000000000ByRc'); + expect(result.secret, 'NMfLZJ00000000000000000000TLQdDx'); + }); + }); +} diff --git a/test/src/models/o_auth2_bitly_test.dart b/test/src/models/o_auth2_bitly_test.dart new file mode 100644 index 00000000..581121e8 --- /dev/null +++ b/test/src/models/o_auth2_bitly_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Bitly', () { + test('model', () { + final model = OAuth2Bitly( + $id: 'github', + enabled: true, + clientId: 'd95151000000000000000000000000000067af9b', + clientSecret: 'a13e250000000000000000000000000000d73095', + ); + + final map = model.toMap(); + final result = OAuth2Bitly.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'd95151000000000000000000000000000067af9b'); + expect(result.clientSecret, 'a13e250000000000000000000000000000d73095'); + }); + }); +} diff --git a/test/src/models/o_auth2_box_test.dart b/test/src/models/o_auth2_box_test.dart new file mode 100644 index 00000000..597ce987 --- /dev/null +++ b/test/src/models/o_auth2_box_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Box', () { + test('model', () { + final model = OAuth2Box( + $id: 'github', + enabled: true, + clientId: 'deglcs00000000000000000000x2og6y', + clientSecret: 'OKM1f100000000000000000000eshEif', + ); + + final map = model.toMap(); + final result = OAuth2Box.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'deglcs00000000000000000000x2og6y'); + expect(result.clientSecret, 'OKM1f100000000000000000000eshEif'); + }); + }); +} diff --git a/test/src/models/o_auth2_dailymotion_test.dart b/test/src/models/o_auth2_dailymotion_test.dart new file mode 100644 index 00000000..1088a137 --- /dev/null +++ b/test/src/models/o_auth2_dailymotion_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Dailymotion', () { + test('model', () { + final model = OAuth2Dailymotion( + $id: 'github', + enabled: true, + apiKey: '07a9000000000000067f', + apiSecret: 'a399a90000000000000000000000000000d90639', + ); + + final map = model.toMap(); + final result = OAuth2Dailymotion.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.apiKey, '07a9000000000000067f'); + expect(result.apiSecret, 'a399a90000000000000000000000000000d90639'); + }); + }); +} diff --git a/test/src/models/o_auth2_discord_test.dart b/test/src/models/o_auth2_discord_test.dart new file mode 100644 index 00000000..f0ca8761 --- /dev/null +++ b/test/src/models/o_auth2_discord_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Discord', () { + test('model', () { + final model = OAuth2Discord( + $id: 'github', + enabled: true, + clientId: '950722000000343754', + clientSecret: 'YmPXnM000000000000000000002zFg5D', + ); + + final map = model.toMap(); + final result = OAuth2Discord.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '950722000000343754'); + expect(result.clientSecret, 'YmPXnM000000000000000000002zFg5D'); + }); + }); +} diff --git a/test/src/models/o_auth2_disqus_test.dart b/test/src/models/o_auth2_disqus_test.dart new file mode 100644 index 00000000..6ac03a4f --- /dev/null +++ b/test/src/models/o_auth2_disqus_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Disqus', () { + test('model', () { + final model = OAuth2Disqus( + $id: 'github', + enabled: true, + publicKey: + 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', + secretKey: + 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9', + ); + + final map = model.toMap(); + final result = OAuth2Disqus.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.publicKey, + 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX'); + expect(result.secretKey, + 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9'); + }); + }); +} diff --git a/test/src/models/o_auth2_dropbox_test.dart b/test/src/models/o_auth2_dropbox_test.dart new file mode 100644 index 00000000..e97e98e9 --- /dev/null +++ b/test/src/models/o_auth2_dropbox_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Dropbox', () { + test('model', () { + final model = OAuth2Dropbox( + $id: 'github', + enabled: true, + appKey: 'jl000000000009t', + appSecret: 'g200000000000vw', + ); + + final map = model.toMap(); + final result = OAuth2Dropbox.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.appKey, 'jl000000000009t'); + expect(result.appSecret, 'g200000000000vw'); + }); + }); +} diff --git a/test/src/models/o_auth2_etsy_test.dart b/test/src/models/o_auth2_etsy_test.dart new file mode 100644 index 00000000..2015e584 --- /dev/null +++ b/test/src/models/o_auth2_etsy_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Etsy', () { + test('model', () { + final model = OAuth2Etsy( + $id: 'github', + enabled: true, + keyString: 'nsgzxh0000000000008j85a2', + sharedSecret: 'tp000000ru', + ); + + final map = model.toMap(); + final result = OAuth2Etsy.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.keyString, 'nsgzxh0000000000008j85a2'); + expect(result.sharedSecret, 'tp000000ru'); + }); + }); +} diff --git a/test/src/models/o_auth2_facebook_test.dart b/test/src/models/o_auth2_facebook_test.dart new file mode 100644 index 00000000..e8e402c7 --- /dev/null +++ b/test/src/models/o_auth2_facebook_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Facebook', () { + test('model', () { + final model = OAuth2Facebook( + $id: 'github', + enabled: true, + appId: '260600000007694', + appSecret: '2d0b2800000000000000000000d38af4', + ); + + final map = model.toMap(); + final result = OAuth2Facebook.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.appId, '260600000007694'); + expect(result.appSecret, '2d0b2800000000000000000000d38af4'); + }); + }); +} diff --git a/test/src/models/o_auth2_figma_test.dart b/test/src/models/o_auth2_figma_test.dart new file mode 100644 index 00000000..e44f2265 --- /dev/null +++ b/test/src/models/o_auth2_figma_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Figma', () { + test('model', () { + final model = OAuth2Figma( + $id: 'github', + enabled: true, + clientId: 'byay5H0000000000VtiI40', + clientSecret: 'yEpOYn0000000000000000004iIsU5', + ); + + final map = model.toMap(); + final result = OAuth2Figma.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'byay5H0000000000VtiI40'); + expect(result.clientSecret, 'yEpOYn0000000000000000004iIsU5'); + }); + }); +} diff --git a/test/src/models/o_auth2_fusion_auth_test.dart b/test/src/models/o_auth2_fusion_auth_test.dart new file mode 100644 index 00000000..533fdb8e --- /dev/null +++ b/test/src/models/o_auth2_fusion_auth_test.dart @@ -0,0 +1,26 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2FusionAuth', () { + test('model', () { + final model = OAuth2FusionAuth( + $id: 'github', + enabled: true, + clientId: 'b2222c00-0000-0000-0000-000000862097', + clientSecret: 'Jx4s0C0000000000000000000000000000000wGqLsc', + endpoint: 'example.fusionauth.io', + ); + + final map = model.toMap(); + final result = OAuth2FusionAuth.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'b2222c00-0000-0000-0000-000000862097'); + expect( + result.clientSecret, 'Jx4s0C0000000000000000000000000000000wGqLsc'); + expect(result.endpoint, 'example.fusionauth.io'); + }); + }); +} diff --git a/test/src/models/o_auth2_github_test.dart b/test/src/models/o_auth2_github_test.dart new file mode 100644 index 00000000..2d04ab0d --- /dev/null +++ b/test/src/models/o_auth2_github_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Github', () { + test('model', () { + final model = OAuth2Github( + $id: 'github', + enabled: true, + clientId: 'e4d87900000000540733', + clientSecret: '5e07c00000000000000000000000000000198bcc', + ); + + final map = model.toMap(); + final result = OAuth2Github.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'e4d87900000000540733'); + expect(result.clientSecret, '5e07c00000000000000000000000000000198bcc'); + }); + }); +} diff --git a/test/src/models/o_auth2_gitlab_test.dart b/test/src/models/o_auth2_gitlab_test.dart new file mode 100644 index 00000000..191516ea --- /dev/null +++ b/test/src/models/o_auth2_gitlab_test.dart @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Gitlab', () { + test('model', () { + final model = OAuth2Gitlab( + $id: 'github', + enabled: true, + applicationId: + 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', + secret: + 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + endpoint: 'https://gitlab.com', + ); + + final map = model.toMap(); + final result = OAuth2Gitlab.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.applicationId, + 'd41ffe0000000000000000000000000000000000000000000000000000d5e252'); + expect(result.secret, + 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38'); + expect(result.endpoint, 'https://gitlab.com'); + }); + }); +} diff --git a/test/src/models/o_auth2_google_test.dart b/test/src/models/o_auth2_google_test.dart new file mode 100644 index 00000000..79ce5d87 --- /dev/null +++ b/test/src/models/o_auth2_google_test.dart @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Google', () { + test('model', () { + final model = OAuth2Google( + $id: 'github', + enabled: true, + clientId: 'your-google-client-id.apps.googleusercontent.com', + clientSecret: 'your-google-client-secret', + ); + + final map = model.toMap(); + final result = OAuth2Google.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect( + result.clientId, 'your-google-client-id.apps.googleusercontent.com'); + expect(result.clientSecret, 'your-google-client-secret'); + }); + }); +} diff --git a/test/src/models/o_auth2_keycloak_test.dart b/test/src/models/o_auth2_keycloak_test.dart new file mode 100644 index 00000000..cdef28a8 --- /dev/null +++ b/test/src/models/o_auth2_keycloak_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Keycloak', () { + test('model', () { + final model = OAuth2Keycloak( + $id: 'github', + enabled: true, + clientId: 'appwrite-o0000000st-app', + clientSecret: 'jdjrJd00000000000000000000HUsaZO', + endpoint: 'keycloak.example.com', + realmName: 'appwrite-realm', + ); + + final map = model.toMap(); + final result = OAuth2Keycloak.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'appwrite-o0000000st-app'); + expect(result.clientSecret, 'jdjrJd00000000000000000000HUsaZO'); + expect(result.endpoint, 'keycloak.example.com'); + expect(result.realmName, 'appwrite-realm'); + }); + }); +} diff --git a/test/src/models/o_auth2_kick_test.dart b/test/src/models/o_auth2_kick_test.dart new file mode 100644 index 00000000..e8275cf2 --- /dev/null +++ b/test/src/models/o_auth2_kick_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Kick', () { + test('model', () { + final model = OAuth2Kick( + $id: 'github', + enabled: true, + clientId: '01KQ7C00000000000001MFHS32', + clientSecret: + '34ac5600000000000000000000000000000000000000000000000000e830c8b', + ); + + final map = model.toMap(); + final result = OAuth2Kick.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '01KQ7C00000000000001MFHS32'); + expect(result.clientSecret, + '34ac5600000000000000000000000000000000000000000000000000e830c8b'); + }); + }); +} diff --git a/test/src/models/o_auth2_linkedin_test.dart b/test/src/models/o_auth2_linkedin_test.dart new file mode 100644 index 00000000..d31c26f9 --- /dev/null +++ b/test/src/models/o_auth2_linkedin_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Linkedin', () { + test('model', () { + final model = OAuth2Linkedin( + $id: 'github', + enabled: true, + clientId: '770000000000dv', + primaryClientSecret: 'your-linkedin-client-secret', + ); + + final map = model.toMap(); + final result = OAuth2Linkedin.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '770000000000dv'); + expect(result.primaryClientSecret, 'your-linkedin-client-secret'); + }); + }); +} diff --git a/test/src/models/o_auth2_microsoft_test.dart b/test/src/models/o_auth2_microsoft_test.dart new file mode 100644 index 00000000..8ae65689 --- /dev/null +++ b/test/src/models/o_auth2_microsoft_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Microsoft', () { + test('model', () { + final model = OAuth2Microsoft( + $id: 'github', + enabled: true, + applicationId: '00001111-aaaa-2222-bbbb-3333cccc4444', + applicationSecret: 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + tenant: 'common', + ); + + final map = model.toMap(); + final result = OAuth2Microsoft.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.applicationId, '00001111-aaaa-2222-bbbb-3333cccc4444'); + expect(result.applicationSecret, 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u'); + expect(result.tenant, 'common'); + }); + }); +} diff --git a/test/src/models/o_auth2_notion_test.dart b/test/src/models/o_auth2_notion_test.dart new file mode 100644 index 00000000..7ae50309 --- /dev/null +++ b/test/src/models/o_auth2_notion_test.dart @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Notion', () { + test('model', () { + final model = OAuth2Notion( + $id: 'github', + enabled: true, + oauthClientId: '341d8700-0000-0000-0000-000000446ee3', + oauthClientSecret: 'secret_dLUr4b000000000000000000000000000000lFHAa9', + ); + + final map = model.toMap(); + final result = OAuth2Notion.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.oauthClientId, '341d8700-0000-0000-0000-000000446ee3'); + expect(result.oauthClientSecret, + 'secret_dLUr4b000000000000000000000000000000lFHAa9'); + }); + }); +} diff --git a/test/src/models/o_auth2_oidc_test.dart b/test/src/models/o_auth2_oidc_test.dart new file mode 100644 index 00000000..99fa9f06 --- /dev/null +++ b/test/src/models/o_auth2_oidc_test.dart @@ -0,0 +1,34 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Oidc', () { + test('model', () { + final model = OAuth2Oidc( + $id: 'github', + enabled: true, + clientId: 'qibI2x0000000000000000000000000006L2YFoG', + clientSecret: + 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + wellKnownURL: 'https://myoauth.com/.well-known/openid-configuration', + authorizationURL: 'https://myoauth.com/oauth2/authorize', + tokenURL: 'https://myoauth.com/oauth2/token', + userInfoURL: 'https://myoauth.com/oauth2/userinfo', + ); + + final map = model.toMap(); + final result = OAuth2Oidc.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'qibI2x0000000000000000000000000006L2YFoG'); + expect(result.clientSecret, + 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV'); + expect(result.wellKnownURL, + 'https://myoauth.com/.well-known/openid-configuration'); + expect(result.authorizationURL, 'https://myoauth.com/oauth2/authorize'); + expect(result.tokenURL, 'https://myoauth.com/oauth2/token'); + expect(result.userInfoURL, 'https://myoauth.com/oauth2/userinfo'); + }); + }); +} diff --git a/test/src/models/o_auth2_okta_test.dart b/test/src/models/o_auth2_okta_test.dart new file mode 100644 index 00000000..ca387e81 --- /dev/null +++ b/test/src/models/o_auth2_okta_test.dart @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Okta', () { + test('model', () { + final model = OAuth2Okta( + $id: 'github', + enabled: true, + clientId: '0oa00000000000000698', + clientSecret: + 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + domain: 'trial-6400025.okta.com', + authorizationServerId: 'aus000000000000000h7z', + ); + + final map = model.toMap(); + final result = OAuth2Okta.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '0oa00000000000000698'); + expect(result.clientSecret, + 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV'); + expect(result.domain, 'trial-6400025.okta.com'); + expect(result.authorizationServerId, 'aus000000000000000h7z'); + }); + }); +} diff --git a/test/src/models/o_auth2_paypal_test.dart b/test/src/models/o_auth2_paypal_test.dart new file mode 100644 index 00000000..aa77d409 --- /dev/null +++ b/test/src/models/o_auth2_paypal_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Paypal', () { + test('model', () { + final model = OAuth2Paypal( + $id: 'github', + enabled: true, + clientId: + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + secretKey: + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + ); + + final map = model.toMap(); + final result = OAuth2Paypal.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB'); + expect(result.secretKey, + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp'); + }); + }); +} diff --git a/test/src/models/o_auth2_podio_test.dart b/test/src/models/o_auth2_podio_test.dart new file mode 100644 index 00000000..357cc7f4 --- /dev/null +++ b/test/src/models/o_auth2_podio_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Podio', () { + test('model', () { + final model = OAuth2Podio( + $id: 'github', + enabled: true, + clientId: 'appwrite-oauth-test-app', + clientSecret: + 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN', + ); + + final map = model.toMap(); + final result = OAuth2Podio.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'appwrite-oauth-test-app'); + expect(result.clientSecret, + 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN'); + }); + }); +} diff --git a/test/src/models/o_auth2_provider_list_test.dart b/test/src/models/o_auth2_provider_list_test.dart new file mode 100644 index 00000000..36fe2b3c --- /dev/null +++ b/test/src/models/o_auth2_provider_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2ProviderList', () { + test('model', () { + final model = OAuth2ProviderList( + total: 5, + providers: [], + ); + + final map = model.toMap(); + final result = OAuth2ProviderList.fromMap(map); + + expect(result.total, 5); + expect(result.providers, []); + }); + }); +} diff --git a/test/src/models/o_auth2_salesforce_test.dart b/test/src/models/o_auth2_salesforce_test.dart new file mode 100644 index 00000000..b19aa954 --- /dev/null +++ b/test/src/models/o_auth2_salesforce_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Salesforce', () { + test('model', () { + final model = OAuth2Salesforce( + $id: 'github', + enabled: true, + customerKey: + '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', + customerSecret: '3w000000000000e2', + ); + + final map = model.toMap(); + final result = OAuth2Salesforce.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.customerKey, + '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq'); + expect(result.customerSecret, '3w000000000000e2'); + }); + }); +} diff --git a/test/src/models/o_auth2_slack_test.dart b/test/src/models/o_auth2_slack_test.dart new file mode 100644 index 00000000..fca5e126 --- /dev/null +++ b/test/src/models/o_auth2_slack_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Slack', () { + test('model', () { + final model = OAuth2Slack( + $id: 'github', + enabled: true, + clientId: '23000000089.15000000000023', + clientSecret: '81656000000000000000000000f3d2fd', + ); + + final map = model.toMap(); + final result = OAuth2Slack.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '23000000089.15000000000023'); + expect(result.clientSecret, '81656000000000000000000000f3d2fd'); + }); + }); +} diff --git a/test/src/models/o_auth2_spotify_test.dart b/test/src/models/o_auth2_spotify_test.dart new file mode 100644 index 00000000..130d47eb --- /dev/null +++ b/test/src/models/o_auth2_spotify_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Spotify', () { + test('model', () { + final model = OAuth2Spotify( + $id: 'github', + enabled: true, + clientId: '6ec271000000000000000000009beace', + clientSecret: 'db068a000000000000000000008b5b9f', + ); + + final map = model.toMap(); + final result = OAuth2Spotify.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '6ec271000000000000000000009beace'); + expect(result.clientSecret, 'db068a000000000000000000008b5b9f'); + }); + }); +} diff --git a/test/src/models/o_auth2_stripe_test.dart b/test/src/models/o_auth2_stripe_test.dart new file mode 100644 index 00000000..fa7316ff --- /dev/null +++ b/test/src/models/o_auth2_stripe_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Stripe', () { + test('model', () { + final model = OAuth2Stripe( + $id: 'github', + enabled: true, + clientId: 'ca_UKibXX0000000000000000000006byvR', + apiSecretKey: + 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp', + ); + + final map = model.toMap(); + final result = OAuth2Stripe.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'ca_UKibXX0000000000000000000006byvR'); + expect(result.apiSecretKey, + 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp'); + }); + }); +} diff --git a/test/src/models/o_auth2_tradeshift_test.dart b/test/src/models/o_auth2_tradeshift_test.dart new file mode 100644 index 00000000..70d39e15 --- /dev/null +++ b/test/src/models/o_auth2_tradeshift_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Tradeshift', () { + test('model', () { + final model = OAuth2Tradeshift( + $id: 'github', + enabled: true, + oauth2ClientId: 'appwrite-test-org.appwrite-test-app', + oauth2ClientSecret: '7cb52700-0000-0000-0000-000000ca5b83', + ); + + final map = model.toMap(); + final result = OAuth2Tradeshift.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.oauth2ClientId, 'appwrite-test-org.appwrite-test-app'); + expect(result.oauth2ClientSecret, '7cb52700-0000-0000-0000-000000ca5b83'); + }); + }); +} diff --git a/test/src/models/o_auth2_twitch_test.dart b/test/src/models/o_auth2_twitch_test.dart new file mode 100644 index 00000000..2a75f459 --- /dev/null +++ b/test/src/models/o_auth2_twitch_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Twitch', () { + test('model', () { + final model = OAuth2Twitch( + $id: 'github', + enabled: true, + clientId: 'vvi0in000000000000000000ikmt9p', + clientSecret: 'pmapue000000000000000000zylw3v', + ); + + final map = model.toMap(); + final result = OAuth2Twitch.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'vvi0in000000000000000000ikmt9p'); + expect(result.clientSecret, 'pmapue000000000000000000zylw3v'); + }); + }); +} diff --git a/test/src/models/o_auth2_word_press_test.dart b/test/src/models/o_auth2_word_press_test.dart new file mode 100644 index 00000000..03ce1976 --- /dev/null +++ b/test/src/models/o_auth2_word_press_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2WordPress', () { + test('model', () { + final model = OAuth2WordPress( + $id: 'github', + enabled: true, + clientId: '130005', + clientSecret: + 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk', + ); + + final map = model.toMap(); + final result = OAuth2WordPress.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '130005'); + expect(result.clientSecret, + 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk'); + }); + }); +} diff --git a/test/src/models/o_auth2_x_test.dart b/test/src/models/o_auth2_x_test.dart new file mode 100644 index 00000000..ba475487 --- /dev/null +++ b/test/src/models/o_auth2_x_test.dart @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2X', () { + test('model', () { + final model = OAuth2X( + $id: 'github', + enabled: true, + customerKey: 'slzZV0000000000000NFLaWT', + secretKey: 'tkEPkp00000000000000000000000000000000000000FTxbI9', + ); + + final map = model.toMap(); + final result = OAuth2X.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.customerKey, 'slzZV0000000000000NFLaWT'); + expect(result.secretKey, + 'tkEPkp00000000000000000000000000000000000000FTxbI9'); + }); + }); +} diff --git a/test/src/models/o_auth2_yahoo_test.dart b/test/src/models/o_auth2_yahoo_test.dart new file mode 100644 index 00000000..1f845896 --- /dev/null +++ b/test/src/models/o_auth2_yahoo_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Yahoo', () { + test('model', () { + final model = OAuth2Yahoo( + $id: 'github', + enabled: true, + clientId: + 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', + clientSecret: 'cf978f0000000000000000000000000000c5e2e9', + ); + + final map = model.toMap(); + final result = OAuth2Yahoo.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, + 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm'); + expect(result.clientSecret, 'cf978f0000000000000000000000000000c5e2e9'); + }); + }); +} diff --git a/test/src/models/o_auth2_yandex_test.dart b/test/src/models/o_auth2_yandex_test.dart new file mode 100644 index 00000000..2e02e5eb --- /dev/null +++ b/test/src/models/o_auth2_yandex_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Yandex', () { + test('model', () { + final model = OAuth2Yandex( + $id: 'github', + enabled: true, + clientId: '6a8a6a0000000000000000000091483c', + clientSecret: 'bbf98500000000000000000000c75a63', + ); + + final map = model.toMap(); + final result = OAuth2Yandex.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '6a8a6a0000000000000000000091483c'); + expect(result.clientSecret, 'bbf98500000000000000000000c75a63'); + }); + }); +} diff --git a/test/src/models/o_auth2_zoho_test.dart b/test/src/models/o_auth2_zoho_test.dart new file mode 100644 index 00000000..903f5dcf --- /dev/null +++ b/test/src/models/o_auth2_zoho_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Zoho', () { + test('model', () { + final model = OAuth2Zoho( + $id: 'github', + enabled: true, + clientId: '1000.83C178000000000000000000RPNX0B', + clientSecret: 'fb5cac000000000000000000000000000000a68f6e', + ); + + final map = model.toMap(); + final result = OAuth2Zoho.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '1000.83C178000000000000000000RPNX0B'); + expect(result.clientSecret, 'fb5cac000000000000000000000000000000a68f6e'); + }); + }); +} diff --git a/test/src/models/o_auth2_zoom_test.dart b/test/src/models/o_auth2_zoom_test.dart new file mode 100644 index 00000000..22ee92c2 --- /dev/null +++ b/test/src/models/o_auth2_zoom_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Zoom', () { + test('model', () { + final model = OAuth2Zoom( + $id: 'github', + enabled: true, + clientId: 'QMAC00000000000000w0AQ', + clientSecret: 'GAWsG4000000000000000000007U01ON', + ); + + final map = model.toMap(); + final result = OAuth2Zoom.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'QMAC00000000000000w0AQ'); + expect(result.clientSecret, 'GAWsG4000000000000000000007U01ON'); + }); + }); +} diff --git a/test/src/models/policy_list_test.dart b/test/src/models/policy_list_test.dart new file mode 100644 index 00000000..4f6bb919 --- /dev/null +++ b/test/src/models/policy_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyList', () { + test('model', () { + final model = PolicyList( + total: 9, + policies: [], + ); + + final map = model.toMap(); + final result = PolicyList.fromMap(map); + + expect(result.total, 9); + expect(result.policies, []); + }); + }); +} diff --git a/test/src/models/policy_membership_privacy_test.dart b/test/src/models/policy_membership_privacy_test.dart new file mode 100644 index 00000000..04fa79f0 --- /dev/null +++ b/test/src/models/policy_membership_privacy_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyMembershipPrivacy', () { + test('model', () { + final model = PolicyMembershipPrivacy( + $id: 'password-dictionary', + userId: true, + userEmail: true, + userPhone: true, + userName: true, + userMFA: true, + ); + + final map = model.toMap(); + final result = PolicyMembershipPrivacy.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.userId, true); + expect(result.userEmail, true); + expect(result.userPhone, true); + expect(result.userName, true); + expect(result.userMFA, true); + }); + }); +} diff --git a/test/src/models/policy_password_dictionary_test.dart b/test/src/models/policy_password_dictionary_test.dart new file mode 100644 index 00000000..458f957f --- /dev/null +++ b/test/src/models/policy_password_dictionary_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyPasswordDictionary', () { + test('model', () { + final model = PolicyPasswordDictionary( + $id: 'password-dictionary', + enabled: true, + ); + + final map = model.toMap(); + final result = PolicyPasswordDictionary.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); + }); +} diff --git a/test/src/models/policy_password_history_test.dart b/test/src/models/policy_password_history_test.dart new file mode 100644 index 00000000..20acea57 --- /dev/null +++ b/test/src/models/policy_password_history_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyPasswordHistory', () { + test('model', () { + final model = PolicyPasswordHistory( + $id: 'password-dictionary', + total: 5, + ); + + final map = model.toMap(); + final result = PolicyPasswordHistory.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.total, 5); + }); + }); +} diff --git a/test/src/models/policy_password_personal_data_test.dart b/test/src/models/policy_password_personal_data_test.dart new file mode 100644 index 00000000..ed17b989 --- /dev/null +++ b/test/src/models/policy_password_personal_data_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyPasswordPersonalData', () { + test('model', () { + final model = PolicyPasswordPersonalData( + $id: 'password-dictionary', + enabled: true, + ); + + final map = model.toMap(); + final result = PolicyPasswordPersonalData.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); + }); +} diff --git a/test/src/models/policy_session_alert_test.dart b/test/src/models/policy_session_alert_test.dart new file mode 100644 index 00000000..f6df96e0 --- /dev/null +++ b/test/src/models/policy_session_alert_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicySessionAlert', () { + test('model', () { + final model = PolicySessionAlert( + $id: 'password-dictionary', + enabled: true, + ); + + final map = model.toMap(); + final result = PolicySessionAlert.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); + }); +} diff --git a/test/src/models/policy_session_duration_test.dart b/test/src/models/policy_session_duration_test.dart new file mode 100644 index 00000000..e1b17439 --- /dev/null +++ b/test/src/models/policy_session_duration_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicySessionDuration', () { + test('model', () { + final model = PolicySessionDuration( + $id: 'password-dictionary', + duration: 3600, + ); + + final map = model.toMap(); + final result = PolicySessionDuration.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.duration, 3600); + }); + }); +} diff --git a/test/src/models/policy_session_invalidation_test.dart b/test/src/models/policy_session_invalidation_test.dart new file mode 100644 index 00000000..a879957f --- /dev/null +++ b/test/src/models/policy_session_invalidation_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicySessionInvalidation', () { + test('model', () { + final model = PolicySessionInvalidation( + $id: 'password-dictionary', + enabled: true, + ); + + final map = model.toMap(); + final result = PolicySessionInvalidation.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); + }); +} diff --git a/test/src/models/policy_session_limit_test.dart b/test/src/models/policy_session_limit_test.dart new file mode 100644 index 00000000..40a8d0f6 --- /dev/null +++ b/test/src/models/policy_session_limit_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicySessionLimit', () { + test('model', () { + final model = PolicySessionLimit( + $id: 'password-dictionary', + total: 10, + ); + + final map = model.toMap(); + final result = PolicySessionLimit.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.total, 10); + }); + }); +} diff --git a/test/src/models/policy_user_limit_test.dart b/test/src/models/policy_user_limit_test.dart new file mode 100644 index 00000000..3c86fa0f --- /dev/null +++ b/test/src/models/policy_user_limit_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyUserLimit', () { + test('model', () { + final model = PolicyUserLimit( + $id: 'password-dictionary', + total: 100, + ); + + final map = model.toMap(); + final result = PolicyUserLimit.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.total, 100); + }); + }); +} diff --git a/test/src/models/presence_list_test.dart b/test/src/models/presence_list_test.dart new file mode 100644 index 00000000..9b661f46 --- /dev/null +++ b/test/src/models/presence_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PresenceList', () { + test('model', () { + final model = PresenceList( + total: 5, + presences: [], + ); + + final map = model.toMap(); + final result = PresenceList.fromMap(map); + + expect(result.total, 5); + expect(result.presences, []); + }); + }); +} diff --git a/test/src/models/presence_test.dart b/test/src/models/presence_test.dart new file mode 100644 index 00000000..dc9a8b9c --- /dev/null +++ b/test/src/models/presence_test.dart @@ -0,0 +1,32 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Presence', () { + test('model', () { + final model = Presence( + $id: '5e5ea5c16897e', + $sequence: '1', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + $permissions: [], + userInternalId: '1', + userId: '674af8f3e12a5f9ac0be', + source: 'HTTP', + data: {}, + ); + + final map = model.toMap(); + final result = Presence.fromMap(map); + + expect(result.$id, '5e5ea5c16897e'); + expect(result.$sequence, '1'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.userInternalId, '1'); + expect(result.userId, '674af8f3e12a5f9ac0be'); + expect(result.source, 'HTTP'); + }); + }); +} diff --git a/test/src/models/project_test.dart b/test/src/models/project_test.dart index adf8ccbe..82981e67 100644 --- a/test/src/models/project_test.dart +++ b/test/src/models/project_test.dart @@ -33,6 +33,8 @@ void main() { authMembershipsUserName: true, authMembershipsUserEmail: true, authMembershipsMfa: true, + authMembershipsUserId: true, + authMembershipsUserPhone: true, authInvalidateSessions: true, oAuthProviders: [], platforms: [], @@ -42,11 +44,12 @@ void main() { smtpEnabled: true, smtpSenderName: 'John Appwrite', smtpSenderEmail: 'john@appwrite.io', - smtpReplyTo: 'support@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', smtpHost: 'mail.appwrite.io', smtpPort: 25, smtpUsername: 'emailuser', - smtpPassword: 'securepassword', + smtpPassword: '', smtpSecure: 'tls', pingCount: 1, pingedAt: '2020-10-15T06:38:00.000+00:00', @@ -125,6 +128,8 @@ void main() { expect(result.authMembershipsUserName, true); expect(result.authMembershipsUserEmail, true); expect(result.authMembershipsMfa, true); + expect(result.authMembershipsUserId, true); + expect(result.authMembershipsUserPhone, true); expect(result.authInvalidateSessions, true); expect(result.oAuthProviders, []); expect(result.platforms, []); @@ -134,11 +139,12 @@ void main() { expect(result.smtpEnabled, true); expect(result.smtpSenderName, 'John Appwrite'); expect(result.smtpSenderEmail, 'john@appwrite.io'); - expect(result.smtpReplyTo, 'support@appwrite.io'); + expect(result.smtpReplyToName, 'Support Team'); + expect(result.smtpReplyToEmail, 'support@appwrite.io'); expect(result.smtpHost, 'mail.appwrite.io'); expect(result.smtpPort, 25); expect(result.smtpUsername, 'emailuser'); - expect(result.smtpPassword, 'securepassword'); + expect(result.smtpPassword, ''); expect(result.smtpSecure, 'tls'); expect(result.pingCount, 1); expect(result.pingedAt, '2020-10-15T06:38:00.000+00:00'); diff --git a/test/src/models/proxy_rule_list_test.dart b/test/src/models/proxy_rule_list_test.dart new file mode 100644 index 00000000..ceff1f64 --- /dev/null +++ b/test/src/models/proxy_rule_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ProxyRuleList', () { + test('model', () { + final model = ProxyRuleList( + total: 5, + rules: [], + ); + + final map = model.toMap(); + final result = ProxyRuleList.fromMap(map); + + expect(result.total, 5); + expect(result.rules, []); + }); + }); +} diff --git a/test/src/models/proxy_rule_test.dart b/test/src/models/proxy_rule_test.dart new file mode 100644 index 00000000..d7fff4ec --- /dev/null +++ b/test/src/models/proxy_rule_test.dart @@ -0,0 +1,46 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:dart_appwrite/enums.dart'; +import 'package:test/test.dart'; + +void main() { + group('ProxyRule', () { + test('model', () { + final model = ProxyRule( + $id: '5e5ea5c16897e', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + domain: 'appwrite.company.com', + type: 'deployment', + trigger: 'manual', + redirectUrl: 'https://appwrite.io/docs', + redirectStatusCode: 301, + deploymentId: 'n3u9feiwmf', + deploymentResourceId: 'n3u9feiwmf', + deploymentVcsProviderBranch: 'main', + status: ProxyRuleStatus.unverified, + logs: + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + renewAt: 'datetime', + ); + + final map = model.toMap(); + final result = ProxyRule.fromMap(map); + + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.domain, 'appwrite.company.com'); + expect(result.type, 'deployment'); + expect(result.trigger, 'manual'); + expect(result.redirectUrl, 'https://appwrite.io/docs'); + expect(result.redirectStatusCode, 301); + expect(result.deploymentId, 'n3u9feiwmf'); + expect(result.deploymentResourceId, 'n3u9feiwmf'); + expect(result.deploymentVcsProviderBranch, 'main'); + expect(result.status, ProxyRuleStatus.unverified); + expect(result.logs, + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.'); + expect(result.renewAt, 'datetime'); + }); + }); +}