Skip to content

Commit 211640a

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 12c626f + 1e3a4aa commit 211640a

File tree

347 files changed

+5045
-688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

347 files changed

+5045
-688
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
## [24.8.0] - Aspose Words Cloud for Dart 24.8 Release Notes
2+
3+
- Added the support of OpenType standard. It is usefull for languages required advanced typography.
4+
- Added support for send/receive progress callbacks in the dart sdk.
5+
16
## [24.7.0] - Aspose Words Cloud for Dart 24.7 Release Notes
27

38
- Added support for azw3 (Amazon Kindle Format) documents.
9+
- Added 'MaxImageResolution' property for SvgSaveOptionsData class.
410

511

612
## [24.6.0] - Aspose Words Cloud for Dart 24.6 Release Notes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Add this dependency to your *pubspec.yaml*:
2727

2828
```yaml
2929
dependencies:
30-
aspose_words_cloud: 24.7.0
30+
aspose_words_cloud: 24.8.0
3131
```
3232
3333
## Getting Started

lib/src/api_client.dart

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
library aspose_words_cloud;
2929

3030
import 'dart:convert';
31+
import 'dart:math';
3132
import 'dart:typed_data';
3233

3334
import 'package:convert/convert.dart';
@@ -457,7 +458,7 @@ class ApiClient {
457458
var batchBody = serializeMultipart(bodyParts, boundary);
458459
batchHeaders['Content-Type'] = 'multipart/form-data; boundary="$boundary"';
459460

460-
var batchRequestData = ApiRequestData('PUT', batchUrl, batchHeaders, batchBody);
461+
var batchRequestData = ApiRequestData('PUT', batchUrl, batchHeaders, batchBody, null, null);
461462
var response = await _callWithChecks(batchRequestData);
462463
var responseParts = deserializeMultipartBatch(response.content);
463464
var result = <dynamic>[];
@@ -501,19 +502,46 @@ class ApiClient {
501502
print(debugMessage);
502503
}
503504

504-
var httpRequest = http.Request(requestData.method, Uri.parse(requestData.url));
505+
http.BaseRequest httpRequest;
506+
if (requestData.sendDataProgressCallback != null && requestData.body != null) {
507+
final streamRequest = httpRequest = http.StreamedRequest(requestData.method, Uri.parse(requestData.url));
508+
streamRequest.sink.addStream(_streamedByteData(requestData.body!, requestData.sendDataProgressCallback!)).then((_) {
509+
streamRequest.sink.close();
510+
});
511+
}
512+
else {
513+
final bodyRequest = httpRequest = http.Request(requestData.method, Uri.parse(requestData.url));
514+
if (requestData.body != null) {
515+
bodyRequest.bodyBytes = requestData.body!.buffer.asUint8List(
516+
requestData.body!.offsetInBytes, requestData.body!.lengthInBytes);
517+
}
518+
}
519+
505520
httpRequest.headers['x-aspose-client'] = 'dart sdk';
506-
httpRequest.headers['x-aspose-client-version'] = '24.7';
521+
httpRequest.headers['x-aspose-client-version'] = '24.8';
507522
httpRequest.headers['Authorization'] = await _getAuthToken();
508523
httpRequest.headers.addAll(requestData.headers);
509524

510-
if (requestData.body != null) {
511-
httpRequest.bodyBytes = requestData.body!.buffer.asUint8List(requestData.body!.offsetInBytes, requestData.body!.lengthInBytes);
512-
}
513-
514525
var response = await httpRequest.send().timeout(configuration.timeout);
515-
var bytes = await response.stream.toBytes();
516-
var responseData = ByteData.view(bytes.buffer);
526+
ByteData responseData;
527+
if (requestData.receiveDataProgressCallback != null) {
528+
var responseReceivedBytes = 0;
529+
final responseTotalBytes = response.contentLength ?? 0;
530+
final bytes = BytesBuilder();
531+
await for (final chunkValue in response.stream) {
532+
final chunk = Uint8List.fromList(chunkValue);
533+
bytes.write(chunk, chunk.offsetInBytes, chunk.lengthInBytes);
534+
responseReceivedBytes += chunk.lengthInBytes;
535+
requestData.receiveDataProgressCallback!(responseReceivedBytes, responseTotalBytes);
536+
}
537+
538+
final totalBytes = bytes.takeBytes();
539+
responseData = ByteData.view(totalBytes.buffer, totalBytes.offsetInBytes, totalBytes.lengthInBytes);
540+
}
541+
else {
542+
final bytes = await response.stream.toBytes();
543+
responseData = ByteData.view(bytes.buffer, bytes.offsetInBytes, bytes.lengthInBytes);
544+
}
517545

518546
if (configuration.debugMode == true) {
519547
var debugMessage = 'RESPONSE STATUS: ${response.statusCode} ${response.reasonPhrase}\r\n';
@@ -532,6 +560,18 @@ class ApiClient {
532560
_handleResponse(response.statusCode, response.reasonPhrase ?? "", responseData);
533561
return ApiResponseData(response.headers, responseData);
534562
}
563+
564+
Stream<Uint8List> _streamedByteData(ByteData buffer, final SendDataProgressCallback sendDataProgressCallback) async* {
565+
final maxChunkSize = 1024 * 64;
566+
final streamTotal = buffer.lengthInBytes;
567+
for (int i = 0; i < streamTotal; i += maxChunkSize) {
568+
final chunkProgress = i;
569+
final chunkOffset = buffer.offsetInBytes + i;
570+
final chunkSize = min(maxChunkSize, streamTotal - i);
571+
sendDataProgressCallback(chunkProgress + chunkSize, streamTotal);
572+
yield buffer.buffer.asUint8List(chunkOffset, chunkSize);
573+
}
574+
}
535575
}
536576

537577
extension IterableExtension<T> on Iterable<T> {

lib/src/api_request_data.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@
2828
library aspose_words_cloud;
2929

3030
import 'dart:typed_data';
31+
import './requests/request_base.dart';
3132

3233
class ApiRequestData {
3334
final String method;
3435
final String url;
3536
final Map<String, String> headers;
3637
final ByteData? body;
37-
ApiRequestData(this.method, this.url, this.headers, this.body);
38+
final SendDataProgressCallback? sendDataProgressCallback;
39+
final ReceiveDataProgressCallback? receiveDataProgressCallback;
40+
ApiRequestData(this.method, this.url, this.headers, this.body, this.sendDataProgressCallback, this.receiveDataProgressCallback);
3841
}

lib/src/models/svg_save_options_data.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ class SvgSaveOptionsData extends FixedPageSaveOptionsData {
4545
set fitToViewPort(bool? val) => _fitToViewPort = val;
4646

4747

48+
/// Gets or sets a value in pixels per inch that limits resolution of exported raster images.
49+
/// If the value of this property is non-zero, it limits resolution of exported raster images.
50+
/// That is, higher-resolution images are resampled down to the limit and lower-resolution images are exported as is.
51+
int? _maxImageResolution;
52+
53+
int? get maxImageResolution => _maxImageResolution;
54+
set maxImageResolution(int? val) => _maxImageResolution = val;
55+
56+
4857
/// Gets or sets the physical folder where resources (images) are saved when exporting.
4958
String? _resourcesFolder;
5059

@@ -241,6 +250,12 @@ class SvgSaveOptionsData extends FixedPageSaveOptionsData {
241250
fitToViewPort = null;
242251
}
243252

253+
if (json.containsKey('MaxImageResolution')) {
254+
maxImageResolution = json['MaxImageResolution'] as int;
255+
} else {
256+
maxImageResolution = null;
257+
}
258+
244259
if (json.containsKey('ResourcesFolder')) {
245260
resourcesFolder = json['ResourcesFolder'] as String;
246261
} else {
@@ -283,6 +298,10 @@ class SvgSaveOptionsData extends FixedPageSaveOptionsData {
283298
_result['FitToViewPort'] = fitToViewPort!;
284299
}
285300

301+
if (maxImageResolution != null) {
302+
_result['MaxImageResolution'] = maxImageResolution!;
303+
}
304+
286305
if (resourcesFolder != null) {
287306
_result['ResourcesFolder'] = resourcesFolder!;
288307
}

lib/src/requests/accept_all_revisions_online_request.dart

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,19 @@ class AcceptAllRevisionsOnlineRequest implements RequestBase {
4747
/// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
4848
final String? encryptedPassword;
4949

50+
/// The value indicates whether OpenType support is on.
51+
final bool? openTypeSupport;
52+
5053
/// Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.
5154
final String? destFileName;
5255

53-
AcceptAllRevisionsOnlineRequest(this.document, {this.loadEncoding, this.password, this.encryptedPassword, this.destFileName});
56+
/// Request send data progress callback
57+
final SendDataProgressCallback? sendDataProgressCallback;
58+
59+
/// Response receive data progress callback
60+
final ReceiveDataProgressCallback? receiveDataProgressCallback;
61+
62+
AcceptAllRevisionsOnlineRequest(this.document, {this.loadEncoding, this.password, this.encryptedPassword, this.openTypeSupport, this.destFileName, this.sendDataProgressCallback, this.receiveDataProgressCallback});
5463

5564
@override
5665
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
@@ -71,6 +80,10 @@ class AcceptAllRevisionsOnlineRequest implements RequestBase {
7180
_queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? "";
7281
}
7382

83+
if (openTypeSupport != null) {
84+
_queryParams['openTypeSupport'] = _apiClient.serializeToString(openTypeSupport) ?? "";
85+
}
86+
7487
if (destFileName != null) {
7588
_queryParams['destFileName'] = _apiClient.serializeToString(destFileName) ?? "";
7689
}
@@ -94,7 +107,7 @@ class AcceptAllRevisionsOnlineRequest implements RequestBase {
94107
}
95108
var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/');
96109
var _body = _apiClient.serializeBodyParts(_bodyParts, _headers);
97-
return ApiRequestData('PUT', _url, _headers, _body);
110+
return ApiRequestData('PUT', _url, _headers, _body, this.sendDataProgressCallback, this.receiveDataProgressCallback);
98111
}
99112

100113
@override

lib/src/requests/accept_all_revisions_request.dart

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,19 @@ class AcceptAllRevisionsRequest implements RequestBase {
5454
/// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
5555
final String? encryptedPassword;
5656

57+
/// The value indicates whether OpenType support is on.
58+
final bool? openTypeSupport;
59+
5760
/// Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.
5861
final String? destFileName;
5962

60-
AcceptAllRevisionsRequest(this.name, {this.folder, this.storage, this.loadEncoding, this.password, this.encryptedPassword, this.destFileName});
63+
/// Request send data progress callback
64+
final SendDataProgressCallback? sendDataProgressCallback;
65+
66+
/// Response receive data progress callback
67+
final ReceiveDataProgressCallback? receiveDataProgressCallback;
68+
69+
AcceptAllRevisionsRequest(this.name, {this.folder, this.storage, this.loadEncoding, this.password, this.encryptedPassword, this.openTypeSupport, this.destFileName, this.sendDataProgressCallback, this.receiveDataProgressCallback});
6170

6271
@override
6372
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
@@ -90,6 +99,10 @@ class AcceptAllRevisionsRequest implements RequestBase {
9099
_queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? "";
91100
}
92101

102+
if (openTypeSupport != null) {
103+
_queryParams['openTypeSupport'] = _apiClient.serializeToString(openTypeSupport) ?? "";
104+
}
105+
93106
if (destFileName != null) {
94107
_queryParams['destFileName'] = _apiClient.serializeToString(destFileName) ?? "";
95108
}
@@ -102,7 +115,7 @@ class AcceptAllRevisionsRequest implements RequestBase {
102115
}
103116
var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/');
104117
var _body = _apiClient.serializeBodyParts(_bodyParts, _headers);
105-
return ApiRequestData('PUT', _url, _headers, _body);
118+
return ApiRequestData('PUT', _url, _headers, _body, this.sendDataProgressCallback, this.receiveDataProgressCallback);
106119
}
107120

108121
@override

lib/src/requests/append_document_online_request.dart

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class AppendDocumentOnlineRequest implements RequestBase {
5050
/// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
5151
final String? encryptedPassword;
5252

53+
/// The value indicates whether OpenType support is on.
54+
final bool? openTypeSupport;
55+
5356
/// Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.
5457
final String? destFileName;
5558

@@ -59,7 +62,13 @@ class AppendDocumentOnlineRequest implements RequestBase {
5962
/// The date and time to use for revisions.
6063
final String? revisionDateTime;
6164

62-
AppendDocumentOnlineRequest(this.document, this.documentList, {this.loadEncoding, this.password, this.encryptedPassword, this.destFileName, this.revisionAuthor, this.revisionDateTime});
65+
/// Request send data progress callback
66+
final SendDataProgressCallback? sendDataProgressCallback;
67+
68+
/// Response receive data progress callback
69+
final ReceiveDataProgressCallback? receiveDataProgressCallback;
70+
71+
AppendDocumentOnlineRequest(this.document, this.documentList, {this.loadEncoding, this.password, this.encryptedPassword, this.openTypeSupport, this.destFileName, this.revisionAuthor, this.revisionDateTime, this.sendDataProgressCallback, this.receiveDataProgressCallback});
6372

6473
@override
6574
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
@@ -80,6 +89,10 @@ class AppendDocumentOnlineRequest implements RequestBase {
8089
_queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? "";
8190
}
8291

92+
if (openTypeSupport != null) {
93+
_queryParams['openTypeSupport'] = _apiClient.serializeToString(openTypeSupport) ?? "";
94+
}
95+
8396
if (destFileName != null) {
8497
_queryParams['destFileName'] = _apiClient.serializeToString(destFileName) ?? "";
8598
}
@@ -124,7 +137,7 @@ class AppendDocumentOnlineRequest implements RequestBase {
124137
}
125138
var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/');
126139
var _body = _apiClient.serializeBodyParts(_bodyParts, _headers);
127-
return ApiRequestData('PUT', _url, _headers, _body);
140+
return ApiRequestData('PUT', _url, _headers, _body, this.sendDataProgressCallback, this.receiveDataProgressCallback);
128141
}
129142

130143
@override

lib/src/requests/append_document_request.dart

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class AppendDocumentRequest implements RequestBase {
5757
/// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
5858
final String? encryptedPassword;
5959

60+
/// The value indicates whether OpenType support is on.
61+
final bool? openTypeSupport;
62+
6063
/// Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.
6164
final String? destFileName;
6265

@@ -66,7 +69,13 @@ class AppendDocumentRequest implements RequestBase {
6669
/// The date and time to use for revisions.
6770
final String? revisionDateTime;
6871

69-
AppendDocumentRequest(this.name, this.documentList, {this.folder, this.storage, this.loadEncoding, this.password, this.encryptedPassword, this.destFileName, this.revisionAuthor, this.revisionDateTime});
72+
/// Request send data progress callback
73+
final SendDataProgressCallback? sendDataProgressCallback;
74+
75+
/// Response receive data progress callback
76+
final ReceiveDataProgressCallback? receiveDataProgressCallback;
77+
78+
AppendDocumentRequest(this.name, this.documentList, {this.folder, this.storage, this.loadEncoding, this.password, this.encryptedPassword, this.openTypeSupport, this.destFileName, this.revisionAuthor, this.revisionDateTime, this.sendDataProgressCallback, this.receiveDataProgressCallback});
7079

7180
@override
7281
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
@@ -99,6 +108,10 @@ class AppendDocumentRequest implements RequestBase {
99108
_queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? "";
100109
}
101110

111+
if (openTypeSupport != null) {
112+
_queryParams['openTypeSupport'] = _apiClient.serializeToString(openTypeSupport) ?? "";
113+
}
114+
102115
if (destFileName != null) {
103116
_queryParams['destFileName'] = _apiClient.serializeToString(destFileName) ?? "";
104117
}
@@ -132,7 +145,7 @@ class AppendDocumentRequest implements RequestBase {
132145
}
133146
var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/');
134147
var _body = _apiClient.serializeBodyParts(_bodyParts, _headers);
135-
return ApiRequestData('PUT', _url, _headers, _body);
148+
return ApiRequestData('PUT', _url, _headers, _body, this.sendDataProgressCallback, this.receiveDataProgressCallback);
136149
}
137150

138151
@override

lib/src/requests/apply_style_to_document_element_online_request.dart

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class ApplyStyleToDocumentElementOnlineRequest implements RequestBase {
5353
/// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
5454
final String? encryptedPassword;
5555

56+
/// The value indicates whether OpenType support is on.
57+
final bool? openTypeSupport;
58+
5659
/// Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.
5760
final String? destFileName;
5861

@@ -62,7 +65,13 @@ class ApplyStyleToDocumentElementOnlineRequest implements RequestBase {
6265
/// The date and time to use for revisions.
6366
final String? revisionDateTime;
6467

65-
ApplyStyleToDocumentElementOnlineRequest(this.document, this.styledNodePath, this.styleApply, {this.loadEncoding, this.password, this.encryptedPassword, this.destFileName, this.revisionAuthor, this.revisionDateTime});
68+
/// Request send data progress callback
69+
final SendDataProgressCallback? sendDataProgressCallback;
70+
71+
/// Response receive data progress callback
72+
final ReceiveDataProgressCallback? receiveDataProgressCallback;
73+
74+
ApplyStyleToDocumentElementOnlineRequest(this.document, this.styledNodePath, this.styleApply, {this.loadEncoding, this.password, this.encryptedPassword, this.openTypeSupport, this.destFileName, this.revisionAuthor, this.revisionDateTime, this.sendDataProgressCallback, this.receiveDataProgressCallback});
6675

6776
@override
6877
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
@@ -87,6 +96,10 @@ class ApplyStyleToDocumentElementOnlineRequest implements RequestBase {
8796
_queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? "";
8897
}
8998

99+
if (openTypeSupport != null) {
100+
_queryParams['openTypeSupport'] = _apiClient.serializeToString(openTypeSupport) ?? "";
101+
}
102+
90103
if (destFileName != null) {
91104
_queryParams['destFileName'] = _apiClient.serializeToString(destFileName) ?? "";
92105
}
@@ -130,7 +143,7 @@ class ApplyStyleToDocumentElementOnlineRequest implements RequestBase {
130143
}
131144
var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/');
132145
var _body = _apiClient.serializeBodyParts(_bodyParts, _headers);
133-
return ApiRequestData('PUT', _url, _headers, _body);
146+
return ApiRequestData('PUT', _url, _headers, _body, this.sendDataProgressCallback, this.receiveDataProgressCallback);
134147
}
135148

136149
@override

0 commit comments

Comments
 (0)