Files
onspring-api-sdk-javascript/src/models/FileInfo.ts
T

71 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-02-04 15:09:13 -06:00
import { FieldType } from '../enums/FieldType';
2023-02-05 15:32:22 -06:00
/**
* @class FileInfo - Represents a file info.
*/
2023-02-04 15:09:13 -06:00
export class FileInfo {
2023-02-05 15:32:22 -06:00
/**
* @property {FieldType} type - The type of the file.
*/
2023-02-04 15:09:13 -06:00
public type: FieldType;
2023-02-05 15:32:22 -06:00
/**
* @property {string} contentType - The content type of the file.
*/
2023-02-04 15:09:13 -06:00
public contentType: string;
2023-02-05 15:32:22 -06:00
/**
* @property {string} name - The name of the file.
*/
2023-02-04 15:09:13 -06:00
public name: string;
2023-02-05 15:32:22 -06:00
/**
* @property {Date} createdDate - The created date of the file.
*/
2023-02-04 15:09:13 -06:00
public createdDate: Date;
2023-02-05 15:32:22 -06:00
/**
* @property {Date} modifiedDate - The modified date of the file.
*/
2023-02-04 15:09:13 -06:00
public modifiedDate: Date;
2023-02-05 15:32:22 -06:00
/**
* @property {string} owner - The owner of the file.
*/
2023-02-04 15:09:13 -06:00
public owner: string;
2023-02-05 15:32:22 -06:00
/**
* @property {string} notes - The notes of the file.
*/
2023-02-04 15:09:13 -06:00
public notes: string;
2023-02-05 15:32:22 -06:00
/**
* @property {string} fileHref - The href of the file.
*/
2023-02-04 15:09:13 -06:00
public fileHref: string;
constructor(
type: string,
contentType: string,
name: string,
createdDate: Date,
modifiedDate: Date,
owner: string,
notes: string,
fileHref: string
) {
if (FieldType[type] === undefined) {
throw new Error(`The type '${type}' is not a valid FieldType.`);
}
this.type = FieldType[type];
this.contentType = contentType;
this.name = name;
this.createdDate = createdDate;
this.modifiedDate = modifiedDate;
this.owner = owner;
this.notes = notes;
this.fileHref = fileHref;
}
}