Add 1.8.x support

This commit is contained in:
Jake Barnby
2025-08-20 03:12:54 +12:00
parent 041f94dc8e
commit 1310f9446f
347 changed files with 16789 additions and 12991 deletions
+3 -3
View File
@@ -2,12 +2,12 @@
[![pub package](https://img.shields.io/pub/v/dart_appwrite.svg?style=flat-square)](https://pub.dartlang.org/packages/dart_appwrite) [![pub package](https://img.shields.io/pub/v/dart_appwrite.svg?style=flat-square)](https://pub.dartlang.org/packages/dart_appwrite)
![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.7.x-blue.svg?style=flat-square) ![Version](https://img.shields.io/badge/api%20version-1.8.x-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![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) [![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.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dart/releases).** **This SDK is compatible with Appwrite server version 1.8.x. 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) > 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)
@@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:
```yml ```yml
dependencies: dependencies:
dart_appwrite: ^16.2.0 dart_appwrite: ^17.0.0
``` ```
You can install packages from the command line: You can install packages from the command line:
+1
View File
@@ -0,0 +1 @@
include: package:lints/recommended.yaml
+1
View File
@@ -11,4 +11,5 @@ Database result = await databases.create(
databaseId: '<DATABASE_ID>', databaseId: '<DATABASE_ID>',
name: '<NAME>', name: '<NAME>',
enabled: false, // (optional) enabled: false, // (optional)
type: .tablesdb, // (optional)
); );
+1 -1
View File
@@ -14,5 +14,5 @@ Execution result = await functions.createExecution(
path: '<PATH>', // (optional) path: '<PATH>', // (optional)
method: ExecutionMethod.gET, // (optional) method: ExecutionMethod.gET, // (optional)
headers: {}, // (optional) headers: {}, // (optional)
scheduledAt: '', // (optional) scheduledAt: '<SCHEDULED_AT>', // (optional)
); );
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnBoolean result = await tablesDb.createBooleanColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: false, // (optional)
array: false, // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnDatetime result = await tablesDb.createDatetimeColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: '', // (optional)
array: false, // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnEmail result = await tablesDb.createEmailColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: 'email@example.com', // (optional)
array: false, // (optional)
);
@@ -0,0 +1,18 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnEnum result = await tablesDb.createEnumColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
elements: [],
xrequired: false,
xdefault: '<DEFAULT>', // (optional)
array: false, // (optional)
);
@@ -0,0 +1,19 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnFloat result = await tablesDb.createFloatColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
min: 0, // (optional)
max: 0, // (optional)
xdefault: 0, // (optional)
array: false, // (optional)
);
+18
View File
@@ -0,0 +1,18 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnIndex result = await tablesDb.createIndex(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
type: IndexType.key,
columns: [],
orders: [], // (optional)
lengths: [], // (optional)
);
@@ -0,0 +1,19 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnInteger result = await tablesDb.createIntegerColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
min: 0, // (optional)
max: 0, // (optional)
xdefault: 0, // (optional)
array: false, // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnIp result = await tablesDb.createIpColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: '', // (optional)
array: false, // (optional)
);
@@ -0,0 +1,19 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnRelationship result = await tablesDb.createRelationshipColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
relatedTableId: '<RELATED_TABLE_ID>',
type: RelationshipType.oneToOne,
twoWay: false, // (optional)
key: '', // (optional)
twoWayKey: '', // (optional)
onDelete: RelationMutate.cascade, // (optional)
);
+16
View File
@@ -0,0 +1,16 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
TablesDb tablesDb = TablesDb(client);
Row result = await tablesDb.createRow(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
data: {},
permissions: ["read("any")"], // (optional)
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
RowList result = await tablesDb.createRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rows: [],
);
@@ -0,0 +1,19 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnString result = await tablesDb.createStringColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
size: 1,
xrequired: false,
xdefault: '<DEFAULT>', // (optional)
array: false, // (optional)
encrypt: false, // (optional)
);
+17
View File
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
Table result = await tablesDb.createTable(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
name: '<NAME>',
permissions: ["read("any")"], // (optional)
rowSecurity: false, // (optional)
enabled: false, // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnUrl result = await tablesDb.createUrlColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: 'https://example.com', // (optional)
array: false, // (optional)
);
+15
View File
@@ -0,0 +1,15 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
Database result = await tablesDb.create(
databaseId: '<DATABASE_ID>',
name: '<NAME>',
enabled: false, // (optional)
type: .tablesdb, // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
Row result = await tablesDb.decrementRowColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
column: '',
value: 0, // (optional)
min: 0, // (optional)
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
await tablesDb.deleteColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
await tablesDb.deleteIndex(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
TablesDb tablesDb = TablesDb(client);
await tablesDb.deleteRow(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
await tablesDb.deleteRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
queries: [], // (optional)
);
+13
View File
@@ -0,0 +1,13 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
await tablesDb.deleteTable(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
);
+12
View File
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
await tablesDb.delete(
databaseId: '<DATABASE_ID>',
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
result = await tablesDb.getColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnIndex result = await tablesDb.getIndex(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
);
+15
View File
@@ -0,0 +1,15 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
TablesDb tablesDb = TablesDb(client);
Row result = await tablesDb.getRow(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
queries: [], // (optional)
);
+13
View File
@@ -0,0 +1,13 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
Table result = await tablesDb.getTable(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
);
+12
View File
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
Database result = await tablesDb.get(
databaseId: '<DATABASE_ID>',
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
Row result = await tablesDb.incrementRowColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
column: '',
value: 0, // (optional)
max: 0, // (optional)
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnList result = await tablesDb.listColumns(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
queries: [], // (optional)
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnIndexList result = await tablesDb.listIndexes(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
queries: [], // (optional)
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
TablesDb tablesDb = TablesDb(client);
RowList result = await tablesDb.listRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
queries: [], // (optional)
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
TableList result = await tablesDb.listTables(
databaseId: '<DATABASE_ID>',
queries: [], // (optional)
search: '<SEARCH>', // (optional)
);
+13
View File
@@ -0,0 +1,13 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
DatabaseList result = await tablesDb.list(
queries: [], // (optional)
search: '<SEARCH>', // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnBoolean result = await tablesDb.updateBooleanColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: false,
newKey: '', // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnDatetime result = await tablesDb.updateDatetimeColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: '',
newKey: '', // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnEmail result = await tablesDb.updateEmailColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: 'email@example.com',
newKey: '', // (optional)
);
@@ -0,0 +1,18 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnEnum result = await tablesDb.updateEnumColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
elements: [],
xrequired: false,
xdefault: '<DEFAULT>',
newKey: '', // (optional)
);
@@ -0,0 +1,19 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnFloat result = await tablesDb.updateFloatColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: 0,
min: 0, // (optional)
max: 0, // (optional)
newKey: '', // (optional)
);
@@ -0,0 +1,19 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnInteger result = await tablesDb.updateIntegerColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: 0,
min: 0, // (optional)
max: 0, // (optional)
newKey: '', // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnIp result = await tablesDb.updateIpColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: '',
newKey: '', // (optional)
);
@@ -0,0 +1,16 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnRelationship result = await tablesDb.updateRelationshipColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
onDelete: RelationMutate.cascade, // (optional)
newKey: '', // (optional)
);
+16
View File
@@ -0,0 +1,16 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
TablesDb tablesDb = TablesDb(client);
Row result = await tablesDb.updateRow(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
data: {}, // (optional)
permissions: ["read("any")"], // (optional)
);
+15
View File
@@ -0,0 +1,15 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
RowList result = await tablesDb.updateRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
data: {}, // (optional)
queries: [], // (optional)
);
@@ -0,0 +1,18 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnString result = await tablesDb.updateStringColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: '<DEFAULT>',
size: 1, // (optional)
newKey: '', // (optional)
);
+17
View File
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
Table result = await tablesDb.updateTable(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
name: '<NAME>',
permissions: ["read("any")"], // (optional)
rowSecurity: false, // (optional)
enabled: false, // (optional)
);
@@ -0,0 +1,17 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
ColumnUrl result = await tablesDb.updateUrlColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: 'https://example.com',
newKey: '', // (optional)
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
Database result = await tablesDb.update(
databaseId: '<DATABASE_ID>',
name: '<NAME>',
enabled: false, // (optional)
);
+16
View File
@@ -0,0 +1,16 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
TablesDb tablesDb = TablesDb(client);
Row result = await tablesDb.upsertRow(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
data: {}, // (optional)
permissions: ["read("any")"], // (optional)
);
+14
View File
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
TablesDb tablesDb = TablesDb(client);
RowList result = await tablesDb.upsertRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rows: [],
);
-62
View File
@@ -1,62 +0,0 @@
# Examples
Init your Appwrite client:
```dart
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
```
Create a new user:
```dart
Users users = Users(client);
User result = await users.create(
userId: ID.unique(),
email: "email@example.com",
phone: "+123456789",
password: "password",
name: "Walter O'Brien"
);
```
Fetch user profile:
```dart
Users users = Users(client);
User profile = await users.get(
userId: '[USER_ID]',
);
```
Upload File:
```dart
Storage storage = Storage(client);
InputFile file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg');
storage.createFile(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID
file: file,
permissions: [
Permission.read(Role.any()),
],
)
.then((response) {
print(response); // File uploaded!
})
.catchError((error) {
print(error.response);
});
```
All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs)
+1 -1
View File
@@ -1 +1 @@
export 'src/client_browser.dart'; export 'src/client_browser.dart';
+1 -1
View File
@@ -1 +1 @@
export 'src/client_io.dart'; export 'src/client_io.dart';
+2 -1
View File
@@ -1,6 +1,6 @@
/// Appwrite Dart SDK /// Appwrite Dart SDK
/// ///
/// This SDK is compatible with Appwrite server version 1.7.x. /// This SDK is compatible with Appwrite server version 1.8.x.
/// For older versions, please check /// For older versions, please check
/// [previous releases](https://github.com/appwrite/sdk-for-dart/releases). /// [previous releases](https://github.com/appwrite/sdk-for-dart/releases).
library dart_appwrite; library dart_appwrite;
@@ -37,6 +37,7 @@ part 'services/locale.dart';
part 'services/messaging.dart'; part 'services/messaging.dart';
part 'services/sites.dart'; part 'services/sites.dart';
part 'services/storage.dart'; part 'services/storage.dart';
part 'services/tables-db.dart';
part 'services/teams.dart'; part 'services/teams.dart';
part 'services/tokens.dart'; part 'services/tokens.dart';
part 'services/users.dart'; part 'services/users.dart';
+1
View File
@@ -7,6 +7,7 @@ part 'src/enums/o_auth_provider.dart';
part 'src/enums/browser.dart'; part 'src/enums/browser.dart';
part 'src/enums/credit_card.dart'; part 'src/enums/credit_card.dart';
part 'src/enums/flag.dart'; part 'src/enums/flag.dart';
part 'src/enums/type.dart';
part 'src/enums/relationship_type.dart'; part 'src/enums/relationship_type.dart';
part 'src/enums/relation_mutate.dart'; part 'src/enums/relation_mutate.dart';
part 'src/enums/index_type.dart'; part 'src/enums/index_type.dart';
+2 -1
View File
@@ -10,7 +10,8 @@ class ID {
final now = DateTime.now(); final now = DateTime.now();
final sec = (now.millisecondsSinceEpoch / 1000).floor(); final sec = (now.millisecondsSinceEpoch / 1000).floor();
final usec = now.microsecondsSinceEpoch - (sec * 1000000); final usec = now.microsecondsSinceEpoch - (sec * 1000000);
return sec.toRadixString(16) + usec.toRadixString(16).padLeft(5, '0'); return sec.toRadixString(16) +
usec.toRadixString(16).padLeft(5, '0');
} }
// Generate a unique ID with padding to have a longer ID // Generate a unique ID with padding to have a longer ID
+17
View File
@@ -2,10 +2,13 @@
library dart_appwrite.models; library dart_appwrite.models;
part 'src/models/model.dart'; part 'src/models/model.dart';
part 'src/models/row_list.dart';
part 'src/models/document_list.dart'; part 'src/models/document_list.dart';
part 'src/models/table_list.dart';
part 'src/models/collection_list.dart'; part 'src/models/collection_list.dart';
part 'src/models/database_list.dart'; part 'src/models/database_list.dart';
part 'src/models/index_list.dart'; part 'src/models/index_list.dart';
part 'src/models/column_index_list.dart';
part 'src/models/user_list.dart'; part 'src/models/user_list.dart';
part 'src/models/session_list.dart'; part 'src/models/session_list.dart';
part 'src/models/identity_list.dart'; part 'src/models/identity_list.dart';
@@ -47,7 +50,21 @@ part 'src/models/attribute_ip.dart';
part 'src/models/attribute_url.dart'; part 'src/models/attribute_url.dart';
part 'src/models/attribute_datetime.dart'; part 'src/models/attribute_datetime.dart';
part 'src/models/attribute_relationship.dart'; part 'src/models/attribute_relationship.dart';
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_float.dart';
part 'src/models/column_boolean.dart';
part 'src/models/column_email.dart';
part 'src/models/column_enum.dart';
part 'src/models/column_ip.dart';
part 'src/models/column_url.dart';
part 'src/models/column_datetime.dart';
part 'src/models/column_relationship.dart';
part 'src/models/index.dart'; part 'src/models/index.dart';
part 'src/models/column_index.dart';
part 'src/models/row.dart';
part 'src/models/document.dart'; part 'src/models/document.dart';
part 'src/models/log.dart'; part 'src/models/log.dart';
part 'src/models/user.dart'; part 'src/models/user.dart';
+57 -33
View File
@@ -1,5 +1,6 @@
part of 'dart_appwrite.dart'; part of 'dart_appwrite.dart';
/// Helper class to generate query strings. /// Helper class to generate query strings.
class Query { class Query {
final String method; final String method;
@@ -9,13 +10,15 @@ class Query {
Query._(this.method, [this.attribute = null, this.values = null]); Query._(this.method, [this.attribute = null, this.values = null]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{'method': method}; final map = <String, dynamic>{
'method': method,
};
if (attribute != null) { if(attribute != null) {
map['attribute'] = attribute; map['attribute'] = attribute;
} }
if (values != null) { if(values != null) {
map['values'] = values is List ? values : [values]; map['values'] = values is List ? values : [values];
} }
@@ -26,7 +29,7 @@ class Query {
String toString() => jsonEncode(toJson()); String toString() => jsonEncode(toJson());
/// Filter resources where [attribute] is equal to [value]. /// Filter resources where [attribute] is equal to [value].
/// ///
/// [value] can be a single value or a list. If a list is used /// [value] can be a single value or a list. If a list is used
/// the query will return resources where [attribute] is equal /// the query will return resources where [attribute] is equal
/// to any of the values in the list. /// to any of the values in the list.
@@ -58,12 +61,10 @@ class Query {
Query._('search', attribute, value).toString(); Query._('search', attribute, value).toString();
/// Filter resources where [attribute] is null. /// Filter resources where [attribute] is null.
static String isNull(String attribute) => static String isNull(String attribute) => Query._('isNull', attribute).toString();
Query._('isNull', attribute).toString();
/// Filter resources where [attribute] is not null. /// Filter resources where [attribute] is not null.
static String isNotNull(String attribute) => static String isNotNull(String attribute) => Query._('isNotNull', attribute).toString();
Query._('isNotNull', attribute).toString();
/// Filter resources where [attribute] is between [start] and [end] (inclusive). /// Filter resources where [attribute] is between [start] and [end] (inclusive).
static String between(String attribute, dynamic start, dynamic end) => static String between(String attribute, dynamic start, dynamic end) =>
@@ -82,51 +83,74 @@ class Query {
static String contains(String attribute, dynamic value) => static String contains(String attribute, dynamic value) =>
Query._('contains', attribute, value).toString(); Query._('contains', attribute, value).toString();
static String or(List<String> queries) => Query._( /// Filter resources where [attribute] does not contain [value]
'or', /// [value] can be a single value or a list.
null, static String notContains(String attribute, dynamic value) =>
queries.map((query) => jsonDecode(query)).toList(), Query._('notContains', attribute, value).toString();
).toString();
static String and(List<String> queries) => Query._( /// Filter resources by searching [attribute] for [value] (inverse of search).
'and', static String notSearch(String attribute, String value) =>
null, Query._('notSearch', attribute, value).toString();
queries.map((query) => jsonDecode(query)).toList(),
).toString(); /// Filter resources where [attribute] is not between [start] and [end] (exclusive).
static String notBetween(String attribute, dynamic start, dynamic end) =>
Query._('notBetween', attribute, [start, end]).toString();
/// Filter resources where [attribute] does not start with [value].
static String notStartsWith(String attribute, String value) =>
Query._('notStartsWith', attribute, value).toString();
/// Filter resources where [attribute] does not end with [value].
static String notEndsWith(String attribute, String value) =>
Query._('notEndsWith', attribute, value).toString();
/// Filter resources where document was created before [value].
static String createdBefore(String value) => Query._('createdBefore', null, value).toString();
/// Filter resources where document was created after [value].
static String createdAfter(String value) => Query._('createdAfter', null, value).toString();
/// Filter resources where document was updated before [value].
static String updatedBefore(String value) => Query._('updatedBefore', null, value).toString();
/// Filter resources where document was updated after [value].
static String updatedAfter(String value) => Query._('updatedAfter', null, value).toString();
static String or(List<String> queries) =>
Query._('or', null, queries.map((query) => jsonDecode(query)).toList()).toString();
static String and(List<String> queries) =>
Query._('and', null, queries.map((query) => jsonDecode(query)).toList()).toString();
/// Specify which attributes should be returned by the API call. /// Specify which attributes should be returned by the API call.
static String select(List<String> attributes) => static String select(List<String> attributes) =>
Query._('select', null, attributes).toString(); Query._('select', null, attributes).toString();
/// Sort results by [attribute] ascending. /// Sort results by [attribute] ascending.
static String orderAsc(String attribute) => static String orderAsc(String attribute) => Query._('orderAsc', attribute).toString();
Query._('orderAsc', attribute).toString();
/// Sort results by [attribute] descending. /// Sort results by [attribute] descending.
static String orderDesc(String attribute) => static String orderDesc(String attribute) => Query._('orderDesc', attribute).toString();
Query._('orderDesc', attribute).toString();
/// Return results before [id]. /// Return results before [id].
/// ///
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination) /// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
/// docs for more information. /// docs for more information.
static String cursorBefore(String id) => static String cursorBefore(String id) => Query._('cursorBefore', null, id).toString();
Query._('cursorBefore', null, id).toString();
/// Return results after [id]. /// Return results after [id].
/// ///
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination) /// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
/// docs for more information. /// docs for more information.
static String cursorAfter(String id) => static String cursorAfter(String id) => Query._('cursorAfter', null, id).toString();
Query._('cursorAfter', null, id).toString();
/// Return only [limit] results. /// Return only [limit] results.
static String limit(int limit) => Query._('limit', null, limit).toString(); static String limit(int limit) => Query._('limit', null, limit).toString();
/// Return results from [offset]. /// Return results from [offset].
/// ///
/// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination) /// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination)
/// docs for more information. /// docs for more information.
static String offset(int offset) => static String offset(int offset) => Query._('offset', null, offset).toString();
Query._('offset', null, offset).toString();
} }
+55 -55
View File
@@ -2,65 +2,65 @@ part of 'dart_appwrite.dart';
/// Helper class to generate role strings for [Permission]. /// Helper class to generate role strings for [Permission].
class Role { class Role {
Role._(); Role._();
/// Grants access to anyone. /// Grants access to anyone.
/// ///
/// This includes authenticated and unauthenticated users. /// This includes authenticated and unauthenticated users.
static String any() { static String any() {
return 'any'; return 'any';
}
/// Grants access to a specific user by user ID.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String user(String id, [String status = '']) {
if (status.isEmpty) {
return 'user:$id';
} }
return 'user:$id/$status';
}
/// Grants access to any authenticated or anonymous user. /// Grants access to a specific user by user ID.
/// ///
/// You can optionally pass verified or unverified for /// You can optionally pass verified or unverified for
/// [status] to target specific types of users. /// [status] to target specific types of users.
static String users([String status = '']) { static String user(String id, [String status = '']) {
if (status.isEmpty) { if(status.isEmpty) {
return 'users'; return 'user:$id';
}
return 'user:$id/$status';
} }
return 'users/$status';
}
/// Grants access to any guest user without a session. /// Grants access to any authenticated or anonymous user.
/// ///
/// Authenticated users don't have access to this role. /// You can optionally pass verified or unverified for
static String guests() { /// [status] to target specific types of users.
return 'guests'; static String users([String status = '']) {
} if(status.isEmpty) {
return 'users';
/// Grants access to a team by team ID. }
/// return 'users/$status';
/// You can optionally pass a role for [role] to target
/// team members with the specified role.
static String team(String id, [String role = '']) {
if (role.isEmpty) {
return 'team:$id';
} }
return 'team:$id/$role';
}
/// Grants access to a specific member of a team. /// Grants access to any guest user without a session.
/// ///
/// When the member is removed from the team, they will /// Authenticated users don't have access to this role.
/// no longer have access. static String guests() {
static String member(String id) { return 'guests';
return 'member:$id'; }
}
/// Grants access to a user with the specified label. /// Grants access to a team by team ID.
static String label(String name) { ///
return 'label:$name'; /// You can optionally pass a role for [role] to target
} /// team members with the specified role.
} static String team(String id, [String role = '']) {
if(role.isEmpty) {
return 'team:$id';
}
return 'team:$id/$role';
}
/// Grants access to a specific member of a team.
///
/// When the member is removed from the team, they will
/// no longer have access.
static String member(String id) {
return 'member:$id';
}
/// Grants access to a user with the specified label.
static String label(String name) {
return 'label:$name';
}
}
+1080 -1081
View File
File diff suppressed because it is too large Load Diff
+156 -222
View File
@@ -3,253 +3,187 @@ part of '../dart_appwrite.dart';
/// The Avatars service aims to help you complete everyday tasks related to /// The Avatars service aims to help you complete everyday tasks related to
/// your app image, icons, and avatars. /// your app image, icons, and avatars.
class Avatars extends Service { class Avatars extends Service {
Avatars(super.client); Avatars(super.client);
/// You can use this endpoint to show different browser icons to your users. /// You can use this endpoint to show different browser icons to your users.
/// The code argument receives the browser code as it appears in your user [GET /// The code argument receives the browser code as it appears in your user [GET
/// /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) /// /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
/// endpoint. Use width, height and quality arguments to change the output /// endpoint. Use width, height and quality arguments to change the output
/// settings. /// settings.
/// ///
/// When one dimension is specified and the other is 0, the image is scaled /// When one dimension is specified and the other is 0, the image is scaled
/// with preserved aspect ratio. If both dimensions are 0, the API provides an /// with preserved aspect ratio. If both dimensions are 0, the API provides an
/// image at source quality. If dimensions are not specified, the default size /// image at source quality. If dimensions are not specified, the default size
/// of image returned is 100x100px. /// of image returned is 100x100px.
Future<Uint8List> getBrowser({ Future<Uint8List> getBrowser({required enums.Browser code, int? width, int? height, int? quality}) async {
required enums.Browser code, final String apiPath = '/avatars/browsers/{code}'.replaceAll('{code}', code.value);
int? width,
int? height,
int? quality,
}) async {
final String apiPath = '/avatars/browsers/{code}'.replaceAll(
'{code}',
code.value,
);
final Map<String, dynamic> params = { final Map<String, dynamic> params = {
'width': width, 'width': width,
'height': height, 'height': height,
'quality': quality, 'quality': quality,
'project': client.config['project'],
'session': client.config['session'], 'project': client.config['project'],
}; 'session': client.config['session'],
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
HttpMethod.get, return res.data;
path: apiPath, }
params: params,
responseType: ResponseType.bytes,
);
return res.data;
}
/// The credit card endpoint will return you the icon of the credit card /// The credit card endpoint will return you the icon of the credit card
/// provider you need. Use width, height and quality arguments to change the /// provider you need. Use width, height and quality arguments to change the
/// output settings. /// output settings.
/// ///
/// When one dimension is specified and the other is 0, the image is scaled /// When one dimension is specified and the other is 0, the image is scaled
/// with preserved aspect ratio. If both dimensions are 0, the API provides an /// with preserved aspect ratio. If both dimensions are 0, the API provides an
/// image at source quality. If dimensions are not specified, the default size /// image at source quality. If dimensions are not specified, the default size
/// of image returned is 100x100px. /// of image returned is 100x100px.
/// ///
Future<Uint8List> getCreditCard({ Future<Uint8List> getCreditCard({required enums.CreditCard code, int? width, int? height, int? quality}) async {
required enums.CreditCard code, final String apiPath = '/avatars/credit-cards/{code}'.replaceAll('{code}', code.value);
int? width,
int? height,
int? quality,
}) async {
final String apiPath = '/avatars/credit-cards/{code}'.replaceAll(
'{code}',
code.value,
);
final Map<String, dynamic> params = { final Map<String, dynamic> params = {
'width': width, 'width': width,
'height': height, 'height': height,
'quality': quality, 'quality': quality,
'project': client.config['project'],
'session': client.config['session'], 'project': client.config['project'],
}; 'session': client.config['session'],
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
HttpMethod.get, return res.data;
path: apiPath, }
params: params,
responseType: ResponseType.bytes,
);
return res.data;
}
/// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote /// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
/// website URL. /// website URL.
/// ///
/// This endpoint does not follow HTTP redirects. /// This endpoint does not follow HTTP redirects.
Future<Uint8List> getFavicon({required String url}) async { Future<Uint8List> getFavicon({required String url}) async {
final String apiPath = '/avatars/favicon'; final String apiPath = '/avatars/favicon';
final Map<String, dynamic> params = { final Map<String, dynamic> params = {
'url': url, 'url': url,
'project': client.config['project'],
'session': client.config['session'], 'project': client.config['project'],
}; 'session': client.config['session'],
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
HttpMethod.get, return res.data;
path: apiPath, }
params: params,
responseType: ResponseType.bytes,
);
return res.data;
}
/// You can use this endpoint to show different country flags icons to your /// You can use this endpoint to show different country flags icons to your
/// users. The code argument receives the 2 letter country code. Use width, /// users. The code argument receives the 2 letter country code. Use width,
/// height and quality arguments to change the output settings. Country codes /// height and quality arguments to change the output settings. Country codes
/// follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. /// follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
/// ///
/// When one dimension is specified and the other is 0, the image is scaled /// When one dimension is specified and the other is 0, the image is scaled
/// with preserved aspect ratio. If both dimensions are 0, the API provides an /// with preserved aspect ratio. If both dimensions are 0, the API provides an
/// image at source quality. If dimensions are not specified, the default size /// image at source quality. If dimensions are not specified, the default size
/// of image returned is 100x100px. /// of image returned is 100x100px.
/// ///
Future<Uint8List> getFlag({ Future<Uint8List> getFlag({required enums.Flag code, int? width, int? height, int? quality}) async {
required enums.Flag code, final String apiPath = '/avatars/flags/{code}'.replaceAll('{code}', code.value);
int? width,
int? height,
int? quality,
}) async {
final String apiPath = '/avatars/flags/{code}'.replaceAll(
'{code}',
code.value,
);
final Map<String, dynamic> params = { final Map<String, dynamic> params = {
'width': width, 'width': width,
'height': height, 'height': height,
'quality': quality, 'quality': quality,
'project': client.config['project'],
'session': client.config['session'], 'project': client.config['project'],
}; 'session': client.config['session'],
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
HttpMethod.get, return res.data;
path: apiPath, }
params: params,
responseType: ResponseType.bytes,
);
return res.data;
}
/// Use this endpoint to fetch a remote image URL and crop it to any image size /// Use this endpoint to fetch a remote image URL and crop it to any image size
/// you want. This endpoint is very useful if you need to crop and display /// you want. This endpoint is very useful if you need to crop and display
/// remote images in your app or in case you want to make sure a 3rd party /// remote images in your app or in case you want to make sure a 3rd party
/// image is properly served using a TLS protocol. /// image is properly served using a TLS protocol.
/// ///
/// When one dimension is specified and the other is 0, the image is scaled /// When one dimension is specified and the other is 0, the image is scaled
/// with preserved aspect ratio. If both dimensions are 0, the API provides an /// with preserved aspect ratio. If both dimensions are 0, the API provides an
/// image at source quality. If dimensions are not specified, the default size /// image at source quality. If dimensions are not specified, the default size
/// of image returned is 400x400px. /// of image returned is 400x400px.
/// ///
/// This endpoint does not follow HTTP redirects. /// This endpoint does not follow HTTP redirects.
Future<Uint8List> getImage({ Future<Uint8List> getImage({required String url, int? width, int? height}) async {
required String url, final String apiPath = '/avatars/image';
int? width,
int? height,
}) async {
final String apiPath = '/avatars/image';
final Map<String, dynamic> params = { final Map<String, dynamic> params = {
'url': url, 'url': url,
'width': width, 'width': width,
'height': height, 'height': height,
'project': client.config['project'],
'session': client.config['session'], 'project': client.config['project'],
}; 'session': client.config['session'],
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
HttpMethod.get, return res.data;
path: apiPath, }
params: params,
responseType: ResponseType.bytes,
);
return res.data;
}
/// Use this endpoint to show your user initials avatar icon on your website or /// Use this endpoint to show your user initials avatar icon on your website or
/// app. By default, this route will try to print your logged-in user name or /// app. By default, this route will try to print your logged-in user name or
/// email initials. You can also overwrite the user name if you pass the 'name' /// email initials. You can also overwrite the user name if you pass the 'name'
/// parameter. If no name is given and no user is logged, an empty avatar will /// parameter. If no name is given and no user is logged, an empty avatar will
/// be returned. /// be returned.
/// ///
/// You can use the color and background params to change the avatar colors. By /// You can use the color and background params to change the avatar colors. By
/// default, a random theme will be selected. The random theme will persist for /// default, a random theme will be selected. The random theme will persist for
/// the user's initials when reloading the same theme will always return for /// the user's initials when reloading the same theme will always return for
/// the same initials. /// the same initials.
/// ///
/// When one dimension is specified and the other is 0, the image is scaled /// When one dimension is specified and the other is 0, the image is scaled
/// with preserved aspect ratio. If both dimensions are 0, the API provides an /// with preserved aspect ratio. If both dimensions are 0, the API provides an
/// image at source quality. If dimensions are not specified, the default size /// image at source quality. If dimensions are not specified, the default size
/// of image returned is 100x100px. /// of image returned is 100x100px.
/// ///
Future<Uint8List> getInitials({ Future<Uint8List> getInitials({String? name, int? width, int? height, String? background}) async {
String? name, final String apiPath = '/avatars/initials';
int? width,
int? height,
String? background,
}) async {
final String apiPath = '/avatars/initials';
final Map<String, dynamic> params = { final Map<String, dynamic> params = {
'name': name, 'name': name,
'width': width, 'width': width,
'height': height, 'height': height,
'background': background, 'background': background,
'project': client.config['project'],
'session': client.config['session'], 'project': client.config['project'],
}; 'session': client.config['session'],
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
HttpMethod.get, return res.data;
path: apiPath, }
params: params,
responseType: ResponseType.bytes,
);
return res.data;
}
/// Converts a given plain text to a QR code image. You can use the query /// Converts a given plain text to a QR code image. You can use the query
/// parameters to change the size and style of the resulting image. /// parameters to change the size and style of the resulting image.
/// ///
Future<Uint8List> getQR({ Future<Uint8List> getQR({required String text, int? size, int? margin, bool? download}) async {
required String text, final String apiPath = '/avatars/qr';
int? size,
int? margin,
bool? download,
}) async {
final String apiPath = '/avatars/qr';
final Map<String, dynamic> params = { final Map<String, dynamic> params = {
'text': text, 'text': text,
'size': size, 'size': size,
'margin': margin, 'margin': margin,
'download': download, 'download': download,
'project': client.config['project'],
'session': client.config['session'], 'project': client.config['project'],
}; 'session': client.config['session'],
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
HttpMethod.get, return res.data;
path: apiPath, }
params: params, }
responseType: ResponseType.bytes,
);
return res.data;
}
}
+1211 -1550
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+36 -34
View File
@@ -3,47 +3,49 @@ part of '../dart_appwrite.dart';
/// The GraphQL API allows you to query and mutate your Appwrite server using /// The GraphQL API allows you to query and mutate your Appwrite server using
/// GraphQL. /// GraphQL.
class Graphql extends Service { class Graphql extends Service {
Graphql(super.client); Graphql(super.client);
/// Execute a GraphQL mutation. /// Execute a GraphQL mutation.
Future query({required Map query}) async { Future query({required Map query}) async {
final String apiPath = '/graphql'; final String apiPath = '/graphql';
final Map<String, dynamic> apiParams = {'query': query}; final Map<String, dynamic> apiParams = {
'query': query,
final Map<String, String> apiHeaders = { };
'x-sdk-graphql': 'true',
'content-type': 'application/json',
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.post, 'x-sdk-graphql': 'true',
path: apiPath, 'content-type': 'application/json',
params: apiParams,
headers: apiHeaders,
);
return res.data; };
}
/// Execute a GraphQL mutation. final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
Future mutation({required Map query}) async {
final String apiPath = '/graphql/mutation';
final Map<String, dynamic> apiParams = {'query': query}; return res.data;
final Map<String, String> apiHeaders = { }
'x-sdk-graphql': 'true',
'content-type': 'application/json',
};
final res = await client.call( /// Execute a GraphQL mutation.
HttpMethod.post, Future mutation({required Map query}) async {
path: apiPath, final String apiPath = '/graphql/mutation';
params: apiParams,
headers: apiHeaders,
);
return res.data; final Map<String, dynamic> apiParams = {
}
} 'query': query,
};
final Map<String, String> apiHeaders = {
'x-sdk-graphql': 'true',
'content-type': 'application/json',
};
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
return res.data;
}
}
+354 -329
View File
@@ -3,434 +3,459 @@ part of '../dart_appwrite.dart';
/// The Health service allows you to both validate and monitor your Appwrite /// The Health service allows you to both validate and monitor your Appwrite
/// server&#039;s health. /// server&#039;s health.
class Health extends Service { class Health extends Service {
Health(super.client); Health(super.client);
/// Check the Appwrite HTTP server is up and responsive. /// Check the Appwrite HTTP server is up and responsive.
Future<models.HealthStatus> get() async { Future<models.HealthStatus> get() async {
final String apiPath = '/health'; final String apiPath = '/health';
final Map<String, dynamic> apiParams = {}; final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {}; final Map<String, String> apiHeaders = {
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthStatus.fromMap(res.data); return models.HealthStatus.fromMap(res.data);
}
/// Check the Appwrite Antivirus server is up and connection is successful. }
Future<models.HealthAntivirus> getAntivirus() async {
final String apiPath = '/health/anti-virus';
final Map<String, dynamic> apiParams = {}; /// Check the Appwrite Antivirus server is up and connection is successful.
Future<models.HealthAntivirus> getAntivirus() async {
final String apiPath = '/health/anti-virus';
final Map<String, String> apiHeaders = {}; final Map<String, dynamic> apiParams = {
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: apiParams,
headers: apiHeaders,
);
return models.HealthAntivirus.fromMap(res.data); final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
}
/// Check the Appwrite in-memory cache servers are up and connection is return models.HealthAntivirus.fromMap(res.data);
/// successful.
Future<models.HealthStatus> getCache() async {
final String apiPath = '/health/cache';
final Map<String, dynamic> apiParams = {}; }
final Map<String, String> apiHeaders = {}; /// Check the Appwrite in-memory cache servers are up and connection is
/// successful.
Future<models.HealthStatus> getCache() async {
final String apiPath = '/health/cache';
final res = await client.call( final Map<String, dynamic> apiParams = {
HttpMethod.get,
path: apiPath,
params: apiParams, };
headers: apiHeaders,
);
return models.HealthStatus.fromMap(res.data); final Map<String, String> apiHeaders = {
}
};
/// Get the SSL certificate for a domain final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
Future<models.HealthCertificate> getCertificate({String? domain}) async {
final String apiPath = '/health/certificate';
final Map<String, dynamic> apiParams = {'domain': domain}; return models.HealthStatus.fromMap(res.data);
final Map<String, String> apiHeaders = {}; }
final res = await client.call( /// Get the SSL certificate for a domain
HttpMethod.get, Future<models.HealthCertificate> getCertificate({String? domain}) async {
path: apiPath, final String apiPath = '/health/certificate';
params: apiParams,
headers: apiHeaders,
);
return models.HealthCertificate.fromMap(res.data); final Map<String, dynamic> apiParams = {
} 'domain': domain,
/// Check the Appwrite database servers are up and connection is successful.
Future<models.HealthStatus> getDB() async { };
final String apiPath = '/health/db';
final Map<String, dynamic> apiParams = {}; final Map<String, String> apiHeaders = {
};
final Map<String, String> apiHeaders = {}; final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
final res = await client.call( return models.HealthCertificate.fromMap(res.data);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthStatus.fromMap(res.data); }
}
/// Check the Appwrite pub-sub servers are up and connection is successful. /// Check the Appwrite database servers are up and connection is successful.
Future<models.HealthStatus> getPubSub() async { Future<models.HealthStatus> getDB() async {
final String apiPath = '/health/pubsub'; final String apiPath = '/health/db';
final Map<String, dynamic> apiParams = {}; final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {}; final Map<String, String> apiHeaders = {
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthStatus.fromMap(res.data); return models.HealthStatus.fromMap(res.data);
}
/// Get the number of builds that are waiting to be processed in the Appwrite }
/// internal queue server.
Future<models.HealthQueue> getQueueBuilds({int? threshold}) async {
final String apiPath = '/health/queue/builds';
final Map<String, dynamic> apiParams = {'threshold': threshold}; /// Check the Appwrite pub-sub servers are up and connection is successful.
Future<models.HealthStatus> getPubSub() async {
final String apiPath = '/health/pubsub';
final Map<String, String> apiHeaders = {}; final Map<String, dynamic> apiParams = {
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
}
/// Get the number of certificates that are waiting to be issued against return models.HealthStatus.fromMap(res.data);
/// [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
/// server.
Future<models.HealthQueue> getQueueCertificates({int? threshold}) async {
final String apiPath = '/health/queue/certificates';
final Map<String, dynamic> apiParams = {'threshold': threshold}; }
final Map<String, String> apiHeaders = {}; /// Get the number of builds that are waiting to be processed in the Appwrite
/// internal queue server.
Future<models.HealthQueue> getQueueBuilds({int? threshold}) async {
final String apiPath = '/health/queue/builds';
final res = await client.call( final Map<String, dynamic> apiParams = {
HttpMethod.get, 'threshold': threshold,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data);
} };
/// Get the number of database changes that are waiting to be processed in the final Map<String, String> apiHeaders = {
/// Appwrite internal queue server.
Future<models.HealthQueue> getQueueDatabases({ };
String? name,
int? threshold,
}) async {
final String apiPath = '/health/queue/databases';
final Map<String, dynamic> apiParams = { final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
'name': name,
'threshold': threshold,
};
final Map<String, String> apiHeaders = {}; return models.HealthQueue.fromMap(res.data);
final res = await client.call( }
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); /// Get the number of certificates that are waiting to be issued against
} /// [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
/// server.
Future<models.HealthQueue> getQueueCertificates({int? threshold}) async {
final String apiPath = '/health/queue/certificates';
/// Get the number of background destructive changes that are waiting to be final Map<String, dynamic> apiParams = {
/// processed in the Appwrite internal queue server. 'threshold': threshold,
Future<models.HealthQueue> getQueueDeletes({int? threshold}) async {
final String apiPath = '/health/queue/deletes';
final Map<String, dynamic> apiParams = {'threshold': threshold};
final Map<String, String> apiHeaders = {};
final res = await client.call(
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data);
}
/// Returns the amount of failed jobs in a given queue.
///
Future<models.HealthQueue> getFailedJobs({
required enums.Name name,
int? threshold,
}) async {
final String apiPath = '/health/queue/failed/{name}'.replaceAll(
'{name}',
name.value,
);
final Map<String, dynamic> apiParams = {'threshold': threshold};
};
final Map<String, String> apiHeaders = {}; final Map<String, String> apiHeaders = {
final res = await client.call( };
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
}
/// Get the number of function executions that are waiting to be processed in
/// the Appwrite internal queue server.
Future<models.HealthQueue> getQueueFunctions({int? threshold}) async {
final String apiPath = '/health/queue/functions';
final Map<String, dynamic> apiParams = {'threshold': threshold}; return models.HealthQueue.fromMap(res.data);
final Map<String, String> apiHeaders = {}; }
final res = await client.call(
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); /// Get the number of database changes that are waiting to be processed in the
} /// Appwrite internal queue server.
Future<models.HealthQueue> getQueueDatabases({String? name, int? threshold}) async {
final String apiPath = '/health/queue/databases';
/// Get the number of logs that are waiting to be processed in the Appwrite final Map<String, dynamic> apiParams = {
/// internal queue server. 'name': name,
Future<models.HealthQueue> getQueueLogs({int? threshold}) async { 'threshold': threshold,
final String apiPath = '/health/queue/logs';
final Map<String, dynamic> apiParams = {'threshold': threshold};
};
final Map<String, String> apiHeaders = {}; final Map<String, String> apiHeaders = {
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); return models.HealthQueue.fromMap(res.data);
}
/// Get the number of mails that are waiting to be processed in the Appwrite }
/// internal queue server.
Future<models.HealthQueue> getQueueMails({int? threshold}) async {
final String apiPath = '/health/queue/mails';
final Map<String, dynamic> apiParams = {'threshold': threshold}; /// Get the number of background destructive changes that are waiting to be
/// processed in the Appwrite internal queue server.
Future<models.HealthQueue> getQueueDeletes({int? threshold}) async {
final String apiPath = '/health/queue/deletes';
final Map<String, String> apiHeaders = {}; final Map<String, dynamic> apiParams = {
'threshold': threshold,
final res = await client.call(
HttpMethod.get, };
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); final Map<String, String> apiHeaders = {
}
};
/// Get the number of messages that are waiting to be processed in the Appwrite final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
/// internal queue server.
Future<models.HealthQueue> getQueueMessaging({int? threshold}) async {
final String apiPath = '/health/queue/messaging';
final Map<String, dynamic> apiParams = {'threshold': threshold}; return models.HealthQueue.fromMap(res.data);
final Map<String, String> apiHeaders = {}; }
final res = await client.call( /// Returns the amount of failed jobs in a given queue.
HttpMethod.get, ///
path: apiPath, Future<models.HealthQueue> getFailedJobs({required enums.Name name, int? threshold}) async {
params: apiParams, final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value);
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); final Map<String, dynamic> apiParams = {
} 'threshold': threshold,
/// Get the number of migrations that are waiting to be processed in the
/// Appwrite internal queue server. };
Future<models.HealthQueue> getQueueMigrations({int? threshold}) async {
final String apiPath = '/health/queue/migrations';
final Map<String, dynamic> apiParams = {'threshold': threshold}; final Map<String, String> apiHeaders = {
};
final Map<String, String> apiHeaders = {}; final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
final res = await client.call( return models.HealthQueue.fromMap(res.data);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); }
}
/// Get the number of metrics that are waiting to be processed in the Appwrite /// Get the number of function executions that are waiting to be processed in
/// stats resources queue. /// the Appwrite internal queue server.
Future<models.HealthQueue> getQueueStatsResources({int? threshold}) async { Future<models.HealthQueue> getQueueFunctions({int? threshold}) async {
final String apiPath = '/health/queue/stats-resources'; final String apiPath = '/health/queue/functions';
final Map<String, dynamic> apiParams = {'threshold': threshold}; final Map<String, dynamic> apiParams = {
'threshold': threshold,
final Map<String, String> apiHeaders = {};
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
}
/// Get the number of metrics that are waiting to be processed in the Appwrite return models.HealthQueue.fromMap(res.data);
/// internal queue server.
Future<models.HealthQueue> getQueueUsage({int? threshold}) async {
final String apiPath = '/health/queue/stats-usage';
final Map<String, dynamic> apiParams = {'threshold': threshold}; }
final Map<String, String> apiHeaders = {}; /// Get the number of logs that are waiting to be processed in the Appwrite
/// internal queue server.
Future<models.HealthQueue> getQueueLogs({int? threshold}) async {
final String apiPath = '/health/queue/logs';
final res = await client.call( final Map<String, dynamic> apiParams = {
HttpMethod.get, 'threshold': threshold,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data);
} };
/// Get the number of webhooks that are waiting to be processed in the Appwrite final Map<String, String> apiHeaders = {
/// internal queue server.
Future<models.HealthQueue> getQueueWebhooks({int? threshold}) async { };
final String apiPath = '/health/queue/webhooks';
final Map<String, dynamic> apiParams = {'threshold': threshold}; final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
final Map<String, String> apiHeaders = {}; return models.HealthQueue.fromMap(res.data);
final res = await client.call( }
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthQueue.fromMap(res.data); /// Get the number of mails that are waiting to be processed in the Appwrite
} /// internal queue server.
Future<models.HealthQueue> getQueueMails({int? threshold}) async {
final String apiPath = '/health/queue/mails';
/// Check the Appwrite storage device is up and connection is successful. final Map<String, dynamic> apiParams = {
Future<models.HealthStatus> getStorage() async { 'threshold': threshold,
final String apiPath = '/health/storage';
final Map<String, dynamic> apiParams = {};
};
final Map<String, String> apiHeaders = {}; final Map<String, String> apiHeaders = {
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthStatus.fromMap(res.data); return models.HealthQueue.fromMap(res.data);
}
/// Check the Appwrite local storage device is up and connection is successful. }
Future<models.HealthStatus> getStorageLocal() async {
final String apiPath = '/health/storage/local';
final Map<String, dynamic> apiParams = {}; /// Get the number of messages that are waiting to be processed in the Appwrite
/// internal queue server.
Future<models.HealthQueue> getQueueMessaging({int? threshold}) async {
final String apiPath = '/health/queue/messaging';
final Map<String, String> apiHeaders = {}; final Map<String, dynamic> apiParams = {
'threshold': threshold,
final res = await client.call(
HttpMethod.get, };
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.HealthStatus.fromMap(res.data); final Map<String, String> apiHeaders = {
}
};
/// Check the Appwrite server time is synced with Google remote NTP server. We final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
/// use this technology to smoothly handle leap seconds with no disruptive
/// events. The [Network Time
/// Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
/// used by hundreds of millions of computers and devices to synchronize their
/// clocks over the Internet. If your computer sets its own clock, it likely
/// uses NTP.
Future<models.HealthTime> getTime() async {
final String apiPath = '/health/time';
final Map<String, dynamic> apiParams = {}; return models.HealthQueue.fromMap(res.data);
final Map<String, String> apiHeaders = {}; }
final res = await client.call( /// Get the number of migrations that are waiting to be processed in the
HttpMethod.get, /// Appwrite internal queue server.
path: apiPath, Future<models.HealthQueue> getQueueMigrations({int? threshold}) async {
params: apiParams, final String apiPath = '/health/queue/migrations';
headers: apiHeaders,
);
return models.HealthTime.fromMap(res.data); final Map<String, dynamic> apiParams = {
} 'threshold': threshold,
}
};
final Map<String, String> apiHeaders = {
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
return models.HealthQueue.fromMap(res.data);
}
/// Get the number of metrics that are waiting to be processed in the Appwrite
/// stats resources queue.
Future<models.HealthQueue> getQueueStatsResources({int? threshold}) async {
final String apiPath = '/health/queue/stats-resources';
final Map<String, dynamic> apiParams = {
'threshold': threshold,
};
final Map<String, String> apiHeaders = {
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
return models.HealthQueue.fromMap(res.data);
}
/// Get the number of metrics that are waiting to be processed in the Appwrite
/// internal queue server.
Future<models.HealthQueue> getQueueUsage({int? threshold}) async {
final String apiPath = '/health/queue/stats-usage';
final Map<String, dynamic> apiParams = {
'threshold': threshold,
};
final Map<String, String> apiHeaders = {
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
return models.HealthQueue.fromMap(res.data);
}
/// Get the number of webhooks that are waiting to be processed in the Appwrite
/// internal queue server.
Future<models.HealthQueue> getQueueWebhooks({int? threshold}) async {
final String apiPath = '/health/queue/webhooks';
final Map<String, dynamic> apiParams = {
'threshold': threshold,
};
final Map<String, String> apiHeaders = {
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
return models.HealthQueue.fromMap(res.data);
}
/// Check the Appwrite storage device is up and connection is successful.
Future<models.HealthStatus> getStorage() async {
final String apiPath = '/health/storage';
final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
return models.HealthStatus.fromMap(res.data);
}
/// Check the Appwrite local storage device is up and connection is successful.
Future<models.HealthStatus> getStorageLocal() async {
final String apiPath = '/health/storage/local';
final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
return models.HealthStatus.fromMap(res.data);
}
/// Check the Appwrite server time is synced with Google remote NTP server. We
/// use this technology to smoothly handle leap seconds with no disruptive
/// events. The [Network Time
/// Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
/// used by hundreds of millions of computers and devices to synchronize their
/// clocks over the Internet. If your computer sets its own clock, it likely
/// uses NTP.
Future<models.HealthTime> getTime() async {
final String apiPath = '/health/time';
final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
return models.HealthTime.fromMap(res.data);
}
}
+127 -119
View File
@@ -3,162 +3,170 @@ part of '../dart_appwrite.dart';
/// The Locale service allows you to customize your app based on your users&#039; /// The Locale service allows you to customize your app based on your users&#039;
/// location. /// location.
class Locale extends Service { class Locale extends Service {
Locale(super.client); Locale(super.client);
/// Get the current user location based on IP. Returns an object with user /// Get the current user location based on IP. Returns an object with user
/// country code, country name, continent name, continent code, ip address and /// country code, country name, continent name, continent code, ip address and
/// suggested currency. You can use the locale header to get the data in a /// suggested currency. You can use the locale header to get the data in a
/// supported language. /// supported language.
/// ///
/// ([IP Geolocation by DB-IP](https://db-ip.com)) /// ([IP Geolocation by DB-IP](https://db-ip.com))
Future<models.Locale> get() async { Future<models.Locale> get() async {
final String apiPath = '/locale'; final String apiPath = '/locale';
final Map<String, dynamic> apiParams = {}; final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {}; final Map<String, String> apiHeaders = {
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.Locale.fromMap(res.data); return models.Locale.fromMap(res.data);
}
/// List of all locale codes in [ISO }
/// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
Future<models.LocaleCodeList> listCodes() async {
final String apiPath = '/locale/codes';
final Map<String, dynamic> apiParams = {}; /// List of all locale codes in [ISO
/// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
Future<models.LocaleCodeList> listCodes() async {
final String apiPath = '/locale/codes';
final Map<String, String> apiHeaders = {}; final Map<String, dynamic> apiParams = {
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: apiParams,
headers: apiHeaders,
);
return models.LocaleCodeList.fromMap(res.data); final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
}
/// List of all continents. You can use the locale header to get the data in a return models.LocaleCodeList.fromMap(res.data);
/// supported language.
Future<models.ContinentList> listContinents() async {
final String apiPath = '/locale/continents';
final Map<String, dynamic> apiParams = {}; }
final Map<String, String> apiHeaders = {}; /// List of all continents. You can use the locale header to get the data in a
/// supported language.
Future<models.ContinentList> listContinents() async {
final String apiPath = '/locale/continents';
final res = await client.call( final Map<String, dynamic> apiParams = {
HttpMethod.get,
path: apiPath,
params: apiParams, };
headers: apiHeaders,
);
return models.ContinentList.fromMap(res.data); final Map<String, String> apiHeaders = {
}
};
/// List of all countries. You can use the locale header to get the data in a final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
/// supported language.
Future<models.CountryList> listCountries() async {
final String apiPath = '/locale/countries';
final Map<String, dynamic> apiParams = {}; return models.ContinentList.fromMap(res.data);
final Map<String, String> apiHeaders = {}; }
final res = await client.call( /// List of all countries. You can use the locale header to get the data in a
HttpMethod.get, /// supported language.
path: apiPath, Future<models.CountryList> listCountries() async {
params: apiParams, final String apiPath = '/locale/countries';
headers: apiHeaders,
);
return models.CountryList.fromMap(res.data); final Map<String, dynamic> apiParams = {
}
};
/// List of all countries that are currently members of the EU. You can use the final Map<String, String> apiHeaders = {
/// locale header to get the data in a supported language.
Future<models.CountryList> listCountriesEU() async { };
final String apiPath = '/locale/countries/eu';
final Map<String, dynamic> apiParams = {}; final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
final Map<String, String> apiHeaders = {}; return models.CountryList.fromMap(res.data);
final res = await client.call( }
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.CountryList.fromMap(res.data); /// List of all countries that are currently members of the EU. You can use the
} /// locale header to get the data in a supported language.
Future<models.CountryList> listCountriesEU() async {
final String apiPath = '/locale/countries/eu';
/// List of all countries phone codes. You can use the locale header to get the final Map<String, dynamic> apiParams = {
/// data in a supported language.
Future<models.PhoneList> listCountriesPhones() async {
final String apiPath = '/locale/countries/phones'; };
final Map<String, dynamic> apiParams = {}; final Map<String, String> apiHeaders = {
};
final Map<String, String> apiHeaders = {}; final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
final res = await client.call( return models.CountryList.fromMap(res.data);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.PhoneList.fromMap(res.data); }
}
/// List of all currencies, including currency symbol, name, plural, and /// List of all countries phone codes. You can use the locale header to get the
/// decimal digits for all major and minor currencies. You can use the locale /// data in a supported language.
/// header to get the data in a supported language. Future<models.PhoneList> listCountriesPhones() async {
Future<models.CurrencyList> listCurrencies() async { final String apiPath = '/locale/countries/phones';
final String apiPath = '/locale/currencies';
final Map<String, dynamic> apiParams = {}; final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {}; final Map<String, String> apiHeaders = {
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.CurrencyList.fromMap(res.data); return models.PhoneList.fromMap(res.data);
}
/// List of all languages classified by ISO 639-1 including 2-letter code, name }
/// in English, and name in the respective language.
Future<models.LanguageList> listLanguages() async {
final String apiPath = '/locale/languages';
final Map<String, dynamic> apiParams = {}; /// List of all currencies, including currency symbol, name, plural, and
/// decimal digits for all major and minor currencies. You can use the locale
/// header to get the data in a supported language.
Future<models.CurrencyList> listCurrencies() async {
final String apiPath = '/locale/currencies';
final Map<String, String> apiHeaders = {}; final Map<String, dynamic> apiParams = {
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: apiParams,
headers: apiHeaders,
);
return models.LanguageList.fromMap(res.data); final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
}
} return models.CurrencyList.fromMap(res.data);
}
/// List of all languages classified by ISO 639-1 including 2-letter code, name
/// in English, and name in the respective language.
Future<models.LanguageList> listLanguages() async {
final String apiPath = '/locale/languages';
final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
return models.LanguageList.fromMap(res.data);
}
}
+1155 -1473
View File
File diff suppressed because it is too large Load Diff
+582 -700
View File
File diff suppressed because it is too large Load Diff
+264 -356
View File
@@ -2,421 +2,329 @@ part of '../dart_appwrite.dart';
/// The Storage service allows you to manage your project files. /// The Storage service allows you to manage your project files.
class Storage extends Service { class Storage extends Service {
Storage(super.client); Storage(super.client);
/// Get a list of all the storage buckets. You can use the query params to /// Get a list of all the storage buckets. You can use the query params to
/// filter your results. /// filter your results.
Future<models.BucketList> listBuckets({ Future<models.BucketList> listBuckets({List<String>? queries, String? search}) async {
List<String>? queries, final String apiPath = '/storage/buckets';
String? search,
}) async {
final String apiPath = '/storage/buckets';
final Map<String, dynamic> apiParams = { final Map<String, dynamic> apiParams = {
'queries': queries, 'queries': queries,
'search': search, 'search': search,
};
final Map<String, String> apiHeaders = {};
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: apiParams,
headers: apiHeaders,
);
return models.BucketList.fromMap(res.data); final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
}
/// Create a new storage bucket. return models.BucketList.fromMap(res.data);
Future<models.Bucket> createBucket({
required String bucketId,
required String name,
List<String>? permissions,
bool? fileSecurity,
bool? enabled,
int? maximumFileSize,
List<String>? allowedFileExtensions,
enums.Compression? compression,
bool? encryption,
bool? antivirus,
}) async {
final String apiPath = '/storage/buckets';
final Map<String, dynamic> apiParams = { }
'bucketId': bucketId,
'name': name,
'permissions': permissions,
'fileSecurity': fileSecurity,
'enabled': enabled,
'maximumFileSize': maximumFileSize,
'allowedFileExtensions': allowedFileExtensions,
'compression': compression?.value,
'encryption': encryption,
'antivirus': antivirus,
};
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; /// Create a new storage bucket.
Future<models.Bucket> createBucket({required String bucketId, required String name, List<String>? permissions, bool? fileSecurity, bool? enabled, int? maximumFileSize, List<String>? allowedFileExtensions, enums.Compression? compression, bool? encryption, bool? antivirus}) async {
final String apiPath = '/storage/buckets';
final res = await client.call( final Map<String, dynamic> apiParams = {
HttpMethod.post,
path: apiPath, 'bucketId': bucketId,
params: apiParams, 'name': name,
headers: apiHeaders, 'permissions': permissions,
); 'fileSecurity': fileSecurity,
'enabled': enabled,
'maximumFileSize': maximumFileSize,
'allowedFileExtensions': allowedFileExtensions,
'compression': compression?.value,
'encryption': encryption,
'antivirus': antivirus,
return models.Bucket.fromMap(res.data); };
}
/// Get a storage bucket by its unique ID. This endpoint response returns a final Map<String, String> apiHeaders = {
/// JSON object with the storage bucket metadata. 'content-type': 'application/json',
Future<models.Bucket> getBucket({required String bucketId}) async {
final String apiPath = '/storage/buckets/{bucketId}'.replaceAll(
'{bucketId}',
bucketId,
);
final Map<String, dynamic> apiParams = {}; };
final Map<String, String> apiHeaders = {}; final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
final res = await client.call( return models.Bucket.fromMap(res.data);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.Bucket.fromMap(res.data); }
}
/// Update a storage bucket by its unique ID. /// Get a storage bucket by its unique ID. This endpoint response returns a
Future<models.Bucket> updateBucket({ /// JSON object with the storage bucket metadata.
required String bucketId, Future<models.Bucket> getBucket({required String bucketId}) async {
required String name, final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId);
List<String>? permissions,
bool? fileSecurity,
bool? enabled,
int? maximumFileSize,
List<String>? allowedFileExtensions,
enums.Compression? compression,
bool? encryption,
bool? antivirus,
}) async {
final String apiPath = '/storage/buckets/{bucketId}'.replaceAll(
'{bucketId}',
bucketId,
);
final Map<String, dynamic> apiParams = { final Map<String, dynamic> apiParams = {
'name': name,
'permissions': permissions,
'fileSecurity': fileSecurity, };
'enabled': enabled,
'maximumFileSize': maximumFileSize,
'allowedFileExtensions': allowedFileExtensions,
'compression': compression?.value,
'encryption': encryption,
'antivirus': antivirus,
};
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; final Map<String, String> apiHeaders = {
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
HttpMethod.put,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.Bucket.fromMap(res.data); return models.Bucket.fromMap(res.data);
}
/// Delete a storage bucket by its unique ID. }
Future deleteBucket({required String bucketId}) async {
final String apiPath = '/storage/buckets/{bucketId}'.replaceAll(
'{bucketId}',
bucketId,
);
final Map<String, dynamic> apiParams = {}; /// Update a storage bucket by its unique ID.
Future<models.Bucket> updateBucket({required String bucketId, required String name, List<String>? permissions, bool? fileSecurity, bool? enabled, int? maximumFileSize, List<String>? allowedFileExtensions, enums.Compression? compression, bool? encryption, bool? antivirus}) async {
final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId);
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; final Map<String, dynamic> apiParams = {
'name': name,
'permissions': permissions,
'fileSecurity': fileSecurity,
'enabled': enabled,
'maximumFileSize': maximumFileSize,
'allowedFileExtensions': allowedFileExtensions,
'compression': compression?.value,
'encryption': encryption,
'antivirus': antivirus,
final res = await client.call( };
HttpMethod.delete,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return res.data; final Map<String, String> apiHeaders = {
} 'content-type': 'application/json',
/// Get a list of all the user files. You can use the query params to filter };
/// your results.
Future<models.FileList> listFiles({
required String bucketId,
List<String>? queries,
String? search,
}) async {
final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll(
'{bucketId}',
bucketId,
);
final Map<String, dynamic> apiParams = { final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders);
'queries': queries,
'search': search,
};
final Map<String, String> apiHeaders = {}; return models.Bucket.fromMap(res.data);
final res = await client.call( }
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.FileList.fromMap(res.data); /// Delete a storage bucket by its unique ID.
} Future deleteBucket({required String bucketId}) async {
final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId);
/// Create a new file. Before using this route, you should create a new bucket final Map<String, dynamic> apiParams = {
/// resource using either a [server
/// integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
/// API or directly from your Appwrite console. };
///
/// Larger files should be uploaded using multiple requests with the
/// [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
/// header to send a partial request with a maximum supported chunk of `5MB`.
/// The `content-range` header values should always be in bytes.
///
/// When the first request is sent, the server will return the **File** object,
/// and the subsequent part request must include the file's **id** in
/// `x-appwrite-id` header to allow the server to know that the partial upload
/// is for the existing file and not for a new one.
///
/// If you're creating a new file using one of the Appwrite SDKs, all the
/// chunking logic will be managed by the SDK internally.
///
Future<models.File> createFile({
required String bucketId,
required String fileId,
required InputFile file,
List<String>? permissions,
Function(UploadProgress)? onProgress,
}) async {
final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll(
'{bucketId}',
bucketId,
);
final Map<String, dynamic> apiParams = { final Map<String, String> apiHeaders = {
'fileId': fileId, 'content-type': 'application/json',
'file': file,
'permissions': permissions,
};
final Map<String, String> apiHeaders = { };
'content-type': 'multipart/form-data',
};
String idParamName = ''; final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders);
idParamName = 'fileId';
final paramName = 'file';
final res = await client.chunkedUpload(
path: apiPath,
params: apiParams,
paramName: paramName,
idParamName: idParamName,
headers: apiHeaders,
onProgress: onProgress,
);
return models.File.fromMap(res.data); return res.data;
}
/// Get a file by its unique ID. This endpoint response returns a JSON object }
/// with the file metadata.
Future<models.File> getFile({
required String bucketId,
required String fileId,
}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'
.replaceAll('{bucketId}', bucketId)
.replaceAll('{fileId}', fileId);
final Map<String, dynamic> apiParams = {}; /// Get a list of all the user files. You can use the query params to filter
/// your results.
Future<models.FileList> listFiles({required String bucketId, List<String>? queries, String? search}) async {
final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId);
final Map<String, String> apiHeaders = {}; final Map<String, dynamic> apiParams = {
'queries': queries,
'search': search,
final res = await client.call(
HttpMethod.get, };
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.File.fromMap(res.data); final Map<String, String> apiHeaders = {
}
};
/// Update a file by its unique ID. Only users with write permissions have final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
/// access to update this resource.
Future<models.File> updateFile({
required String bucketId,
required String fileId,
String? name,
List<String>? permissions,
}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'
.replaceAll('{bucketId}', bucketId)
.replaceAll('{fileId}', fileId);
final Map<String, dynamic> apiParams = { return models.FileList.fromMap(res.data);
'name': name,
'permissions': permissions,
};
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; }
final res = await client.call( /// Create a new file. Before using this route, you should create a new bucket
HttpMethod.put, /// resource using either a [server
path: apiPath, /// integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
params: apiParams, /// API or directly from your Appwrite console.
headers: apiHeaders, ///
); /// Larger files should be uploaded using multiple requests with the
/// [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
/// header to send a partial request with a maximum supported chunk of `5MB`.
/// The `content-range` header values should always be in bytes.
///
/// When the first request is sent, the server will return the **File** object,
/// and the subsequent part request must include the file's **id** in
/// `x-appwrite-id` header to allow the server to know that the partial upload
/// is for the existing file and not for a new one.
///
/// If you're creating a new file using one of the Appwrite SDKs, all the
/// chunking logic will be managed by the SDK internally.
///
Future<models.File> createFile({required String bucketId, required String fileId, required InputFile file, List<String>? permissions, Function(UploadProgress)? onProgress}) async {
final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId);
return models.File.fromMap(res.data); final Map<String, dynamic> apiParams = {
}
'fileId': fileId,
'file': file,
'permissions': permissions,
/// Delete a file by its unique ID. Only users with write permissions have };
/// access to delete this resource.
Future deleteFile({required String bucketId, required String fileId}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'
.replaceAll('{bucketId}', bucketId)
.replaceAll('{fileId}', fileId);
final Map<String, dynamic> apiParams = {}; final Map<String, String> apiHeaders = {
'content-type': 'multipart/form-data',
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; };
final res = await client.call( String idParamName = '';
HttpMethod.delete, idParamName = 'fileId';
path: apiPath, final paramName = 'file';
params: apiParams, final res = await client.chunkedUpload(
headers: apiHeaders, path: apiPath,
); params: apiParams,
paramName: paramName,
idParamName: idParamName,
headers: apiHeaders,
onProgress: onProgress,
);
return res.data; return models.File.fromMap(res.data);
}
/// Get a file content by its unique ID. The endpoint response return with a }
/// 'Content-Disposition: attachment' header that tells the browser to start
/// downloading the file to user downloads directory.
Future<Uint8List> getFileDownload({
required String bucketId,
required String fileId,
String? token,
}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'
.replaceAll('{bucketId}', bucketId)
.replaceAll('{fileId}', fileId);
final Map<String, dynamic> params = { /// Get a file by its unique ID. This endpoint response returns a JSON object
'token': token, /// with the file metadata.
Future<models.File> getFile({required String bucketId, required String fileId}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
'project': client.config['project'], final Map<String, dynamic> apiParams = {
'session': client.config['session'],
};
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: params,
responseType: ResponseType.bytes,
);
return res.data;
}
/// Get a file preview image. Currently, this method supports preview for image final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
/// files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
/// and spreadsheets, will return the file icon image. You can also pass query
/// string arguments for cutting and resizing your preview image. Preview is
/// supported only for image files smaller than 10MB.
Future<Uint8List> getFilePreview({
required String bucketId,
required String fileId,
int? width,
int? height,
enums.ImageGravity? gravity,
int? quality,
int? borderWidth,
String? borderColor,
int? borderRadius,
double? opacity,
int? rotation,
String? background,
enums.ImageFormat? output,
String? token,
}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'
.replaceAll('{bucketId}', bucketId)
.replaceAll('{fileId}', fileId);
final Map<String, dynamic> params = { return models.File.fromMap(res.data);
'width': width,
'height': height,
'gravity': gravity?.value,
'quality': quality,
'borderWidth': borderWidth,
'borderColor': borderColor,
'borderRadius': borderRadius,
'opacity': opacity,
'rotation': rotation,
'background': background,
'output': output?.value,
'token': token,
'project': client.config['project'], }
'session': client.config['session'],
};
final res = await client.call( /// Update a file by its unique ID. Only users with write permissions have
HttpMethod.get, /// access to update this resource.
path: apiPath, Future<models.File> updateFile({required String bucketId, required String fileId, String? name, List<String>? permissions}) async {
params: params, final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
responseType: ResponseType.bytes,
);
return res.data;
}
/// Get a file content by its unique ID. This endpoint is similar to the final Map<String, dynamic> apiParams = {
/// download method but returns with no 'Content-Disposition: attachment'
/// header. 'name': name,
Future<Uint8List> getFileView({ 'permissions': permissions,
required String bucketId,
required String fileId,
String? token,
}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'
.replaceAll('{bucketId}', bucketId)
.replaceAll('{fileId}', fileId);
final Map<String, dynamic> params = { };
'token': token,
'project': client.config['project'], final Map<String, String> apiHeaders = {
'session': client.config['session'], 'content-type': 'application/json',
};
final res = await client.call( };
HttpMethod.get,
path: apiPath, final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders);
params: params,
responseType: ResponseType.bytes, return models.File.fromMap(res.data);
);
return res.data; }
}
} /// Delete a file by its unique ID. Only users with write permissions have
/// access to delete this resource.
Future deleteFile({required String bucketId, required String fileId}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {
'content-type': 'application/json',
};
final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders);
return res.data;
}
/// Get a file content by its unique ID. The endpoint response return with a
/// 'Content-Disposition: attachment' header that tells the browser to start
/// downloading the file to user downloads directory.
Future<Uint8List> getFileDownload({required String bucketId, required String fileId, String? token}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
final Map<String, dynamic> params = {
'token': token,
'project': client.config['project'],
'session': client.config['session'],
};
final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
return res.data;
}
/// Get a file preview image. Currently, this method supports preview for image
/// files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
/// and spreadsheets, will return the file icon image. You can also pass query
/// string arguments for cutting and resizing your preview image. Preview is
/// supported only for image files smaller than 10MB.
Future<Uint8List> getFilePreview({required String bucketId, required String fileId, int? width, int? height, enums.ImageGravity? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, enums.ImageFormat? output, String? token}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
final Map<String, dynamic> params = {
'width': width,
'height': height,
'gravity': gravity?.value,
'quality': quality,
'borderWidth': borderWidth,
'borderColor': borderColor,
'borderRadius': borderRadius,
'opacity': opacity,
'rotation': rotation,
'background': background,
'output': output?.value,
'token': token,
'project': client.config['project'],
'session': client.config['session'],
};
final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
return res.data;
}
/// Get a file content by its unique ID. This endpoint is similar to the
/// download method but returns with no 'Content-Disposition: attachment'
/// header.
Future<Uint8List> getFileView({required String bucketId, required String fileId, String? token}) async {
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
final Map<String, dynamic> params = {
'token': token,
'project': client.config['project'],
'session': client.config['session'],
};
final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
return res.data;
}
}
File diff suppressed because it is too large Load Diff
+318 -353
View File
@@ -3,356 +3,321 @@ part of '../dart_appwrite.dart';
/// The Teams service allows you to group users of your project and to enable /// The Teams service allows you to group users of your project and to enable
/// them to share read and write access to your project resources /// them to share read and write access to your project resources
class Teams extends Service { class Teams extends Service {
Teams(super.client); Teams(super.client);
/// Get a list of all the teams in which the current user is a member. You can /// Get a list of all the teams in which the current user is a member. You can
/// use the parameters to filter your results. /// use the parameters to filter your results.
Future<models.TeamList> list({List<String>? queries, String? search}) async { Future<models.TeamList> list({List<String>? queries, String? search}) async {
final String apiPath = '/teams'; final String apiPath = '/teams';
final Map<String, dynamic> apiParams = { final Map<String, dynamic> apiParams = {
'queries': queries, 'queries': queries,
'search': search, 'search': search,
};
final Map<String, String> apiHeaders = {}; };
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: apiParams,
headers: apiHeaders, final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
);
return models.TeamList.fromMap(res.data);
return models.TeamList.fromMap(res.data);
} }
/// Create a new team. The user who creates the team will automatically be /// Create a new team. The user who creates the team will automatically be
/// assigned as the owner of the team. Only the users with the owner role can /// assigned as the owner of the team. Only the users with the owner role can
/// invite new members, add new owners and delete or update the team. /// invite new members, add new owners and delete or update the team.
Future<models.Team> create({ Future<models.Team> create({required String teamId, required String name, List<String>? roles}) async {
required String teamId, final String apiPath = '/teams';
required String name,
List<String>? roles, final Map<String, dynamic> apiParams = {
}) async {
final String apiPath = '/teams'; 'teamId': teamId,
'name': name,
final Map<String, dynamic> apiParams = { 'roles': roles,
'teamId': teamId,
'name': name, };
'roles': roles,
}; final Map<String, String> apiHeaders = {
'content-type': 'application/json',
final Map<String, String> apiHeaders = {'content-type': 'application/json'};
};
final res = await client.call(
HttpMethod.post, final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
path: apiPath,
params: apiParams, return models.Team.fromMap(res.data);
headers: apiHeaders,
); }
return models.Team.fromMap(res.data); /// Get a team by its ID. All team members have read access for this resource.
} Future<models.Team> get({required String teamId}) async {
final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId);
/// Get a team by its ID. All team members have read access for this resource.
Future<models.Team> get({required String teamId}) async { final Map<String, dynamic> apiParams = {
final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId);
final Map<String, dynamic> apiParams = {}; };
final Map<String, String> apiHeaders = {}; final Map<String, String> apiHeaders = {
final res = await client.call( };
HttpMethod.get,
path: apiPath, final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
params: apiParams,
headers: apiHeaders, return models.Team.fromMap(res.data);
);
}
return models.Team.fromMap(res.data);
} /// Update the team's name by its unique ID.
Future<models.Team> updateName({required String teamId, required String name}) async {
/// Update the team's name by its unique ID. final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId);
Future<models.Team> updateName({
required String teamId, final Map<String, dynamic> apiParams = {
required String name,
}) async { 'name': name,
final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId);
};
final Map<String, dynamic> apiParams = {'name': name};
final Map<String, String> apiHeaders = {
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; 'content-type': 'application/json',
final res = await client.call( };
HttpMethod.put,
path: apiPath, final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders);
params: apiParams,
headers: apiHeaders, return models.Team.fromMap(res.data);
);
}
return models.Team.fromMap(res.data);
} /// Delete a team using its ID. Only team members with the owner role can
/// delete the team.
/// Delete a team using its ID. Only team members with the owner role can Future delete({required String teamId}) async {
/// delete the team. final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId);
Future delete({required String teamId}) async {
final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); final Map<String, dynamic> apiParams = {
final Map<String, dynamic> apiParams = {};
};
final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {
final res = await client.call( 'content-type': 'application/json',
HttpMethod.delete,
path: apiPath, };
params: apiParams,
headers: apiHeaders, final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders);
);
return res.data;
return res.data;
} }
/// Use this endpoint to list a team's members using the team's ID. All team /// Use this endpoint to list a team's members using the team's ID. All team
/// members have read access to this endpoint. Hide sensitive attributes from /// members have read access to this endpoint. Hide sensitive attributes from
/// the response by toggling membership privacy in the Console. /// the response by toggling membership privacy in the Console.
Future<models.MembershipList> listMemberships({ Future<models.MembershipList> listMemberships({required String teamId, List<String>? queries, String? search}) async {
required String teamId, final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId);
List<String>? queries,
String? search, final Map<String, dynamic> apiParams = {
}) async { 'queries': queries,
final String apiPath = '/teams/{teamId}/memberships'.replaceAll( 'search': search,
'{teamId}',
teamId,
); };
final Map<String, dynamic> apiParams = { final Map<String, String> apiHeaders = {
'queries': queries,
'search': search, };
};
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
final Map<String, String> apiHeaders = {};
return models.MembershipList.fromMap(res.data);
final res = await client.call(
HttpMethod.get, }
path: apiPath,
params: apiParams, /// Invite a new member to join your team. Provide an ID for existing users, or
headers: apiHeaders, /// invite unregistered users using an email or phone number. If initiated from
); /// a Client SDK, Appwrite will send an email or sms with a link to join the
/// team to the invited user, and an account will be created for them if one
return models.MembershipList.fromMap(res.data); /// doesn't exist. If initiated from a Server SDK, the new member will be added
} /// automatically to the team.
///
/// Invite a new member to join your team. Provide an ID for existing users, or /// You only need to provide one of a user ID, email, or phone number. Appwrite
/// invite unregistered users using an email or phone number. If initiated from /// will prioritize accepting the user ID > email > phone number if you provide
/// a Client SDK, Appwrite will send an email or sms with a link to join the /// more than one of these parameters.
/// team to the invited user, and an account will be created for them if one ///
/// doesn't exist. If initiated from a Server SDK, the new member will be added /// Use the `url` parameter to redirect the user from the invitation email to
/// automatically to the team. /// your app. After the user is redirected, use the [Update Team Membership
/// /// Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus)
/// You only need to provide one of a user ID, email, or phone number. Appwrite /// endpoint to allow the user to accept the invitation to the team.
/// will prioritize accepting the user ID > email > phone number if you provide ///
/// more than one of these parameters. /// Please note that to avoid a [Redirect
/// /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
/// Use the `url` parameter to redirect the user from the invitation email to /// Appwrite will accept the only redirect URLs under the domains you have
/// your app. After the user is redirected, use the [Update Team Membership /// added as a platform on the Appwrite Console.
/// Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) ///
/// endpoint to allow the user to accept the invitation to the team. Future<models.Membership> createMembership({required String teamId, required List<String> roles, String? email, String? userId, String? phone, String? url, String? name}) async {
/// final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId);
/// Please note that to avoid a [Redirect
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) final Map<String, dynamic> apiParams = {
/// Appwrite will accept the only redirect URLs under the domains you have
/// added as a platform on the Appwrite Console. 'email': email,
/// 'userId': userId,
Future<models.Membership> createMembership({ 'phone': phone,
required String teamId, 'roles': roles,
required List<String> roles, 'url': url,
String? email, 'name': name,
String? userId,
String? phone, };
String? url,
String? name, final Map<String, String> apiHeaders = {
}) async { 'content-type': 'application/json',
final String apiPath = '/teams/{teamId}/memberships'.replaceAll(
'{teamId}', };
teamId,
); final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
final Map<String, dynamic> apiParams = { return models.Membership.fromMap(res.data);
'email': email,
'userId': userId, }
'phone': phone,
'roles': roles, /// Get a team member by the membership unique id. All team members have read
'url': url, /// access for this resource. Hide sensitive attributes from the response by
'name': name, /// toggling membership privacy in the Console.
}; Future<models.Membership> getMembership({required String teamId, required String membershipId}) async {
final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, dynamic> apiParams = {
final res = await client.call(
HttpMethod.post,
path: apiPath, };
params: apiParams,
headers: apiHeaders, final Map<String, String> apiHeaders = {
);
};
return models.Membership.fromMap(res.data);
} final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
/// Get a team member by the membership unique id. All team members have read return models.Membership.fromMap(res.data);
/// access for this resource. Hide sensitive attributes from the response by
/// toggling membership privacy in the Console. }
Future<models.Membership> getMembership({
required String teamId, /// Modify the roles of a team member. Only team members with the owner role
required String membershipId, /// have access to this endpoint. Learn more about [roles and
}) async { /// permissions](https://appwrite.io/docs/permissions).
final String apiPath = '/teams/{teamId}/memberships/{membershipId}' ///
.replaceAll('{teamId}', teamId) Future<models.Membership> updateMembership({required String teamId, required String membershipId, required List<String> roles}) async {
.replaceAll('{membershipId}', membershipId); final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
final Map<String, dynamic> apiParams = {}; final Map<String, dynamic> apiParams = {
final Map<String, String> apiHeaders = {}; 'roles': roles,
final res = await client.call( };
HttpMethod.get,
path: apiPath, final Map<String, String> apiHeaders = {
params: apiParams, 'content-type': 'application/json',
headers: apiHeaders,
); };
return models.Membership.fromMap(res.data); final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders);
}
return models.Membership.fromMap(res.data);
/// Modify the roles of a team member. Only team members with the owner role
/// have access to this endpoint. Learn more about [roles and }
/// permissions](https://appwrite.io/docs/permissions).
/// /// This endpoint allows a user to leave a team or for a team owner to delete
Future<models.Membership> updateMembership({ /// the membership of any other team member. You can also use this endpoint to
required String teamId, /// delete a user membership even if it is not accepted.
required String membershipId, Future deleteMembership({required String teamId, required String membershipId}) async {
required List<String> roles, final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
}) async {
final String apiPath = '/teams/{teamId}/memberships/{membershipId}' final Map<String, dynamic> apiParams = {
.replaceAll('{teamId}', teamId)
.replaceAll('{membershipId}', membershipId);
};
final Map<String, dynamic> apiParams = {'roles': roles};
final Map<String, String> apiHeaders = {
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; 'content-type': 'application/json',
final res = await client.call( };
HttpMethod.patch,
path: apiPath, final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders);
params: apiParams,
headers: apiHeaders, return res.data;
);
}
return models.Membership.fromMap(res.data);
} /// Use this endpoint to allow a user to accept an invitation to join a team
/// after being redirected back to your app from the invitation email received
/// This endpoint allows a user to leave a team or for a team owner to delete /// by the user.
/// the membership of any other team member. You can also use this endpoint to ///
/// delete a user membership even if it is not accepted. /// If the request is successful, a session for the user is automatically
Future deleteMembership({ /// created.
required String teamId, ///
required String membershipId, Future<models.Membership> updateMembershipStatus({required String teamId, required String membershipId, required String userId, required String secret}) async {
}) async { final String apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
final String apiPath = '/teams/{teamId}/memberships/{membershipId}'
.replaceAll('{teamId}', teamId) final Map<String, dynamic> apiParams = {
.replaceAll('{membershipId}', membershipId);
'userId': userId,
final Map<String, dynamic> apiParams = {}; 'secret': secret,
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; };
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.delete, 'content-type': 'application/json',
path: apiPath,
params: apiParams, };
headers: apiHeaders,
); final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders);
return res.data; return models.Membership.fromMap(res.data);
}
}
/// Use this endpoint to allow a user to accept an invitation to join a team
/// after being redirected back to your app from the invitation email received /// Get the team's shared preferences by its unique ID. If a preference doesn't
/// by the user. /// need to be shared by all team members, prefer storing them in [user
/// /// preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
/// If the request is successful, a session for the user is automatically Future<models.Preferences> getPrefs({required String teamId}) async {
/// created. final String apiPath = '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId);
///
Future<models.Membership> updateMembershipStatus({ final Map<String, dynamic> apiParams = {
required String teamId,
required String membershipId,
required String userId, };
required String secret,
}) async { final Map<String, String> apiHeaders = {
final String apiPath = '/teams/{teamId}/memberships/{membershipId}/status'
.replaceAll('{teamId}', teamId) };
.replaceAll('{membershipId}', membershipId);
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
final Map<String, dynamic> apiParams = {'userId': userId, 'secret': secret};
return models.Preferences.fromMap(res.data);
final Map<String, String> apiHeaders = {'content-type': 'application/json'};
}
final res = await client.call(
HttpMethod.patch, /// Update the team's preferences by its unique ID. The object you pass is
path: apiPath, /// stored as is and replaces any previous value. The maximum allowed prefs
params: apiParams, /// size is 64kB and throws an error if exceeded.
headers: apiHeaders, Future<models.Preferences> updatePrefs({required String teamId, required Map prefs}) async {
); final String apiPath = '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId);
return models.Membership.fromMap(res.data); final Map<String, dynamic> apiParams = {
}
'prefs': prefs,
/// Get the team's shared preferences by its unique ID. If a preference doesn't
/// need to be shared by all team members, prefer storing them in [user };
/// preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
Future<models.Preferences> getPrefs({required String teamId}) async { final Map<String, String> apiHeaders = {
final String apiPath = '/teams/{teamId}/prefs'.replaceAll( 'content-type': 'application/json',
'{teamId}',
teamId, };
);
final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders);
final Map<String, dynamic> apiParams = {};
return models.Preferences.fromMap(res.data);
final Map<String, String> apiHeaders = {};
}
final res = await client.call( }
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.Preferences.fromMap(res.data);
}
/// Update the team's preferences by its unique ID. The object you pass is
/// stored as is and replaces any previous value. The maximum allowed prefs
/// size is 64kB and throws an error if exceeded.
Future<models.Preferences> updatePrefs({
required String teamId,
required Map prefs,
}) async {
final String apiPath = '/teams/{teamId}/prefs'.replaceAll(
'{teamId}',
teamId,
);
final Map<String, dynamic> apiParams = {'prefs': prefs};
final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final res = await client.call(
HttpMethod.put,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.Preferences.fromMap(res.data);
}
}
+81 -85
View File
@@ -1,113 +1,109 @@
part of '../dart_appwrite.dart'; part of '../dart_appwrite.dart';
class Tokens extends Service { class Tokens extends Service {
Tokens(super.client); Tokens(super.client);
/// List all the tokens created for a specific file or bucket. You can use the /// List all the tokens created for a specific file or bucket. You can use the
/// query params to filter your results. /// query params to filter your results.
Future<models.ResourceTokenList> list({ Future<models.ResourceTokenList> list({required String bucketId, required String fileId, List<String>? queries}) async {
required String bucketId, final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
required String fileId,
List<String>? queries,
}) async {
final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'
.replaceAll('{bucketId}', bucketId)
.replaceAll('{fileId}', fileId);
final Map<String, dynamic> apiParams = {'queries': queries}; final Map<String, dynamic> apiParams = {
'queries': queries,
final Map<String, String> apiHeaders = {};
};
final res = await client.call( final Map<String, String> apiHeaders = {
HttpMethod.get,
path: apiPath, };
params: apiParams,
headers: apiHeaders,
);
return models.ResourceTokenList.fromMap(res.data); final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
}
/// Create a new token. A token is linked to a file. Token can be passed as a return models.ResourceTokenList.fromMap(res.data);
/// request URL search parameter.
Future<models.ResourceToken> createFileToken({
required String bucketId,
required String fileId,
String? expire,
}) async {
final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'
.replaceAll('{bucketId}', bucketId)
.replaceAll('{fileId}', fileId);
final Map<String, dynamic> apiParams = {'expire': expire}; }
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; /// Create a new token. A token is linked to a file. Token can be passed as a
/// request URL search parameter.
Future<models.ResourceToken> createFileToken({required String bucketId, required String fileId, String? expire}) async {
final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
final res = await client.call( final Map<String, dynamic> apiParams = {
HttpMethod.post,
path: apiPath, 'expire': expire,
params: apiParams,
headers: apiHeaders,
);
return models.ResourceToken.fromMap(res.data); };
}
/// Get a token by its unique ID. final Map<String, String> apiHeaders = {
Future<models.ResourceToken> get({required String tokenId}) async { 'content-type': 'application/json',
final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId);
final Map<String, dynamic> apiParams = {}; };
final Map<String, String> apiHeaders = {}; final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
final res = await client.call( return models.ResourceToken.fromMap(res.data);
HttpMethod.get,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.ResourceToken.fromMap(res.data); }
}
/// Update a token by its unique ID. Use this endpoint to update a token's /// Get a token by its unique ID.
/// expiry date. Future<models.ResourceToken> get({required String tokenId}) async {
Future<models.ResourceToken> update({ final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId);
required String tokenId,
String? expire,
}) async {
final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId);
final Map<String, dynamic> apiParams = {'expire': expire}; final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; final Map<String, String> apiHeaders = {
};
final res = await client.call( final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
HttpMethod.patch,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.ResourceToken.fromMap(res.data); return models.ResourceToken.fromMap(res.data);
}
/// Delete a token by its unique ID. }
Future delete({required String tokenId}) async {
final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId);
final Map<String, dynamic> apiParams = {}; /// Update a token by its unique ID. Use this endpoint to update a token's
/// expiry date.
Future<models.ResourceToken> update({required String tokenId, String? expire}) async {
final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId);
final Map<String, String> apiHeaders = {'content-type': 'application/json'}; final Map<String, dynamic> apiParams = {
'expire': expire,
final res = await client.call( };
HttpMethod.delete,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return res.data; final Map<String, String> apiHeaders = {
} 'content-type': 'application/json',
}
};
final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders);
return models.ResourceToken.fromMap(res.data);
}
/// Delete a token by its unique ID.
Future delete({required String tokenId}) async {
final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId);
final Map<String, dynamic> apiParams = {
};
final Map<String, String> apiHeaders = {
'content-type': 'application/json',
};
final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders);
return res.data;
}
}
+959 -1104
View File
File diff suppressed because it is too large Load Diff
+7 -8
View File
@@ -8,7 +8,7 @@ import 'upload_progress.dart';
/// [Client] that handles requests to Appwrite /// [Client] that handles requests to Appwrite
abstract class Client { abstract class Client {
/// The size for cunked uploads in bytes. /// The size for cunked uploads in bytes.
static const int CHUNK_SIZE = 5 * 1024 * 1024; static const int CHUNK_SIZE = 5*1024*1024;
/// Holds configuration such as project. /// Holds configuration such as project.
late Map<String, String> config; late Map<String, String> config;
@@ -18,16 +18,16 @@ abstract class Client {
String get endPoint => _endPoint; String get endPoint => _endPoint;
/// Initializes a [Client]. /// Initializes a [Client].
factory Client({ factory Client(
String endPoint = 'https://cloud.appwrite.io/v1', {String endPoint = 'https://cloud.appwrite.io/v1',
bool selfSigned = false, bool selfSigned = false}) =>
}) => createClient(endPoint: endPoint, selfSigned: selfSigned); createClient(endPoint: endPoint, selfSigned: selfSigned);
/// Handle OAuth2 session creation. /// Handle OAuth2 session creation.
Future<String?> webAuth(Uri url); Future<String?> webAuth(Uri url);
/// Set self signed to [status]. /// Set self signed to [status].
/// ///
/// If self signed is true, [Client] will ignore invalid certificates. /// If self signed is true, [Client] will ignore invalid certificates.
/// This is helpful in environments where your Appwrite /// This is helpful in environments where your Appwrite
/// instance does not have a valid SSL certificate. /// instance does not have a valid SSL certificate.
@@ -81,8 +81,7 @@ abstract class Client {
}); });
/// Send the API request. /// Send the API request.
Future<Response> call( Future<Response> call(HttpMethod method, {
HttpMethod method, {
String path = '', String path = '',
Map<String, String> headers = const {}, Map<String, String> headers = const {},
Map<String, dynamic> params = const {}, Map<String, dynamic> params = const {},
+1 -5
View File
@@ -2,25 +2,21 @@ import 'response.dart';
import 'client.dart'; import 'client.dart';
import 'enums.dart'; import 'enums.dart';
abstract class ClientBase implements Client { abstract class ClientBase implements Client {
/// Your project ID /// Your project ID
@override @override
ClientBase setProject(value); ClientBase setProject(value);
/// Your secret API key /// Your secret API key
@override @override
ClientBase setKey(value); ClientBase setKey(value);
/// Your secret JSON Web Token /// Your secret JSON Web Token
@override @override
ClientBase setJWT(value); ClientBase setJWT(value);
@override @override
ClientBase setLocale(value); ClientBase setLocale(value);
/// The user session to authenticate with /// The user session to authenticate with
@override @override
ClientBase setSession(value); ClientBase setSession(value);
/// The user agent string of the client that made the request /// The user agent string of the client that made the request
@override @override
ClientBase setForwardedUserAgent(value); ClientBase setForwardedUserAgent(value);
+55 -70
View File
@@ -9,11 +9,14 @@ import 'response.dart';
import 'input_file.dart'; import 'input_file.dart';
import 'upload_progress.dart'; import 'upload_progress.dart';
ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBase createClient({
required String endPoint,
required bool selfSigned,
}) =>
ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); ClientBrowser(endPoint: endPoint, selfSigned: selfSigned);
class ClientBrowser extends ClientBase with ClientMixin { class ClientBrowser extends ClientBase with ClientMixin {
static const int CHUNK_SIZE = 5 * 1024 * 1024; static const int CHUNK_SIZE = 5*1024*1024;
String _endPoint; String _endPoint;
Map<String, String>? _headers; Map<String, String>? _headers;
@override @override
@@ -30,67 +33,60 @@ class ClientBrowser extends ClientBase with ClientMixin {
'x-sdk-name': 'Dart', 'x-sdk-name': 'Dart',
'x-sdk-platform': 'server', 'x-sdk-platform': 'server',
'x-sdk-language': 'dart', 'x-sdk-language': 'dart',
'x-sdk-version': '16.2.0', 'x-sdk-version': '17.0.0',
'X-Appwrite-Response-Format': '1.7.0', 'X-Appwrite-Response-Format' : '1.8.0',
}; };
config = {}; config = {};
assert( assert(_endPoint.startsWith(RegExp("http://|https://")),
_endPoint.startsWith(RegExp("http://|https://")), "endPoint $_endPoint must start with 'http'");
"endPoint $_endPoint must start with 'http'",
);
} }
@override @override
String get endPoint => _endPoint; String get endPoint => _endPoint;
/// Your project ID /// Your project ID
@override @override
ClientBrowser setProject(value) { ClientBrowser setProject(value) {
config['project'] = value; config['project'] = value;
addHeader('X-Appwrite-Project', value); addHeader('X-Appwrite-Project', value);
return this; return this;
} }
/// Your secret API key
/// Your secret API key @override
@override ClientBrowser setKey(value) {
ClientBrowser setKey(value) { config['key'] = value;
config['key'] = value; addHeader('X-Appwrite-Key', value);
addHeader('X-Appwrite-Key', value); return this;
return this; }
} /// Your secret JSON Web Token
@override
/// Your secret JSON Web Token ClientBrowser setJWT(value) {
@override config['jWT'] = value;
ClientBrowser setJWT(value) { addHeader('X-Appwrite-JWT', value);
config['jWT'] = value; return this;
addHeader('X-Appwrite-JWT', value); }
return this; @override
} ClientBrowser setLocale(value) {
config['locale'] = value;
@override addHeader('X-Appwrite-Locale', value);
ClientBrowser setLocale(value) { return this;
config['locale'] = value; }
addHeader('X-Appwrite-Locale', value); /// The user session to authenticate with
return this; @override
} ClientBrowser setSession(value) {
config['session'] = value;
/// The user session to authenticate with addHeader('X-Appwrite-Session', value);
@override return this;
ClientBrowser setSession(value) { }
config['session'] = value; /// The user agent string of the client that made the request
addHeader('X-Appwrite-Session', value); @override
return this; ClientBrowser setForwardedUserAgent(value) {
} config['forwardedUserAgent'] = value;
addHeader('X-Forwarded-User-Agent', value);
/// The user agent string of the client that made the request return this;
@override }
ClientBrowser setForwardedUserAgent(value) {
config['forwardedUserAgent'] = value;
addHeader('X-Forwarded-User-Agent', value);
return this;
}
@override @override
ClientBrowser setSelfSigned({bool status = true}) { ClientBrowser setSelfSigned({bool status = true}) {
@@ -139,11 +135,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
late Response res; late Response res;
if (size <= CHUNK_SIZE) { if (size <= CHUNK_SIZE) {
params[paramName] = http.MultipartFile.fromBytes( params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, filename: file.filename);
paramName,
file.bytes!,
filename: file.filename,
);
return call( return call(
HttpMethod.post, HttpMethod.post,
path: path, path: path,
@@ -170,19 +162,12 @@ class ClientBrowser extends ClientBase with ClientMixin {
List<int> chunk = []; List<int> chunk = [];
final end = min(offset + CHUNK_SIZE, size); final end = min(offset + CHUNK_SIZE, size);
chunk = file.bytes!.getRange(offset, end).toList(); chunk = file.bytes!.getRange(offset, end).toList();
params[paramName] = http.MultipartFile.fromBytes( params[paramName] =
paramName, http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename);
chunk,
filename: file.filename,
);
headers['content-range'] = headers['content-range'] =
'bytes $offset-${min<int>((offset + CHUNK_SIZE - 1), size - 1)}/$size'; 'bytes $offset-${min<int>((offset + CHUNK_SIZE - 1), size - 1)}/$size';
res = await call( res = await call(HttpMethod.post,
HttpMethod.post, path: path, headers: headers, params: params);
path: path,
headers: headers,
params: params,
);
offset += CHUNK_SIZE; offset += CHUNK_SIZE;
if (offset < size) { if (offset < size) {
headers['x-appwrite-id'] = res.data['\$id']; headers['x-appwrite-id'] = res.data['\$id'];
+67 -78
View File
@@ -10,11 +10,17 @@ import 'response.dart';
import 'input_file.dart'; import 'input_file.dart';
import 'upload_progress.dart'; import 'upload_progress.dart';
ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBase createClient({
ClientIO(endPoint: endPoint, selfSigned: selfSigned); required String endPoint,
required bool selfSigned,
}) =>
ClientIO(
endPoint: endPoint,
selfSigned: selfSigned,
);
class ClientIO extends ClientBase with ClientMixin { class ClientIO extends ClientBase with ClientMixin {
static const int CHUNK_SIZE = 5 * 1024 * 1024; static const int CHUNK_SIZE = 5*1024*1024;
String _endPoint; String _endPoint;
Map<String, String>? _headers; Map<String, String>? _headers;
@override @override
@@ -36,69 +42,61 @@ class ClientIO extends ClientBase with ClientMixin {
'x-sdk-name': 'Dart', 'x-sdk-name': 'Dart',
'x-sdk-platform': 'server', 'x-sdk-platform': 'server',
'x-sdk-language': 'dart', 'x-sdk-language': 'dart',
'x-sdk-version': '16.2.0', 'x-sdk-version': '17.0.0',
'user-agent': 'user-agent' : 'AppwriteDartSDK/17.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
'AppwriteDartSDK/16.2.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', 'X-Appwrite-Response-Format' : '1.8.0',
'X-Appwrite-Response-Format': '1.7.0',
}; };
config = {}; config = {};
assert( assert(_endPoint.startsWith(RegExp("http://|https://")),
_endPoint.startsWith(RegExp("http://|https://")), "endPoint $_endPoint must start with 'http'");
"endPoint $_endPoint must start with 'http'",
);
} }
@override @override
String get endPoint => _endPoint; String get endPoint => _endPoint;
/// Your project ID /// Your project ID
@override @override
ClientIO setProject(value) { ClientIO setProject(value) {
config['project'] = value; config['project'] = value;
addHeader('X-Appwrite-Project', value); addHeader('X-Appwrite-Project', value);
return this; return this;
} }
/// Your secret API key
/// Your secret API key @override
@override ClientIO setKey(value) {
ClientIO setKey(value) { config['key'] = value;
config['key'] = value; addHeader('X-Appwrite-Key', value);
addHeader('X-Appwrite-Key', value); return this;
return this; }
} /// Your secret JSON Web Token
@override
/// Your secret JSON Web Token ClientIO setJWT(value) {
@override config['jWT'] = value;
ClientIO setJWT(value) { addHeader('X-Appwrite-JWT', value);
config['jWT'] = value; return this;
addHeader('X-Appwrite-JWT', value); }
return this; @override
} ClientIO setLocale(value) {
config['locale'] = value;
@override addHeader('X-Appwrite-Locale', value);
ClientIO setLocale(value) { return this;
config['locale'] = value; }
addHeader('X-Appwrite-Locale', value); /// The user session to authenticate with
return this; @override
} ClientIO setSession(value) {
config['session'] = value;
/// The user session to authenticate with addHeader('X-Appwrite-Session', value);
@override return this;
ClientIO setSession(value) { }
config['session'] = value; /// The user agent string of the client that made the request
addHeader('X-Appwrite-Session', value); @override
return this; ClientIO setForwardedUserAgent(value) {
} config['forwardedUserAgent'] = value;
addHeader('X-Forwarded-User-Agent', value);
/// The user agent string of the client that made the request return this;
@override }
ClientIO setForwardedUserAgent(value) {
config['forwardedUserAgent'] = value;
addHeader('X-Forwarded-User-Agent', value);
return this;
}
@override @override
ClientIO setSelfSigned({bool status = true}) { ClientIO setSelfSigned({bool status = true}) {
@@ -153,16 +151,11 @@ class ClientIO extends ClientBase with ClientMixin {
if (size <= CHUNK_SIZE) { if (size <= CHUNK_SIZE) {
if (file.path != null) { if (file.path != null) {
params[paramName] = await http.MultipartFile.fromPath( params[paramName] = await http.MultipartFile.fromPath(
paramName, paramName, file.path!,
file.path!, filename: file.filename);
filename: file.filename,
);
} else { } else {
params[paramName] = http.MultipartFile.fromBytes( params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!,
paramName, filename: file.filename);
file.bytes!,
filename: file.filename,
);
} }
return call( return call(
HttpMethod.post, HttpMethod.post,
@@ -201,19 +194,12 @@ class ClientIO extends ClientBase with ClientMixin {
raf!.setPositionSync(offset); raf!.setPositionSync(offset);
chunk = raf.readSync(CHUNK_SIZE); chunk = raf.readSync(CHUNK_SIZE);
} }
params[paramName] = http.MultipartFile.fromBytes( params[paramName] =
paramName, http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename);
chunk,
filename: file.filename,
);
headers['content-range'] = headers['content-range'] =
'bytes $offset-${min<int>((offset + CHUNK_SIZE - 1), size - 1)}/$size'; 'bytes $offset-${min<int>((offset + CHUNK_SIZE - 1), size - 1)}/$size';
res = await call( res = await call(HttpMethod.post,
HttpMethod.post, path: path, headers: headers, params: params);
path: path,
headers: headers,
params: params,
);
offset += CHUNK_SIZE; offset += CHUNK_SIZE;
if (offset < size) { if (offset < size) {
headers['x-appwrite-id'] = res.data['\$id']; headers['x-appwrite-id'] = res.data['\$id'];
@@ -258,7 +244,10 @@ class ClientIO extends ClientBase with ClientMixin {
try { try {
final streamedResponse = await _httpClient.send(request); final streamedResponse = await _httpClient.send(request);
res = await toResponse(streamedResponse); res = await toResponse(streamedResponse);
return prepareResponse(res, responseType: responseType); return prepareResponse(
res,
responseType: responseType,
);
} catch (e) { } catch (e) {
if (e is AppwriteException) { if (e is AppwriteException) {
rethrow; rethrow;
+27 -37
View File
@@ -26,21 +26,21 @@ mixin ClientMixin {
} else { } else {
if (value is List) { if (value is List) {
value.asMap().forEach((i, v) { value.asMap().forEach((i, v) {
(request as http.MultipartRequest).fields.addAll({ (request as http.MultipartRequest)
"$key[$i]": v.toString(), .fields
}); .addAll({"$key[$i]": v.toString()});
}); });
} else { } else {
(request as http.MultipartRequest).fields.addAll({ (request as http.MultipartRequest)
key: value.toString(), .fields
}); .addAll({key: value.toString()});
} }
} }
}); });
} }
} else if (method == HttpMethod.get) { } else if (method == HttpMethod.get) {
if (params.isNotEmpty) { if (params.isNotEmpty) {
params = params.map((key, value) { params = params.map((key, value){
if (value is int || value is double) { if (value is int || value is double) {
return MapEntry(key, value.toString()); return MapEntry(key, value.toString());
} }
@@ -51,13 +51,12 @@ mixin ClientMixin {
}); });
} }
uri = Uri( uri = Uri(
fragment: uri.fragment, fragment: uri.fragment,
path: uri.path, path: uri.path,
host: uri.host, host: uri.host,
scheme: uri.scheme, scheme: uri.scheme,
queryParameters: params, queryParameters: params,
port: uri.port, port: uri.port);
);
request = http.Request(method.name(), uri); request = http.Request(method.name(), uri);
} else { } else {
(request as http.Request).body = jsonEncode(params); (request as http.Request).body = jsonEncode(params);
@@ -67,9 +66,7 @@ mixin ClientMixin {
headers['User-Agent'] = Uri.encodeFull(headers['User-Agent']!); headers['User-Agent'] = Uri.encodeFull(headers['User-Agent']!);
} }
if (headers['X-Forwarded-User-Agent'] != null) { if (headers['X-Forwarded-User-Agent'] != null) {
headers['X-Forwarded-User-Agent'] = Uri.encodeFull( headers['X-Forwarded-User-Agent'] = Uri.encodeFull(headers['X-Forwarded-User-Agent']!);
headers['X-Forwarded-User-Agent']!,
);
} }
request.headers.addAll(headers); request.headers.addAll(headers);
@@ -116,25 +113,18 @@ mixin ClientMixin {
return Response(data: data); return Response(data: data);
} }
Future<http.Response> toResponse( Future<http.Response> toResponse(http.StreamedResponse streamedResponse) async {
http.StreamedResponse streamedResponse, if(streamedResponse.statusCode == 204) {
) async { return http.Response('',
if (streamedResponse.statusCode == 204) { streamedResponse.statusCode,
return http.Response( headers: streamedResponse.headers.map((k,v) => k.toLowerCase()=='content-type' ? MapEntry(k, 'text/plain') : MapEntry(k,v)),
'', request: streamedResponse.request,
streamedResponse.statusCode, isRedirect: streamedResponse.isRedirect,
headers: streamedResponse.headers.map( persistentConnection: streamedResponse.persistentConnection,
(k, v) => k.toLowerCase() == 'content-type' reasonPhrase: streamedResponse.reasonPhrase,
? MapEntry(k, 'text/plain') );
: MapEntry(k, v), } else {
), return await http.Response.fromStream(streamedResponse);
request: streamedResponse.request, }
isRedirect: streamedResponse.isRedirect,
persistentConnection: streamedResponse.persistentConnection,
reasonPhrase: streamedResponse.reasonPhrase,
);
} else {
return await http.Response.fromStream(streamedResponse);
}
} }
} }
+1 -2
View File
@@ -3,5 +3,4 @@ import 'client_base.dart';
/// Implemented in `browser_client.dart` and `io_client.dart`. /// Implemented in `browser_client.dart` and `io_client.dart`.
ClientBase createClient({required String endPoint, required bool selfSigned}) => ClientBase createClient({required String endPoint, required bool selfSigned}) =>
throw UnsupportedError( throw UnsupportedError(
'Cannot create a client without dart:html or dart:io.', 'Cannot create a client without dart:html or dart:io.');
);
+2 -2
View File
@@ -16,6 +16,6 @@ enum ResponseType {
/// Transform the response data to a String encoded with UTF8. /// Transform the response data to a String encoded with UTF8.
plain, plain,
/// Get original bytes, the type of response will be List<int> /// Get original bytes, the type of response will be `List<int>`
bytes, bytes
} }
+8 -6
View File
@@ -1,12 +1,14 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum Adapter { enum Adapter {
static(value: 'static'), xstatic(value: 'static'),
ssr(value: 'ssr'); ssr(value: 'ssr');
const Adapter({required this.value}); const Adapter({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+10 -8
View File
@@ -1,14 +1,16 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum AuthenticationFactor { enum AuthenticationFactor {
email(value: 'email'), email(value: 'email'),
phone(value: 'phone'), phone(value: 'phone'),
totp(value: 'totp'), totp(value: 'totp'),
recoverycode(value: 'recoverycode'); recoverycode(value: 'recoverycode');
const AuthenticationFactor({required this.value}); const AuthenticationFactor({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+7 -5
View File
@@ -1,11 +1,13 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum AuthenticatorType { enum AuthenticatorType {
totp(value: 'totp'); totp(value: 'totp');
const AuthenticatorType({required this.value}); const AuthenticatorType({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+20 -18
View File
@@ -1,24 +1,26 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum Browser { enum Browser {
avantBrowser(value: 'aa'), avantBrowser(value: 'aa'),
androidWebViewBeta(value: 'an'), androidWebViewBeta(value: 'an'),
googleChrome(value: 'ch'), googleChrome(value: 'ch'),
googleChromeIOS(value: 'ci'), googleChromeIOS(value: 'ci'),
googleChromeMobile(value: 'cm'), googleChromeMobile(value: 'cm'),
chromium(value: 'cr'), chromium(value: 'cr'),
mozillaFirefox(value: 'ff'), mozillaFirefox(value: 'ff'),
safari(value: 'sf'), safari(value: 'sf'),
mobileSafari(value: 'mf'), mobileSafari(value: 'mf'),
microsoftEdge(value: 'ps'), microsoftEdge(value: 'ps'),
microsoftEdgeIOS(value: 'oi'), microsoftEdgeIOS(value: 'oi'),
operaMini(value: 'om'), operaMini(value: 'om'),
opera(value: 'op'), opera(value: 'op'),
operaNext(value: 'on'); operaNext(value: 'on');
const Browser({required this.value}); const Browser({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+71 -69
View File
@@ -1,75 +1,77 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum BuildRuntime { enum BuildRuntime {
node145(value: 'node-14.5'), node145(value: 'node-14.5'),
node160(value: 'node-16.0'), node160(value: 'node-16.0'),
node180(value: 'node-18.0'), node180(value: 'node-18.0'),
node190(value: 'node-19.0'), node190(value: 'node-19.0'),
node200(value: 'node-20.0'), node200(value: 'node-20.0'),
node210(value: 'node-21.0'), node210(value: 'node-21.0'),
node22(value: 'node-22'), node22(value: 'node-22'),
php80(value: 'php-8.0'), php80(value: 'php-8.0'),
php81(value: 'php-8.1'), php81(value: 'php-8.1'),
php82(value: 'php-8.2'), php82(value: 'php-8.2'),
php83(value: 'php-8.3'), php83(value: 'php-8.3'),
ruby30(value: 'ruby-3.0'), ruby30(value: 'ruby-3.0'),
ruby31(value: 'ruby-3.1'), ruby31(value: 'ruby-3.1'),
ruby32(value: 'ruby-3.2'), ruby32(value: 'ruby-3.2'),
ruby33(value: 'ruby-3.3'), ruby33(value: 'ruby-3.3'),
python38(value: 'python-3.8'), python38(value: 'python-3.8'),
python39(value: 'python-3.9'), python39(value: 'python-3.9'),
python310(value: 'python-3.10'), python310(value: 'python-3.10'),
python311(value: 'python-3.11'), python311(value: 'python-3.11'),
python312(value: 'python-3.12'), python312(value: 'python-3.12'),
pythonMl311(value: 'python-ml-3.11'), pythonMl311(value: 'python-ml-3.11'),
pythonMl312(value: 'python-ml-3.12'), pythonMl312(value: 'python-ml-3.12'),
deno121(value: 'deno-1.21'), deno121(value: 'deno-1.21'),
deno124(value: 'deno-1.24'), deno124(value: 'deno-1.24'),
deno135(value: 'deno-1.35'), deno135(value: 'deno-1.35'),
deno140(value: 'deno-1.40'), deno140(value: 'deno-1.40'),
deno146(value: 'deno-1.46'), deno146(value: 'deno-1.46'),
deno20(value: 'deno-2.0'), deno20(value: 'deno-2.0'),
dart215(value: 'dart-2.15'), dart215(value: 'dart-2.15'),
dart216(value: 'dart-2.16'), dart216(value: 'dart-2.16'),
dart217(value: 'dart-2.17'), dart217(value: 'dart-2.17'),
dart218(value: 'dart-2.18'), dart218(value: 'dart-2.18'),
dart219(value: 'dart-2.19'), dart219(value: 'dart-2.19'),
dart30(value: 'dart-3.0'), dart30(value: 'dart-3.0'),
dart31(value: 'dart-3.1'), dart31(value: 'dart-3.1'),
dart33(value: 'dart-3.3'), dart33(value: 'dart-3.3'),
dart35(value: 'dart-3.5'), dart35(value: 'dart-3.5'),
dart38(value: 'dart-3.8'), dart38(value: 'dart-3.8'),
dotnet60(value: 'dotnet-6.0'), dotnet60(value: 'dotnet-6.0'),
dotnet70(value: 'dotnet-7.0'), dotnet70(value: 'dotnet-7.0'),
dotnet80(value: 'dotnet-8.0'), dotnet80(value: 'dotnet-8.0'),
java80(value: 'java-8.0'), java80(value: 'java-8.0'),
java110(value: 'java-11.0'), java110(value: 'java-11.0'),
java170(value: 'java-17.0'), java170(value: 'java-17.0'),
java180(value: 'java-18.0'), java180(value: 'java-18.0'),
java210(value: 'java-21.0'), java210(value: 'java-21.0'),
java22(value: 'java-22'), java22(value: 'java-22'),
swift55(value: 'swift-5.5'), swift55(value: 'swift-5.5'),
swift58(value: 'swift-5.8'), swift58(value: 'swift-5.8'),
swift59(value: 'swift-5.9'), swift59(value: 'swift-5.9'),
swift510(value: 'swift-5.10'), swift510(value: 'swift-5.10'),
kotlin16(value: 'kotlin-1.6'), kotlin16(value: 'kotlin-1.6'),
kotlin18(value: 'kotlin-1.8'), kotlin18(value: 'kotlin-1.8'),
kotlin19(value: 'kotlin-1.9'), kotlin19(value: 'kotlin-1.9'),
kotlin20(value: 'kotlin-2.0'), kotlin20(value: 'kotlin-2.0'),
cpp17(value: 'cpp-17'), cpp17(value: 'cpp-17'),
cpp20(value: 'cpp-20'), cpp20(value: 'cpp-20'),
bun10(value: 'bun-1.0'), bun10(value: 'bun-1.0'),
bun11(value: 'bun-1.1'), bun11(value: 'bun-1.1'),
go123(value: 'go-1.23'), go123(value: 'go-1.23'),
static1(value: 'static-1'), static1(value: 'static-1'),
flutter324(value: 'flutter-3.24'), flutter324(value: 'flutter-3.24'),
flutter327(value: 'flutter-3.27'), flutter327(value: 'flutter-3.27'),
flutter329(value: 'flutter-3.29'), flutter329(value: 'flutter-3.29'),
flutter332(value: 'flutter-3.32'); flutter332(value: 'flutter-3.32');
const BuildRuntime({required this.value}); const BuildRuntime({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+9 -7
View File
@@ -1,13 +1,15 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum Compression { enum Compression {
none(value: 'none'), none(value: 'none'),
gzip(value: 'gzip'), gzip(value: 'gzip'),
zstd(value: 'zstd'); zstd(value: 'zstd');
const Compression({required this.value}); const Compression({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+23 -21
View File
@@ -1,27 +1,29 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum CreditCard { enum CreditCard {
americanExpress(value: 'amex'), americanExpress(value: 'amex'),
argencard(value: 'argencard'), argencard(value: 'argencard'),
cabal(value: 'cabal'), cabal(value: 'cabal'),
cencosud(value: 'cencosud'), cencosud(value: 'cencosud'),
dinersClub(value: 'diners'), dinersClub(value: 'diners'),
discover(value: 'discover'), discover(value: 'discover'),
elo(value: 'elo'), elo(value: 'elo'),
hipercard(value: 'hipercard'), hipercard(value: 'hipercard'),
jCB(value: 'jcb'), jCB(value: 'jcb'),
mastercard(value: 'mastercard'), mastercard(value: 'mastercard'),
naranja(value: 'naranja'), naranja(value: 'naranja'),
tarjetaShopping(value: 'targeta-shopping'), tarjetaShopping(value: 'targeta-shopping'),
unionChinaPay(value: 'union-china-pay'), unionChinaPay(value: 'union-china-pay'),
visa(value: 'visa'), visa(value: 'visa'),
mIR(value: 'mir'), mIR(value: 'mir'),
maestro(value: 'maestro'), maestro(value: 'maestro'),
rupay(value: 'rupay'); rupay(value: 'rupay');
const CreditCard({required this.value}); const CreditCard({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+8 -6
View File
@@ -1,12 +1,14 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum DeploymentDownloadType { enum DeploymentDownloadType {
source(value: 'source'), source(value: 'source'),
output(value: 'output'); output(value: 'output');
const DeploymentDownloadType({required this.value}); const DeploymentDownloadType({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+12 -10
View File
@@ -1,16 +1,18 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum ExecutionMethod { enum ExecutionMethod {
gET(value: 'GET'), gET(value: 'GET'),
pOST(value: 'POST'), pOST(value: 'POST'),
pUT(value: 'PUT'), pUT(value: 'PUT'),
pATCH(value: 'PATCH'), pATCH(value: 'PATCH'),
dELETE(value: 'DELETE'), dELETE(value: 'DELETE'),
oPTIONS(value: 'OPTIONS'); oPTIONS(value: 'OPTIONS');
const ExecutionMethod({required this.value}); const ExecutionMethod({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+201 -199
View File
@@ -1,205 +1,207 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum Flag { enum Flag {
afghanistan(value: 'af'), afghanistan(value: 'af'),
angola(value: 'ao'), angola(value: 'ao'),
albania(value: 'al'), albania(value: 'al'),
andorra(value: 'ad'), andorra(value: 'ad'),
unitedArabEmirates(value: 'ae'), unitedArabEmirates(value: 'ae'),
argentina(value: 'ar'), argentina(value: 'ar'),
armenia(value: 'am'), armenia(value: 'am'),
antiguaAndBarbuda(value: 'ag'), antiguaAndBarbuda(value: 'ag'),
australia(value: 'au'), australia(value: 'au'),
austria(value: 'at'), austria(value: 'at'),
azerbaijan(value: 'az'), azerbaijan(value: 'az'),
burundi(value: 'bi'), burundi(value: 'bi'),
belgium(value: 'be'), belgium(value: 'be'),
benin(value: 'bj'), benin(value: 'bj'),
burkinaFaso(value: 'bf'), burkinaFaso(value: 'bf'),
bangladesh(value: 'bd'), bangladesh(value: 'bd'),
bulgaria(value: 'bg'), bulgaria(value: 'bg'),
bahrain(value: 'bh'), bahrain(value: 'bh'),
bahamas(value: 'bs'), bahamas(value: 'bs'),
bosniaAndHerzegovina(value: 'ba'), bosniaAndHerzegovina(value: 'ba'),
belarus(value: 'by'), belarus(value: 'by'),
belize(value: 'bz'), belize(value: 'bz'),
bolivia(value: 'bo'), bolivia(value: 'bo'),
brazil(value: 'br'), brazil(value: 'br'),
barbados(value: 'bb'), barbados(value: 'bb'),
bruneiDarussalam(value: 'bn'), bruneiDarussalam(value: 'bn'),
bhutan(value: 'bt'), bhutan(value: 'bt'),
botswana(value: 'bw'), botswana(value: 'bw'),
centralAfricanRepublic(value: 'cf'), centralAfricanRepublic(value: 'cf'),
canada(value: 'ca'), canada(value: 'ca'),
switzerland(value: 'ch'), switzerland(value: 'ch'),
chile(value: 'cl'), chile(value: 'cl'),
china(value: 'cn'), china(value: 'cn'),
coteDIvoire(value: 'ci'), coteDIvoire(value: 'ci'),
cameroon(value: 'cm'), cameroon(value: 'cm'),
democraticRepublicOfTheCongo(value: 'cd'), democraticRepublicOfTheCongo(value: 'cd'),
republicOfTheCongo(value: 'cg'), republicOfTheCongo(value: 'cg'),
colombia(value: 'co'), colombia(value: 'co'),
comoros(value: 'km'), comoros(value: 'km'),
capeVerde(value: 'cv'), capeVerde(value: 'cv'),
costaRica(value: 'cr'), costaRica(value: 'cr'),
cuba(value: 'cu'), cuba(value: 'cu'),
cyprus(value: 'cy'), cyprus(value: 'cy'),
czechRepublic(value: 'cz'), czechRepublic(value: 'cz'),
germany(value: 'de'), germany(value: 'de'),
djibouti(value: 'dj'), djibouti(value: 'dj'),
dominica(value: 'dm'), dominica(value: 'dm'),
denmark(value: 'dk'), denmark(value: 'dk'),
dominicanRepublic(value: 'do'), dominicanRepublic(value: 'do'),
algeria(value: 'dz'), algeria(value: 'dz'),
ecuador(value: 'ec'), ecuador(value: 'ec'),
egypt(value: 'eg'), egypt(value: 'eg'),
eritrea(value: 'er'), eritrea(value: 'er'),
spain(value: 'es'), spain(value: 'es'),
estonia(value: 'ee'), estonia(value: 'ee'),
ethiopia(value: 'et'), ethiopia(value: 'et'),
finland(value: 'fi'), finland(value: 'fi'),
fiji(value: 'fj'), fiji(value: 'fj'),
france(value: 'fr'), france(value: 'fr'),
micronesiaFederatedStatesOf(value: 'fm'), micronesiaFederatedStatesOf(value: 'fm'),
gabon(value: 'ga'), gabon(value: 'ga'),
unitedKingdom(value: 'gb'), unitedKingdom(value: 'gb'),
georgia(value: 'ge'), georgia(value: 'ge'),
ghana(value: 'gh'), ghana(value: 'gh'),
guinea(value: 'gn'), guinea(value: 'gn'),
gambia(value: 'gm'), gambia(value: 'gm'),
guineaBissau(value: 'gw'), guineaBissau(value: 'gw'),
equatorialGuinea(value: 'gq'), equatorialGuinea(value: 'gq'),
greece(value: 'gr'), greece(value: 'gr'),
grenada(value: 'gd'), grenada(value: 'gd'),
guatemala(value: 'gt'), guatemala(value: 'gt'),
guyana(value: 'gy'), guyana(value: 'gy'),
honduras(value: 'hn'), honduras(value: 'hn'),
croatia(value: 'hr'), croatia(value: 'hr'),
haiti(value: 'ht'), haiti(value: 'ht'),
hungary(value: 'hu'), hungary(value: 'hu'),
indonesia(value: 'id'), indonesia(value: 'id'),
india(value: 'in'), india(value: 'in'),
ireland(value: 'ie'), ireland(value: 'ie'),
iranIslamicRepublicOf(value: 'ir'), iranIslamicRepublicOf(value: 'ir'),
iraq(value: 'iq'), iraq(value: 'iq'),
iceland(value: 'is'), iceland(value: 'is'),
israel(value: 'il'), israel(value: 'il'),
italy(value: 'it'), italy(value: 'it'),
jamaica(value: 'jm'), jamaica(value: 'jm'),
jordan(value: 'jo'), jordan(value: 'jo'),
japan(value: 'jp'), japan(value: 'jp'),
kazakhstan(value: 'kz'), kazakhstan(value: 'kz'),
kenya(value: 'ke'), kenya(value: 'ke'),
kyrgyzstan(value: 'kg'), kyrgyzstan(value: 'kg'),
cambodia(value: 'kh'), cambodia(value: 'kh'),
kiribati(value: 'ki'), kiribati(value: 'ki'),
saintKittsAndNevis(value: 'kn'), saintKittsAndNevis(value: 'kn'),
southKorea(value: 'kr'), southKorea(value: 'kr'),
kuwait(value: 'kw'), kuwait(value: 'kw'),
laoPeopleSDemocraticRepublic(value: 'la'), laoPeopleSDemocraticRepublic(value: 'la'),
lebanon(value: 'lb'), lebanon(value: 'lb'),
liberia(value: 'lr'), liberia(value: 'lr'),
libya(value: 'ly'), libya(value: 'ly'),
saintLucia(value: 'lc'), saintLucia(value: 'lc'),
liechtenstein(value: 'li'), liechtenstein(value: 'li'),
sriLanka(value: 'lk'), sriLanka(value: 'lk'),
lesotho(value: 'ls'), lesotho(value: 'ls'),
lithuania(value: 'lt'), lithuania(value: 'lt'),
luxembourg(value: 'lu'), luxembourg(value: 'lu'),
latvia(value: 'lv'), latvia(value: 'lv'),
morocco(value: 'ma'), morocco(value: 'ma'),
monaco(value: 'mc'), monaco(value: 'mc'),
moldova(value: 'md'), moldova(value: 'md'),
madagascar(value: 'mg'), madagascar(value: 'mg'),
maldives(value: 'mv'), maldives(value: 'mv'),
mexico(value: 'mx'), mexico(value: 'mx'),
marshallIslands(value: 'mh'), marshallIslands(value: 'mh'),
northMacedonia(value: 'mk'), northMacedonia(value: 'mk'),
mali(value: 'ml'), mali(value: 'ml'),
malta(value: 'mt'), malta(value: 'mt'),
myanmar(value: 'mm'), myanmar(value: 'mm'),
montenegro(value: 'me'), montenegro(value: 'me'),
mongolia(value: 'mn'), mongolia(value: 'mn'),
mozambique(value: 'mz'), mozambique(value: 'mz'),
mauritania(value: 'mr'), mauritania(value: 'mr'),
mauritius(value: 'mu'), mauritius(value: 'mu'),
malawi(value: 'mw'), malawi(value: 'mw'),
malaysia(value: 'my'), malaysia(value: 'my'),
namibia(value: 'na'), namibia(value: 'na'),
niger(value: 'ne'), niger(value: 'ne'),
nigeria(value: 'ng'), nigeria(value: 'ng'),
nicaragua(value: 'ni'), nicaragua(value: 'ni'),
netherlands(value: 'nl'), netherlands(value: 'nl'),
norway(value: 'no'), norway(value: 'no'),
nepal(value: 'np'), nepal(value: 'np'),
nauru(value: 'nr'), nauru(value: 'nr'),
newZealand(value: 'nz'), newZealand(value: 'nz'),
oman(value: 'om'), oman(value: 'om'),
pakistan(value: 'pk'), pakistan(value: 'pk'),
panama(value: 'pa'), panama(value: 'pa'),
peru(value: 'pe'), peru(value: 'pe'),
philippines(value: 'ph'), philippines(value: 'ph'),
palau(value: 'pw'), palau(value: 'pw'),
papuaNewGuinea(value: 'pg'), papuaNewGuinea(value: 'pg'),
poland(value: 'pl'), poland(value: 'pl'),
frenchPolynesia(value: 'pf'), frenchPolynesia(value: 'pf'),
northKorea(value: 'kp'), northKorea(value: 'kp'),
portugal(value: 'pt'), portugal(value: 'pt'),
paraguay(value: 'py'), paraguay(value: 'py'),
qatar(value: 'qa'), qatar(value: 'qa'),
romania(value: 'ro'), romania(value: 'ro'),
russia(value: 'ru'), russia(value: 'ru'),
rwanda(value: 'rw'), rwanda(value: 'rw'),
saudiArabia(value: 'sa'), saudiArabia(value: 'sa'),
sudan(value: 'sd'), sudan(value: 'sd'),
senegal(value: 'sn'), senegal(value: 'sn'),
singapore(value: 'sg'), singapore(value: 'sg'),
solomonIslands(value: 'sb'), solomonIslands(value: 'sb'),
sierraLeone(value: 'sl'), sierraLeone(value: 'sl'),
elSalvador(value: 'sv'), elSalvador(value: 'sv'),
sanMarino(value: 'sm'), sanMarino(value: 'sm'),
somalia(value: 'so'), somalia(value: 'so'),
serbia(value: 'rs'), serbia(value: 'rs'),
southSudan(value: 'ss'), southSudan(value: 'ss'),
saoTomeAndPrincipe(value: 'st'), saoTomeAndPrincipe(value: 'st'),
suriname(value: 'sr'), suriname(value: 'sr'),
slovakia(value: 'sk'), slovakia(value: 'sk'),
slovenia(value: 'si'), slovenia(value: 'si'),
sweden(value: 'se'), sweden(value: 'se'),
eswatini(value: 'sz'), eswatini(value: 'sz'),
seychelles(value: 'sc'), seychelles(value: 'sc'),
syria(value: 'sy'), syria(value: 'sy'),
chad(value: 'td'), chad(value: 'td'),
togo(value: 'tg'), togo(value: 'tg'),
thailand(value: 'th'), thailand(value: 'th'),
tajikistan(value: 'tj'), tajikistan(value: 'tj'),
turkmenistan(value: 'tm'), turkmenistan(value: 'tm'),
timorLeste(value: 'tl'), timorLeste(value: 'tl'),
tonga(value: 'to'), tonga(value: 'to'),
trinidadAndTobago(value: 'tt'), trinidadAndTobago(value: 'tt'),
tunisia(value: 'tn'), tunisia(value: 'tn'),
turkey(value: 'tr'), turkey(value: 'tr'),
tuvalu(value: 'tv'), tuvalu(value: 'tv'),
tanzania(value: 'tz'), tanzania(value: 'tz'),
uganda(value: 'ug'), uganda(value: 'ug'),
ukraine(value: 'ua'), ukraine(value: 'ua'),
uruguay(value: 'uy'), uruguay(value: 'uy'),
unitedStates(value: 'us'), unitedStates(value: 'us'),
uzbekistan(value: 'uz'), uzbekistan(value: 'uz'),
vaticanCity(value: 'va'), vaticanCity(value: 'va'),
saintVincentAndTheGrenadines(value: 'vc'), saintVincentAndTheGrenadines(value: 'vc'),
venezuela(value: 've'), venezuela(value: 've'),
vietnam(value: 'vn'), vietnam(value: 'vn'),
vanuatu(value: 'vu'), vanuatu(value: 'vu'),
samoa(value: 'ws'), samoa(value: 'ws'),
yemen(value: 'ye'), yemen(value: 'ye'),
southAfrica(value: 'za'), southAfrica(value: 'za'),
zambia(value: 'zm'), zambia(value: 'zm'),
zimbabwe(value: 'zw'); zimbabwe(value: 'zw');
const Flag({required this.value}); const Flag({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+20 -18
View File
@@ -1,24 +1,26 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum Framework { enum Framework {
analog(value: 'analog'), analog(value: 'analog'),
angular(value: 'angular'), angular(value: 'angular'),
nextjs(value: 'nextjs'), nextjs(value: 'nextjs'),
react(value: 'react'), react(value: 'react'),
nuxt(value: 'nuxt'), nuxt(value: 'nuxt'),
vue(value: 'vue'), vue(value: 'vue'),
sveltekit(value: 'sveltekit'), sveltekit(value: 'sveltekit'),
astro(value: 'astro'), astro(value: 'astro'),
remix(value: 'remix'), remix(value: 'remix'),
lynx(value: 'lynx'), lynx(value: 'lynx'),
flutter(value: 'flutter'), flutter(value: 'flutter'),
reactNative(value: 'react-native'), reactNative(value: 'react-native'),
vite(value: 'vite'), vite(value: 'vite'),
other(value: 'other'); other(value: 'other');
const Framework({required this.value}); const Framework({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+13 -11
View File
@@ -1,17 +1,19 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum ImageFormat { enum ImageFormat {
jpg(value: 'jpg'), jpg(value: 'jpg'),
jpeg(value: 'jpeg'), jpeg(value: 'jpeg'),
png(value: 'png'), png(value: 'png'),
webp(value: 'webp'), webp(value: 'webp'),
heic(value: 'heic'), heic(value: 'heic'),
avif(value: 'avif'), avif(value: 'avif'),
gif(value: 'gif'); gif(value: 'gif');
const ImageFormat({required this.value}); const ImageFormat({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+15 -13
View File
@@ -1,19 +1,21 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum ImageGravity { enum ImageGravity {
center(value: 'center'), center(value: 'center'),
topLeft(value: 'top-left'), topLeft(value: 'top-left'),
top(value: 'top'), top(value: 'top'),
topRight(value: 'top-right'), topRight(value: 'top-right'),
left(value: 'left'), left(value: 'left'),
right(value: 'right'), right(value: 'right'),
bottomLeft(value: 'bottom-left'), bottomLeft(value: 'bottom-left'),
bottom(value: 'bottom'), bottom(value: 'bottom'),
bottomRight(value: 'bottom-right'); bottomRight(value: 'bottom-right');
const ImageGravity({required this.value}); const ImageGravity({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+9 -7
View File
@@ -1,13 +1,15 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum IndexType { enum IndexType {
key(value: 'key'), key(value: 'key'),
fulltext(value: 'fulltext'), fulltext(value: 'fulltext'),
unique(value: 'unique'); unique(value: 'unique');
const IndexType({required this.value}); const IndexType({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+8 -6
View File
@@ -1,12 +1,14 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum MessagePriority { enum MessagePriority {
normal(value: 'normal'), normal(value: 'normal'),
high(value: 'high'); high(value: 'high');
const MessagePriority({required this.value}); const MessagePriority({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+9 -7
View File
@@ -1,13 +1,15 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum MessagingProviderType { enum MessagingProviderType {
email(value: 'email'), email(value: 'email'),
sms(value: 'sms'), sms(value: 'sms'),
push(value: 'push'); push(value: 'push');
const MessagingProviderType({required this.value}); const MessagingProviderType({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }
+18 -16
View File
@@ -1,22 +1,24 @@
part of '../../enums.dart'; part of '../../enums.dart';
enum Name { enum Name {
v1Database(value: 'v1-database'), v1Database(value: 'v1-database'),
v1Deletes(value: 'v1-deletes'), v1Deletes(value: 'v1-deletes'),
v1Audits(value: 'v1-audits'), v1Audits(value: 'v1-audits'),
v1Mails(value: 'v1-mails'), v1Mails(value: 'v1-mails'),
v1Functions(value: 'v1-functions'), v1Functions(value: 'v1-functions'),
v1StatsResources(value: 'v1-stats-resources'), v1StatsResources(value: 'v1-stats-resources'),
v1StatsUsage(value: 'v1-stats-usage'), v1StatsUsage(value: 'v1-stats-usage'),
v1Webhooks(value: 'v1-webhooks'), v1Webhooks(value: 'v1-webhooks'),
v1Certificates(value: 'v1-certificates'), v1Certificates(value: 'v1-certificates'),
v1Builds(value: 'v1-builds'), v1Builds(value: 'v1-builds'),
v1Messaging(value: 'v1-messaging'), v1Messaging(value: 'v1-messaging'),
v1Migrations(value: 'v1-migrations'); v1Migrations(value: 'v1-migrations');
const Name({required this.value}); const Name({
required this.value
});
final String value; final String value;
String toJson() => value; String toJson() => value;
} }

Some files were not shown because too many files have changed in this diff Show More