Skip to content

Commit

Permalink
chore: release rc
Browse files Browse the repository at this point in the history
  • Loading branch information
christyjacob4 committed Aug 17, 2024
1 parent 0d8d15a commit 9e2067f
Show file tree
Hide file tree
Showing 27 changed files with 526 additions and 33 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![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)
![Version](https://img.shields.io/badge/api%20version-1.5.x-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.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)
[![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)
Expand All @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
dart_appwrite: ^12.0.0-rc.1
dart_appwrite: ^12.0.0-rc.2
```
You can install packages from the command line:
Expand Down
1 change: 0 additions & 1 deletion docs/examples/account/delete-mfa-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ Account account = Account(client);

await account.deleteMfaAuthenticator(
type: AuthenticatorType.totp,
otp: '<OTP>',
);
2 changes: 1 addition & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ Func result = await functions.create(
templateRepository: '<TEMPLATE_REPOSITORY>', // (optional)
templateOwner: '<TEMPLATE_OWNER>', // (optional)
templateRootDirectory: '<TEMPLATE_ROOT_DIRECTORY>', // (optional)
templateBranch: '<TEMPLATE_BRANCH>', // (optional)
templateVersion: '<TEMPLATE_VERSION>', // (optional)
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('&lt;YOUR_PROJECT_ID&gt;') // Your project ID
.setKey('&lt;YOUR_API_KEY&gt;'); // Your secret API key
.setSession(''); // The user session to authenticate with

Functions functions = Functions(client);

UInt8List result = await functions.downloadDeployment(
UInt8List result = await functions.getDeploymentDownload(
functionId: '<FUNCTION_ID>',
deploymentId: '<DEPLOYMENT_ID>',
);
11 changes: 11 additions & 0 deletions docs/examples/functions/get-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:dart_appwrite/dart_appwrite.dart';

Client client = Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('&lt;YOUR_PROJECT_ID&gt;'); // Your project ID

Functions functions = Functions(client);

TemplateFunction result = await functions.getTemplate(
templateId: '<TEMPLATE_ID>',
);
14 changes: 14 additions & 0 deletions docs/examples/functions/list-templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';

Client client = Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('&lt;YOUR_PROJECT_ID&gt;'); // Your project ID

Functions functions = Functions(client);

TemplateFunctionList result = await functions.listTemplates(
runtimes: [], // (optional)
useCases: [], // (optional)
limit: 1, // (optional)
offset: 0, // (optional)
);
2 changes: 1 addition & 1 deletion lib/dart_appwrite.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Appwrite Dart SDK
///
/// This SDK is compatible with Appwrite server version 1.5.x.
/// This SDK is compatible with Appwrite server version 1.6.x.
/// For older versions, please check
/// [previous releases](https://github.com/appwrite/sdk-for-dart/releases).
library dart_appwrite;
Expand Down
4 changes: 4 additions & 0 deletions lib/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ part 'src/models/bucket_list.dart';
part 'src/models/team_list.dart';
part 'src/models/membership_list.dart';
part 'src/models/function_list.dart';
part 'src/models/template_function_list.dart';
part 'src/models/runtime_list.dart';
part 'src/models/deployment_list.dart';
part 'src/models/execution_list.dart';
Expand Down Expand Up @@ -66,6 +67,9 @@ part 'src/models/bucket.dart';
part 'src/models/team.dart';
part 'src/models/membership.dart';
part 'src/models/function.dart';
part 'src/models/template_function.dart';
part 'src/models/template_runtime.dart';
part 'src/models/template_variable.dart';
part 'src/models/runtime.dart';
part 'src/models/deployment.dart';
part 'src/models/execution.dart';
Expand Down
11 changes: 5 additions & 6 deletions lib/services/account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Account extends Service {

}

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

final Map<String, dynamic> apiParams = {

'otp': otp,


};

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

}

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

}

/// Create phone verification (confirmation)
/// Update phone verification (confirmation)
///
/// Use this endpoint to complete the user phone verification process. Use the
/// **userId** and **secret** that were sent to your user's phone number to
Expand Down
2 changes: 2 additions & 0 deletions lib/services/avatars.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class Avatars extends Service {
/// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
/// website URL.
///
/// This endpoint does not follow HTTP redirects.
Future<Uint8List> getFavicon({required String url}) async {
final String apiPath = '/avatars/favicon';

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

Expand Down
78 changes: 69 additions & 9 deletions lib/services/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Functions extends Service {
/// [permissions](https://appwrite.io/docs/permissions) to allow different
/// project users or team with access to execute the function using the client
/// API.
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 {
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 {
final String apiPath = '/functions';

final Map<String, dynamic> apiParams = {
Expand All @@ -61,7 +61,7 @@ class Functions extends Service {
'templateRepository': templateRepository,
'templateOwner': templateOwner,
'templateRootDirectory': templateRootDirectory,
'templateBranch': templateBranch,
'templateVersion': templateVersion,

};

Expand Down Expand Up @@ -98,6 +98,58 @@ class Functions extends Service {

}

/// List function templates
///
/// List available function templates. You can use template details in
/// [createFunction](/docs/references/cloud/server-nodejs/functions#create)
/// method.
Future<models.TemplateFunctionList> listTemplates({List<String>? runtimes, List<String>? useCases, int? limit, int? offset}) async {
final String apiPath = '/functions/templates';

final Map<String, dynamic> apiParams = {
'runtimes': runtimes,
'useCases': useCases,
'limit': limit,
'offset': offset,


};

final Map<String, String> apiHeaders = {
'content-type': 'application/json',

};

final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);

return models.TemplateFunctionList.fromMap(res.data);

}

/// Get function template
///
/// Get a function template using ID. You can use template details in
/// [createFunction](/docs/references/cloud/server-nodejs/functions#create)
/// method.
Future<models.TemplateFunction> getTemplate({required String templateId}) async {
final String apiPath = '/functions/templates/{templateId}'.replaceAll('{templateId}', templateId);

final Map<String, dynamic> apiParams = {


};

final Map<String, String> apiHeaders = {
'content-type': 'application/json',

};

final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);

return models.TemplateFunction.fromMap(res.data);

}

/// Get function
///
/// Get a function by its unique ID.
Expand Down Expand Up @@ -271,7 +323,7 @@ class Functions extends Service {

}

/// Update function deployment
/// Update deployment
///
/// Update the function code deployment ID using the unique function ID. Use
/// this endpoint to switch the code deployment that should be executed by the
Expand Down Expand Up @@ -360,18 +412,18 @@ class Functions extends Service {

}

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

final Map<String, dynamic> params = {


'project': client.config['project'],
'key': client.config['key'],
'session': client.config['session'],
};

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

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

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

};

final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
String idParamName = '';
final res = await client.chunkedUpload(
path: apiPath,
params: apiParams,
paramName: paramName,
idParamName: idParamName,
headers: apiHeaders,
onProgress: onProgress,
);

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

Expand Down
4 changes: 2 additions & 2 deletions lib/src/client_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ClientBrowser extends ClientBase with ClientMixin {
'x-sdk-name': 'Dart',
'x-sdk-platform': 'server',
'x-sdk-language': 'dart',
'x-sdk-version': '12.0.0-rc.1',
'X-Appwrite-Response-Format' : '1.5.0',
'x-sdk-version': '12.0.0-rc.2',
'X-Appwrite-Response-Format' : '1.6.0',
};

config = {};
Expand Down
6 changes: 3 additions & 3 deletions lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class ClientIO extends ClientBase with ClientMixin {
'x-sdk-name': 'Dart',
'x-sdk-platform': 'server',
'x-sdk-language': 'dart',
'x-sdk-version': '12.0.0-rc.1',
'user-agent' : 'AppwriteDartSDK/12.0.0-rc.1 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
'X-Appwrite-Response-Format' : '1.5.0',
'x-sdk-version': '12.0.0-rc.2',
'user-agent' : 'AppwriteDartSDK/12.0.0-rc.2 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
'X-Appwrite-Response-Format' : '1.6.0',
};

config = {};
Expand Down
5 changes: 5 additions & 0 deletions lib/src/models/execution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class Execution implements Model {
final String errors;
/// Function execution duration in seconds.
final double duration;
/// The scheduled time for execution. If left empty, execution will be queued immediately.
final String? scheduledAt;

Execution({
required this.$id,
Expand All @@ -52,6 +54,7 @@ class Execution implements Model {
required this.logs,
required this.errors,
required this.duration,
this.scheduledAt,
});

factory Execution.fromMap(Map<String, dynamic> map) {
Expand All @@ -72,6 +75,7 @@ class Execution implements Model {
logs: map['logs'].toString(),
errors: map['errors'].toString(),
duration: map['duration'].toDouble(),
scheduledAt: map['scheduledAt']?.toString(),
);
}

Expand All @@ -93,6 +97,7 @@ class Execution implements Model {
"logs": logs,
"errors": errors,
"duration": duration,
"scheduledAt": scheduledAt,
};
}
}
5 changes: 5 additions & 0 deletions lib/src/models/runtime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ part of '../../models.dart';
class Runtime implements Model {
/// Runtime ID.
final String $id;
/// Parent runtime key.
final String key;
/// Runtime Name.
final String name;
/// Runtime version.
Expand All @@ -19,6 +21,7 @@ class Runtime implements Model {

Runtime({
required this.$id,
required this.key,
required this.name,
required this.version,
required this.base,
Expand All @@ -30,6 +33,7 @@ class Runtime implements Model {
factory Runtime.fromMap(Map<String, dynamic> map) {
return Runtime(
$id: map['\$id'].toString(),
key: map['key'].toString(),
name: map['name'].toString(),
version: map['version'].toString(),
base: map['base'].toString(),
Expand All @@ -42,6 +46,7 @@ class Runtime implements Model {
Map<String, dynamic> toMap() {
return {
"\$id": $id,
"key": key,
"name": name,
"version": version,
"base": base,
Expand Down
Loading

0 comments on commit 9e2067f

Please sign in to comment.