Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
dynabic-billing-team committed Jun 24, 2024
2 parents bae9693 + 5ea231a commit 0069625
Show file tree
Hide file tree
Showing 13 changed files with 411 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [24.6.0] - Aspose Words Cloud for Dart 24.6 Release Notes

- Added the 'TranslateNodeId' method to transalate a node id to a node path.


## [24.5.0] - Aspose Words Cloud for Dart 24.5 Release Notes

- Added the support of multistorage operations. Saving a file as a result of an operation can be performed in a specific storage, when, used file path in the next format '@storage:path/to/file.doc'.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Add this dependency to your *pubspec.yaml*:

```yaml
dependencies:
aspose_words_cloud: 24.5.0
aspose_words_cloud: 24.6.0
```
## Getting Started
Expand Down
3 changes: 3 additions & 0 deletions lib/aspose_words_cloud.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export 'src/models/table.dart';
export 'src/models/text_save_options_data.dart';
export 'src/models/tiff_save_options_data.dart';
export 'src/models/time_zone_info_data.dart';
export 'src/models/translate_node_id_response.dart';
export 'src/models/txt_save_options_base_data.dart';
export 'src/models/user_information.dart';
export 'src/models/watermark_data_base.dart';
Expand Down Expand Up @@ -603,6 +604,8 @@ export 'src/requests/search_online_request.dart';
export 'src/requests/search_request.dart';
export 'src/requests/split_document_online_request.dart';
export 'src/requests/split_document_request.dart';
export 'src/requests/translate_node_id_online_request.dart';
export 'src/requests/translate_node_id_request.dart';
export 'src/requests/unprotect_document_online_request.dart';
export 'src/requests/unprotect_document_request.dart';
export 'src/requests/update_bookmark_online_request.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class ApiClient {

var httpRequest = http.Request(requestData.method, Uri.parse(requestData.url));
httpRequest.headers['x-aspose-client'] = 'dart sdk';
httpRequest.headers['x-aspose-client-version'] = '24.5';
httpRequest.headers['x-aspose-client-version'] = '24.6';
httpRequest.headers['Authorization'] = await _getAuthToken();
httpRequest.headers.addAll(requestData.headers);

