// Type definitions for sprestlib 1.9.0 // Project: https://gitbrent.github.io/SpRestLib/ // Definitions by: Brent Ely // Jandos // Kelvin Bell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 declare namespace sprLib { const version: string; interface optionsOptions { baseUrl?: string; nodeCookie?: string; nodeEnabled?: boolean; nodeServer?: string; queryLimit?: number; } interface IOptions { baseUrl: string; nodeCookie?: string; nodeEnabled?: boolean; nodeServer?: string; queryLimit: number; } function options(): IOptions; function options(options: optionsOptions): IOptions; function baseUrl(): string; function baseUrl(baseUrl: string): void; function nodeConfig(options: object): void; function renewSecurityToken(): void; interface FileCheckInOptions { comment?: string; type?: 'major' | 'minor' | 'overwrite'; } interface FileInfoOptions { version?: number; } interface IFile { checkin(options: FileCheckInOptions): Promise; checkout(): Promise; delete(): Promise; get(): Promise; info(options: FileInfoOptions): Promise; perms(): Promise; recycle(): Promise; } function file(fileName: string): IFile; interface FolderUploadOptions { name: string; data: object; requestDigest?: string; overwrite?: boolean; } interface IFolder { add(folderName: string): Promise; delete(): Promise; files(): Promise; folders(): Promise; info(): Promise; perms(): Promise; recycle(): Promise; upload(options: FolderUploadOptions): Promise; } function folder(folderName: string): IFolder; /** * SharePoint List/Library API. * * @see \`{@link https://gitbrent.github.io/SpRestLib/docs/api-list.html }\` * @since 1.0 */ interface ListOptions { name?: string; guid?: string; baseUrl?: string; requestDigest?: string; } interface ListItemsOptions { listCols?: Array | object; metadata?: boolean; queryFilter?: string; queryLimit?: number; queryNext?: object; queryOrderBy?: string; } interface IList { cols(): Promise; info(): Promise; perms(): Promise; items(options: ListItemsOptions): Promise; create(options: object): Promise; update(options: object): Promise; delete(options: object): Promise; recycle(options: object): Promise; } function list(listName: string): IList; function list(listGuid: string): IList; function list(options: ListOptions): IList; interface RestOptions { url: string; type?: 'GET' | 'POST' | 'DELETE'; data?: object; headers?: any; requestDigest?: string; } function rest(options: RestOptions): Promise; interface ISite { info(): Promise; lists(): Promise; subsites(): Promise; perms(): Promise; roles(): Promise; groups(): Promise; users(): Promise; } function site(siteUrl?: string): ISite; interface UserOptions { baseUrl?: string; id?: string; email?: string; login?: string; title?: string; } interface IUser { info(): Promise; groups(): Promise; profile(arrProfileKeys?: object): Promise; } function user(options?: UserOptions): IUser; }