Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 20.0.0

* Rename `VCSDeploymentType` enum to `VCSReferenceType`
* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters
* Add `Theme`, `Timezone` and `Output` enums
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove duplicate enum entries.

Line 7 claims to add Theme, Timezone, and Output enums in version 20.0.0, but Line 12 already documents these same enums as added in version 19.4.0. Enums cannot be added in two different versions.

Please verify which version actually introduced these enums and remove the duplicate entry.

🤖 Prompt for AI Agents
CHANGELOG.md around lines 7 to 12: the entry on line 7 ("Add `Theme`, `Timezone`
and `Output` enums" in version 20.0.0) duplicates the same enums already
documented as added in version 19.4.0 on line 12; determine which release
actually introduced these enums (verify git history or commit that added the
enums) and remove the incorrect duplicate entry so the enums are only documented
once under the correct version.


## 19.4.0

* Add `getScreenshot` method to `Avatars` service
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
dart_appwrite: ^19.4.0
dart_appwrite: ^20.0.0
```

You can install packages from the command line:
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Avatars avatars = Avatars(client);

UInt8List result = await avatars.getBrowser(
Uint8List result = await avatars.getBrowser(
code: Browser.avantBrowser,
width: 0, // (optional)
height: 0, // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-credit-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Avatars avatars = Avatars(client);

UInt8List result = await avatars.getCreditCard(
Uint8List result = await avatars.getCreditCard(
code: CreditCard.americanExpress,
width: 0, // (optional)
height: 0, // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-favicon.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Client client = Client()

Avatars avatars = Avatars(client);

UInt8List result = await avatars.getFavicon(
Uint8List result = await avatars.getFavicon(
url: 'https://example.com',
);
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Avatars avatars = Avatars(client);

UInt8List result = await avatars.getFlag(
Uint8List result = await avatars.getFlag(
code: Flag.afghanistan,
width: 0, // (optional)
height: 0, // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Avatars avatars = Avatars(client);

UInt8List result = await avatars.getImage(
Uint8List result = await avatars.getImage(
url: 'https://example.com',
width: 0, // (optional)
height: 0, // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-initials.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Avatars avatars = Avatars(client);

UInt8List result = await avatars.getInitials(
Uint8List result = await avatars.getInitials(
name: '<NAME>', // (optional)
width: 0, // (optional)
height: 0, // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-qr.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Avatars avatars = Avatars(client);

UInt8List result = await avatars.getQR(
Uint8List result = await avatars.getQR(
text: '<TEXT>',
size: 1, // (optional)
margin: 0, // (optional)
Expand Down
43 changes: 23 additions & 20 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,28 @@ Client client = Client()

Avatars avatars = Avatars(client);

UInt8List result = await avatars.getScreenshot(
Uint8List result = await avatars.getScreenshot(
url: 'https://example.com',
headers: {}, // (optional)
viewportWidth: 1, // (optional)
viewportHeight: 1, // (optional)
scale: 0.1, // (optional)
theme: .light, // (optional)
userAgent: '<USER_AGENT>', // (optional)
fullpage: false, // (optional)
locale: '<LOCALE>', // (optional)
timezone: .africaAbidjan, // (optional)
latitude: -90, // (optional)
longitude: -180, // (optional)
accuracy: 0, // (optional)
touch: false, // (optional)
permissions: [], // (optional)
sleep: 0, // (optional)
width: 0, // (optional)
height: 0, // (optional)
quality: -1, // (optional)
output: .jpg, // (optional)
headers: {
"Authorization": "Bearer token123",
"X-Custom-Header": "value"
}, // (optional)
viewportWidth: 1920, // (optional)
viewportHeight: 1080, // (optional)
scale: 2, // (optional)
theme: Theme.light, // (optional)
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // (optional)
fullpage: true, // (optional)
locale: 'en-US', // (optional)
timezone: Timezone.africaAbidjan, // (optional)
latitude: 37.7749, // (optional)
longitude: -122.4194, // (optional)
accuracy: 100, // (optional)
touch: true, // (optional)
permissions: ["geolocation","notifications"], // (optional)
sleep: 3, // (optional)
width: 800, // (optional)
height: 600, // (optional)
quality: 85, // (optional)
output: Output.jpg, // (optional)
);
3 changes: 2 additions & 1 deletion docs/examples/functions/create-template-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Deployment result = await functions.createTemplateDeployment(
repository: '<REPOSITORY>',
owner: '<OWNER>',
rootDirectory: '<ROOT_DIRECTORY>',
version: '<VERSION>',
type: TemplateReferenceType.commit,
reference: '<REFERENCE>',
activate: false, // (optional)
);
2 changes: 1 addition & 1 deletion docs/examples/functions/create-vcs-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Functions functions = Functions(client);

Deployment result = await functions.createVcsDeployment(
functionId: '<FUNCTION_ID>',
type: VCSDeploymentType.branch,
type: VCSReferenceType.branch,
reference: '<REFERENCE>',
activate: false, // (optional)
);
2 changes: 1 addition & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Functions functions = Functions(client);
Func result = await functions.create(
functionId: '<FUNCTION_ID>',
name: '<NAME>',
runtime: .node145,
runtime: Runtime.node145,
execute: ["any"], // (optional)
events: [], // (optional)
schedule: '', // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/functions/get-deployment-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Functions functions = Functions(client);

UInt8List result = await functions.getDeploymentDownload(
Uint8List result = await functions.getDeploymentDownload(
functionId: '<FUNCTION_ID>',
deploymentId: '<DEPLOYMENT_ID>',
type: DeploymentDownloadType.source, // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/functions/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Functions functions = Functions(client);
Func result = await functions.update(
functionId: '<FUNCTION_ID>',
name: '<NAME>',
runtime: .node145, // (optional)
runtime: Runtime.node145, // (optional)
execute: ["any"], // (optional)
events: [], // (optional)
schedule: '', // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/health/get-failed-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Client client = Client()
Health health = Health(client);

HealthQueue result = await health.getFailedJobs(
name: .v1Database,
name: Name.v1Database,
threshold: 0, // (optional)
);
3 changes: 2 additions & 1 deletion docs/examples/sites/create-template-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Deployment result = await sites.createTemplateDeployment(
repository: '<REPOSITORY>',
owner: '<OWNER>',
rootDirectory: '<ROOT_DIRECTORY>',
version: '<VERSION>',
type: TemplateReferenceType.branch,
reference: '<REFERENCE>',
activate: false, // (optional)
);
2 changes: 1 addition & 1 deletion docs/examples/sites/create-vcs-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Sites sites = Sites(client);

Deployment result = await sites.createVcsDeployment(
siteId: '<SITE_ID>',
type: VCSDeploymentType.branch,
type: VCSReferenceType.branch,
reference: '<REFERENCE>',
activate: false, // (optional)
);
6 changes: 3 additions & 3 deletions docs/examples/sites/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Sites sites = Sites(client);
Site result = await sites.create(
siteId: '<SITE_ID>',
name: '<NAME>',
framework: .analog,
buildRuntime: .node145,
framework: Framework.analog,
buildRuntime: BuildRuntime.node145,
enabled: false, // (optional)
logging: false, // (optional)
timeout: 1, // (optional)
installCommand: '<INSTALL_COMMAND>', // (optional)
buildCommand: '<BUILD_COMMAND>', // (optional)
outputDirectory: '<OUTPUT_DIRECTORY>', // (optional)
adapter: .static, // (optional)
adapter: Adapter.static, // (optional)
installationId: '<INSTALLATION_ID>', // (optional)
fallbackFile: '<FALLBACK_FILE>', // (optional)
providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/sites/get-deployment-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Sites sites = Sites(client);

UInt8List result = await sites.getDeploymentDownload(
Uint8List result = await sites.getDeploymentDownload(
siteId: '<SITE_ID>',
deploymentId: '<DEPLOYMENT_ID>',
type: DeploymentDownloadType.source, // (optional)
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/sites/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Sites sites = Sites(client);
Site result = await sites.update(
siteId: '<SITE_ID>',
name: '<NAME>',
framework: .analog,
framework: Framework.analog,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the main SDK files and enum definitions
# First, let's see the repository structure
git ls-files | head -20

# Look for TypeScript/JavaScript enum definitions
fd -e ts -e js -e tsx -e jsx | grep -v node_modules | head -30

Repository: appwrite/sdk-for-dart

Length of output: 776


🏁 Script executed:

#!/bin/bash
# Find Dart files with enum definitions
fd -e dart | grep -v pubspec | head -30

# Look for enum definitions in Dart files
rg -n "enum Framework\|enum BuildRuntime\|enum Adapter" --type dart

Repository: appwrite/sdk-for-dart

Length of output: 750


🏁 Script executed:

#!/bin/bash
# Check the size of enums.dart
wc -l lib/enums.dart

# Read the entire file to find the enums
cat -n lib/enums.dart

Repository: appwrite/sdk-for-dart

Length of output: 1851


🏁 Script executed:

#!/bin/bash
# Read the three enum files
echo "=== framework.dart ==="
cat -n lib/src/enums/framework.dart

echo -e "\n=== build_runtime.dart ==="
cat -n lib/src/enums/build_runtime.dart

echo -e "\n=== adapter.dart ==="
cat -n lib/src/enums/adapter.dart

Repository: appwrite/sdk-for-dart

Length of output: 3918


🏁 Script executed:

#!/bin/bash
# Read the update.md file to see the actual enum usage
cat -n docs/examples/sites/update.md

Repository: appwrite/sdk-for-dart

Length of output: 1418


The enum value Adapter.static does not exist; it should be Adapter.xstatic.

The verification found that Framework.analog and BuildRuntime.node145 are valid enum values in the SDK. However, Adapter.static is incorrect. The actual enum member in lib/src/enums/adapter.dart (line 4) is named Adapter.xstatic, which has the string value 'static'. The documentation file at line 21 must be updated to use Adapter.xstatic instead of Adapter.static.

🤖 Prompt for AI Agents
In docs/examples/sites/update.md around line 13, the code uses a non-existent
enum member Adapter.static; replace it with the correct enum member
Adapter.xstatic (the enum is defined in lib/src/enums/adapter.dart and xstatic
has the string value 'static') so the example compiles and matches the SDK enum
names.

enabled: false, // (optional)
logging: false, // (optional)
timeout: 1, // (optional)
installCommand: '<INSTALL_COMMAND>', // (optional)
buildCommand: '<BUILD_COMMAND>', // (optional)
outputDirectory: '<OUTPUT_DIRECTORY>', // (optional)
buildRuntime: .node145, // (optional)
adapter: .static, // (optional)
buildRuntime: BuildRuntime.node145, // (optional)
adapter: Adapter.static, // (optional)
fallbackFile: '<FALLBACK_FILE>', // (optional)
installationId: '<INSTALLATION_ID>', // (optional)
providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // (optional)
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/storage/create-bucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Bucket result = await storage.createBucket(
enabled: false, // (optional)
maximumFileSize: 1, // (optional)
allowedFileExtensions: [], // (optional)
compression: .none, // (optional)
compression: Compression.none, // (optional)
encryption: false, // (optional)
antivirus: false, // (optional)
transformations: false, // (optional)
);
2 changes: 1 addition & 1 deletion docs/examples/storage/get-file-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Storage storage = Storage(client);

UInt8List result = await storage.getFileDownload(
Uint8List result = await storage.getFileDownload(
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
token: '<TOKEN>', // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/storage/get-file-preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Storage storage = Storage(client);

UInt8List result = await storage.getFilePreview(
Uint8List result = await storage.getFilePreview(
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
width: 0, // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/storage/get-file-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Client client = Client()

Storage storage = Storage(client);

UInt8List result = await storage.getFileView(
Uint8List result = await storage.getFileView(
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
token: '<TOKEN>', // (optional)
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/storage/update-bucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Bucket result = await storage.updateBucket(
enabled: false, // (optional)
maximumFileSize: 1, // (optional)
allowedFileExtensions: [], // (optional)
compression: .none, // (optional)
compression: Compression.none, // (optional)
encryption: false, // (optional)
antivirus: false, // (optional)
transformations: false, // (optional)
);
3 changes: 2 additions & 1 deletion lib/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ part 'src/enums/relationship_type.dart';
part 'src/enums/relation_mutate.dart';
part 'src/enums/index_type.dart';
part 'src/enums/runtime.dart';
part 'src/enums/vcs_deployment_type.dart';
part 'src/enums/template_reference_type.dart';
part 'src/enums/vcs_reference_type.dart';
part 'src/enums/deployment_download_type.dart';
part 'src/enums/execution_method.dart';
part 'src/enums/name.dart';
Expand Down
8 changes: 4 additions & 4 deletions lib/services/account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class Account extends Service {
'This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.')
Future<models.MfaChallenge> createMfaChallenge(
{required enums.AuthenticationFactor factor}) async {
final String apiPath = '/account/mfa/challenge';
final String apiPath = '/account/mfa/challenges';

final Map<String, dynamic> apiParams = {
'factor': factor.value,
Expand All @@ -321,7 +321,7 @@ class Account extends Service {
/// method.
Future<models.MfaChallenge> createMFAChallenge(
{required enums.AuthenticationFactor factor}) async {
final String apiPath = '/account/mfa/challenge';
final String apiPath = '/account/mfa/challenges';

final Map<String, dynamic> apiParams = {
'factor': factor.value,
Expand All @@ -346,7 +346,7 @@ class Account extends Service {
'This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.')
Future<models.Session> updateMfaChallenge(
{required String challengeId, required String otp}) async {
final String apiPath = '/account/mfa/challenge';
final String apiPath = '/account/mfa/challenges';

final Map<String, dynamic> apiParams = {
'challengeId': challengeId,
Expand All @@ -370,7 +370,7 @@ class Account extends Service {
/// method.
Future<models.Session> updateMFAChallenge(
{required String challengeId, required String otp}) async {
final String apiPath = '/account/mfa/challenge';
final String apiPath = '/account/mfa/challenges';

final Map<String, dynamic> apiParams = {
'challengeId': challengeId,
Expand Down
Loading