Skip to content

Commit 9e2067f

Browse files
committed
chore: release rc
1 parent 0d8d15a commit 9e2067f

27 files changed

+526
-33
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![pub package](https://img.shields.io/pub/v/dart_appwrite.svg?style=flat-square)](https://pub.dartlang.org/packages/dart_appwrite)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-1.5.x-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.6.x-blue.svg?style=flat-square)
66
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
77
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
88
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
@@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:
2323

2424
```yml
2525
dependencies:
26-
dart_appwrite: ^12.0.0-rc.1
26+
dart_appwrite: ^12.0.0-rc.2
2727
```
2828
2929
You can install packages from the command line:

docs/examples/account/delete-mfa-authenticator.md

-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ Account account = Account(client);
99

1010
await account.deleteMfaAuthenticator(
1111
type: AuthenticatorType.totp,
12-
otp: '<OTP>',
1312
);

docs/examples/functions/create.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ Func result = await functions.create(
2828
templateRepository: '<TEMPLATE_REPOSITORY>', // (optional)
2929
templateOwner: '<TEMPLATE_OWNER>', // (optional)
3030
templateRootDirectory: '<TEMPLATE_ROOT_DIRECTORY>', // (optional)
31-
templateBranch: '<TEMPLATE_BRANCH>', // (optional)
31+
templateVersion: '<TEMPLATE_VERSION>', // (optional)
3232
);

docs/examples/functions/download-deployment.md docs/examples/functions/get-deployment-download.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import 'package:dart_appwrite/dart_appwrite.dart';
33
Client client = Client()
44
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
55
.setProject('&lt;YOUR_PROJECT_ID&gt;') // Your project ID
6-
.setKey('&lt;YOUR_API_KEY&gt;'); // Your secret API key
6+
.setSession(''); // The user session to authenticate with
77

88
Functions functions = Functions(client);
99

10-
UInt8List result = await functions.downloadDeployment(
10+
UInt8List result = await functions.getDeploymentDownload(
1111
functionId: '<FUNCTION_ID>',
1212
deploymentId: '<DEPLOYMENT_ID>',
1313
);
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
Client client = Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('&lt;YOUR_PROJECT_ID&gt;'); // Your project ID
6+
7+
Functions functions = Functions(client);
8+
9+
TemplateFunction result = await functions.getTemplate(
10+
templateId: '<TEMPLATE_ID>',
11+
);
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
Client client = Client()
4+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('&lt;YOUR_PROJECT_ID&gt;'); // Your project ID
6+
7+
Functions functions = Functions(client);
8+
9+
TemplateFunctionList result = await functions.listTemplates(
10+
runtimes: [], // (optional)
11+
useCases: [], // (optional)
12+
limit: 1, // (optional)
13+
offset: 0, // (optional)
14+
);

lib/dart_appwrite.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// Appwrite Dart SDK
22
///
3-
/// This SDK is compatible with Appwrite server version 1.5.x.
3+
/// This SDK is compatible with Appwrite server version 1.6.x.
44
/// For older versions, please check
55
/// [previous releases](https://github.com/appwrite/sdk-for-dart/releases).
66
library dart_appwrite;

lib/models.dart

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ part 'src/models/bucket_list.dart';
1515
part 'src/models/team_list.dart';
1616
part 'src/models/membership_list.dart';
1717
part 'src/models/function_list.dart';
18+
part 'src/models/template_function_list.dart';
1819
part 'src/models/runtime_list.dart';
1920
part 'src/models/deployment_list.dart';
2021
part 'src/models/execution_list.dart';
@@ -66,6 +67,9 @@ part 'src/models/bucket.dart';
6667
part 'src/models/team.dart';
6768
part 'src/models/membership.dart';
6869
part 'src/models/function.dart';
70+
part 'src/models/template_function.dart';
71+
part 'src/models/template_runtime.dart';
72+
part 'src/models/template_variable.dart';
6973
part 'src/models/runtime.dart';
7074
part 'src/models/deployment.dart';
7175
part 'src/models/execution.dart';

lib/services/account.dart

+5-6
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class Account extends Service {
207207

208208
}
209209

210-
/// Add Authenticator
210+
/// Create Authenticator
211211
///
212212
/// Add an authenticator app to be used as an MFA factor. Verify the
213213
/// authenticator using the [verify
@@ -260,13 +260,12 @@ class Account extends Service {
260260
/// Delete Authenticator
261261
///
262262
/// Delete an authenticator for a user by ID.
263-
Future deleteMfaAuthenticator({required enums.AuthenticatorType type, required String otp}) async {
263+
Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async {
264264
final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value);
265265

266266
final Map<String, dynamic> apiParams = {
267267

268-
'otp': otp,
269-
268+
270269
};
271270

272271
final Map<String, String> apiHeaders = {
@@ -280,7 +279,7 @@ class Account extends Service {
280279

281280
}
282281

283-
/// Create 2FA Challenge
282+
/// Create MFA Challenge
284283
///
285284
/// Begin the process of MFA verification after sign-in. Finish the flow with
286285
/// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
@@ -1150,7 +1149,7 @@ class Account extends Service {
11501149

11511150
}
11521151

1153-
/// Create phone verification (confirmation)
1152+
/// Update phone verification (confirmation)
11541153
///
11551154
/// Use this endpoint to complete the user phone verification process. Use the
11561155
/// **userId** and **secret** that were sent to your user's phone number to

lib/services/avatars.dart

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class Avatars extends Service {
6767
/// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
6868
/// website URL.
6969
///
70+
/// This endpoint does not follow HTTP redirects.
7071
Future<Uint8List> getFavicon({required String url}) async {
7172
final String apiPath = '/avatars/favicon';
7273

@@ -123,6 +124,7 @@ class Avatars extends Service {
123124
/// image at source quality. If dimensions are not specified, the default size
124125
/// of image returned is 400x400px.
125126
///
127+
/// This endpoint does not follow HTTP redirects.
126128
Future<Uint8List> getImage({required String url, int? width, int? height}) async {
127129
final String apiPath = '/avatars/image';
128130

lib/services/functions.dart

+69-9
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Functions extends Service {
3636
/// [permissions](https://appwrite.io/docs/permissions) to allow different
3737
/// project users or team with access to execute the function using the client
3838
/// API.
39-
Future<models.Func> create({required String functionId, required String name, required enums.Runtime runtime, List<String>? execute, List<String>? events, String? schedule, int? timeout, bool? enabled, bool? logging, String? entrypoint, String? commands, List<String>? scopes, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? templateRepository, String? templateOwner, String? templateRootDirectory, String? templateBranch}) async {
39+
Future<models.Func> create({required String functionId, required String name, required enums.Runtime runtime, List<String>? execute, List<String>? events, String? schedule, int? timeout, bool? enabled, bool? logging, String? entrypoint, String? commands, List<String>? scopes, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? templateRepository, String? templateOwner, String? templateRootDirectory, String? templateVersion}) async {
4040
final String apiPath = '/functions';
4141

4242
final Map<String, dynamic> apiParams = {
@@ -61,7 +61,7 @@ class Functions extends Service {
6161
'templateRepository': templateRepository,
6262
'templateOwner': templateOwner,
6363
'templateRootDirectory': templateRootDirectory,
64-
'templateBranch': templateBranch,
64+
'templateVersion': templateVersion,
6565

6666
};
6767

@@ -98,6 +98,58 @@ class Functions extends Service {
9898

9999
}
100100

101+
/// List function templates
102+
///
103+
/// List available function templates. You can use template details in
104+
/// [createFunction](/docs/references/cloud/server-nodejs/functions#create)
105+
/// method.
106+
Future<models.TemplateFunctionList> listTemplates({List<String>? runtimes, List<String>? useCases, int? limit, int? offset}) async {
107+
final String apiPath = '/functions/templates';
108+
109+
final Map<String, dynamic> apiParams = {
110+
'runtimes': runtimes,
111+
'useCases': useCases,
112+
'limit': limit,
113+
'offset': offset,
114+
115+
116+
};
117+
118+
final Map<String, String> apiHeaders = {
119+
'content-type': 'application/json',
120+
121+
};
122+
123+
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
124+
125+
return models.TemplateFunctionList.fromMap(res.data);
126+
127+
}
128+
129+
/// Get function template
130+
///
131+
/// Get a function template using ID. You can use template details in
132+
/// [createFunction](/docs/references/cloud/server-nodejs/functions#create)
133+
/// method.
134+
Future<models.TemplateFunction> getTemplate({required String templateId}) async {
135+
final String apiPath = '/functions/templates/{templateId}'.replaceAll('{templateId}', templateId);
136+
137+
final Map<String, dynamic> apiParams = {
138+
139+
140+
};
141+
142+
final Map<String, String> apiHeaders = {
143+
'content-type': 'application/json',
144+
145+
};
146+
147+
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
148+
149+
return models.TemplateFunction.fromMap(res.data);
150+
151+
}
152+
101153
/// Get function
102154
///
103155
/// Get a function by its unique ID.
@@ -271,7 +323,7 @@ class Functions extends Service {
271323

272324
}
273325

274-
/// Update function deployment
326+
/// Update deployment
275327
///
276328
/// Update the function code deployment ID using the unique function ID. Use
277329
/// this endpoint to switch the code deployment that should be executed by the
@@ -360,18 +412,18 @@ class Functions extends Service {
360412

361413
}
362414

363-
/// Download Deployment
415+
/// Download deployment
364416
///
365417
/// Get a Deployment's contents by its unique ID. This endpoint supports range
366418
/// requests for partial or streaming file download.
367-
Future<Uint8List> downloadDeployment({required String functionId, required String deploymentId}) async {
419+
Future<Uint8List> getDeploymentDownload({required String functionId, required String deploymentId}) async {
368420
final String apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId);
369421

370422
final Map<String, dynamic> params = {
371423

372424

373425
'project': client.config['project'],
374-
'key': client.config['key'],
426+
'session': client.config['session'],
375427
};
376428

377429
final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes);
@@ -409,7 +461,7 @@ class Functions extends Service {
409461
/// current execution status. You can ping the `Get Execution` endpoint to get
410462
/// updates on the current execution status. Once this endpoint is called, your
411463
/// function execution process will start asynchronously.
412-
Future<models.Execution> createExecution({required String functionId, String? body, bool? xasync, String? path, enums.ExecutionMethod? method, Map? headers, String? scheduledAt}) async {
464+
Future<models.Execution> createExecution({required String functionId, String? body, bool? xasync, String? path, enums.ExecutionMethod? method, Map? headers, String? scheduledAt, Function(UploadProgress)? onProgress}) async {
413465
final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId);
414466

415467
final Map<String, dynamic> apiParams = {
@@ -424,11 +476,19 @@ class Functions extends Service {
424476
};
425477

426478
final Map<String, String> apiHeaders = {
427-
'content-type': 'application/json',
479+
'content-type': 'multipart/form-data',
428480

429481
};
430482

431-
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
483+
String idParamName = '';
484+
final res = await client.chunkedUpload(
485+
path: apiPath,
486+
params: apiParams,
487+
paramName: paramName,
488+
idParamName: idParamName,
489+
headers: apiHeaders,
490+
onProgress: onProgress,
491+
);
432492

433493
return models.Execution.fromMap(res.data);
434494

lib/src/client_browser.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class ClientBrowser extends ClientBase with ClientMixin {
3333
'x-sdk-name': 'Dart',
3434
'x-sdk-platform': 'server',
3535
'x-sdk-language': 'dart',
36-
'x-sdk-version': '12.0.0-rc.1',
37-
'X-Appwrite-Response-Format' : '1.5.0',
36+
'x-sdk-version': '12.0.0-rc.2',
37+
'X-Appwrite-Response-Format' : '1.6.0',
3838
};
3939

4040
config = {};

lib/src/client_io.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class ClientIO extends ClientBase with ClientMixin {
4242
'x-sdk-name': 'Dart',
4343
'x-sdk-platform': 'server',
4444
'x-sdk-language': 'dart',
45-
'x-sdk-version': '12.0.0-rc.1',
46-
'user-agent' : 'AppwriteDartSDK/12.0.0-rc.1 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
47-
'X-Appwrite-Response-Format' : '1.5.0',
45+
'x-sdk-version': '12.0.0-rc.2',
46+
'user-agent' : 'AppwriteDartSDK/12.0.0-rc.2 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
47+
'X-Appwrite-Response-Format' : '1.6.0',
4848
};
4949

5050
config = {};

lib/src/models/execution.dart

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class Execution implements Model {
3434
final String errors;
3535
/// Function execution duration in seconds.
3636
final double duration;
37+
/// The scheduled time for execution. If left empty, execution will be queued immediately.
38+
final String? scheduledAt;
3739

3840
Execution({
3941
required this.$id,
@@ -52,6 +54,7 @@ class Execution implements Model {
5254
required this.logs,
5355
required this.errors,
5456
required this.duration,
57+
this.scheduledAt,
5558
});
5659

5760
factory Execution.fromMap(Map<String, dynamic> map) {
@@ -72,6 +75,7 @@ class Execution implements Model {
7275
logs: map['logs'].toString(),
7376
errors: map['errors'].toString(),
7477
duration: map['duration'].toDouble(),
78+
scheduledAt: map['scheduledAt']?.toString(),
7579
);
7680
}
7781

@@ -93,6 +97,7 @@ class Execution implements Model {
9397
"logs": logs,
9498
"errors": errors,
9599
"duration": duration,
100+
"scheduledAt": scheduledAt,
96101
};
97102
}
98103
}

lib/src/models/runtime.dart

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ part of '../../models.dart';
44
class Runtime implements Model {
55
/// Runtime ID.
66
final String $id;
7+
/// Parent runtime key.
8+
final String key;
79
/// Runtime Name.
810
final String name;
911
/// Runtime version.
@@ -19,6 +21,7 @@ class Runtime implements Model {
1921

2022
Runtime({
2123
required this.$id,
24+
required this.key,
2225
required this.name,
2326
required this.version,
2427
required this.base,
@@ -30,6 +33,7 @@ class Runtime implements Model {
3033
factory Runtime.fromMap(Map<String, dynamic> map) {
3134
return Runtime(
3235
$id: map['\$id'].toString(),
36+
key: map['key'].toString(),
3337
name: map['name'].toString(),
3438
version: map['version'].toString(),
3539
base: map['base'].toString(),
@@ -42,6 +46,7 @@ class Runtime implements Model {
4246
Map<String, dynamic> toMap() {
4347
return {
4448
"\$id": $id,
49+
"key": key,
4550
"name": name,
4651
"version": version,
4752
"base": base,

0 commit comments

Comments
 (0)