diff --git a/CHANGELOG.md b/CHANGELOG.md index fb6b74b8..35b85ad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 24.1.1 + +* Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs) +* Added: `sizeActual` field to `File` model +* Updated: Refreshed code formatting from the SDK generator + ## 24.1.0 * Added: Realtime `presences` channel and `RealtimePresence` types for presence subscriptions diff --git a/README.md b/README.md index ca43bef0..84ed4e08 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^24.1.0 + appwrite: ^24.1.1 ``` You can install packages from the command line: diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md deleted file mode 100644 index f224e4f6..00000000 --- a/docs/examples/advisor/get-insight.md +++ /dev/null @@ -1,14 +0,0 @@ -```dart -import 'package:appwrite/appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -Advisor advisor = Advisor(client); - -Insight result = await advisor.getInsight( - reportId: '', - insightId: '', -); -``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md deleted file mode 100644 index cdbb7541..00000000 --- a/docs/examples/advisor/get-report.md +++ /dev/null @@ -1,13 +0,0 @@ -```dart -import 'package:appwrite/appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -Advisor advisor = Advisor(client); - -Report result = await advisor.getReport( - reportId: '', -); -``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md deleted file mode 100644 index d9b594ef..00000000 --- a/docs/examples/advisor/list-insights.md +++ /dev/null @@ -1,15 +0,0 @@ -```dart -import 'package:appwrite/appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -Advisor advisor = Advisor(client); - -InsightList result = await advisor.listInsights( - reportId: '', - queries: [], // optional - total: false, // optional -); -``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md deleted file mode 100644 index 162d463e..00000000 --- a/docs/examples/advisor/list-reports.md +++ /dev/null @@ -1,14 +0,0 @@ -```dart -import 'package:appwrite/appwrite.dart'; - -Client client = Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -Advisor advisor = Advisor(client); - -ReportList result = await advisor.listReports( - queries: [], // optional - total: false, // optional -); -``` diff --git a/lib/appwrite.dart b/lib/appwrite.dart index 85a84fe6..ae51be5e 100644 --- a/lib/appwrite.dart +++ b/lib/appwrite.dart @@ -40,7 +40,6 @@ part 'services/graphql.dart'; part 'services/locale.dart'; part 'services/messaging.dart'; part 'services/presences.dart'; -part 'services/advisor.dart'; part 'services/storage.dart'; part 'services/tables_db.dart'; part 'services/teams.dart'; diff --git a/lib/models.dart b/lib/models.dart index 5a4c5dac..fb5d3f8d 100644 --- a/lib/models.dart +++ b/lib/models.dart @@ -21,8 +21,6 @@ part 'src/models/currency_list.dart'; part 'src/models/phone_list.dart'; part 'src/models/locale_code_list.dart'; part 'src/models/transaction_list.dart'; -part 'src/models/insight_list.dart'; -part 'src/models/report_list.dart'; part 'src/models/row.dart'; part 'src/models/document.dart'; part 'src/models/presence.dart'; @@ -59,6 +57,3 @@ part 'src/models/mfa_factors.dart'; part 'src/models/transaction.dart'; part 'src/models/subscriber.dart'; part 'src/models/target.dart'; -part 'src/models/insight.dart'; -part 'src/models/insight_cta.dart'; -part 'src/models/report.dart'; diff --git a/lib/services/advisor.dart b/lib/services/advisor.dart deleted file mode 100644 index 153401be..00000000 --- a/lib/services/advisor.dart +++ /dev/null @@ -1,82 +0,0 @@ -part of '../appwrite.dart'; - -class Advisor extends Service { - /// Initializes a [Advisor] service - Advisor(super.client); - - /// Get a list of all the project's analyzer reports. You can use the query - /// params to filter your results. - /// - Future listReports( - {List? queries, bool? total}) async { - const String apiPath = '/reports'; - - final Map apiParams = { - if (queries != null) 'queries': queries, - if (total != null) 'total': total, - }; - - final Map apiHeaders = {}; - - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); - - return models.ReportList.fromMap(res.data); - } - - /// Get an analyzer report by its unique ID. The response includes the report's - /// metadata and the nested insights it produced. - /// - Future getReport({required String reportId}) async { - final String apiPath = - '/reports/{reportId}'.replaceAll('{reportId}', reportId); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); - - return models.Report.fromMap(res.data); - } - - /// List the insights produced under a single analyzer report. You can use the - /// query params to filter your results further. - /// - Future listInsights( - {required String reportId, List? queries, bool? total}) async { - final String apiPath = - '/reports/{reportId}/insights'.replaceAll('{reportId}', reportId); - - final Map apiParams = { - if (queries != null) 'queries': queries, - if (total != null) 'total': total, - }; - - final Map apiHeaders = {}; - - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); - - return models.InsightList.fromMap(res.data); - } - - /// Get an insight by its unique ID, scoped to its parent report. - /// - Future getInsight( - {required String reportId, required String insightId}) async { - final String apiPath = '/reports/{reportId}/insights/{insightId}' - .replaceAll('{reportId}', reportId) - .replaceAll('{insightId}', insightId); - - final Map apiParams = {}; - - final Map apiHeaders = {}; - - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); - - return models.Insight.fromMap(res.data); - } -} diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 1eb34c10..98c71f28 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '24.1.0', + 'x-sdk-version': '24.1.1', 'X-Appwrite-Response-Format': '1.9.5', }; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index ecc5c698..ff6501c8 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -58,7 +58,7 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '24.1.0', + 'x-sdk-version': '24.1.1', 'X-Appwrite-Response-Format': '1.9.5', }; diff --git a/lib/src/models/file.dart b/lib/src/models/file.dart index d17a8aac..01cdcb3a 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -29,6 +29,9 @@ class File implements Model { /// File original size in bytes. final int sizeOriginal; + /// File actual stored size in bytes after compression and/or encryption. + final int sizeActual; + /// Total number of chunks available final int chunksTotal; @@ -51,6 +54,7 @@ class File implements Model { required this.signature, required this.mimeType, required this.sizeOriginal, + required this.sizeActual, required this.chunksTotal, required this.chunksUploaded, required this.encryption, @@ -68,6 +72,7 @@ class File implements Model { signature: map['signature'].toString(), mimeType: map['mimeType'].toString(), sizeOriginal: map['sizeOriginal'], + sizeActual: map['sizeActual'], chunksTotal: map['chunksTotal'], chunksUploaded: map['chunksUploaded'], encryption: map['encryption'], @@ -87,6 +92,7 @@ class File implements Model { "signature": signature, "mimeType": mimeType, "sizeOriginal": sizeOriginal, + "sizeActual": sizeActual, "chunksTotal": chunksTotal, "chunksUploaded": chunksUploaded, "encryption": encryption, diff --git a/lib/src/models/insight.dart b/lib/src/models/insight.dart deleted file mode 100644 index 4527e5f1..00000000 --- a/lib/src/models/insight.dart +++ /dev/null @@ -1,121 +0,0 @@ -part of '../../models.dart'; - -/// Insight -class Insight implements Model { - /// Insight ID. - final String $id; - - /// Insight creation date in ISO 8601 format. - final String $createdAt; - - /// Insight update date in ISO 8601 format. - final String $updatedAt; - - /// Parent report ID. Insights always belong to a report. - final String reportId; - - /// Insight type. One of databaseIndex (legacy), tablesDBIndex, documentsDBIndex, vectorsDBIndex, databasePerformance, sitePerformance, siteAccessibility, siteSeo, functionPerformance. The index types are engine-specific so each CTA can pair the right service+method (databases.createIndex, tablesDB.createIndex, documentsDB.createIndex, or vectorsDB.createIndex). - final String type; - - /// Insight severity. One of info, warning, critical. - final String severity; - - /// Insight status. One of active, dismissed. - final String status; - - /// Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. - final String resourceType; - - /// ID of the resource the insight is about. - final String resourceId; - - /// Plural noun for the parent resource that contains the insight's resource, e.g. an insight about a column index on a table → resourceType=indexes, parentResourceType=tables. Empty when the resource has no parent. - final String parentResourceType; - - /// ID of the parent resource. Empty when the resource has no parent. - final String parentResourceId; - - /// Insight title. - final String title; - - /// Short markdown summary describing the insight. - final String summary; - - /// List of call-to-action buttons attached to this insight. - final List ctas; - - /// Time the insight was analyzed in ISO 8601 format. - final String? analyzedAt; - - /// Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. - final String? dismissedAt; - - /// User ID that dismissed the insight. Empty when not dismissed. - final String? dismissedBy; - - Insight({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.reportId, - required this.type, - required this.severity, - required this.status, - required this.resourceType, - required this.resourceId, - required this.parentResourceType, - required this.parentResourceId, - required this.title, - required this.summary, - required this.ctas, - this.analyzedAt, - this.dismissedAt, - this.dismissedBy, - }); - - factory Insight.fromMap(Map map) { - return Insight( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - reportId: map['reportId'].toString(), - type: map['type'].toString(), - severity: map['severity'].toString(), - status: map['status'].toString(), - resourceType: map['resourceType'].toString(), - resourceId: map['resourceId'].toString(), - parentResourceType: map['parentResourceType'].toString(), - parentResourceId: map['parentResourceId'].toString(), - title: map['title'].toString(), - summary: map['summary'].toString(), - ctas: - List.from(map['ctas'].map((p) => InsightCTA.fromMap(p))), - analyzedAt: map['analyzedAt']?.toString(), - dismissedAt: map['dismissedAt']?.toString(), - dismissedBy: map['dismissedBy']?.toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "reportId": reportId, - "type": type, - "severity": severity, - "status": status, - "resourceType": resourceType, - "resourceId": resourceId, - "parentResourceType": parentResourceType, - "parentResourceId": parentResourceId, - "title": title, - "summary": summary, - "ctas": ctas.map((p) => p.toMap()).toList(), - "analyzedAt": analyzedAt, - "dismissedAt": dismissedAt, - "dismissedBy": dismissedBy, - }; - } -} diff --git a/lib/src/models/insight_cta.dart b/lib/src/models/insight_cta.dart deleted file mode 100644 index 7e7b1de7..00000000 --- a/lib/src/models/insight_cta.dart +++ /dev/null @@ -1,42 +0,0 @@ -part of '../../models.dart'; - -/// InsightCTA -class InsightCTA implements Model { - /// Human-readable label for the CTA, used in UI. - final String label; - - /// Public API service (SDK namespace) the client should invoke. Must match the engine that owns the resource — for index suggestions: databases (legacy), tablesDB, documentsDB, or vectorsDB. - final String service; - - /// Public API method on the chosen service the client should invoke when this CTA is triggered. - final String method; - - /// Parameter map the client should pass to the service method when this CTA is triggered. Keys match the target API's parameter names (e.g. databaseId/tableId/columns for tablesDB, databaseId/collectionId/attributes for the legacy Databases API). - final Map params; - - InsightCTA({ - required this.label, - required this.service, - required this.method, - required this.params, - }); - - factory InsightCTA.fromMap(Map map) { - return InsightCTA( - label: map['label'].toString(), - service: map['service'].toString(), - method: map['method'].toString(), - params: map['params'], - ); - } - - @override - Map toMap() { - return { - "label": label, - "service": service, - "method": method, - "params": params, - }; - } -} diff --git a/lib/src/models/insight_list.dart b/lib/src/models/insight_list.dart deleted file mode 100644 index e68635dd..00000000 --- a/lib/src/models/insight_list.dart +++ /dev/null @@ -1,31 +0,0 @@ -part of '../../models.dart'; - -/// Insights List -class InsightList implements Model { - /// Total number of insights that matched your query. - final int total; - - /// List of insights. - final List insights; - - InsightList({ - required this.total, - required this.insights, - }); - - factory InsightList.fromMap(Map map) { - return InsightList( - total: map['total'], - insights: - List.from(map['insights'].map((p) => Insight.fromMap(p))), - ); - } - - @override - Map toMap() { - return { - "total": total, - "insights": insights.map((p) => p.toMap()).toList(), - }; - } -} diff --git a/lib/src/models/report.dart b/lib/src/models/report.dart deleted file mode 100644 index 6dd6b445..00000000 --- a/lib/src/models/report.dart +++ /dev/null @@ -1,91 +0,0 @@ -part of '../../models.dart'; - -/// Report -class Report implements Model { - /// Report ID. - final String $id; - - /// Report creation date in ISO 8601 format. - final String $createdAt; - - /// Report update date in ISO 8601 format. - final String $updatedAt; - - /// ID of the third-party app that submitted the report. - final String appId; - - /// Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. - final String type; - - /// Short, human-readable title for the report. - final String title; - - /// Markdown summary describing the report. - final String summary; - - /// Plural noun describing what the report analyzes, e.g. databases, sites, urls. - final String targetType; - - /// Free-form target identifier (URL for lighthouse, resource ID for db). - final String target; - - /// Categories covered by the report, e.g. performance, accessibility. - final List categories; - - /// Insights nested under this report. - final List insights; - - /// Time the report was analyzed in ISO 8601 format. - final String? analyzedAt; - - Report({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.appId, - required this.type, - required this.title, - required this.summary, - required this.targetType, - required this.target, - required this.categories, - required this.insights, - this.analyzedAt, - }); - - factory Report.fromMap(Map map) { - return Report( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - appId: map['appId'].toString(), - type: map['type'].toString(), - title: map['title'].toString(), - summary: map['summary'].toString(), - targetType: map['targetType'].toString(), - target: map['target'].toString(), - categories: List.from(map['categories'] ?? []), - insights: - List.from(map['insights'].map((p) => Insight.fromMap(p))), - analyzedAt: map['analyzedAt']?.toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "appId": appId, - "type": type, - "title": title, - "summary": summary, - "targetType": targetType, - "target": target, - "categories": categories, - "insights": insights.map((p) => p.toMap()).toList(), - "analyzedAt": analyzedAt, - }; - } -} diff --git a/lib/src/models/report_list.dart b/lib/src/models/report_list.dart deleted file mode 100644 index f7ea39d5..00000000 --- a/lib/src/models/report_list.dart +++ /dev/null @@ -1,30 +0,0 @@ -part of '../../models.dart'; - -/// Reports List -class ReportList implements Model { - /// Total number of reports that matched your query. - final int total; - - /// List of reports. - final List reports; - - ReportList({ - required this.total, - required this.reports, - }); - - factory ReportList.fromMap(Map map) { - return ReportList( - total: map['total'], - reports: List.from(map['reports'].map((p) => Report.fromMap(p))), - ); - } - - @override - Map toMap() { - return { - "total": total, - "reports": reports.map((p) => p.toMap()).toList(), - }; - } -} diff --git a/pubspec.yaml b/pubspec.yaml index ae53b96f..052a6a98 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 24.1.0 +version: 24.1.1 description: Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter diff --git a/test/services/advisor_test.dart b/test/services/advisor_test.dart deleted file mode 100644 index c1fbca22..00000000 --- a/test/services/advisor_test.dart +++ /dev/null @@ -1,145 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/mockito.dart'; -import 'package:appwrite/models.dart' as models; -import 'package:appwrite/enums.dart' as enums; -import 'package:appwrite/src/enums.dart'; -import 'package:appwrite/src/response.dart'; -import 'dart:typed_data'; -import 'package:appwrite/appwrite.dart'; - -class MockClient extends Mock implements Client { - Map config = {'project': 'testproject'}; - String endPoint = 'https://localhost/v1'; - @override - Future call( - HttpMethod? method, { - String path = '', - Map headers = const {}, - Map params = const {}, - ResponseType? responseType, - }) async { - return super.noSuchMethod(Invocation.method(#call, [method]), - returnValue: Response()); - } - - @override - Future webAuth( - Uri? url, { - String? callbackUrlScheme, - }) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); - } - - @override - Future chunkedUpload({ - String? path, - Map? params, - String? paramName, - String? idParamName, - Map? headers, - Function(UploadProgress)? onProgress, - }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); - } -} - -void main() { - group('Advisor test', () { - late MockClient client; - late Advisor advisor; - - setUp(() { - client = MockClient(); - advisor = Advisor(client); - }); - - test('test method listReports()', () async { - final Map data = { - 'total': 5, - 'reports': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await advisor.listReports(); - expect(response, isA()); - }); - - test('test method getReport()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'type': 'lighthouse', - 'title': 'Lighthouse audit for https://appwrite.io/', - 'summary': 'Performance score 78. 4 opportunities found.', - 'targetType': 'urls', - 'target': 'https://appwrite.io/', - 'categories': [], - 'insights': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await advisor.getReport( - reportId: '', - ); - expect(response, isA()); - }); - - test('test method listInsights()', () async { - final Map data = { - 'total': 5, - 'insights': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await advisor.listInsights( - reportId: '', - ); - expect(response, isA()); - }); - - test('test method getInsight()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'reportId': '5e5ea5c16897e', - 'type': 'tablesDBIndex', - 'severity': 'warning', - 'status': 'active', - 'resourceType': 'databases', - 'resourceId': 'main', - 'parentResourceType': 'tables', - 'parentResourceId': 'orders', - 'title': 'Missing index on collection orders', - 'summary': - 'Queries against `orders.status` are scanning the full collection.', - 'ctas': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await advisor.getInsight( - reportId: '', - insightId: '', - ); - expect(response, isA()); - }); - }); -} diff --git a/test/services/storage_test.dart b/test/services/storage_test.dart index a7cb9bd8..55a42f94 100644 --- a/test/services/storage_test.dart +++ b/test/services/storage_test.dart @@ -84,6 +84,7 @@ void main() { 'signature': '5d529fd02b544198ae075bd57c1762bb', 'mimeType': 'image/png', 'sizeOriginal': 17890, + 'sizeActual': 12345, 'chunksTotal': 17890, 'chunksUploaded': 17890, 'encryption': true, @@ -117,6 +118,7 @@ void main() { 'signature': '5d529fd02b544198ae075bd57c1762bb', 'mimeType': 'image/png', 'sizeOriginal': 17890, + 'sizeActual': 12345, 'chunksTotal': 17890, 'chunksUploaded': 17890, 'encryption': true, @@ -145,6 +147,7 @@ void main() { 'signature': '5d529fd02b544198ae075bd57c1762bb', 'mimeType': 'image/png', 'sizeOriginal': 17890, + 'sizeActual': 12345, 'chunksTotal': 17890, 'chunksUploaded': 17890, 'encryption': true, diff --git a/test/src/models/file_test.dart b/test/src/models/file_test.dart index c01df19b..7f132646 100644 --- a/test/src/models/file_test.dart +++ b/test/src/models/file_test.dart @@ -14,6 +14,7 @@ void main() { signature: '5d529fd02b544198ae075bd57c1762bb', mimeType: 'image/png', sizeOriginal: 17890, + sizeActual: 12345, chunksTotal: 17890, chunksUploaded: 17890, encryption: true, @@ -32,6 +33,7 @@ void main() { expect(result.signature, '5d529fd02b544198ae075bd57c1762bb'); expect(result.mimeType, 'image/png'); expect(result.sizeOriginal, 17890); + expect(result.sizeActual, 12345); expect(result.chunksTotal, 17890); expect(result.chunksUploaded, 17890); expect(result.encryption, true); diff --git a/test/src/models/insight_cta_test.dart b/test/src/models/insight_cta_test.dart deleted file mode 100644 index abaaa864..00000000 --- a/test/src/models/insight_cta_test.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:appwrite/models.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - group('InsightCTA', () { - test('model', () { - final model = InsightCTA( - label: 'Create missing index', - service: 'tablesDB', - method: 'createIndex', - params: {}, - ); - - final map = model.toMap(); - final result = InsightCTA.fromMap(map); - - expect(result.label, 'Create missing index'); - expect(result.service, 'tablesDB'); - expect(result.method, 'createIndex'); - expect(result.params, {}); - }); - }); -} diff --git a/test/src/models/insight_list_test.dart b/test/src/models/insight_list_test.dart deleted file mode 100644 index 001d800d..00000000 --- a/test/src/models/insight_list_test.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:appwrite/models.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - group('InsightList', () { - test('model', () { - final model = InsightList( - total: 5, - insights: [], - ); - - final map = model.toMap(); - final result = InsightList.fromMap(map); - - expect(result.total, 5); - expect(result.insights, []); - }); - }); -} diff --git a/test/src/models/insight_test.dart b/test/src/models/insight_test.dart deleted file mode 100644 index 08321bda..00000000 --- a/test/src/models/insight_test.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:appwrite/models.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - group('Insight', () { - test('model', () { - final model = Insight( - $id: '5e5ea5c16897e', - $createdAt: '2020-10-15T06:38:00.000+00:00', - $updatedAt: '2020-10-15T06:38:00.000+00:00', - reportId: '5e5ea5c16897e', - type: 'tablesDBIndex', - severity: 'warning', - status: 'active', - resourceType: 'databases', - resourceId: 'main', - parentResourceType: 'tables', - parentResourceId: 'orders', - title: 'Missing index on collection orders', - summary: - 'Queries against `orders.status` are scanning the full collection.', - ctas: [], - ); - - final map = model.toMap(); - final result = Insight.fromMap(map); - - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.reportId, '5e5ea5c16897e'); - expect(result.type, 'tablesDBIndex'); - expect(result.severity, 'warning'); - expect(result.status, 'active'); - expect(result.resourceType, 'databases'); - expect(result.resourceId, 'main'); - expect(result.parentResourceType, 'tables'); - expect(result.parentResourceId, 'orders'); - expect(result.title, 'Missing index on collection orders'); - expect(result.summary, - 'Queries against `orders.status` are scanning the full collection.'); - expect(result.ctas, []); - }); - }); -} diff --git a/test/src/models/report_list_test.dart b/test/src/models/report_list_test.dart deleted file mode 100644 index 42f988ec..00000000 --- a/test/src/models/report_list_test.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:appwrite/models.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - group('ReportList', () { - test('model', () { - final model = ReportList( - total: 5, - reports: [], - ); - - final map = model.toMap(); - final result = ReportList.fromMap(map); - - expect(result.total, 5); - expect(result.reports, []); - }); - }); -} diff --git a/test/src/models/report_test.dart b/test/src/models/report_test.dart deleted file mode 100644 index 4cbdb6f8..00000000 --- a/test/src/models/report_test.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:appwrite/models.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - group('Report', () { - test('model', () { - final model = Report( - $id: '5e5ea5c16897e', - $createdAt: '2020-10-15T06:38:00.000+00:00', - $updatedAt: '2020-10-15T06:38:00.000+00:00', - appId: '5e5ea5c16897e', - type: 'lighthouse', - title: 'Lighthouse audit for https://appwrite.io/', - summary: 'Performance score 78. 4 opportunities found.', - targetType: 'urls', - target: 'https://appwrite.io/', - categories: [], - insights: [], - ); - - final map = model.toMap(); - final result = Report.fromMap(map); - - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.appId, '5e5ea5c16897e'); - expect(result.type, 'lighthouse'); - expect(result.title, 'Lighthouse audit for https://appwrite.io/'); - expect(result.summary, 'Performance score 78. 4 opportunities found.'); - expect(result.targetType, 'urls'); - expect(result.target, 'https://appwrite.io/'); - expect(result.categories, []); - expect(result.insights, []); - }); - }); -}