Expand Down
1 change: 1 addition & 0 deletions lib/src/models/model_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ abstract class ModelBase {
'TextSaveOptionsData, _': () => TextSaveOptionsData(),
'TiffSaveOptionsData, _': () => TiffSaveOptionsData(),
'TimeZoneInfoData, _': () => TimeZoneInfoData(),
'TranslateNodeIdResponse, _': () => TranslateNodeIdResponse(),
'UserInformation, _': () => UserInformation(),
'WatermarkDataImage, _': () => WatermarkDataImage(),
'WatermarkDataText, _': () => WatermarkDataText(),
Expand Down
82 changes: 82 additions & 0 deletions lib/src/models/translate_node_id_response.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* --------------------------------------------------------------------------------
* <copyright company="Aspose" file="translate_node_id_response.dart">
* Copyright (c) 2024 Aspose.Words for Cloud
* </copyright>
* <summary>
* 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.
* </summary>
* --------------------------------------------------------------------------------
*/

library aspose_words_cloud;

import '../../aspose_words_cloud.dart';

/// The REST response with a node path.
/// This response is returned by the Service when handling "GET https://api.aspose.cloud/v4.0/words/Test.doc/translate/{0}" REST API requests.
class TranslateNodeIdResponse extends WordsResponse {
/// Gets or sets the node path.
String? _path;

String? get path => _path;
set path(String? val) => _path = val;


@override
void deserialize(Map<String, dynamic>? json) {
if (json == null) {
throw ApiException(400, 'Failed to deserialize TranslateNodeIdResponse data model.');
}

super.deserialize(json);
if (json.containsKey('RequestId')) {
requestId = json['RequestId'] as String;
} else {
requestId = null;
}

if (json.containsKey('Path')) {
path = json['Path'] as String;
} else {
path = null;
}
}

@override
Map<String, dynamic> serialize() {
var _result = <String, dynamic>{};
_result.addAll(super.serialize());
if (path != null) {
_result['Path'] = path!;
}
return _result;
}

@override
void getFilesContent(List<FileReference> resultFilesContent) {
}

@override
void validate() {
super.validate();
}
}


113 changes: 113 additions & 0 deletions lib/src/requests/translate_node_id_online_request.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* --------------------------------------------------------------------------------
* <copyright company="Aspose" file="translate_node_id_online_request.dart">
* Copyright (c) 2024 Aspose.Words for Cloud
* </copyright>
* <summary>
* 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.
* </summary>
* --------------------------------------------------------------------------------
*/

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 TranslateNodeIdOnline operation.
class TranslateNodeIdOnlineRequest implements RequestBase {
/// The document.
final ByteData? document;

/// The node identifier. Identifier examples: id0.0.0.
final String? nodeId;

/// 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;

TranslateNodeIdOnlineRequest(this.document, this.nodeId, {this.loadEncoding, this.password, this.encryptedPassword});

@override
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
var _path = '/words/online/get/translate/{nodeId}';
var _queryParams = <String, String>{};
var _headers = <String, String>{};
var _bodyParts = <ApiRequestPart>[];
var _fileContentParts = <FileReference>[];
if (nodeId == null) {
throw ApiException(400, 'Parameter nodeId is required.');
}
_path = _path.replaceAll('{nodeId}', _apiClient.serializeToString(nodeId) ?? "");
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 (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);
}

@override
dynamic deserializeResponse(final ApiClient _apiClient, final Map<String, String> _headers, final ByteData? _body) {
if (_body == null) {
return ApiException(400, "Nullable response body is not allowed for this operation type.");
}

var _result = TranslateNodeIdResponse();
var _jsonData = utf8.decode(_body.buffer.asUint8List(_body.offsetInBytes, _body.lengthInBytes));
var _json = jsonDecode(_jsonData);
_result.deserialize(_json as Map<String, dynamic>);
return _result;
}
}
121 changes: 121 additions & 0 deletions lib/src/requests/translate_node_id_request.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
* --------------------------------------------------------------------------------
* <copyright company="Aspose" file="translate_node_id_request.dart">
* Copyright (c) 2024 Aspose.Words for Cloud
* </copyright>
* <summary>
* 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.
* </summary>
* --------------------------------------------------------------------------------
*/

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 TranslateNodeId operation.
class TranslateNodeIdRequest implements RequestBase {
/// The filename of the input document.
final String? name;

/// The node identifier. Identifier examples: id0.0.0.
final String? nodeId;

/// 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;

TranslateNodeIdRequest(this.name, this.nodeId, {this.folder, this.storage, this.loadEncoding, this.password, this.encryptedPassword});

@override
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
var _path = '/words/{name}/translate/{nodeId}';
var _queryParams = <String, String>{};
var _headers = <String, String>{};
var _bodyParts = <ApiRequestPart>[];
var _fileContentParts = <FileReference>[];
if (name == null) {
throw ApiException(400, 'Parameter name is required.');
}
_path = _path.replaceAll('{name}', _apiClient.serializeToString(name) ?? "");

if (nodeId == null) {
throw ApiException(400, 'Parameter nodeId is required.');
}
_path = _path.replaceAll('{nodeId}', _apiClient.serializeToString(nodeId) ?? "");
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) ?? "";
}

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);
}

@override
dynamic deserializeResponse(final ApiClient _apiClient, final Map<String, String> _headers, final ByteData? _body) {
if (_body == null) {
return ApiException(400, "Nullable response body is not allowed for this operation type.");
}

var _result = TranslateNodeIdResponse();
var _jsonData = utf8.decode(_body.buffer.asUint8List(_body.offsetInBytes, _body.lengthInBytes));
var _json = jsonDecode(_jsonData);
_result.deserialize(_json as Map<String, dynamic>);
return _result;
}
}
10 changes: 10 additions & 0 deletions lib/src/words_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,16 @@ class WordsApi {
return await _apiClient.call(request) as SplitDocumentOnlineResponse;
}

/// Translate a node id to a node path.
Future< TranslateNodeIdResponse > translateNodeId(TranslateNodeIdRequest request) async {
return await _apiClient.call(request) as TranslateNodeIdResponse;
}

/// Translate a node id to a node path.
Future< TranslateNodeIdResponse > translateNodeIdOnline(TranslateNodeIdOnlineRequest request) async {
return await _apiClient.call(request) as TranslateNodeIdResponse;
}

/// Removes protection from the document.
Future< ProtectionDataResponse > unprotectDocument(UnprotectDocumentRequest request) async {
return await _apiClient.call(request) as ProtectionDataResponse;
Expand Down
Loading

0 comments on commit 0069625

Please sign in to comment.