Skip to content

Commit b37dc84

Browse files
SDK regenerated by CI server [ci skip]
1 parent e0b18cc commit b37dc84

File tree

276 files changed

+10561
-1780
lines changed

Some content is hidden

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

276 files changed

+10561
-1780
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ 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 22.10
20+
21+
- FileReference structure has been added that allows to determine how the document will be accessed: from the remote storage, or loaded directly in the request.
22+
- The 'AppendDocument' and 'AppendDocumentOnline' methods takes a 'FileReference' instead of an 'href' property.
23+
24+
1925
## Enhancements in Version 22.9
2026

2127
- CompressDocument method now can handle images.

src/api.ts

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5782,14 +5782,27 @@ export class WordsApi implements Encryptor {
57825782
const querystring = require('querystring');
57835783
const requestParts = [];
57845784

5785+
const readStream = async function (stream: Readable): Promise<Buffer> {
5786+
const chunks = [];
5787+
for await (const x of stream) {
5788+
chunks.push(x);
5789+
}
5790+
if (chunks.length > 0 && typeof(chunks[0]) === 'number') {
5791+
return Buffer.from(chunks);
5792+
}
5793+
else {
5794+
return Buffer.concat(chunks);
5795+
}
5796+
};
5797+
57855798
for (const requestObj of requests) {
57865799
const options = await requestObj.createRequestOptions(this.configuration, this);
57875800

57885801
let bodyString = options.method + " " + options.uri.toString().replace(this.configuration.getApiBaseUrl() + "/words/", "") + (Object.keys(options.qs).length ? '?' + querystring.stringify(options.qs) : "") + "\r\n";
57895802

57905803
if (options.formData == null) {
5791-
if (options.body != null) {
5792-
bodyString += "Content-Type: application/json; charset=utf-8\r\n";
5804+
if (options.headers != null && options.headers['Content-Type'] != null) {
5805+
bodyString += "Content-Type: " + options.headers['Content-Type'] + "\r\n";
57935806
}
57945807

57955808
bodyString += "RequestId: " + requestObj.id + "\r\n";
@@ -5799,14 +5812,23 @@ export class WordsApi implements Encryptor {
57995812

58005813
bodyString += "\r\n";
58015814

5815+
var bodyBuffer = null;
58025816
if (options.body != null) {
5803-
bodyString += JSON.stringify(options.body);
5817+
if (typeof options.body === 'string' || options.body instanceof String) {
5818+
bodyBuffer = Buffer.from(options.body);
5819+
}
5820+
else {
5821+
bodyBuffer = await readStream(options.body);
5822+
}
5823+
}
5824+
else {
5825+
bodyBuffer = Buffer.from('');
58045826
}
58055827

58065828
const textPart = {
58075829
'Content-Type': 'application/http; msgtype=request',
58085830
'Content-Disposition': 'form-data',
5809-
body: bodyString,
5831+
body: Buffer.concat([Buffer.from(bodyString), bodyBuffer]),
58105832
};
58115833

58125834
requestParts.push(textPart);
@@ -5815,20 +5837,6 @@ export class WordsApi implements Encryptor {
58155837
const formData = options.formData;
58165838
const requestForm = new FormData();
58175839
const appendFormValue = async function (key, value) {
5818-
5819-
const readStream = async function (stream: Readable): Promise<Buffer> {
5820-
const chunks = [];
5821-
for await (const x of stream) {
5822-
chunks.push(x);
5823-
}
5824-
if (chunks.length > 0 && typeof(chunks[0]) === 'number') {
5825-
return Buffer.from(chunks);
5826-
}
5827-
else {
5828-
return Buffer.concat(chunks);
5829-
}
5830-
};
5831-
58325840
if (value instanceof require("stream").Readable) {
58335841
try {
58345842
value = {
@@ -5906,23 +5914,7 @@ export class WordsApi implements Encryptor {
59065914
continue;
59075915
}
59085916

5909-
switch (responsePart.headers["content-type"].split(';')[0]) {
5910-
case "application/json": {
5911-
data.push(requestMap[id].createResponse(JSON.parse(responsePart.body), responsePart.headers));
5912-
break;
5913-
}
5914-
case "application/octet-stream": {
5915-
data.push(requestMap[id].createResponse(responsePart.body, responsePart.headers));
5916-
break;
5917-
}
5918-
case "multipart/mixed": {
5919-
data.push(requestMap[id].createResponse(responsePart.body, responsePart.headers));
5920-
break;
5921-
}
5922-
default: {
5923-
throw new Error("Unknown response type: " + responsePart.headers["content-type"]);
5924-
}
5925-
}
5917+
data.push(requestMap[id].createResponse(responsePart.body, responsePart.headers));
59265918
}
59275919
}
59285920
}

src/internal/requestHelper.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ async function invokeApiMethodInternal(requestOptions: request.OptionsWithUri, c
150150
reject(error);
151151
} else {
152152
if (response.statusCode >= 200 && response.statusCode <= 299) {
153+
if (response.body != null && (typeof response.body === 'string' || response.body instanceof String)) {
154+
response.body = Buffer.from(response.body);
155+
}
153156
resolve(response);
154157
} else if (response.statusCode === 401 && !notApplyAuthToRequest) {
155158
try {

src/model/apiError.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
*/
2727

2828
import { AttributeInfo } from '../internal/attributeInfo';
29+
import { ModelInterface } from './modelInterface';
2930

3031
export const importsMapApiError = {
3132
};
3233

3334
/**
3435
* Api error.
3536
*/
36-
export class ApiError {
37+
export class ApiError implements ModelInterface {
3738
/**
3839
* Attribute type map
3940
*/
@@ -100,5 +101,8 @@ export class ApiError {
100101
public constructor(init?: Partial< ApiError >) {
101102
Object.assign(this, init);
102103
}
104+
105+
public collectFilesContent(_resultFilesContent: Array<any>) {
106+
}
103107
}
104108

src/model/availableFontsResponse.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
import { AttributeInfo } from '../internal/attributeInfo';
29+
import { ModelInterface } from './modelInterface';
2930
import { FontInfo } from './fontInfo';
3031
import { WordsResponse } from './wordsResponse';
3132

@@ -85,5 +86,8 @@ export class AvailableFontsResponse extends WordsResponse {
8586
super(init);
8687
Object.assign(this, init);
8788
}
89+
90+
public collectFilesContent(_resultFilesContent: Array<any>) {
91+
}
8892
}
8993

src/model/baseEntry.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,25 @@
2626
*/
2727

2828
import { AttributeInfo } from '../internal/attributeInfo';
29+
import { ModelInterface } from './modelInterface';
30+
import { FileReference } from './fileReference';
2931

3032
export const importsMapBaseEntry = {
33+
FileReference,
3134
};
3235

3336
/**
34-
* Represents a entry which will be appended to the original resource document.
37+
* Represents a base class for document which will be appended to the original resource document.
3538
*/
36-
export class BaseEntry {
39+
export abstract class BaseEntry implements ModelInterface {
3740
/**
3841
* Attribute type map
3942
*/
4043
public static attributeTypeMap: Array<AttributeInfo> = [
4144
{
42-
name: "href",
43-
baseName: "Href",
44-
type: "string",
45+
name: "fileReference",
46+
baseName: "FileReference",
47+
type: "FileReference",
4548
}
4649
];
4750

@@ -53,12 +56,20 @@ export class BaseEntry {
5356
}
5457

5558
/**
56-
* Gets or sets the path to entry to append at the server.
59+
* Gets or sets the file reference.
5760
*/
58-
public href: string;
61+
public fileReference: FileReference;
5962

6063
public constructor(init?: Partial< BaseEntry >) {
6164
Object.assign(this, init);
6265
}
66+
67+
public collectFilesContent(_resultFilesContent: Array<any>) {
68+
if (this.fileReference)
69+
{
70+
this.fileReference.collectFilesContent(_resultFilesContent);
71+
}
72+
73+
}
6374
}
6475

src/model/baseEntryList.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
*/
2727

2828
import { AttributeInfo } from '../internal/attributeInfo';
29+
import { ModelInterface } from './modelInterface';
2930

3031
export const importsMapBaseEntryList = {
3132
};
3233

3334
/**
3435
* Represents a list of entries which will be appended to the original resource entry.
3536
*/
36-
export abstract class BaseEntryList {
37+
export abstract class BaseEntryList implements ModelInterface {
3738
/**
3839
* Attribute type map
3940
*/
@@ -51,5 +52,8 @@ export abstract class BaseEntryList {
5152
public constructor(init?: Partial< BaseEntryList >) {
5253
Object.assign(this, init);
5354
}
55+
56+
public collectFilesContent(_resultFilesContent: Array<any>) {
57+
}
5458
}
5559

src/model/bmpSaveOptionsData.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
import { AttributeInfo } from '../internal/attributeInfo';
29+
import { ModelInterface } from './modelInterface';
2930
import { ImageSaveOptionsData } from './imageSaveOptionsData';
3031

3132
export const importsMapBmpSaveOptionsData = {
@@ -56,5 +57,8 @@ export class BmpSaveOptionsData extends ImageSaveOptionsData {
5657

5758
Object.assign(this, init);
5859
}
60+
61+
public collectFilesContent(_resultFilesContent: Array<any>) {
62+
}
5963
}
6064

src/model/bookmark.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
import { AttributeInfo } from '../internal/attributeInfo';
29+
import { ModelInterface } from './modelInterface';
2930
import { LinkElement } from './linkElement';
3031

3132
export const importsMapBookmark = {
@@ -73,5 +74,8 @@ export class Bookmark extends LinkElement {
7374
super(init);
7475
Object.assign(this, init);
7576
}
77+
78+
public collectFilesContent(_resultFilesContent: Array<any>) {
79+
}
7680
}
7781

src/model/bookmarkData.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
*/
2727

2828
import { AttributeInfo } from '../internal/attributeInfo';
29+
import { ModelInterface } from './modelInterface';
2930

3031
export const importsMapBookmarkData = {
3132
};
3233

3334
/**
3435
* DTO for bookmark updating.
3536
*/
36-
export class BookmarkData {
37+
export class BookmarkData implements ModelInterface {
3738
/**
3839
* Attribute type map
3940
*/
@@ -70,5 +71,8 @@ export class BookmarkData {
7071
public constructor(init?: Partial< BookmarkData >) {
7172
Object.assign(this, init);
7273
}
74+
75+
public collectFilesContent(_resultFilesContent: Array<any>) {
76+
}
7377
}
7478

0 commit comments

Comments
 (0)