Skip to content

Commit d8f3640

Browse files
SDK regenerated by CI server [ci skip]
1 parent cbde290 commit d8f3640

File tree

5 files changed

+160
-2
lines changed

5 files changed

+160
-2
lines changed

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": "25.9.0",
3+
"version": "25.10.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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4669,6 +4669,24 @@ export class WordsApi implements Encryptor {
46694669
return Promise.resolve(result);
46704670
}
46714671

4672+
/**
4673+
* Downloads a document from the Web using URL and saves it to cloud storage in the specified format.
4674+
* @param requestObj contains request parameters
4675+
*/
4676+
public async loadWebDocumentOnline(requestObj: model.LoadWebDocumentOnlineRequest): Promise< model.WordsIncomingMessage< model.LoadWebDocumentOnlineResponse > > {
4677+
if (requestObj === null || requestObj === undefined) {
4678+
throw new Error('Required parameter "request" was null or undefined when calling loadWebDocumentOnline.');
4679+
}
4680+
4681+
const requestOptions = await requestObj.createRequestOptions(this.configuration, this);
4682+
4683+
const response = await invokeApiMethod(requestOptions, this.configuration);
4684+
const result = new model.WordsIncomingMessage< model.LoadWebDocumentOnlineResponse >();
4685+
result.response = response;
4686+
result.body = requestObj.createResponse(response.body, response.headers);
4687+
return Promise.resolve(result);
4688+
}
4689+
46724690
/**
46734691
* Merge the section with the next one.
46744692
* @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"] = "25.9";
134+
requestOptions.headers["x-aspose-client-version"] = "25.10";
135135
requestOptions.encoding = null;
136136

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

src/model/model.ts

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36609,6 +36609,102 @@ export class LoadWebDocumentRequest implements RequestInterface {
3660936609
}
3661036610
}
3661136611

36612+
/**
36613+
* Request model for LoadWebDocumentOnline operation.
36614+
* Downloads a document from the Web using URL and saves it to cloud storage in the specified format.
36615+
*/
36616+
export class LoadWebDocumentOnlineRequest implements RequestInterface {
36617+
36618+
public constructor(init?: Partial< LoadWebDocumentOnlineRequest >) {
36619+
Object.assign(this, init);
36620+
}
36621+
36622+
/**
36623+
* The properties of data downloading.
36624+
*/
36625+
public data: importedLoadWebDocumentData.LoadWebDocumentData;
36626+
36627+
/**
36628+
* create the requst options for this request
36629+
* @param configuration a configuration for the request
36630+
* @param data encryptor
36631+
*/
36632+
public async createRequestOptions(configuration: Configuration, _encryptor: Encryptor) : Promise<request.OptionsWithUri> {
36633+
const localVarPath = configuration.getApiBaseUrl() + "/words/online/put/loadWebDocument"
36634+
.replace("//", "/");
36635+
var queryParameters: any = {};
36636+
var headerParams: any = {};
36637+
var formParams: any = [];
36638+
var filesContent: any = [];
36639+
// verify required parameter 'this.data' is not undefined
36640+
if (this.data === undefined) {
36641+
throw new Error('Required parameter "this.data" was undefined when calling loadWebDocumentOnline.');
36642+
}
36643+
36644+
// verify required parameter 'this.data' is not null
36645+
if (this.data === null) {
36646+
throw new Error('Required parameter "this.data" was null when calling loadWebDocumentOnline.');
36647+
}
36648+
this.data?.validate();
36649+
36650+
if (this.data !== undefined) {
36651+
let _obj = ObjectSerializer.serialize(this.data, this.data.constructor.name === "Object" ? "importedLoadWebDocumentData.LoadWebDocumentData" : this.data.constructor.name);
36652+
formParams.push(['Data', JSON.stringify(_obj), 'application/json']);
36653+
}
36654+
36655+
for (let fileContent of filesContent) {
36656+
await fileContent.encryptPassword(_encryptor);
36657+
if (fileContent.getSource() == FileReference.SourceEnum.Request) {
36658+
formParams.push([fileContent.getReference(), fileContent.getContent(), 'application/octet-stream']);
36659+
}
36660+
}
36661+
36662+
const requestOptions: request.Options = {
36663+
method: "PUT",
36664+
qs: queryParameters,
36665+
headers: headerParams,
36666+
uri: localVarPath,
36667+
};
36668+
36669+
if (formParams.length == 1) {
36670+
let formFirstParam = formParams[0];
36671+
requestOptions.body = formFirstParam[1];
36672+
requestOptions.headers["Content-Type"] = formFirstParam[2];
36673+
}
36674+
else if (formParams.length > 1) {
36675+
const requestParts = [];
36676+
for (let formParam of formParams) {
36677+
requestParts.push({
36678+
'Content-Type': formParam[2],
36679+
'Content-Disposition': 'form-data; name="' + formParam[0] + '"',
36680+
body: formParam[1],
36681+
});
36682+
}
36683+
36684+
requestOptions.headers["Content-Type"] = 'multipart/form-data';
36685+
requestOptions.multipart = requestParts;
36686+
}
36687+
36688+
return Promise.resolve(requestOptions);
36689+
}
36690+
36691+
/**
36692+
* create response from string
36693+
*/
36694+
createResponse(_response: Buffer, _headers: http.IncomingHttpHeaders): any {
36695+
const result = new LoadWebDocumentOnlineResponse();
36696+
const boundary = getBoundary(_headers);
36697+
const parts = parseMultipart(_response, boundary);
36698+
result.model = ObjectSerializer.deserialize(JSON.parse(findMultipartElement(parts, "Model").body.toString()), "SaveResponse");
36699+
36700+
36701+
const partDocument = findMultipartElement(parts, "Document");
36702+
result.document = parseFilesCollection(partDocument.body, partDocument.headers);
36703+
36704+
return result;
36705+
}
36706+
}
36707+
3661236708
/**
3661336709
* Request model for MergeWithNext operation.
3661436710
* Merge the section with the next one.
@@ -51314,6 +51410,22 @@ export class InsertWatermarkTextOnlineResponse {
5131451410
public document: Map<string, Buffer>;
5131551411
}
5131651412

51413+
/**
51414+
* Response model for LoadWebDocumentOnline operation.
51415+
* Downloads a document from the Web using URL and saves it to cloud storage in the specified format.
51416+
*/
51417+
export class LoadWebDocumentOnlineResponse {
51418+
/**
51419+
* The REST response with a save result.
51420+
*/
51421+
public model: importedSaveResponse.SaveResponse;
51422+
51423+
/**
51424+
* The document after modification.
51425+
*/
51426+
public document: Map<string, Buffer>;
51427+
}
51428+
5131751429
/**
5131851430
* Response model for ProtectDocumentOnline operation.
5131951431
* Changes the document protection. The previous protection will be overwritten if it exist.

test/document/loadWebDocumentTests.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,32 @@ describe("loadWebDocument", () => {
6565

6666
});
6767
});
68+
69+
// Test for loading web document online.
70+
describe("loadWebDocumentOnline test", () => {
71+
it("should return response with code 200", () => {
72+
const wordsApi = BaseTest.initializeWordsApi();
73+
const requestDataSaveOptions = new model.DocSaveOptionsData({
74+
fileName: "google.doc",
75+
dmlEffectsRenderingMode: model.DocSaveOptionsData.DmlEffectsRenderingModeEnum.None,
76+
dmlRenderingMode: model.DocSaveOptionsData.DmlRenderingModeEnum.DrawingML,
77+
zipOutput: false
78+
})
79+
const requestData = new model.LoadWebDocumentData({
80+
loadingDocumentUrl: "http://google.com",
81+
saveOptions: requestDataSaveOptions
82+
})
83+
const request = new model.LoadWebDocumentOnlineRequest({
84+
data: requestData
85+
});
86+
87+
// Act
88+
return wordsApi.loadWebDocumentOnline(request)
89+
.then((resultApi) => {
90+
// Assert
91+
expect(resultApi.response.statusCode).to.equal(200);
92+
});
93+
94+
});
95+
});
6896
});

0 commit comments

Comments
 (0)