UNPKG

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