Skip to content

Commit

Permalink
SDK regenerated by CI server [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
dynabic-billing-team committed Dec 15, 2023
1 parent 8a46fde commit ef30af9
Show file tree
Hide file tree
Showing 4 changed files with 1,414 additions and 354 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Feel free to explore the [Developer's Guide](https://docs.aspose.cloud/display/w
- Implemented DeleteOfficeMathObjects operation to delete all office math objects from document.
- Parameter ProtectionRequest was removed from the UnprotectDocument operation. Now removing protection from a document does not require a password.
- Model ProtectionRequest marked as deprecated, please use ProtectionRequestV2 instead for perform ProtectDocument operation. To change the password or protection type of protected document, the old password is no required.
- Added fields Password and EncryptedPassword to FileReference for documents encrypted by password.
- Removed parameter encryptedPassword2 from CompareDocument method. Please use FileReference password instead.


## Enhancements in Version 23.11
Expand Down
34 changes: 27 additions & 7 deletions src/model/fileReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { AttributeInfo } from '../internal/attributeInfo';
import { ModelInterface } from './modelInterface';
import { v4 as uuidv4 } from 'uuid';
import { Readable } from "stream";
import { Encryptor } from '../api';

export const importsMapFileReference = {
};
Expand All @@ -47,6 +48,16 @@ export class FileReference implements ModelInterface {
name: "reference",
baseName: "Reference",
type: "string",
},
{
name: "password",
baseName: "Password",
type: "string",
},
{
name: "encryptedPassword",
baseName: "EncryptedPassword",
type: "string",
}
];

Expand All @@ -59,17 +70,26 @@ export class FileReference implements ModelInterface {

private source: FileReference.SourceEnum;
private reference: string;
private password: string;
private encryptedPassword: string;
private content: Readable;

private constructor(source: FileReference.SourceEnum, reference: string, content: Readable) {
private constructor(source: FileReference.SourceEnum, reference: string, content: Readable, password: string) {
this.source = source;
this.reference = reference;
this.content = content;
this.password = password;
this.encryptedPassword = null;
}

public collectFilesContent(_resultFilesContent: Array<any>) {
if (this.source == FileReference.SourceEnum.Request) {
_resultFilesContent.push(this);
_resultFilesContent.push(this);
}

public async encryptPassword(encryptor: Encryptor) : Promise<void> {
if (this.password !== null && this.password !== undefined) {
this.encryptedPassword = await encryptor.encrypt(this.password);
this.password = null;
}
}

Expand All @@ -89,12 +109,12 @@ export class FileReference implements ModelInterface {
return this.content;
}

static fromRemoteFilePath(remoteFilePath: string): FileReference {
return new FileReference(FileReference.SourceEnum.Storage, remoteFilePath, null);
static fromRemoteFilePath(remoteFilePath: string, password: string = null): FileReference {
return new FileReference(FileReference.SourceEnum.Storage, remoteFilePath, null, password);
}

static fromLocalFileContent(localFileContent: Readable): FileReference {
return new FileReference(FileReference.SourceEnum.Request, uuidv4(), localFileContent);
static fromLocalFileContent(localFileContent: Readable, password: string = null): FileReference {
return new FileReference(FileReference.SourceEnum.Request, uuidv4(), localFileContent, password);
}
}

Expand Down
Loading

0 comments on commit ef30af9

Please sign in to comment.