UNPKG

6.85 kBTypeScriptView Raw
1import { _SPCollection, IDeleteableWithETag, _SPInstance, ISPQueryable, ISPInstance } from "../spqueryable.js";
2import { IListItemFormUpdateValue } from "../lists/types.js";
3import { IList } from "../lists/index.js";
4import { IResourcePath } from "../utils/to-resource-path.js";
5/**
6 * Describes a collection of Item objects
7 *
8 */
9export declare class _Items extends _SPCollection {
10 /**
11 * Gets an Item by id
12 *
13 * @param id The integer id of the item to retrieve
14 */
15 getById(id: number): IItem;
16 /**
17 * Gets BCS Item by string id
18 *
19 * @param stringId The string id of the BCS item to retrieve
20 */
21 getItemByStringId(stringId: string): IItem;
22 /**
23 * Skips the specified number of items (https://msdn.microsoft.com/en-us/library/office/fp142385.aspx#sectionSection6)
24 *
25 * @param skip The starting id where the page should start, use with top to specify pages
26 * @param reverse It true the PagedPrev=true parameter is added allowing backwards navigation in the collection
27 */
28 skip(skip: number, reverse?: boolean): this;
29 /**
30 * Gets a collection designed to aid in paging through data
31 *
32 */
33 getPaged<T = any[]>(): Promise<PagedItemCollection<T>>;
34 /**
35 * Adds a new item to the collection
36 *
37 * @param properties The new items's properties
38 * @param listItemEntityTypeFullName The type name of the list's entities
39 */
40 add(properties?: Record<string, any>): Promise<IItemAddResult>;
41}
42export interface IItems extends _Items {
43}
44export declare const Items: import("@pnp/sp").ISPInvokableFactory<IItems>;
45/**
46 * Descrines a single Item instance
47 *
48 */
49export declare class _Item extends _SPInstance {
50 delete: (this: ISPQueryable<any>, eTag?: string) => Promise<void>;
51 /**
52 * Gets the effective base permissions for the item
53 *
54 */
55 get effectiveBasePermissions(): ISPQueryable;
56 /**
57 * Gets the effective base permissions for the item in a UI context
58 *
59 */
60 get effectiveBasePermissionsForUI(): ISPQueryable;
61 /**
62 * Gets the field values for this list item in their HTML representation
63 *
64 */
65 get fieldValuesAsHTML(): ISPInstance;
66 /**
67 * Gets the field values for this list item in their text representation
68 *
69 */
70 get fieldValuesAsText(): ISPInstance;
71 /**
72 * Gets the field values for this list item for use in editing controls
73 *
74 */
75 get fieldValuesForEdit(): ISPInstance;
76 /**
77 * Gets the collection of versions associated with this item
78 */
79 get versions(): IItemVersions;
80 /**
81 * this item's list
82 */
83 get list(): IList;
84 /**
85 * Updates this list instance with the supplied properties
86 *
87 * @param properties A plain object hash of values to update for the list
88 * @param eTag Value used in the IF-Match header, by default "*"
89 */
90 update(properties: Record<string, any>, eTag?: string): Promise<IItemUpdateResult>;
91 /**
92 * Moves the list item to the Recycle Bin and returns the identifier of the new Recycle Bin item.
93 */
94 recycle(): Promise<string>;
95 /**
96 * Deletes the item object with options.
97 *
98 * @param parameters Specifies the options to use when deleting a item.
99 */
100 deleteWithParams(parameters: Partial<IItemDeleteParams>): Promise<void>;
101 /**
102 * Gets a string representation of the full URL to the WOPI frame.
103 * If there is no associated WOPI application, or no associated action, an empty string is returned.
104 *
105 * @param action Display mode: 0: view, 1: edit, 2: mobileView, 3: interactivePreview
106 */
107 getWopiFrameUrl(action?: number): Promise<string>;
108 /**
109 * Validates and sets the values of the specified collection of fields for the list item.
110 *
111 * @param formValues The fields to change and their new values.
112 * @param bNewDocumentUpdate true if the list item is a document being updated after upload; otherwise false.
113 */
114 validateUpdateListItem(formValues: IListItemFormUpdateValue[], bNewDocumentUpdate?: boolean): Promise<IListItemFormUpdateValue[]>;
115 /**
116 * Gets the parent information for this item's list and web
117 */
118 getParentInfos(): Promise<IItemParentInfos>;
119 setImageField(fieldName: string, imageName: string, imageContent: any): Promise<any>;
120}
121export interface IItem extends _Item, IDeleteableWithETag {
122}
123export declare const Item: import("@pnp/sp").ISPInvokableFactory<IItem>;
124/**
125 * Describes a collection of Version objects
126 *
127 */
128export declare class _ItemVersions extends _SPCollection {
129 /**
130 * Gets a version by id
131 *
132 * @param versionId The id of the version to retrieve
133 */
134 getById(versionId: number): IItemVersion;
135}
136export interface IItemVersions extends _ItemVersions {
137}
138export declare const ItemVersions: import("@pnp/sp").ISPInvokableFactory<IItemVersions>;
139/**
140 * Describes a single Version instance
141 *
142 */
143export declare class _ItemVersion extends _SPInstance {
144 delete: (this: ISPQueryable<any>, eTag?: string) => Promise<void>;
145}
146export interface IItemVersion extends _ItemVersion, IDeleteableWithETag {
147}
148export declare const ItemVersion: import("@pnp/sp").ISPInvokableFactory<IItemVersion>;
149/**
150 * Provides paging functionality for list items
151 */
152export declare class PagedItemCollection<T> {
153 private parent;
154 private nextUrl;
155 results: T;
156 constructor(parent: _Items, nextUrl: string, results: T);
157 /**
158 * If true there are more results available in the set, otherwise there are not
159 */
160 get hasNext(): boolean;
161 /**
162 * Gets the next set of results, or resolves to null if no results are available
163 */
164 getNext(): Promise<PagedItemCollection<T> | null>;
165}
166export interface IItemAddResult {
167 item: IItem;
168 data: any;
169}
170export interface IItemUpdateResult {
171 item: IItem;
172 data: IItemUpdateResultData;
173}
174export interface IItemUpdateResultData {
175 etag: string;
176}
177export interface IItemImageUploadResult {
178 Name: string;
179 ServerRelativeUrl: string;
180 UniqueId: string;
181}
182export interface IItemDeleteParams {
183 /**
184 * If true, delete or recycle a file when the LockType
185 * value is SPLockType.Shared or SPLockType.None.
186 * When false, delete or recycle the file when
187 * the LockType value SPLockType.None.
188 */
189 BypassSharedLock: boolean;
190}
191export interface IItemParentInfos {
192 Item: {
193 Id: string;
194 };
195 ParentList: {
196 Id: string;
197 Title: string;
198 RootFolderServerRelativePath: IResourcePath;
199 RootFolderServerRelativeUrl: string;
200 RootFolderUniqueId: string;
201 };
202 ParentWeb: {
203 Id: string;
204 ServerRelativePath: IResourcePath;
205 ServerRelativeUrl: string;
206 Url: string;
207 };
208}
209//# sourceMappingURL=types.d.ts.map
\No newline at end of file