Skip to content

Commit 4288583

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 3fa553c + e67d3c9 commit 4288583

File tree

6 files changed

+377
-2
lines changed

6 files changed

+377
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Feel free to explore the [Developer's Guide](https://docs.aspose.cloud/display/w
1616
- Add & remove watermarks and protection.
1717
- Read & write access to Document Object Model.
1818

19+
## Enhancements in Version 23.5
20+
21+
- Added InsertSection method.
22+
23+
1924
## Enhancements in Version 23.4
2025

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "asposewordscloud",
3-
"version": "23.4.0",
3+
"version": "23.5.0",
44
"description": "Aspose.Words Cloud SDK for Node.js",
55
"homepage": "https://products.aspose.cloud/words/cloud",
66
"author": {

src/api.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4197,6 +4197,39 @@ export class WordsApi implements Encryptor {
41974197
return Promise.resolve(result);
41984198
}
41994199

4200+
/**
4201+
* Inserts a section to the document.
4202+
* @param requestObj contains request parameters
4203+
*/
4204+
public async insertSection(requestObj: model.InsertSectionRequest): Promise< http.IncomingMessage > {
4205+
if (requestObj === null || requestObj === undefined) {
4206+
throw new Error('Required parameter "request" was null or undefined when calling insertSection.');
4207+
}
4208+
4209+
const requestOptions = await requestObj.createRequestOptions(this.configuration, this);
4210+
4211+
const response = await invokeApiMethod(requestOptions, this.configuration);
4212+
return Promise.resolve(response);
4213+
}
4214+
4215+
/**
4216+
* Inserts a section to the document.
4217+
* @param requestObj contains request parameters
4218+
*/
4219+
public async insertSectionOnline(requestObj: model.InsertSectionOnlineRequest): Promise< model.WordsIncomingMessage< Map<string, Buffer> > > {
4220+
if (requestObj === null || requestObj === undefined) {
4221+
throw new Error('Required parameter "request" was null or undefined when calling insertSectionOnline.');
4222+
}
4223+
4224+
const requestOptions = await requestObj.createRequestOptions(this.configuration, this);
4225+
4226+
const response = await invokeApiMethod(requestOptions, this.configuration);
4227+
const result = new model.WordsIncomingMessage< Map<string, Buffer> >();
4228+
result.response = response;
4229+
result.body = requestObj.createResponse(response.body, response.headers);
4230+
return Promise.resolve(result);
4231+
}
4232+
42004233
/**
42014234
* Inserts a new StructuredDocumentTag (SDT) to the document node.
42024235
* @param requestObj contains request parameters

src/internal/requestHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async function invokeApiMethodInternal(requestOptions: request.OptionsWithUri, c
131131
requestOptions.timeout = 1000 * confguration.timeout;
132132

133133
requestOptions.headers["x-aspose-client"] = "nodejs sdk";
134-
requestOptions.headers["x-aspose-client-version"] = "23.4";
134+
requestOptions.headers["x-aspose-client-version"] = "23.5";
135135
requestOptions.encoding = null;
136136

137137
requestOptions.uri = encodeURI(requestOptions.uri.toString());

src/model/model.ts

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3871,6 +3871,16 @@ export class CreateDocumentRequest implements RequestInterface {
38713871
var headerParams: any = {};
38723872
var formParams: any = [];
38733873
var filesContent: any = [];
3874+
// verify required parameter 'this.fileName' is not undefined
3875+
if (this.fileName === undefined) {
3876+
throw new Error('Required parameter "this.fileName" was undefined when calling createDocument.');
3877+
}
3878+
3879+
// verify required parameter 'this.fileName' is not null
3880+
if (this.fileName === null) {
3881+
throw new Error('Required parameter "this.fileName" was null when calling createDocument.');
3882+
}
3883+
38743884
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "fileName", this.fileName, _encryptor);
38753885
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "folder", this.folder, _encryptor);
38763886
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "storage", this.storage, _encryptor);
@@ -31010,6 +31020,284 @@ export class InsertRunOnlineRequest implements RequestInterface {
3101031020
}
3101131021
}
3101231022

31023+
/**
31024+
* Request model for InsertSection operation.
31025+
* Inserts a section to the document.
31026+
*/
31027+
export class InsertSectionRequest implements RequestInterface {
31028+
31029+
public constructor(init?: Partial< InsertSectionRequest >) {
31030+
Object.assign(this, init);
31031+
}
31032+
31033+
/**
31034+
* The filename of the input document.
31035+
*/
31036+
public name: string;
31037+
31038+
/**
31039+
* The index to insert into.
31040+
*/
31041+
public sectionIndex: number;
31042+
31043+
/**
31044+
* Original document folder.
31045+
*/
31046+
public folder: string;
31047+
31048+
/**
31049+
* Original document storage.
31050+
*/
31051+
public storage: string;
31052+
31053+
/**
31054+
* Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
31055+
*/
31056+
public loadEncoding: string;
31057+
31058+
/**
31059+
* 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.
31060+
*/
31061+
public password: string;
31062+
31063+
/**
31064+
* Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
31065+
*/
31066+
public encryptedPassword: string;
31067+
31068+
/**
31069+
* 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.
31070+
*/
31071+
public destFileName: string;
31072+
31073+
/**
31074+
* 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.
31075+
*/
31076+
public revisionAuthor: string;
31077+
31078+
/**
31079+
* The date and time to use for revisions.
31080+
*/
31081+
public revisionDateTime: string;
31082+
31083+
/**
31084+
* create the requst options for this request
31085+
* @param configuration a configuration for the request
31086+
* @param data encryptor
31087+
*/
31088+
public async createRequestOptions(configuration: Configuration, _encryptor: Encryptor) : Promise<request.OptionsWithUri> {
31089+
let localVarPath = configuration.getApiBaseUrl() + "/words/{name}/sections/{sectionIndex}"
31090+
.replace("/{" + "name" + "}", (this.name !== null && this.name !== undefined) ? "/" + String(this.name) : "")
31091+
.replace("/{" + "sectionIndex" + "}", (this.sectionIndex !== null && this.sectionIndex !== undefined) ? "/" + String(this.sectionIndex) : "")
31092+
.replace("//", "/");
31093+
var queryParameters: any = {};
31094+
var headerParams: any = {};
31095+
var formParams: any = [];
31096+
var filesContent: any = [];
31097+
// verify required parameter 'this.name' is not undefined
31098+
if (this.name === undefined) {
31099+
throw new Error('Required parameter "this.name" was undefined when calling insertSection.');
31100+
}
31101+
31102+
// verify required parameter 'this.name' is not null
31103+
if (this.name === null) {
31104+
throw new Error('Required parameter "this.name" was null when calling insertSection.');
31105+
}
31106+
31107+
// verify required parameter 'this.sectionIndex' is not undefined
31108+
if (this.sectionIndex === undefined) {
31109+
throw new Error('Required parameter "this.sectionIndex" was undefined when calling insertSection.');
31110+
}
31111+
31112+
// verify required parameter 'this.sectionIndex' is not null
31113+
if (this.sectionIndex === null) {
31114+
throw new Error('Required parameter "this.sectionIndex" was null when calling insertSection.');
31115+
}
31116+
31117+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "folder", this.folder, _encryptor);
31118+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "storage", this.storage, _encryptor);
31119+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "loadEncoding", this.loadEncoding, _encryptor);
31120+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "password", this.password, _encryptor);
31121+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "encryptedPassword", this.encryptedPassword, _encryptor);
31122+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "destFileName", this.destFileName, _encryptor);
31123+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "revisionAuthor", this.revisionAuthor, _encryptor);
31124+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "revisionDateTime", this.revisionDateTime, _encryptor);
31125+
31126+
for (let fileContent of filesContent) {
31127+
formParams.push([fileContent.getReference(), fileContent.getContent(), 'application/octet-stream']);
31128+
}
31129+
31130+
const requestOptions: request.Options = {
31131+
method: "POST",
31132+
qs: queryParameters,
31133+
headers: headerParams,
31134+
uri: localVarPath,
31135+
};
31136+
31137+
if (formParams.length == 1) {
31138+
let formFirstParam = formParams[0];
31139+
requestOptions.body = formFirstParam[1];
31140+
requestOptions.headers["Content-Type"] = formFirstParam[2];
31141+
}
31142+
else if (formParams.length > 1) {
31143+
const requestParts = [];
31144+
for (let formParam of formParams) {
31145+
requestParts.push({
31146+
'Content-Type': formParam[2],
31147+
'Content-Disposition': 'form-data; name="' + formParam[0] + '"',
31148+
body: formParam[1],
31149+
});
31150+
}
31151+
31152+
requestOptions.headers["Content-Type"] = 'multipart/form-data';
31153+
requestOptions.multipart = requestParts;
31154+
}
31155+
31156+
return Promise.resolve(requestOptions);
31157+
}
31158+
31159+
/**
31160+
* create response from string
31161+
*/
31162+
createResponse(_response: Buffer, _headers: http.IncomingHttpHeaders): any {
31163+
return null;
31164+
}
31165+
}
31166+
31167+
/**
31168+
* Request model for InsertSectionOnline operation.
31169+
* Inserts a section to the document.
31170+
*/
31171+
export class InsertSectionOnlineRequest implements RequestInterface {
31172+
31173+
public constructor(init?: Partial< InsertSectionOnlineRequest >) {
31174+
Object.assign(this, init);
31175+
}
31176+
31177+
/**
31178+
* The document.
31179+
*/
31180+
public document: Readable;
31181+
31182+
/**
31183+
* The index to insert into.
31184+
*/
31185+
public sectionIndex: number;
31186+
31187+
/**
31188+
* Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
31189+
*/
31190+
public loadEncoding: string;
31191+
31192+
/**
31193+
* 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.
31194+
*/
31195+
public password: string;
31196+
31197+
/**
31198+
* Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
31199+
*/
31200+
public encryptedPassword: string;
31201+
31202+
/**
31203+
* 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.
31204+
*/
31205+
public destFileName: string;
31206+
31207+
/**
31208+
* 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.
31209+
*/
31210+
public revisionAuthor: string;
31211+
31212+
/**
31213+
* The date and time to use for revisions.
31214+
*/
31215+
public revisionDateTime: string;
31216+
31217+
/**
31218+
* create the requst options for this request
31219+
* @param configuration a configuration for the request
31220+
* @param data encryptor
31221+
*/
31222+
public async createRequestOptions(configuration: Configuration, _encryptor: Encryptor) : Promise<request.OptionsWithUri> {
31223+
let localVarPath = configuration.getApiBaseUrl() + "/words/online/post/sections/{sectionIndex}"
31224+
.replace("/{" + "sectionIndex" + "}", (this.sectionIndex !== null && this.sectionIndex !== undefined) ? "/" + String(this.sectionIndex) : "")
31225+
.replace("//", "/");
31226+
var queryParameters: any = {};
31227+
var headerParams: any = {};
31228+
var formParams: any = [];
31229+
var filesContent: any = [];
31230+
// verify required parameter 'this.document' is not undefined
31231+
if (this.document === undefined) {
31232+
throw new Error('Required parameter "this.document" was undefined when calling insertSectionOnline.');
31233+
}
31234+
31235+
// verify required parameter 'this.document' is not null
31236+
if (this.document === null) {
31237+
throw new Error('Required parameter "this.document" was null when calling insertSectionOnline.');
31238+
}
31239+
31240+
// verify required parameter 'this.sectionIndex' is not undefined
31241+
if (this.sectionIndex === undefined) {
31242+
throw new Error('Required parameter "this.sectionIndex" was undefined when calling insertSectionOnline.');
31243+
}
31244+
31245+
// verify required parameter 'this.sectionIndex' is not null
31246+
if (this.sectionIndex === null) {
31247+
throw new Error('Required parameter "this.sectionIndex" was null when calling insertSectionOnline.');
31248+
}
31249+
31250+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "loadEncoding", this.loadEncoding, _encryptor);
31251+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "password", this.password, _encryptor);
31252+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "encryptedPassword", this.encryptedPassword, _encryptor);
31253+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "destFileName", this.destFileName, _encryptor);
31254+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "revisionAuthor", this.revisionAuthor, _encryptor);
31255+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "revisionDateTime", this.revisionDateTime, _encryptor);
31256+
if (this.document !== undefined) {
31257+
formParams.push(['Document', this.document, 'application/octet-stream']);
31258+
}
31259+
31260+
for (let fileContent of filesContent) {
31261+
formParams.push([fileContent.getReference(), fileContent.getContent(), 'application/octet-stream']);
31262+
}
31263+
31264+
const requestOptions: request.Options = {
31265+
method: "PUT",
31266+
qs: queryParameters,
31267+
headers: headerParams,
31268+
uri: localVarPath,
31269+
};
31270+
31271+
if (formParams.length == 1) {
31272+
let formFirstParam = formParams[0];
31273+
requestOptions.body = formFirstParam[1];
31274+
requestOptions.headers["Content-Type"] = formFirstParam[2];
31275+
}
31276+
else if (formParams.length > 1) {
31277+
const requestParts = [];
31278+
for (let formParam of formParams) {
31279+
requestParts.push({
31280+
'Content-Type': formParam[2],
31281+
'Content-Disposition': 'form-data; name="' + formParam[0] + '"',
31282+
body: formParam[1],
31283+
});
31284+
}
31285+
31286+
requestOptions.headers["Content-Type"] = 'multipart/form-data';
31287+
requestOptions.multipart = requestParts;
31288+
}
31289+
31290+
return Promise.resolve(requestOptions);
31291+
}
31292+
31293+
/**
31294+
* create response from string
31295+
*/
31296+
createResponse(_response: Buffer, _headers: http.IncomingHttpHeaders): any {
31297+
return parseFilesCollection(_response, _headers);
31298+
}
31299+
}
31300+
3101331301
/**
3101431302
* Request model for InsertStructuredDocumentTag operation.
3101531303
* Inserts a new StructuredDocumentTag (SDT) to the document node.

0 commit comments

Comments
 (0)