UNPKG

2.02 kBTypeScriptView Raw
1import { ReadableFile } from "../files/readable-file.js";
2import { IDeleteableWithETag, _SPCollection } from "../spqueryable.js";
3export declare class _Attachments extends _SPCollection<IAttachmentInfo[]> {
4 /**
5 * Gets a Attachment File by filename
6 *
7 * @param name The name of the file, including extension.
8 */
9 getByName(name: string): IAttachment;
10 /**
11 * Adds a new attachment to the collection. Not supported for batching.
12 *
13 * @param name The name of the file, including extension.
14 * @param content The Base64 file content.
15 */
16 add(name: string, content: string | Blob | ArrayBuffer): Promise<IAttachmentAddResult>;
17}
18export interface IAttachments extends _Attachments {
19}
20export declare const Attachments: import("../spqueryable.js").ISPInvokableFactory<IAttachments>;
21export declare class _Attachment extends ReadableFile<IAttachmentInfo> {
22 delete: (this: import("../spqueryable.js").ISPQueryable<any>, eTag?: string) => Promise<void>;
23 /**
24 * Sets the content of a file. Not supported for batching
25 *
26 * @param content The value to set for the file contents
27 */
28 setContent(body: string | ArrayBuffer | Blob): Promise<IAttachment>;
29 /**
30 * Delete this attachment file and send it to recycle bin
31 *
32 * @param eTag Value used in the IF-Match header, by default "*"
33 */
34 recycle(eTag?: string): Promise<void>;
35}
36export interface IAttachment extends _Attachment, IDeleteableWithETag {
37}
38export declare const Attachment: import("../spqueryable.js").ISPInvokableFactory<IAttachment>;
39export interface IAttachmentAddResult {
40 file: IAttachment;
41 data: IAttachmentFileInfo;
42}
43export interface IAttachmentFileInfo {
44 name: string;
45 content: string | Blob | ArrayBuffer;
46}
47export interface IAttachmentInfo {
48 FileName: string;
49 FileNameAsPath: {
50 DecodedUrl: string;
51 };
52 ServerRelativePath: {
53 DecodedUrl: string;
54 };
55 ServerRelativeUrl: string;
56}
57//# sourceMappingURL=types.d.ts.map
\No newline at end of file