From bb562213d620ce44932c8a3a918c4a6ec45d88c0 Mon Sep 17 00:00:00 2001 From: Kelvin Bell Date: Wed, 17 Oct 2018 15:06:03 -0400 Subject: [PATCH 1/2] modified declaration by replacing all classes with functions as they caused linting errors in Typescript --- dist/sprestlib.d.ts | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/dist/sprestlib.d.ts b/dist/sprestlib.d.ts index b0b54f8..c9dee89 100644 --- a/dist/sprestlib.d.ts +++ b/dist/sprestlib.d.ts @@ -18,22 +18,20 @@ declare namespace sprLib { interface FileInfoOptions { version?: number; } - class file { - constructor(fileName: string); - + interface IFile { get(): Promise; info(options: FileInfoOptions): Promise; perms(): Promise; } + function file(fileName: string): IFile; - class folder { - constructor(folderName: string); - - files(): Promise; - folders(): Promise; + interface IFolder { + files(): Promise; + folders(): Promise; info(): Promise; - perms(): Promise; + perms(): Promise; } + function folder(folderName: string): IFolder; /** * SharePoint List/Library API. @@ -42,7 +40,8 @@ declare namespace sprLib { * @since 1.0 */ interface ListOptions { - name: string; + name?: string; + guid?: string; baseUrl?: string; requestDigest?: string; } @@ -54,11 +53,7 @@ declare namespace sprLib { queryNext?: Object; queryOrderBy?: string; } - class list { - constructor(listName: string); - constructor(listGuid: string); - constructor(options: ListOptions); - + interface IList { cols(): Promise; info(): Promise; perms(): Promise; @@ -69,6 +64,9 @@ declare namespace sprLib { 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; @@ -79,9 +77,7 @@ declare namespace sprLib { } function rest(options: RestOptions): Promise; - class site { - constructor(siteUrl?: string); - + interface ISite { info(): Promise; lists(): Promise; subsites(): Promise; @@ -90,7 +86,8 @@ declare namespace sprLib { groups(): Promise; users(): Promise; } - + function site(siteUrl?: string): ISite; + interface UserOptions { id?: string; email?: string; @@ -98,11 +95,10 @@ declare namespace sprLib { title?: string; } - class user { - constructor(options?: UserOptions); - + interface IUser { info(): Promise; groups(): Promise; profile(arrProfileKeys: Object): Object; } + function user(options?: UserOptions): IUser; } From cec123d5c50d2013d49d187ff7c898b3fb4336a0 Mon Sep 17 00:00:00 2001 From: Kelvin Bell Date: Mon, 22 Oct 2018 13:29:50 -0400 Subject: [PATCH 2/2] fixed User interface and options --- dist/sprestlib.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dist/sprestlib.d.ts b/dist/sprestlib.d.ts index c9dee89..986e309 100644 --- a/dist/sprestlib.d.ts +++ b/dist/sprestlib.d.ts @@ -89,6 +89,7 @@ declare namespace sprLib { function site(siteUrl?: string): ISite; interface UserOptions { + baseUrl?: string; id?: string; email?: string; login?: string; @@ -98,7 +99,7 @@ declare namespace sprLib { interface IUser { info(): Promise; groups(): Promise; - profile(arrProfileKeys: Object): Object; + profile(arrProfileKeys?: Object): Promise; } function user(options?: UserOptions): IUser; }