diff --git a/CHANGELOG.md b/CHANGELOG.md index 3027333d..2c5a30dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [24.11.0] - Aspose Words Cloud for Dart 24.11 Release Notes + +- Added GetAllRevisions method to obtain all available revisions in document. +- Added AppendAllEntriesToOneSection parameter to AppendDocument method to append entries to the same section. + + ## [24.9.0] - Aspose Words Cloud for Dart 24.9 Release Notes - Added digital signature methds for DOC, DOCX, XPS, or ODT documents. diff --git a/README.md b/README.md index 1756ac9f..bbe241f7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Add this dependency to your *pubspec.yaml*: ```yaml dependencies: - aspose_words_cloud: 24.10.0 + aspose_words_cloud: 24.11.0 ``` ## Getting Started diff --git a/lib/aspose_words_cloud.dart b/lib/aspose_words_cloud.dart index a2898681..8acaa148 100644 --- a/lib/aspose_words_cloud.dart +++ b/lib/aspose_words_cloud.dart @@ -227,7 +227,10 @@ export 'src/models/replace_text_parameters.dart'; export 'src/models/replace_text_response.dart'; export 'src/models/report_build_options.dart'; export 'src/models/report_engine_settings.dart'; +export 'src/models/revision_collection.dart'; +export 'src/models/revision.dart'; export 'src/models/revisions_modification_response.dart'; +export 'src/models/revisions_response.dart'; export 'src/models/rtf_save_options_data.dart'; export 'src/models/run_base.dart'; export 'src/models/run_insert.dart'; @@ -407,6 +410,8 @@ export 'src/requests/delete_watermark_request.dart'; export 'src/requests/download_file_request.dart'; export 'src/requests/execute_mail_merge_online_request.dart'; export 'src/requests/execute_mail_merge_request.dart'; +export 'src/requests/get_all_revisions_online_request.dart'; +export 'src/requests/get_all_revisions_request.dart'; export 'src/requests/get_available_fonts_request.dart'; export 'src/requests/get_bookmark_by_name_online_request.dart'; export 'src/requests/get_bookmark_by_name_request.dart'; diff --git a/lib/src/api_client.dart b/lib/src/api_client.dart index 32f6bbb8..7aa03738 100644 --- a/lib/src/api_client.dart +++ b/lib/src/api_client.dart @@ -518,7 +518,7 @@ class ApiClient { } httpRequest.headers['x-aspose-client'] = 'dart sdk'; - httpRequest.headers['x-aspose-client-version'] = '24.10'; + httpRequest.headers['x-aspose-client-version'] = '24.11'; httpRequest.headers['Authorization'] = await _getAuthToken(); httpRequest.headers.addAll(requestData.headers); diff --git a/lib/src/models/document_entry_list.dart b/lib/src/models/document_entry_list.dart index b590676b..220f8b9c 100644 --- a/lib/src/models/document_entry_list.dart +++ b/lib/src/models/document_entry_list.dart @@ -31,6 +31,13 @@ import '../../aspose_words_cloud.dart'; /// Represents a list of documents which will be appended to the original resource document. class DocumentEntryList extends BaseEntryList { + /// Gets or sets a value indicating whether to append all documents to the same section. + bool? _appendAllEntriesToOneSection; + + bool? get appendAllEntriesToOneSection => _appendAllEntriesToOneSection; + set appendAllEntriesToOneSection(bool? val) => _appendAllEntriesToOneSection = val; + + /// Gets or sets a value indicating whether to apply headers and footers from base document to appending documents. The default value is true. bool? _applyBaseDocumentHeadersAndFootersToAppendingDocuments; @@ -52,6 +59,12 @@ class DocumentEntryList extends BaseEntryList { } super.deserialize(json); + if (json.containsKey('AppendAllEntriesToOneSection')) { + appendAllEntriesToOneSection = json['AppendAllEntriesToOneSection'] as bool; + } else { + appendAllEntriesToOneSection = null; + } + if (json.containsKey('ApplyBaseDocumentHeadersAndFootersToAppendingDocuments')) { applyBaseDocumentHeadersAndFootersToAppendingDocuments = json['ApplyBaseDocumentHeadersAndFootersToAppendingDocuments'] as bool; } else { @@ -73,6 +86,10 @@ class DocumentEntryList extends BaseEntryList { Map serialize() { var _result = {}; _result.addAll(super.serialize()); + if (appendAllEntriesToOneSection != null) { + _result['AppendAllEntriesToOneSection'] = appendAllEntriesToOneSection!; + } + if (applyBaseDocumentHeadersAndFootersToAppendingDocuments != null) { _result['ApplyBaseDocumentHeadersAndFootersToAppendingDocuments'] = applyBaseDocumentHeadersAndFootersToAppendingDocuments!; } diff --git a/lib/src/models/model_base.dart b/lib/src/models/model_base.dart index 7f6bb498..f6047bf0 100644 --- a/lib/src/models/model_base.dart +++ b/lib/src/models/model_base.dart @@ -220,7 +220,10 @@ abstract class ModelBase { 'ReplaceTextResponse, _': () => ReplaceTextResponse(), 'ReportBuildOptions, _': () => throw ApiException(400, 'Invalid type of class.'), 'ReportEngineSettings, _': () => ReportEngineSettings(), + 'Revision, _': () => Revision(), + 'RevisionCollection, _': () => RevisionCollection(), 'RevisionsModificationResponse, _': () => RevisionsModificationResponse(), + 'RevisionsResponse, _': () => RevisionsResponse(), 'RtfSaveOptionsData, _': () => RtfSaveOptionsData(), 'Run, _': () => Run(), 'RunInsert, _': () => RunInsert(), diff --git a/lib/src/models/revision.dart b/lib/src/models/revision.dart new file mode 100644 index 00000000..6979e527 --- /dev/null +++ b/lib/src/models/revision.dart @@ -0,0 +1,127 @@ +/* + * -------------------------------------------------------------------------------- + * + * Copyright (c) 2024 Aspose.Words for Cloud + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * -------------------------------------------------------------------------------- + */ + +library aspose_words_cloud; + +import '../../aspose_words_cloud.dart'; + +/// Revision Dto. +class Revision implements ModelBase { + /// Gets or sets the revision author. + String? _revisionAuthor; + + String? get revisionAuthor => _revisionAuthor; + set revisionAuthor(String? val) => _revisionAuthor = val; + + + /// Gets or sets the revision date time. + DateTime? _revisionDateTime; + + DateTime? get revisionDateTime => _revisionDateTime; + set revisionDateTime(DateTime? val) => _revisionDateTime = val; + + + /// Gets or sets the revision text. + String? _revisionText; + + String? get revisionText => _revisionText; + set revisionText(String? val) => _revisionText = val; + + + /// Gets or sets the revision type. + String? _revisionType; + + String? get revisionType => _revisionType; + set revisionType(String? val) => _revisionType = val; + + + @override + void deserialize(Map? json) { + if (json == null) { + throw ApiException(400, 'Failed to deserialize Revision data model.'); + } + + if (json.containsKey('RevisionAuthor')) { + revisionAuthor = json['RevisionAuthor'] as String; + } else { + revisionAuthor = null; + } + + if (json.containsKey('RevisionDateTime')) { + revisionDateTime = DateTime.parse(json['RevisionDateTime'] as String); + } else { + revisionDateTime = null; + } + + if (json.containsKey('RevisionText')) { + revisionText = json['RevisionText'] as String; + } else { + revisionText = null; + } + + if (json.containsKey('RevisionType')) { + revisionType = json['RevisionType'] as String; + } else { + revisionType = null; + } + } + + @override + Map serialize() { + var _result = {}; + if (revisionAuthor != null) { + _result['RevisionAuthor'] = revisionAuthor!; + } + + if (revisionDateTime != null) { + _result['RevisionDateTime'] = revisionDateTime!.toIso8601String(); + } + + if (revisionText != null) { + _result['RevisionText'] = revisionText!; + } + + if (revisionType != null) { + _result['RevisionType'] = revisionType!; + } + return _result; + } + + @override + void getFilesContent(List resultFilesContent) { + } + + @override + void validate() { + if (revisionDateTime == null) + { + throw new ApiException(400, 'Property RevisionDateTime in Revision is required.'); + } + } +} + + diff --git a/lib/src/models/revision_collection.dart b/lib/src/models/revision_collection.dart new file mode 100644 index 00000000..5e76db05 --- /dev/null +++ b/lib/src/models/revision_collection.dart @@ -0,0 +1,82 @@ +/* + * -------------------------------------------------------------------------------- + * + * Copyright (c) 2024 Aspose.Words for Cloud + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * -------------------------------------------------------------------------------- + */ + +library aspose_words_cloud; + +import '../../aspose_words_cloud.dart'; + +/// RevisionCollection DTO. +class RevisionCollection implements ModelBase { + /// Gets or sets the revisions. + List? _revisions; + + List? get revisions => _revisions; + set revisions(List? val) => _revisions = val; + + + @override + void deserialize(Map? json) { + if (json == null) { + throw ApiException(400, 'Failed to deserialize RevisionCollection data model.'); + } + + if (json.containsKey('Revisions')) { + // Array processing + revisions = []; + for(final _element in json['Revisions']) { + revisions!.add(ModelBase.createInstance< Revision >(_element as Map)); + } + } else { + revisions = null; + } + } + + @override + Map serialize() { + var _result = {}; + if (revisions != null) { + _result['Revisions'] = revisions!.map((_element) => _element?.serialize()).toList(); + } + return _result; + } + + @override + void getFilesContent(List resultFilesContent) { + } + + @override + void validate() { + + for (final elementRevisions in revisions ?? []) + { + elementRevisions?.validate(); + } + + } +} + + diff --git a/lib/src/models/revisions_response.dart b/lib/src/models/revisions_response.dart new file mode 100644 index 00000000..e4400341 --- /dev/null +++ b/lib/src/models/revisions_response.dart @@ -0,0 +1,84 @@ +/* + * -------------------------------------------------------------------------------- + * + * Copyright (c) 2024 Aspose.Words for Cloud + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * -------------------------------------------------------------------------------- + */ + +library aspose_words_cloud; + +import '../../aspose_words_cloud.dart'; + +/// The revision response. +class RevisionsResponse extends WordsResponse { + /// Gets or sets Revisions. + RevisionCollection? _revisions; + + RevisionCollection? get revisions => _revisions; + set revisions(RevisionCollection? val) => _revisions = val; + + + @override + void deserialize(Map? json) { + if (json == null) { + throw ApiException(400, 'Failed to deserialize RevisionsResponse data model.'); + } + + super.deserialize(json); + if (json.containsKey('RequestId')) { + requestId = json['RequestId'] as String; + } else { + requestId = null; + } + + if (json.containsKey('Revisions')) { + revisions = ModelBase.createInstance< RevisionCollection >(json['Revisions'] as Map); + } else { + revisions = null; + } + } + + @override + Map serialize() { + var _result = {}; + _result.addAll(super.serialize()); + if (revisions != null) { + _result['Revisions'] = revisions!.serialize(); + } + return _result; + } + + @override + void getFilesContent(List resultFilesContent) { + } + + @override + void validate() { + super.validate(); + + revisions?.validate(); + + } +} + + diff --git a/lib/src/requests/get_all_revisions_online_request.dart b/lib/src/requests/get_all_revisions_online_request.dart new file mode 100644 index 00000000..e0dab0dd --- /dev/null +++ b/lib/src/requests/get_all_revisions_online_request.dart @@ -0,0 +1,119 @@ +/* + * -------------------------------------------------------------------------------- + * + * Copyright (c) 2024 Aspose.Words for Cloud + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * -------------------------------------------------------------------------------- + */ + +library aspose_words_cloud; + +import 'dart:convert'; +import 'dart:typed_data'; +import '../../aspose_words_cloud.dart'; +import '../api_client.dart'; +import '../api_request_data.dart'; +import '../api_request_part.dart'; + +/// Request model for GetAllRevisionsOnline operation. +class GetAllRevisionsOnlineRequest implements RequestBase { + /// The document. + final ByteData? document; + + /// Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML. + final String? loadEncoding; + + /// Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API. + final String? password; + + /// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details. + final String? encryptedPassword; + + /// The value indicates whether OpenType support is on. + final bool? openTypeSupport; + + /// Request send data progress callback + final SendDataProgressCallback? sendDataProgressCallback; + + /// Response receive data progress callback + final ReceiveDataProgressCallback? receiveDataProgressCallback; + + GetAllRevisionsOnlineRequest(this.document, {this.loadEncoding, this.password, this.encryptedPassword, this.openTypeSupport, this.sendDataProgressCallback, this.receiveDataProgressCallback}); + + @override + Future createRequestData(final ApiClient _apiClient) async { + var _path = '/words/online/get/revisions/getAll'; + var _queryParams = {}; + var _headers = {}; + var _bodyParts = []; + var _fileContentParts = []; + if (loadEncoding != null) { + _queryParams['loadEncoding'] = _apiClient.serializeToString(loadEncoding) ?? ""; + } + + if (password != null) { + _queryParams['encryptedPassword'] = await _apiClient.encryptPassword(password!); + } + + if (encryptedPassword != null) { + _queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? ""; + } + + if (openTypeSupport != null) { + _queryParams['openTypeSupport'] = _apiClient.serializeToString(openTypeSupport) ?? ""; + } + + if (document != null) { + + var _formBody = _apiClient.serializeBody(document, 'Document'); + if (_formBody != null) { + _bodyParts.add(_formBody); + } + } + else { + throw ApiException(400, 'Parameter document is required.'); + } + + for (final _fileContentPart in _fileContentParts) { + _fileContentPart.encryptPassword(_apiClient); + if (_fileContentPart.source == 'Request') { + _bodyParts.add(ApiRequestPart(_fileContentPart.content!, 'application/octet-stream', name: _fileContentPart.reference)); + } + } + var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/'); + var _body = _apiClient.serializeBodyParts(_bodyParts, _headers); + return ApiRequestData('PUT', _url, _headers, _body, this.sendDataProgressCallback, this.receiveDataProgressCallback); + } + + @override + dynamic deserializeResponse(final ApiClient _apiClient, final Map _headers, final ByteData? _body) { + if (_body == null) { + return ApiException(400, "Nullable response body is not allowed for this operation type."); + } + + var _result = RevisionsResponse(); + var _jsonData = utf8.decode(_body.buffer.asUint8List(_body.offsetInBytes, _body.lengthInBytes)); + var _json = jsonDecode(_jsonData); + _result.deserialize(_json as Map); + return _result; + } +} \ No newline at end of file diff --git a/lib/src/requests/get_all_revisions_request.dart b/lib/src/requests/get_all_revisions_request.dart new file mode 100644 index 00000000..58d9ab65 --- /dev/null +++ b/lib/src/requests/get_all_revisions_request.dart @@ -0,0 +1,126 @@ +/* + * -------------------------------------------------------------------------------- + * + * Copyright (c) 2024 Aspose.Words for Cloud + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * -------------------------------------------------------------------------------- + */ + +library aspose_words_cloud; + +import 'dart:convert'; +import 'dart:typed_data'; +import '../../aspose_words_cloud.dart'; +import '../api_client.dart'; +import '../api_request_data.dart'; +import '../api_request_part.dart'; + +/// Request model for GetAllRevisions operation. +class GetAllRevisionsRequest implements RequestBase { + /// The filename of the input document. + final String? name; + + /// Original document folder. + final String? folder; + + /// Original document storage. + final String? storage; + + /// Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML. + final String? loadEncoding; + + /// Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API. + final String? password; + + /// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details. + final String? encryptedPassword; + + /// The value indicates whether OpenType support is on. + final bool? openTypeSupport; + + /// Request send data progress callback + final SendDataProgressCallback? sendDataProgressCallback; + + /// Response receive data progress callback + final ReceiveDataProgressCallback? receiveDataProgressCallback; + + GetAllRevisionsRequest(this.name, {this.folder, this.storage, this.loadEncoding, this.password, this.encryptedPassword, this.openTypeSupport, this.sendDataProgressCallback, this.receiveDataProgressCallback}); + + @override + Future createRequestData(final ApiClient _apiClient) async { + var _path = '/words/{name}/revisions/getAll'; + var _queryParams = {}; + var _headers = {}; + var _bodyParts = []; + var _fileContentParts = []; + if (name == null) { + throw ApiException(400, 'Parameter name is required.'); + } + _path = _path.replaceAll('{name}', _apiClient.serializeToString(name) ?? ""); + if (folder != null) { + _queryParams['folder'] = _apiClient.serializeToString(folder) ?? ""; + } + + if (storage != null) { + _queryParams['storage'] = _apiClient.serializeToString(storage) ?? ""; + } + + if (loadEncoding != null) { + _queryParams['loadEncoding'] = _apiClient.serializeToString(loadEncoding) ?? ""; + } + + if (password != null) { + _queryParams['encryptedPassword'] = await _apiClient.encryptPassword(password!); + } + + if (encryptedPassword != null) { + _queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? ""; + } + + if (openTypeSupport != null) { + _queryParams['openTypeSupport'] = _apiClient.serializeToString(openTypeSupport) ?? ""; + } + + for (final _fileContentPart in _fileContentParts) { + _fileContentPart.encryptPassword(_apiClient); + if (_fileContentPart.source == 'Request') { + _bodyParts.add(ApiRequestPart(_fileContentPart.content!, 'application/octet-stream', name: _fileContentPart.reference)); + } + } + var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/'); + var _body = _apiClient.serializeBodyParts(_bodyParts, _headers); + return ApiRequestData('GET', _url, _headers, _body, this.sendDataProgressCallback, this.receiveDataProgressCallback); + } + + @override + dynamic deserializeResponse(final ApiClient _apiClient, final Map _headers, final ByteData? _body) { + if (_body == null) { + return ApiException(400, "Nullable response body is not allowed for this operation type."); + } + + var _result = RevisionsResponse(); + var _jsonData = utf8.decode(_body.buffer.asUint8List(_body.offsetInBytes, _body.lengthInBytes)); + var _json = jsonDecode(_jsonData); + _result.deserialize(_json as Map); + return _result; + } +} \ No newline at end of file diff --git a/lib/src/words_api.dart b/lib/src/words_api.dart index f13c7ba9..120629f0 100644 --- a/lib/src/words_api.dart +++ b/lib/src/words_api.dart @@ -496,6 +496,16 @@ class WordsApi { return await _apiClient.call(request) as ByteData; } + /// Get all information about revisions. + Future< RevisionsResponse > getAllRevisions(GetAllRevisionsRequest request) async { + return await _apiClient.call(request) as RevisionsResponse; + } + + /// Get all information about revisions. + Future< RevisionsResponse > getAllRevisionsOnline(GetAllRevisionsOnlineRequest request) async { + return await _apiClient.call(request) as RevisionsResponse; + } + /// Reads available fonts from the document. Future< AvailableFontsResponse > getAvailableFonts(GetAvailableFontsRequest request) async { return await _apiClient.call(request) as AvailableFontsResponse; diff --git a/pubspec.yaml b/pubspec.yaml index 242943a8..a15be519 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: aspose_words_cloud description: This package allows you to work with Aspose.Words Cloud REST APIs in your Dart applications quickly and easily, with zero initial cost. -version: 24.10.0 +version: 24.11.0 homepage: https://github.com/aspose-words-cloud/aspose-words-cloud-dart environment: diff --git a/test/aspose_words_cloud_tests.dart b/test/aspose_words_cloud_tests.dart index dd939f25..7eaa06b4 100644 --- a/test/aspose_words_cloud_tests.dart +++ b/test/aspose_words_cloud_tests.dart @@ -226,6 +226,8 @@ void main() { test('AcceptAllRevisionsOnline', () async => await RevisionsTests(testContext).testAcceptAllRevisionsOnline()); test('RejectAllRevisions', () async => await RevisionsTests(testContext).testRejectAllRevisions()); test('RejectAllRevisionsOnline', () async => await RevisionsTests(testContext).testRejectAllRevisionsOnline()); + test('GetAllRevisions', () async => await RevisionsTests(testContext).testGetAllRevisions()); + test('GetAllRevisionsOnline', () async => await RevisionsTests(testContext).testGetAllRevisionsOnline()); }); group('Signature', () { diff --git a/test/document/revisions_tests.dart b/test/document/revisions_tests.dart index 05916279..287dc834 100644 --- a/test/document/revisions_tests.dart +++ b/test/document/revisions_tests.dart @@ -39,7 +39,7 @@ class RevisionsTests RevisionsTests(this.context) { remoteDataFolder = context.remoteBaseTestDataFolder + '/DocumentActions/Revisions'; - localFile = 'Common/test_multi_pages.docx'; + localFile = 'DocumentElements/Revisions/TestRevisions.doc'; } /// Test for accepting revisions in document. @@ -107,4 +107,34 @@ class RevisionsTests expect(result.model?.result, isNotNull); expect(result.model?.result?.dest, isNotNull); } + + /// Test for getting revisions from document. + Future testGetAllRevisions() async + { + final remoteFileName = 'TestAcceptAllRevisions.docx'; + await context.uploadFile(localFile, remoteDataFolder + '/' + remoteFileName); + + final request = GetAllRevisionsRequest( + remoteFileName, + folder: remoteDataFolder + ); + + final result = await context.getApi().getAllRevisions(request); + expect(result.revisions, isNotNull); + expect(result.revisions?.revisions?.length, 6); + } + + /// Test for getting revisions online from document. + Future testGetAllRevisionsOnline() async + { + final requestDocument = await context.loadBinaryFile(localFile); + + final request = GetAllRevisionsOnlineRequest( + requestDocument + ); + + final result = await context.getApi().getAllRevisionsOnline(request); + expect(result.revisions, isNotNull); + expect(result.revisions?.revisions?.length, 6); + } } diff --git a/test/document_properties/document_properties_tests.dart b/test/document_properties/document_properties_tests.dart index fe9d0a39..a8a171b6 100644 --- a/test/document_properties/document_properties_tests.dart +++ b/test/document_properties/document_properties_tests.dart @@ -56,7 +56,7 @@ class DocumentPropertiesTests final result = await context.getApi().getDocumentProperties(request); expect(result.documentProperties, isNotNull); expect(result.documentProperties?.list, isNotNull); - expect(result.documentProperties?.list?.length, 24); + expect(result.documentProperties?.list?.length, 27); expect(result.documentProperties?.list?[0], isNotNull); expect(result.documentProperties?.list?[0]?.name, 'Author'); expect(result.documentProperties?.list?[0]?.value, ''); diff --git a/test_data/DocumentElements/Revisions/TestRevisions.doc b/test_data/DocumentElements/Revisions/TestRevisions.doc new file mode 100644 index 00000000..9f2fedf2 Binary files /dev/null and b/test_data/DocumentElements/Revisions/TestRevisions.doc differ