mirror of
https://github.com/appwrite/sdk-for-flutter.git
synced 2026-04-07 19:27:41 +00:00
fix scripts
This commit is contained in:
@@ -9,4 +9,4 @@ Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -2,15 +2,12 @@ library appwrite;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart' show MultipartFile;
|
||||
import 'src/enums.dart';
|
||||
import 'src/client.dart';
|
||||
import 'src/service.dart';
|
||||
import 'src/input_file.dart';
|
||||
import 'models.dart' as models;
|
||||
import 'src/upload_progress.dart';
|
||||
import 'src/exception.dart';
|
||||
|
||||
export 'src/response.dart';
|
||||
export 'src/client.dart';
|
||||
|
||||
+315
-428
File diff suppressed because it is too large
Load Diff
+111
-118
@@ -1,207 +1,200 @@
|
||||
part of appwrite;
|
||||
|
||||
/// The Avatars service aims to help you complete everyday tasks related to
|
||||
/// your app image, icons, and avatars.
|
||||
/// The Avatars service aims to help you complete everyday tasks related to
|
||||
/// your app image, icons, and avatars.
|
||||
class Avatars extends Service {
|
||||
Avatars(Client client): super(client);
|
||||
|
||||
/// Get Browser Icon
|
||||
///
|
||||
/// 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
|
||||
/// /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use
|
||||
/// width, height and quality arguments to change the output settings.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
Future<Uint8List> getBrowser({required String code, int? width, int? height, int? quality}) async {
|
||||
/// Get Browser Icon
|
||||
///
|
||||
/// 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
|
||||
/// /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use
|
||||
/// width, height and quality arguments to change the output settings.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
Future<Uint8List> getBrowser({required String code, int? width, int? height, int? quality}) async {
|
||||
final String path = '/avatars/browsers/{code}'.replaceAll('{code}', code);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'width': width,
|
||||
'height': height,
|
||||
'quality': quality,
|
||||
|
||||
'height': height,
|
||||
'quality': quality,
|
||||
|
||||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Get Credit Card Icon
|
||||
///
|
||||
/// 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
|
||||
/// output settings.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getCreditCard({required String code, int? width, int? height, int? quality}) async {
|
||||
/// Get Credit Card Icon
|
||||
///
|
||||
/// 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
|
||||
/// output settings.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getCreditCard({required String code, int? width, int? height, int? quality}) async {
|
||||
final String path = '/avatars/credit-cards/{code}'.replaceAll('{code}', code);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'width': width,
|
||||
'height': height,
|
||||
'quality': quality,
|
||||
|
||||
'height': height,
|
||||
'quality': quality,
|
||||
|
||||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Get Favicon
|
||||
///
|
||||
/// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
|
||||
/// website URL.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getFavicon({required String url}) async {
|
||||
/// Get Favicon
|
||||
///
|
||||
/// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
|
||||
/// website URL.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getFavicon({required String url}) async {
|
||||
const String path = '/avatars/favicon';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'url': url,
|
||||
|
||||
|
||||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Get Country Flag
|
||||
///
|
||||
/// 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,
|
||||
/// height and quality arguments to change the output settings.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getFlag({required String code, int? width, int? height, int? quality}) async {
|
||||
/// Get Country Flag
|
||||
///
|
||||
/// 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,
|
||||
/// height and quality arguments to change the output settings.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getFlag({required String code, int? width, int? height, int? quality}) async {
|
||||
final String path = '/avatars/flags/{code}'.replaceAll('{code}', code);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'width': width,
|
||||
'height': height,
|
||||
'quality': quality,
|
||||
|
||||
'height': height,
|
||||
'quality': quality,
|
||||
|
||||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Get Image from URL
|
||||
///
|
||||
/// 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
|
||||
/// remote images in your app or in case you want to make sure a 3rd party
|
||||
/// image is properly served using a TLS protocol.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 400x400px.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getImage({required String url, int? width, int? height}) async {
|
||||
/// Get Image from URL
|
||||
///
|
||||
/// 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
|
||||
/// remote images in your app or in case you want to make sure a 3rd party
|
||||
/// image is properly served using a TLS protocol.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 400x400px.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getImage({required String url, int? width, int? height}) async {
|
||||
const String path = '/avatars/image';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'url': url,
|
||||
'width': width,
|
||||
'height': height,
|
||||
|
||||
'width': width,
|
||||
'height': height,
|
||||
|
||||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Get User Initials
|
||||
///
|
||||
/// 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
|
||||
/// 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
|
||||
/// be returned.
|
||||
///
|
||||
/// 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
|
||||
/// the user's initials when reloading the same theme will always return for
|
||||
/// the same initials.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getInitials({String? name, int? width, int? height, String? color, String? background}) async {
|
||||
/// Get User Initials
|
||||
///
|
||||
/// 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
|
||||
/// 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
|
||||
/// be returned.
|
||||
///
|
||||
/// 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
|
||||
/// the user's initials when reloading the same theme will always return for
|
||||
/// the same initials.
|
||||
///
|
||||
/// 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
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getInitials({String? name, int? width, int? height, String? color, String? background}) async {
|
||||
const String path = '/avatars/initials';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'name': name,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'color': color,
|
||||
'background': background,
|
||||
|
||||
'width': width,
|
||||
'height': height,
|
||||
'color': color,
|
||||
'background': background,
|
||||
|
||||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Get QR Code
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getQR({required String text, int? size, int? margin, bool? download}) async {
|
||||
/// Get QR Code
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
///
|
||||
Future<Uint8List> getQR({required String text, int? size, int? margin, bool? download}) async {
|
||||
const String path = '/avatars/qr';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'text': text,
|
||||
'size': size,
|
||||
'margin': margin,
|
||||
'download': download,
|
||||
|
||||
'size': size,
|
||||
'margin': margin,
|
||||
'download': download,
|
||||
|
||||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
}
|
||||
+28
-48
@@ -1,127 +1,107 @@
|
||||
part of appwrite;
|
||||
|
||||
/// The Databases service allows you to create structured collections of
|
||||
/// documents, query and filter lists of documents
|
||||
/// The Databases service allows you to create structured collections of
|
||||
/// documents, query and filter lists of documents
|
||||
class Databases extends Service {
|
||||
Databases(Client client, {required this.databaseId}): super(client);
|
||||
String databaseId;
|
||||
|
||||
/// List Documents
|
||||
Future<models.DocumentList> listDocuments({required String collectionId, List? queries, int? limit, int? offset, String? cursor, String? cursorDirection, List? orderAttributes, List? orderTypes}) async {
|
||||
/// List Documents
|
||||
Future<models.DocumentList> listDocuments({required String collectionId, List? queries, int? limit, int? offset, String? cursor, String? cursorDirection, List? orderAttributes, List? orderTypes}) async {
|
||||
final String path = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'queries': queries,
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
'orderAttributes': orderAttributes,
|
||||
'orderTypes': orderTypes,
|
||||
|
||||
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
'orderAttributes': orderAttributes,
|
||||
'orderTypes': orderTypes,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.DocumentList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Create Document
|
||||
Future<models.Document> createDocument({required String collectionId, required String documentId, required Map data, List? read, List? write}) async {
|
||||
/// Create Document
|
||||
Future<models.Document> createDocument({required String collectionId, required String documentId, required Map data, List? read, List? write}) async {
|
||||
final String path = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'documentId': documentId,
|
||||
'data': data,
|
||||
'read': read,
|
||||
'write': write,
|
||||
|
||||
'data': data,
|
||||
'read': read,
|
||||
'write': write,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Document.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Get Document
|
||||
Future<models.Document> getDocument({required String collectionId, required String documentId}) async {
|
||||
/// Get Document
|
||||
Future<models.Document> getDocument({required String collectionId, required String documentId}) async {
|
||||
final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Document.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Update Document
|
||||
Future<models.Document> updateDocument({required String collectionId, required String documentId, Map? data, List? read, List? write}) async {
|
||||
/// Update Document
|
||||
Future<models.Document> updateDocument({required String collectionId, required String documentId, Map? data, List? read, List? write}) async {
|
||||
final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'data': data,
|
||||
'read': read,
|
||||
'write': write,
|
||||
|
||||
'read': read,
|
||||
'write': write,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Document.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Delete Document
|
||||
Future deleteDocument({required String collectionId, required String documentId}) async {
|
||||
/// Delete Document
|
||||
Future deleteDocument({required String collectionId, required String documentId}) async {
|
||||
final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.delete, path: path, params: params, headers: headers);
|
||||
|
||||
return res.data;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+34
-50
@@ -1,113 +1,97 @@
|
||||
part of appwrite;
|
||||
|
||||
/// The Functions Service allows you view, create and manage your Cloud
|
||||
/// Functions.
|
||||
/// The Functions Service allows you view, create and manage your Cloud
|
||||
/// Functions.
|
||||
class Functions extends Service {
|
||||
Functions(Client client): super(client);
|
||||
|
||||
/// Retry Build
|
||||
Future retryBuild({required String functionId, required String deploymentId, required String buildId}) async {
|
||||
/// Retry Build
|
||||
Future retryBuild({required String functionId, required String deploymentId, required String buildId}) async {
|
||||
final String path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId).replaceAll('{buildId}', buildId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: path, params: params, headers: headers);
|
||||
|
||||
return res.data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// List Executions
|
||||
///
|
||||
/// Get a list of all the current user function execution logs. You can use the
|
||||
/// query params to filter your results. On admin mode, this endpoint will
|
||||
/// return a list of all of the project's executions. [Learn more about
|
||||
/// different API modes](/docs/admin).
|
||||
///
|
||||
Future<models.ExecutionList> listExecutions({required String functionId, int? limit, int? offset, String? search, String? cursor, String? cursorDirection}) async {
|
||||
/// List Executions
|
||||
///
|
||||
/// Get a list of all the current user function execution logs. You can use the
|
||||
/// query params to filter your results. On admin mode, this endpoint will
|
||||
/// return a list of all of the project's executions. [Learn more about
|
||||
/// different API modes](/docs/admin).
|
||||
///
|
||||
Future<models.ExecutionList> listExecutions({required String functionId, int? limit, int? offset, String? search, String? cursor, String? cursorDirection}) async {
|
||||
final String path = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'search': search,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
|
||||
|
||||
'offset': offset,
|
||||
'search': search,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.ExecutionList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Create Execution
|
||||
///
|
||||
/// Trigger a function execution. The returned object will return you the
|
||||
/// 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? data, bool? xasync}) async {
|
||||
/// Create Execution
|
||||
///
|
||||
/// Trigger a function execution. The returned object will return you the
|
||||
/// 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? data, bool? xasync}) async {
|
||||
final String path = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'data': data,
|
||||
'async': xasync,
|
||||
|
||||
'async': xasync,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Execution.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Get Execution
|
||||
///
|
||||
/// Get a function execution log by its unique ID.
|
||||
///
|
||||
Future<models.Execution> getExecution({required String functionId, required String executionId}) async {
|
||||
/// Get Execution
|
||||
///
|
||||
/// Get a function execution log by its unique ID.
|
||||
///
|
||||
Future<models.Execution> getExecution({required String functionId, required String executionId}) async {
|
||||
final String path = '/functions/{functionId}/executions/{executionId}'.replaceAll('{functionId}', functionId).replaceAll('{executionId}', executionId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Execution.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+56
-84
@@ -1,187 +1,159 @@
|
||||
part of appwrite;
|
||||
|
||||
/// The Locale service allows you to customize your app based on your users'
|
||||
/// location.
|
||||
/// The Locale service allows you to customize your app based on your users'
|
||||
/// location.
|
||||
class Locale extends Service {
|
||||
Locale(Client client): super(client);
|
||||
|
||||
/// Get User Locale
|
||||
///
|
||||
/// Get the current user location based on IP. Returns an object with user
|
||||
/// 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
|
||||
/// supported language.
|
||||
///
|
||||
/// ([IP Geolocation by DB-IP](https://db-ip.com))
|
||||
///
|
||||
Future<models.Locale> get() async {
|
||||
/// Get User Locale
|
||||
///
|
||||
/// Get the current user location based on IP. Returns an object with user
|
||||
/// 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
|
||||
/// supported language.
|
||||
///
|
||||
/// ([IP Geolocation by DB-IP](https://db-ip.com))
|
||||
///
|
||||
Future<models.Locale> get() async {
|
||||
const String path = '/locale';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Locale.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// List Continents
|
||||
///
|
||||
/// List of all continents. You can use the locale header to get the data in a
|
||||
/// supported language.
|
||||
///
|
||||
Future<models.ContinentList> getContinents() async {
|
||||
/// List Continents
|
||||
///
|
||||
/// List of all continents. You can use the locale header to get the data in a
|
||||
/// supported language.
|
||||
///
|
||||
Future<models.ContinentList> getContinents() async {
|
||||
const String path = '/locale/continents';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.ContinentList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// List Countries
|
||||
///
|
||||
/// List of all countries. You can use the locale header to get the data in a
|
||||
/// supported language.
|
||||
///
|
||||
Future<models.CountryList> getCountries() async {
|
||||
/// List Countries
|
||||
///
|
||||
/// List of all countries. You can use the locale header to get the data in a
|
||||
/// supported language.
|
||||
///
|
||||
Future<models.CountryList> getCountries() async {
|
||||
const String path = '/locale/countries';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.CountryList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// List EU Countries
|
||||
///
|
||||
/// 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> getCountriesEU() async {
|
||||
/// List EU Countries
|
||||
///
|
||||
/// 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> getCountriesEU() async {
|
||||
const String path = '/locale/countries/eu';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.CountryList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// List Countries Phone Codes
|
||||
///
|
||||
/// List of all countries phone codes. You can use the locale header to get the
|
||||
/// data in a supported language.
|
||||
///
|
||||
Future<models.PhoneList> getCountriesPhones() async {
|
||||
/// List Countries Phone Codes
|
||||
///
|
||||
/// List of all countries phone codes. You can use the locale header to get the
|
||||
/// data in a supported language.
|
||||
///
|
||||
Future<models.PhoneList> getCountriesPhones() async {
|
||||
const String path = '/locale/countries/phones';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.PhoneList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// List Currencies
|
||||
///
|
||||
/// 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> getCurrencies() async {
|
||||
/// List Currencies
|
||||
///
|
||||
/// 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> getCurrencies() async {
|
||||
const String path = '/locale/currencies';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.CurrencyList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// List Languages
|
||||
///
|
||||
/// 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> getLanguages() async {
|
||||
/// List Languages
|
||||
///
|
||||
/// 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> getLanguages() async {
|
||||
const String path = '/locale/languages';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.LanguageList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+99
-120
@@ -1,77 +1,72 @@
|
||||
part of appwrite;
|
||||
|
||||
/// The Storage service allows you to manage your project files.
|
||||
/// The Storage service allows you to manage your project files.
|
||||
class Storage extends Service {
|
||||
Storage(Client client): super(client);
|
||||
|
||||
/// List Files
|
||||
///
|
||||
/// Get a list of all the user files. You can use the query params to filter
|
||||
/// your results. On admin mode, this endpoint will return a list of all of the
|
||||
/// project's files. [Learn more about different API modes](/docs/admin).
|
||||
///
|
||||
Future<models.FileList> listFiles({required String bucketId, String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
|
||||
/// List Files
|
||||
///
|
||||
/// Get a list of all the user files. You can use the query params to filter
|
||||
/// your results. On admin mode, this endpoint will return a list of all of the
|
||||
/// project's files. [Learn more about different API modes](/docs/admin).
|
||||
///
|
||||
Future<models.FileList> listFiles({required String bucketId, String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
|
||||
final String path = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'search': search,
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
'orderType': orderType,
|
||||
|
||||
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
'orderType': orderType,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.FileList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Create File
|
||||
///
|
||||
/// Create a new file. Before using this route, you should create a new bucket
|
||||
/// resource using either a [server
|
||||
/// integration](/docs/server/database#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? read, List? write, Function(UploadProgress)? onProgress}) async {
|
||||
/// Create File
|
||||
///
|
||||
/// Create a new file. Before using this route, you should create a new bucket
|
||||
/// resource using either a [server
|
||||
/// integration](/docs/server/database#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? read, List? write, Function(UploadProgress)? onProgress}) async {
|
||||
final String path = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'fileId': fileId,
|
||||
'file': file,
|
||||
'read': read,
|
||||
'write': write,
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
'fileId': fileId,
|
||||
'file': file,
|
||||
'read': read,
|
||||
'write': write,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'multipart/form-data',
|
||||
|
||||
'content-type': 'multipart/form-data',
|
||||
};
|
||||
|
||||
String idParamName = '';
|
||||
@@ -88,93 +83,80 @@ class Storage extends Service {
|
||||
|
||||
return models.File.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Get File
|
||||
///
|
||||
/// 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 {
|
||||
/// Get File
|
||||
///
|
||||
/// 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 path = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.File.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Update File
|
||||
///
|
||||
/// Update a file by its unique ID. Only users with write permissions have
|
||||
/// access to update this resource.
|
||||
///
|
||||
Future<models.File> updateFile({required String bucketId, required String fileId, List? read, List? write}) async {
|
||||
/// Update File
|
||||
///
|
||||
/// Update a file by its unique ID. Only users with write permissions have
|
||||
/// access to update this resource.
|
||||
///
|
||||
Future<models.File> updateFile({required String bucketId, required String fileId, List? read, List? write}) async {
|
||||
final String path = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'read': read,
|
||||
'write': write,
|
||||
|
||||
'write': write,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.put, path: path, params: params, headers: headers);
|
||||
|
||||
return models.File.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Delete File
|
||||
///
|
||||
/// 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 {
|
||||
/// Delete File
|
||||
///
|
||||
/// 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 path = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.delete, path: path, params: params, headers: headers);
|
||||
|
||||
return res.data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Get File for Download
|
||||
///
|
||||
/// 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}) async {
|
||||
/// Get File for Download
|
||||
///
|
||||
/// 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}) async {
|
||||
final String path = '/storage/buckets/{bucketId}/files/{fileId}/download'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
@@ -185,49 +167,47 @@ class Storage extends Service {
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Get File Preview
|
||||
///
|
||||
/// 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, String? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, String? output}) async {
|
||||
/// Get File Preview
|
||||
///
|
||||
/// 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, String? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, String? output}) async {
|
||||
final String path = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'width': width,
|
||||
'height': height,
|
||||
'gravity': gravity,
|
||||
'quality': quality,
|
||||
'borderWidth': borderWidth,
|
||||
'borderColor': borderColor,
|
||||
'borderRadius': borderRadius,
|
||||
'opacity': opacity,
|
||||
'rotation': rotation,
|
||||
'background': background,
|
||||
'output': output,
|
||||
|
||||
'height': height,
|
||||
'gravity': gravity,
|
||||
'quality': quality,
|
||||
'borderWidth': borderWidth,
|
||||
'borderColor': borderColor,
|
||||
'borderRadius': borderRadius,
|
||||
'opacity': opacity,
|
||||
'rotation': rotation,
|
||||
'background': background,
|
||||
'output': output,
|
||||
|
||||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Get File for View
|
||||
///
|
||||
/// 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}) async {
|
||||
/// Get File for View
|
||||
///
|
||||
/// 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}) async {
|
||||
final String path = '/storage/buckets/{bucketId}/files/{fileId}/view'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
@@ -238,6 +218,5 @@ class Storage extends Service {
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, responseType: ResponseType.bytes);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
}
|
||||
+118
-162
@@ -1,328 +1,284 @@
|
||||
part of appwrite;
|
||||
|
||||
/// 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
|
||||
/// 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
|
||||
class Teams extends Service {
|
||||
Teams(Client client): super(client);
|
||||
|
||||
/// List Teams
|
||||
///
|
||||
/// Get a list of all the teams in which the current user is a member. You can
|
||||
/// use the parameters to filter your results.
|
||||
///
|
||||
/// In admin mode, this endpoint returns a list of all the teams in the current
|
||||
/// project. [Learn more about different API modes](/docs/admin).
|
||||
///
|
||||
Future<models.TeamList> list({String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
|
||||
/// List Teams
|
||||
///
|
||||
/// Get a list of all the teams in which the current user is a member. You can
|
||||
/// use the parameters to filter your results.
|
||||
///
|
||||
/// In admin mode, this endpoint returns a list of all the teams in the current
|
||||
/// project. [Learn more about different API modes](/docs/admin).
|
||||
///
|
||||
Future<models.TeamList> list({String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
|
||||
const String path = '/teams';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'search': search,
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
'orderType': orderType,
|
||||
|
||||
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
'orderType': orderType,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.TeamList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Create Team
|
||||
///
|
||||
/// 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
|
||||
/// invite new members, add new owners and delete or update the team.
|
||||
///
|
||||
Future<models.Team> create({required String teamId, required String name, List? roles}) async {
|
||||
/// Create Team
|
||||
///
|
||||
/// 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
|
||||
/// invite new members, add new owners and delete or update the team.
|
||||
///
|
||||
Future<models.Team> create({required String teamId, required String name, List? roles}) async {
|
||||
const String path = '/teams';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'teamId': teamId,
|
||||
'name': name,
|
||||
'roles': roles,
|
||||
|
||||
'name': name,
|
||||
'roles': roles,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Team.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Get Team
|
||||
///
|
||||
/// Get a team by its ID. All team members have read access for this resource.
|
||||
///
|
||||
Future<models.Team> get({required String teamId}) async {
|
||||
/// Get Team
|
||||
///
|
||||
/// 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 path = '/teams/{teamId}'.replaceAll('{teamId}', teamId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Team.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Update Team
|
||||
///
|
||||
/// Update a team using its ID. Only members with the owner role can update the
|
||||
/// team.
|
||||
///
|
||||
Future<models.Team> update({required String teamId, required String name}) async {
|
||||
/// Update Team
|
||||
///
|
||||
/// Update a team using its ID. Only members with the owner role can update the
|
||||
/// team.
|
||||
///
|
||||
Future<models.Team> update({required String teamId, required String name}) async {
|
||||
final String path = '/teams/{teamId}'.replaceAll('{teamId}', teamId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'name': name,
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.put, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Team.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Delete Team
|
||||
///
|
||||
/// Delete a team using its ID. Only team members with the owner role can
|
||||
/// delete the team.
|
||||
///
|
||||
Future delete({required String teamId}) async {
|
||||
/// Delete Team
|
||||
///
|
||||
/// Delete a team using its ID. Only team members with the owner role can
|
||||
/// delete the team.
|
||||
///
|
||||
Future delete({required String teamId}) async {
|
||||
final String path = '/teams/{teamId}'.replaceAll('{teamId}', teamId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.delete, path: path, params: params, headers: headers);
|
||||
|
||||
return res.data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Get Team Memberships
|
||||
///
|
||||
/// Use this endpoint to list a team's members using the team's ID. All team
|
||||
/// members have read access to this endpoint.
|
||||
///
|
||||
Future<models.MembershipList> getMemberships({required String teamId, String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
|
||||
/// Get Team Memberships
|
||||
///
|
||||
/// Use this endpoint to list a team's members using the team's ID. All team
|
||||
/// members have read access to this endpoint.
|
||||
///
|
||||
Future<models.MembershipList> getMemberships({required String teamId, String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
|
||||
final String path = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'search': search,
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
'orderType': orderType,
|
||||
|
||||
|
||||
'limit': limit,
|
||||
'offset': offset,
|
||||
'cursor': cursor,
|
||||
'cursorDirection': cursorDirection,
|
||||
'orderType': orderType,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.MembershipList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Create Team Membership
|
||||
///
|
||||
/// Invite a new member to join your team. If initiated from the client SDK, an
|
||||
/// email with a link to join the team will be sent to the member's email
|
||||
/// address and an account will be created for them should they not be signed
|
||||
/// up already. If initiated from server-side SDKs, the new member will
|
||||
/// automatically be added to the team.
|
||||
///
|
||||
/// Use the 'url' parameter to redirect the user from the invitation email back
|
||||
/// to your app. When the user is redirected, use the [Update Team Membership
|
||||
/// Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
|
||||
/// the user to accept the invitation to the team.
|
||||
///
|
||||
/// Please note that to avoid a [Redirect
|
||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// adding your platforms in the console interface.
|
||||
///
|
||||
Future<models.Membership> createMembership({required String teamId, required String email, required List roles, required String url, String? name}) async {
|
||||
/// Create Team Membership
|
||||
///
|
||||
/// Invite a new member to join your team. If initiated from the client SDK, an
|
||||
/// email with a link to join the team will be sent to the member's email
|
||||
/// address and an account will be created for them should they not be signed
|
||||
/// up already. If initiated from server-side SDKs, the new member will
|
||||
/// automatically be added to the team.
|
||||
///
|
||||
/// Use the 'url' parameter to redirect the user from the invitation email back
|
||||
/// to your app. When the user is redirected, use the [Update Team Membership
|
||||
/// Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
|
||||
/// the user to accept the invitation to the team.
|
||||
///
|
||||
/// Please note that to avoid a [Redirect
|
||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// adding your platforms in the console interface.
|
||||
///
|
||||
Future<models.Membership> createMembership({required String teamId, required String email, required List roles, required String url, String? name}) async {
|
||||
final String path = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'email': email,
|
||||
'roles': roles,
|
||||
'url': url,
|
||||
'name': name,
|
||||
|
||||
'roles': roles,
|
||||
'url': url,
|
||||
'name': name,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Membership.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Get Team Membership
|
||||
///
|
||||
/// Get a team member by the membership unique id. All team members have read
|
||||
/// access for this resource.
|
||||
///
|
||||
Future<models.MembershipList> getMembership({required String teamId, required String membershipId}) async {
|
||||
/// Get Team Membership
|
||||
///
|
||||
/// Get a team member by the membership unique id. All team members have read
|
||||
/// access for this resource.
|
||||
///
|
||||
Future<models.MembershipList> getMembership({required String teamId, required String membershipId}) async {
|
||||
final String path = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||
|
||||
return models.MembershipList.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Update Membership Roles
|
||||
///
|
||||
/// 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](/docs/permissions).
|
||||
///
|
||||
Future<models.Membership> updateMembershipRoles({required String teamId, required String membershipId, required List roles}) async {
|
||||
/// Update Membership Roles
|
||||
///
|
||||
/// 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](/docs/permissions).
|
||||
///
|
||||
Future<models.Membership> updateMembershipRoles({required String teamId, required String membershipId, required List roles}) async {
|
||||
final String path = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'roles': roles,
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Membership.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Delete Team Membership
|
||||
///
|
||||
/// This endpoint allows a user to leave a team or for a team owner to delete
|
||||
/// the membership of any other team member. You can also use this endpoint to
|
||||
/// delete a user membership even if it is not accepted.
|
||||
///
|
||||
Future deleteMembership({required String teamId, required String membershipId}) async {
|
||||
/// Delete Team Membership
|
||||
///
|
||||
/// This endpoint allows a user to leave a team or for a team owner to delete
|
||||
/// the membership of any other team member. You can also use this endpoint to
|
||||
/// delete a user membership even if it is not accepted.
|
||||
///
|
||||
Future deleteMembership({required String teamId, required String membershipId}) async {
|
||||
final String path = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.delete, path: path, params: params, headers: headers);
|
||||
|
||||
return res.data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Update Team Membership Status
|
||||
///
|
||||
/// 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
|
||||
/// by the user.
|
||||
///
|
||||
/// If the request is successful, a session for the user is automatically
|
||||
/// created.
|
||||
///
|
||||
///
|
||||
Future<models.Membership> updateMembershipStatus({required String teamId, required String membershipId, required String userId, required String secret}) async {
|
||||
/// Update Team Membership Status
|
||||
///
|
||||
/// 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
|
||||
/// by the user.
|
||||
///
|
||||
/// If the request is successful, a session for the user is automatically
|
||||
/// created.
|
||||
///
|
||||
///
|
||||
Future<models.Membership> updateMembershipStatus({required String teamId, required String membershipId, required String userId, required String secret}) async {
|
||||
final String path = '/teams/{teamId}/memberships/{membershipId}/status'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'userId': userId,
|
||||
'secret': secret,
|
||||
|
||||
'secret': secret,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
|
||||
|
||||
return models.Membership.fromMap(res.data);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:html' as html;
|
||||
import 'dart:math';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_web_auth/flutter_web_auth.dart';
|
||||
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/browser_client.dart';
|
||||
import 'client_mixin.dart';
|
||||
@@ -216,7 +216,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
|
||||
|
||||
@override
|
||||
Future webAuth(Uri url) {
|
||||
return FlutterWebAuth.authenticate(
|
||||
return FlutterWebAuth2.authenticate(
|
||||
url: url.toString(),
|
||||
callbackUrlScheme: "appwrite-callback-" + config['project']!,
|
||||
);
|
||||
|
||||
+10
-2
@@ -6,7 +6,7 @@ import 'package:http/http.dart' as http;
|
||||
import 'package:http/io_client.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:flutter_web_auth/flutter_web_auth.dart';
|
||||
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart';
|
||||
import 'client_mixin.dart';
|
||||
import 'client_base.dart';
|
||||
import 'cookie_manager.dart';
|
||||
@@ -34,6 +34,7 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
@override
|
||||
late Map<String, String> config;
|
||||
bool selfSigned;
|
||||
bool _initProgress = false;
|
||||
bool _initialized = false;
|
||||
String? _endPointRealtime;
|
||||
late http.Client _httpClient;
|
||||
@@ -41,6 +42,7 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
late CookieJar _cookieJar;
|
||||
final List<Interceptor> _interceptors = [];
|
||||
|
||||
bool get initProgress => _initProgress;
|
||||
bool get initialized => _initialized;
|
||||
CookieJar get cookieJar => _cookieJar;
|
||||
@override
|
||||
@@ -133,6 +135,8 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
}
|
||||
|
||||
Future init() async {
|
||||
if(_initProgress) return;
|
||||
_initProgress = true;
|
||||
// if web skip cookie implementation and origin header as those are automatically handled by browsers
|
||||
final Directory cookieDir = await _getCookiePath();
|
||||
_cookieJar = PersistCookieJar(storage: FileStorage(cookieDir.path));
|
||||
@@ -175,6 +179,7 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
'user-agent', '${packageInfo.packageName}/${packageInfo.version} $device');
|
||||
|
||||
_initialized = true;
|
||||
_initProgress = false;
|
||||
}
|
||||
|
||||
Future<http.BaseRequest> _interceptRequest(http.BaseRequest request) async {
|
||||
@@ -304,7 +309,7 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
|
||||
@override
|
||||
Future webAuth(Uri url) {
|
||||
return FlutterWebAuth.authenticate(
|
||||
return FlutterWebAuth2.authenticate(
|
||||
url: url.toString(),
|
||||
callbackUrlScheme: "appwrite-callback-" + config['project']!,
|
||||
).then((value) async {
|
||||
@@ -333,6 +338,9 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
Map<String, dynamic> params = const {},
|
||||
ResponseType? responseType,
|
||||
}) async {
|
||||
while (!_initialized && _initProgress) {
|
||||
await Future.delayed(Duration(milliseconds: 10));
|
||||
}
|
||||
if (!_initialized) {
|
||||
await init();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ class RealtimeIO extends RealtimeBase with RealtimeMixin {
|
||||
|
||||
Future<WebSocketChannel> _getWebSocket(Uri uri) async {
|
||||
Map<String, String>? headers;
|
||||
while (!(client as ClientIO).initialized && (client as ClientIO).initProgress) {
|
||||
await Future.delayed(Duration(milliseconds: 10));
|
||||
}
|
||||
if (!(client as ClientIO).initialized) {
|
||||
await (client as ClientIO).init();
|
||||
}
|
||||
|
||||
+8
-7
@@ -6,19 +6,20 @@ repository: https://github.com/appwrite/sdk-for-flutter
|
||||
issue_tracker: https://github.com/appwrite/sdk-generator/issues
|
||||
documentation: https://appwrite.io/support
|
||||
environment:
|
||||
sdk: '>=2.14.0 <3.0.0'
|
||||
sdk: '>=2.17.0 <3.0.0'
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
cookie_jar: ^3.0.1
|
||||
device_info_plus: ^3.2.2
|
||||
flutter_web_auth: ^0.4.1
|
||||
http: ^0.13.4
|
||||
package_info_plus: 1.4.2
|
||||
path_provider: ^2.0.9
|
||||
device_info_plus: ^4.1.2
|
||||
flutter_web_auth_2: ^1.0.1
|
||||
http: ^0.13.5
|
||||
package_info_plus: ^1.4.3+1
|
||||
path_provider: ^2.0.11
|
||||
web_socket_channel: ^2.2.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^1.0.4
|
||||
flutter_lints: ^2.0.1
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
Reference in New Issue
Block a user