Skip to content

Commit a81fe92

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 2926a1b + d847b56 commit a81fe92

12 files changed

+315
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [23.5.0] - Aspose Words Cloud for Dart 23.5 Release Notes
2+
3+
- Added InsertSection method.
4+
5+
16
## [23.4.0] - Aspose Words Cloud for Dart 23.4 Release Notes
27

38
- Added new type of RangeEndIdentifier for RangeApi: document:end

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: 23.4.0
30+
aspose_words_cloud: 23.5.0
3131
```
3232
3333
## Getting Started

lib/aspose_words_cloud.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,8 @@ export 'src/requests/insert_paragraph_online_request.dart';
543543
export 'src/requests/insert_paragraph_request.dart';
544544
export 'src/requests/insert_run_online_request.dart';
545545
export 'src/requests/insert_run_request.dart';
546+
export 'src/requests/insert_section_online_request.dart';
547+
export 'src/requests/insert_section_request.dart';
546548
export 'src/requests/insert_structured_document_tag_online_request.dart';
547549
export 'src/requests/insert_structured_document_tag_request.dart';
548550
export 'src/requests/insert_style_online_request.dart';

lib/src/api_client.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ class ApiClient {
503503

504504
var httpRequest = http.Request(requestData.method, Uri.parse(requestData.url));
505505
httpRequest.headers['x-aspose-client'] = 'dart sdk';
506-
httpRequest.headers['x-aspose-client-version'] = '23.4';
506+
httpRequest.headers['x-aspose-client-version'] = '23.5';
507507
httpRequest.headers['Authorization'] = await _getAuthToken();
508508
httpRequest.headers.addAll(requestData.headers);
509509

lib/src/requests/create_document_request.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CreateDocumentRequest implements RequestBase {
4545
/// Original document storage.
4646
final String? storage;
4747

48-
CreateDocumentRequest({this.fileName, this.folder, this.storage});
48+
CreateDocumentRequest(this.fileName, {this.folder, this.storage});
4949

5050
@override
5151
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
@@ -57,6 +57,9 @@ class CreateDocumentRequest implements RequestBase {
5757
if (fileName != null) {
5858
_queryParams['fileName'] = _apiClient.serializeToString(fileName) ?? "";
5959
}
60+
else {
61+
throw ApiException(400, 'Parameter fileName is required.');
62+
}
6063

6164
if (folder != null) {
6265
_queryParams['folder'] = _apiClient.serializeToString(folder) ?? "";
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="insert_section_online_request.dart">
4+
* Copyright (c) 2023 Aspose.Words for Cloud
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------
26+
*/
27+
28+
library aspose_words_cloud;
29+
30+
import 'dart:typed_data';
31+
import '../../aspose_words_cloud.dart';
32+
import '../api_client.dart';
33+
import '../api_request_data.dart';
34+
import '../api_request_part.dart';
35+
import '../body_part_data.dart';
36+
37+
/// Request model for InsertSectionOnline operation.
38+
class InsertSectionOnlineRequest implements RequestBase {
39+
/// The document.
40+
final ByteData? document;
41+
42+
/// The index to insert into.
43+
final int? sectionIndex;
44+
45+
/// Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
46+
final String? loadEncoding;
47+
48+
/// 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.
49+
final String? password;
50+
51+
/// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
52+
final String? encryptedPassword;
53+
54+
/// 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.
55+
final String? destFileName;
56+
57+
/// Initials of the author to use for revisions.If you set this parameter and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions.
58+
final String? revisionAuthor;
59+
60+
/// The date and time to use for revisions.
61+
final String? revisionDateTime;
62+
63+
InsertSectionOnlineRequest(this.document, this.sectionIndex, {this.loadEncoding, this.password, this.encryptedPassword, this.destFileName, this.revisionAuthor, this.revisionDateTime});
64+
65+
@override
66+
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
67+
var _path = '/words/online/post/sections/{sectionIndex}';
68+
var _queryParams = <String, String>{};
69+
var _headers = <String, String>{};
70+
var _bodyParts = <ApiRequestPart>[];
71+
var _fileContentParts = <FileReference>[];
72+
if (sectionIndex == null) {
73+
throw ApiException(400, 'Parameter sectionIndex is required.');
74+
}
75+
_path = _path.replaceAll('{sectionIndex}', _apiClient.serializeToString(sectionIndex) ?? "");
76+
if (loadEncoding != null) {
77+
_queryParams['loadEncoding'] = _apiClient.serializeToString(loadEncoding) ?? "";
78+
}
79+
80+
if (password != null) {
81+
_queryParams['encryptedPassword'] = await _apiClient.encryptPassword(password!);
82+
}
83+
84+
if (encryptedPassword != null) {
85+
_queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? "";
86+
}
87+
88+
if (destFileName != null) {
89+
_queryParams['destFileName'] = _apiClient.serializeToString(destFileName) ?? "";
90+
}
91+
92+
if (revisionAuthor != null) {
93+
_queryParams['revisionAuthor'] = _apiClient.serializeToString(revisionAuthor) ?? "";
94+
}
95+
96+
if (revisionDateTime != null) {
97+
_queryParams['revisionDateTime'] = _apiClient.serializeToString(revisionDateTime) ?? "";
98+
}
99+
100+
if (document != null) {
101+
var _formBody = _apiClient.serializeBody(document, 'Document');
102+
if (_formBody != null) {
103+
_bodyParts.add(_formBody);
104+
}
105+
}
106+
else {
107+
throw ApiException(400, 'Parameter document is required.');
108+
}
109+
110+
for (final _fileContentPart in _fileContentParts) {
111+
if (_fileContentPart.source == 'Request') {
112+
_bodyParts.add(ApiRequestPart(_fileContentPart.content!, 'application/octet-stream', name: _fileContentPart.reference));
113+
}
114+
}
115+
var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/');
116+
var _body = _apiClient.serializeBodyParts(_bodyParts, _headers);
117+
return ApiRequestData('PUT', _url, _headers, _body);
118+
}
119+
120+
@override
121+
dynamic deserializeResponse(final ApiClient _apiClient, final Map<String, String> _headers, final ByteData? _body) {
122+
if (_body == null) {
123+
return ApiException(400, "Nullable response body is not allowed for this operation type.");
124+
}
125+
126+
return _apiClient.deserializeFilesCollection(BodyPartData(_headers['content-type'], _headers['filename'], _body));
127+
}
128+
}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="insert_section_request.dart">
4+
* Copyright (c) 2023 Aspose.Words for Cloud
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------
26+
*/
27+
28+
library aspose_words_cloud;
29+
30+
import 'dart:typed_data';
31+
import '../../aspose_words_cloud.dart';
32+
import '../api_client.dart';
33+
import '../api_request_data.dart';
34+
import '../api_request_part.dart';
35+
36+
/// Request model for InsertSection operation.
37+
class InsertSectionRequest implements RequestBase {
38+
/// The filename of the input document.
39+
final String? name;
40+
41+
/// The index to insert into.
42+
final int? sectionIndex;
43+
44+
/// Original document folder.
45+
final String? folder;
46+
47+
/// Original document storage.
48+
final String? storage;
49+
50+
/// Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
51+
final String? loadEncoding;
52+
53+
/// 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.
54+
final String? password;
55+
56+
/// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
57+
final String? encryptedPassword;
58+
59+
/// 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.
60+
final String? destFileName;
61+
62+
/// Initials of the author to use for revisions.If you set this parameter and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions.
63+
final String? revisionAuthor;
64+
65+
/// The date and time to use for revisions.
66+
final String? revisionDateTime;
67+
68+
InsertSectionRequest(this.name, this.sectionIndex, {this.folder, this.storage, this.loadEncoding, this.password, this.encryptedPassword, this.destFileName, this.revisionAuthor, this.revisionDateTime});
69+
70+
@override
71+
Future<ApiRequestData> createRequestData(final ApiClient _apiClient) async {
72+
var _path = '/words/{name}/sections/{sectionIndex}';
73+
var _queryParams = <String, String>{};
74+
var _headers = <String, String>{};
75+
var _bodyParts = <ApiRequestPart>[];
76+
var _fileContentParts = <FileReference>[];
77+
if (name == null) {
78+
throw ApiException(400, 'Parameter name is required.');
79+
}
80+
_path = _path.replaceAll('{name}', _apiClient.serializeToString(name) ?? "");
81+
82+
if (sectionIndex == null) {
83+
throw ApiException(400, 'Parameter sectionIndex is required.');
84+
}
85+
_path = _path.replaceAll('{sectionIndex}', _apiClient.serializeToString(sectionIndex) ?? "");
86+
if (folder != null) {
87+
_queryParams['folder'] = _apiClient.serializeToString(folder) ?? "";
88+
}
89+
90+
if (storage != null) {
91+
_queryParams['storage'] = _apiClient.serializeToString(storage) ?? "";
92+
}
93+
94+
if (loadEncoding != null) {
95+
_queryParams['loadEncoding'] = _apiClient.serializeToString(loadEncoding) ?? "";
96+
}
97+
98+
if (password != null) {
99+
_queryParams['encryptedPassword'] = await _apiClient.encryptPassword(password!);
100+
}
101+
102+
if (encryptedPassword != null) {
103+
_queryParams['encryptedPassword'] = _apiClient.serializeToString(encryptedPassword) ?? "";
104+
}
105+
106+
if (destFileName != null) {
107+
_queryParams['destFileName'] = _apiClient.serializeToString(destFileName) ?? "";
108+
}
109+
110+
if (revisionAuthor != null) {
111+
_queryParams['revisionAuthor'] = _apiClient.serializeToString(revisionAuthor) ?? "";
112+
}
113+
114+
if (revisionDateTime != null) {
115+
_queryParams['revisionDateTime'] = _apiClient.serializeToString(revisionDateTime) ?? "";
116+
}
117+
118+
for (final _fileContentPart in _fileContentParts) {
119+
if (_fileContentPart.source == 'Request') {
120+
_bodyParts.add(ApiRequestPart(_fileContentPart.content!, 'application/octet-stream', name: _fileContentPart.reference));
121+
}
122+
}
123+
var _url = _apiClient.configuration.getApiRootUrl() + _apiClient.applyQueryParams(_path, _queryParams).replaceAll('//', '/');
124+
var _body = _apiClient.serializeBodyParts(_bodyParts, _headers);
125+
return ApiRequestData('POST', _url, _headers, _body);
126+
}
127+
128+
@override
129+
dynamic deserializeResponse(final ApiClient _apiClient, final Map<String, String> _headers, final ByteData? _body) {
130+
return null;
131+
}
132+
}

lib/src/words_api.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,16 @@ class WordsApi {
11991199
return await _apiClient.call(request) as InsertRunOnlineResponse;
12001200
}
12011201

1202+
/// Inserts a section to the document.
1203+
Future< void > insertSection(InsertSectionRequest request) async {
1204+
await _apiClient.call(request);
1205+
}
1206+
1207+
/// Inserts a section to the document.
1208+
Future< Map<String, ByteData> > insertSectionOnline(InsertSectionOnlineRequest request) async {
1209+
return await _apiClient.call(request) as Map<String, ByteData>;
1210+
}
1211+
12021212
/// Inserts a new StructuredDocumentTag (SDT) to the document node.
12031213
Future< StructuredDocumentTagResponse > insertStructuredDocumentTag(InsertStructuredDocumentTagRequest request) async {
12041214
return await _apiClient.call(request) as StructuredDocumentTagResponse;

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: aspose_words_cloud
22
description: This package allows you to work with Aspose.Words Cloud REST APIs in your Dart applications quickly and easily, with zero initial cost.
3-
version: 23.4.0
3+
version: 23.5.0
44
homepage: https://github.com/aspose-words-cloud/aspose-words-cloud-dart
55

66
environment:

test/aspose_words_cloud_tests.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ void main() {
518518
test('GetSectionsOnline', () async => await SectionTests(testContext).testGetSectionsOnline());
519519
test('DeleteSection', () async => await SectionTests(testContext).testDeleteSection());
520520
test('DeleteSectionOnline', () async => await SectionTests(testContext).testDeleteSectionOnline());
521+
test('InsertSection', () async => await SectionTests(testContext).testInsertSection());
522+
test('InsertSectionOnline', () async => await SectionTests(testContext).testInsertSectionOnline());
521523
test('LinkHeaderFootersToPrevious', () async => await SectionTests(testContext).testLinkHeaderFootersToPrevious());
522524
});
523525

0 commit comments

Comments
 (0)