Skip to content
This repository was archived by the owner on Jan 18, 2021. It is now read-only.

Modified declaration file #37

Merged
merged 2 commits into from
Oct 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions dist/sprestlib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,20 @@ declare namespace sprLib {
interface FileInfoOptions {
version?: number;
}
class file {
Copy link
Contributor Author

@kelvinbell kelvinbell Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed these classes. Added IFile interface and file function to replace the 'file' class. This was repeated in the other classes.

constructor(fileName: string);

interface IFile {
get(): Promise<Blob>;
info(options: FileInfoOptions): Promise<Object>;
perms(): Promise<Object[]>;
}
function file(fileName: string): IFile;

class folder {
constructor(folderName: string);

files(): Promise<Object[]>;
folders(): Promise<Object[]>;
interface IFolder {
files(): Promise<Object[]>;
folders(): Promise<Object[]>;
info(): Promise<Object>;
perms(): Promise<Object[]>;
perms(): Promise<Object[]>;
}
function folder(folderName: string): IFolder;

/**
* SharePoint List/Library API.
Expand All @@ -42,7 +40,8 @@ declare namespace sprLib {
* @since 1.0
*/
interface ListOptions {
name: string;
name?: string;
guid?: string;
baseUrl?: string;
requestDigest?: string;
}
Expand All @@ -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<Object[]>;
info(): Promise<Object>;
perms(): Promise<Object[]>;
Expand All @@ -69,6 +64,9 @@ declare namespace sprLib {
delete(options: Object): Promise<number>;
recycle(options: Object): Promise<number>;
}
function list(listName: string): IList;
function list(listGuid: string): IList;
function list(options: ListOptions): IList;

interface RestOptions {
url: string;
Expand All @@ -79,9 +77,7 @@ declare namespace sprLib {
}
function rest(options: RestOptions): Promise<Object[]>;

class site {
constructor(siteUrl?: string);

interface ISite {
info(): Promise<Object>;
lists(): Promise<Object[]>;
subsites(): Promise<Object[]>;
Expand All @@ -90,19 +86,20 @@ declare namespace sprLib {
groups(): Promise<Object[]>;
users(): Promise<Object[]>;
}

function site(siteUrl?: string): ISite;

interface UserOptions {
baseUrl?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'baseUrl' was in the documentation, but not in the declaration file.

id?: string;
email?: string;
login?: string;
title?: string;
}

class user {
constructor(options?: UserOptions);

interface IUser {
info(): Promise<Object>;
groups(): Promise<Object[]>;
profile(arrProfileKeys: Object): Object;
profile(arrProfileKeys?: Object): Promise<Object>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returned a promise for the profile func.

}
function user(options?: UserOptions): IUser;
}