Skip to content

Commit f2fa0a8

Browse files
committed
20221111 update: add new conversion apis.
1 parent e7244f1 commit f2fa0a8

File tree

5 files changed

+232
-13
lines changed

5 files changed

+232
-13
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![](https://img.shields.io/badge/REST%20API-v3.0-lightgrey) ![npm](https://img.shields.io/npm/v/asposecellscloud) ![node-current](https://img.shields.io/node/v/asposecellscloud) [![GitHub license](https://img.shields.io/github/license/aspose-cells-cloud/aspose-cells-cloud-node)](https://github.com/aspose-cells-cloud/aspose-cells-cloud-node/blob/master/LICENSE) ![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/aspose-cells-cloud/aspose-cells-cloud-node/22.10)
1+
![](https://img.shields.io/badge/REST%20API-v3.0-lightgrey) ![npm](https://img.shields.io/npm/v/asposecellscloud) ![node-current](https://img.shields.io/node/v/asposecellscloud) [![GitHub license](https://img.shields.io/github/license/aspose-cells-cloud/aspose-cells-cloud-node)](https://github.com/aspose-cells-cloud/aspose-cells-cloud-node/blob/master/LICENSE) ![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/aspose-cells-cloud/aspose-cells-cloud-node/22.11)
22

33
# Process Excel® Files in the Cloud with Node.js
44

@@ -20,11 +20,11 @@
2020
- Fetch the required shape from worksheet.
2121
- Leverage the power of named ranges.
2222

23-
## Feature & Enhancements in Version 22.10
23+
## Feature & Enhancements in Version 22.11
2424

25-
- Add api for converting workbook to pptx.
26-
- Add api for converting workbook to html.
27-
- Add api for converting workbook to markdown.
25+
- Add api for converting workbook to json.
26+
- Add api for converting workbook to sql.
27+
- Add api for converting workbook to csv.
2828

2929
## Read & Write Spreadsheet Formats
3030

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "asposecellscloud",
3-
"version": "22.10.0",
3+
"version": "22.11.0",
44
"description": "Aspose.Cells Cloud SDK for Node.js",
55
"keywords": [
66
"Aspose",

src/api.ts

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12081,6 +12081,119 @@ export class CellsApi {
1208112081
const result = ObjectSerializer.deserialize(response.body, "FileInfo");
1208212082
return Promise.resolve({ body: result, response });
1208312083
}
12084+
12085+
12086+
/**
12087+
*
12088+
* @param requestObj contains request parameters
12089+
*/
12090+
public async postConvertWorkbookToJson(requestObj: model.PostConvertWorkbookToJsonRequest): Promise<{ response: http.ClientResponse, body: model.FileInfo }> {
12091+
if (requestObj === null || requestObj === undefined) {
12092+
throw new Error('Required parameter "requestObj" was null or undefined when calling postConvertWorkbookToJson.');
12093+
}
12094+
12095+
let localVarPath = this.configuration.getApiBaseUrl() + "/cells/convert/json";
12096+
const queryParameters: any = {};
12097+
const formParams: any = {};
12098+
12099+
// verify required parameter 'requestObj.file' is not null or undefined
12100+
if (requestObj.file === null || requestObj.file === undefined) {
12101+
throw new Error('Required parameter "requestObj.file" was null or undefined when calling postConvertWorkbookToJson.');
12102+
}
12103+
12104+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "password", requestObj.password);
12105+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "checkExcelRestriction", requestObj.checkExcelRestriction);
12106+
if (requestObj.file !== undefined) {
12107+
formParams.file = requestObj.file;
12108+
}
12109+
12110+
const requestOptions: request.Options = {
12111+
method: "POST",
12112+
qs: queryParameters,
12113+
uri: localVarPath,
12114+
json: true,
12115+
};
12116+
12117+
(requestOptions as any).formData = formParams;
12118+
const response = await invokeApiMethod(requestOptions, this.configuration);
12119+
const result = ObjectSerializer.deserialize(response.body, "FileInfo");
12120+
return Promise.resolve({ body: result, response });
12121+
}
12122+
12123+
/**
12124+
*
12125+
* @param requestObj contains request parameters
12126+
*/
12127+
public async postConvertWorkbookToSQL(requestObj: model.PostConvertWorkbookToSQLRequest): Promise<{ response: http.ClientResponse, body: model.FileInfo }> {
12128+
if (requestObj === null || requestObj === undefined) {
12129+
throw new Error('Required parameter "requestObj" was null or undefined when calling postConvertWorkbookToSQL.');
12130+
}
12131+
12132+
let localVarPath = this.configuration.getApiBaseUrl() + "/cells/convert/sql";
12133+
const queryParameters: any = {};
12134+
const formParams: any = {};
12135+
12136+
// verify required parameter 'requestObj.file' is not null or undefined
12137+
if (requestObj.file === null || requestObj.file === undefined) {
12138+
throw new Error('Required parameter "requestObj.file" was null or undefined when calling postConvertWorkbookToSQL.');
12139+
}
12140+
12141+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "password", requestObj.password);
12142+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "checkExcelRestriction", requestObj.checkExcelRestriction);
12143+
if (requestObj.file !== undefined) {
12144+
formParams.file = requestObj.file;
12145+
}
12146+
12147+
const requestOptions: request.Options = {
12148+
method: "POST",
12149+
qs: queryParameters,
12150+
uri: localVarPath,
12151+
json: true,
12152+
};
12153+
12154+
(requestOptions as any).formData = formParams;
12155+
const response = await invokeApiMethod(requestOptions, this.configuration);
12156+
const result = ObjectSerializer.deserialize(response.body, "FileInfo");
12157+
return Promise.resolve({ body: result, response });
12158+
}
12159+
12160+
/**
12161+
*
12162+
* @param requestObj contains request parameters
12163+
*/
12164+
public async postConvertWorkbookToCSV(requestObj: model.PostConvertWorkbookToCSVRequest): Promise<{ response: http.ClientResponse, body: model.FileInfo }> {
12165+
if (requestObj === null || requestObj === undefined) {
12166+
throw new Error('Required parameter "requestObj" was null or undefined when calling postConvertWorkbookToCSV.');
12167+
}
12168+
12169+
let localVarPath = this.configuration.getApiBaseUrl() + "/cells/convert/csv";
12170+
const queryParameters: any = {};
12171+
const formParams: any = {};
12172+
12173+
// verify required parameter 'requestObj.file' is not null or undefined
12174+
if (requestObj.file === null || requestObj.file === undefined) {
12175+
throw new Error('Required parameter "requestObj.file" was null or undefined when calling postConvertWorkbookToCSV.');
12176+
}
12177+
12178+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "password", requestObj.password);
12179+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "checkExcelRestriction", requestObj.checkExcelRestriction);
12180+
if (requestObj.file !== undefined) {
12181+
formParams.file = requestObj.file;
12182+
}
12183+
12184+
const requestOptions: request.Options = {
12185+
method: "POST",
12186+
qs: queryParameters,
12187+
uri: localVarPath,
12188+
json: true,
12189+
};
12190+
12191+
(requestOptions as any).formData = formParams;
12192+
const response = await invokeApiMethod(requestOptions, this.configuration);
12193+
const result = ObjectSerializer.deserialize(response.body, "FileInfo");
12194+
return Promise.resolve({ body: result, response });
12195+
}
12196+
1208412197
/**
1208512198
* Check if storage exists
1208612199
* @param requestObj contains request parameters

src/model/model.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26631,6 +26631,80 @@ export class PostConvertWorkbookToPptxRequest {
2663126631
Object.assign(this, init);
2663226632
}
2663326633
}
26634+
26635+
26636+
/**
26637+
* Request model for PostConvertWorkbookToJson operation.
26638+
*/
26639+
export class PostConvertWorkbookToJsonRequest {
26640+
/**
26641+
* File to upload
26642+
*/
26643+
public file: Buffer;
26644+
26645+
/**
26646+
* Gets or sets password
26647+
*/
26648+
public password: string;
26649+
26650+
/**
26651+
* Gets or sets checkExcelRestriction
26652+
*/
26653+
public checkExcelRestriction: boolean;
26654+
26655+
public constructor(init?: Partial<PostConvertWorkbookToJsonRequest>) {
26656+
Object.assign(this, init);
26657+
}
26658+
}
26659+
26660+
/**
26661+
* Request model for PostConvertWorkbookToSQL operation.
26662+
*/
26663+
export class PostConvertWorkbookToSQLRequest {
26664+
/**
26665+
* File to upload
26666+
*/
26667+
public file: Buffer;
26668+
26669+
/**
26670+
* Gets or sets password
26671+
*/
26672+
public password: string;
26673+
26674+
/**
26675+
* Gets or sets checkExcelRestriction
26676+
*/
26677+
public checkExcelRestriction: boolean;
26678+
26679+
public constructor(init?: Partial<PostConvertWorkbookToSQLRequest>) {
26680+
Object.assign(this, init);
26681+
}
26682+
}
26683+
26684+
/**
26685+
* Request model for PostConvertWorkbookToCSV operation.
26686+
*/
26687+
export class PostConvertWorkbookToCSVRequest {
26688+
/**
26689+
* File to upload
26690+
*/
26691+
public file: Buffer;
26692+
26693+
/**
26694+
* Gets or sets password
26695+
*/
26696+
public password: string;
26697+
26698+
/**
26699+
* Gets or sets checkExcelRestriction
26700+
*/
26701+
public checkExcelRestriction: boolean;
26702+
26703+
public constructor(init?: Partial<PostConvertWorkbookToCSVRequest>) {
26704+
Object.assign(this, init);
26705+
}
26706+
}
26707+
2663426708
/**
2663526709
* Request model for StorageExists operation.
2663626710
*/

test/CellsConvertApi.ts

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var assert = require('assert');
3535
describe('CellsConvertApi', function () {
3636
this.timeout(200000);
3737
describe('PostConvertWorkbookToPNG', function () {
38-
it('should call PostCompress successfully', function () {
38+
it('should call PostConvertWorkbookToPNG successfully', function () {
3939
const cellsApi = BaseTest.initializeCellsApi();
4040
var req = new model.PostConvertWorkbookToPNGRequest();
4141
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
@@ -47,7 +47,7 @@ describe('CellsConvertApi', function () {
4747
});
4848

4949
describe('PostConvertWorkbookToPDF', function () {
50-
it('should call PostCompress successfully', function () {
50+
it('should call PostConvertWorkbookToPDF successfully', function () {
5151
const cellsApi = BaseTest.initializeCellsApi();
5252
var req = new model.PostConvertWorkbookToPDFRequest();
5353
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
@@ -59,7 +59,7 @@ describe('CellsConvertApi', function () {
5959
});
6060

6161
describe('PostConvertWorkbookToDocx', function () {
62-
it('should call PostCompress successfully', function () {
62+
it('should call PostConvertWorkbookToDocx successfully', function () {
6363
const cellsApi = BaseTest.initializeCellsApi();
6464
var req = new model.PostConvertWorkbookToDocxRequest();
6565
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
@@ -71,7 +71,7 @@ describe('CellsConvertApi', function () {
7171
});
7272

7373
describe('PostConvertWorkbookToPptx', function () {
74-
it('should call PostCompress successfully', function () {
74+
it('should call PostConvertWorkbookToPptx successfully', function () {
7575
const cellsApi = BaseTest.initializeCellsApi();
7676
var req = new model.PostConvertWorkbookToPptxRequest();
7777
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
@@ -83,7 +83,7 @@ describe('CellsConvertApi', function () {
8383
});
8484

8585
describe('PostConvertWorkbookToHtml', function () {
86-
it('should call PostCompress successfully', function () {
86+
it('should call PostConvertWorkbookToHtml successfully', function () {
8787
const cellsApi = BaseTest.initializeCellsApi();
8888
var req = new model.PostConvertWorkbookToHtmlRequest();
8989
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
@@ -95,7 +95,7 @@ describe('CellsConvertApi', function () {
9595
});
9696

9797
describe('PostConvertWorkbookToMarkdown', function () {
98-
it('should call PostCompress successfully', function () {
98+
it('should call PostConvertWorkbookToMarkdown successfully', function () {
9999
const cellsApi = BaseTest.initializeCellsApi();
100100
var req = new model.PostConvertWorkbookToMarkdownRequest();
101101
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
@@ -105,5 +105,37 @@ describe('CellsConvertApi', function () {
105105
});
106106
});
107107
});
108-
108+
describe('PostConvertWorkbookToJson', function () {
109+
it('should call PostConvertWorkbookToJson successfully', function () {
110+
const cellsApi = BaseTest.initializeCellsApi();
111+
var req = new model.PostConvertWorkbookToJsonRequest();
112+
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
113+
return cellsApi.postConvertWorkbookToJson(req)
114+
.then((result) => {
115+
expect(result.response.statusCode).to.equal(200);
116+
});
117+
});
118+
});
119+
describe('PostConvertWorkbookToSQL', function () {
120+
it('should call PostConvertWorkbookToSQL successfully', function () {
121+
const cellsApi = BaseTest.initializeCellsApi();
122+
var req = new model.PostConvertWorkbookToSQLRequest();
123+
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
124+
return cellsApi.postConvertWorkbookToSQL(req)
125+
.then((result) => {
126+
expect(result.response.statusCode).to.equal(200);
127+
});
128+
});
129+
});
130+
describe('PostConvertWorkbookToCSV', function () {
131+
it('should call PostConvertWorkbookToCSV successfully', function () {
132+
const cellsApi = BaseTest.initializeCellsApi();
133+
var req = new model.PostConvertWorkbookToCSVRequest();
134+
req.file = fs.createReadStream(localPath + "assemblytest.xlsx");
135+
return cellsApi.postConvertWorkbookToCSV(req)
136+
.then((result) => {
137+
expect(result.response.statusCode).to.equal(200);
138+
});
139+
});
140+
});
109141
});

0 commit comments

Comments
 (0)