gd-sprest
Advanced tools
Comparing version 0.9.93 to 0.9.94
{ | ||
"name": "gd-sprest", | ||
"version": "0.9.93", | ||
"version": "0.9.94", | ||
"description": "An easy way to develop against the SharePoint REST API.", | ||
@@ -5,0 +5,0 @@ "author": "Gunjan Datta <me@dattabase.com> (https://github.com/gunjandatta/sprest)", |
@@ -389,4 +389,13 @@ module $REST { | ||
// Update this data object and return it | ||
return this.updateDataObject() || this; | ||
// Update this data object | ||
this.updateDataObject(); | ||
// See if this is a collection and has more results | ||
if(this["d"] && this["d"].__next) { | ||
// Add the "next" method to get the next set of results | ||
this["next"] = new Function("return this.getNextSetOfResults();"); | ||
} | ||
// Return this object | ||
return this; | ||
} | ||
@@ -467,2 +476,20 @@ } | ||
// Method to get the next set of results | ||
protected getNextSetOfResults() { | ||
// Create the target information to query the next set of results | ||
let targetInfo = Object.create(this.targetInfo); | ||
targetInfo.endpoint = ""; | ||
targetInfo.url = this["d"].__next; | ||
// Create a new object | ||
let obj = new Base(targetInfo); | ||
// Set the properties | ||
obj.base = this.base ? this.base : this; | ||
obj.parent = this; | ||
// Return the object | ||
return obj; | ||
} | ||
// Method to update a collection object | ||
@@ -600,23 +627,29 @@ private updateDataCollection(results:any) { | ||
// See if there are more items to get | ||
if(this.getAllItemsFl && data.d.__next) { | ||
// Create the target information to query the next set of results | ||
let targetInfo = Object.create(this.targetInfo); | ||
targetInfo.endpoint = ""; | ||
targetInfo.url = data.d.__next; | ||
if(data.d.__next) { | ||
// See if we are getting all items in this request | ||
if(this.getAllItemsFl) { | ||
// Create the target information to query the next set of results | ||
let targetInfo = Object.create(this.targetInfo); | ||
targetInfo.endpoint = ""; | ||
targetInfo.url = data.d.__next; | ||
// Create a new object | ||
new Utils.Request(true, new Utils.TargetInfo(targetInfo), (request) => { | ||
// Convert the response and ensure the data property exists | ||
let data = JSON.parse(request.response); | ||
if(data.d) { | ||
// Update the data collection | ||
this.updateDataCollection(data.d.results); | ||
// Create a new object | ||
new Utils.Request(true, new Utils.TargetInfo(targetInfo), (request) => { | ||
// Convert the response and ensure the data property exists | ||
let data = JSON.parse(request.response); | ||
if(data.d) { | ||
// Update the data collection | ||
this.updateDataCollection(data.d.results); | ||
// Validate the data collection | ||
return this.validateDataCollectionResults(request, promise); | ||
} | ||
// Validate the data collection | ||
return this.validateDataCollectionResults(request, promise); | ||
} | ||
// Resolve the promise | ||
promise.resolve(); | ||
}); | ||
// Resolve the promise | ||
promise.resolve(); | ||
}); | ||
} else { | ||
// Add a method to get the next set of results | ||
this["next"] = new Function("return this.getNextSetOfResults();"); | ||
} | ||
} else { | ||
@@ -623,0 +656,0 @@ // Resolve the promise |
@@ -49,2 +49,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IAttachmentFiles; | ||
/** | ||
* Queries the collection. | ||
@@ -51,0 +56,0 @@ * @param oData - The OData information. |
@@ -60,2 +60,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IContentTypes; | ||
/** | ||
* Queries the collection. | ||
@@ -62,0 +67,0 @@ * @param oData - The OData information. |
@@ -54,2 +54,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IEventReceivers; | ||
/** | ||
* Queries the collection. | ||
@@ -56,0 +61,0 @@ * @param oData - The OData information. |
@@ -54,2 +54,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IFieldLinks; | ||
/** | ||
* Queries the collection. | ||
@@ -56,0 +61,0 @@ * @param oData - The OData information. |
@@ -87,2 +87,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IFields; | ||
/** | ||
* Queries the collection. | ||
@@ -89,0 +94,0 @@ * @param oData - The OData information. |
@@ -63,2 +63,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IFiles; | ||
/** | ||
* Queries the collection. | ||
@@ -65,0 +70,0 @@ * @param oData - The OData information. |
@@ -42,2 +42,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IFileVersions; | ||
/** | ||
* Queries the collection. | ||
@@ -44,0 +49,0 @@ * @param oData - The OData information. |
@@ -54,2 +54,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IFolders; | ||
/** | ||
* Queries the collection. | ||
@@ -56,0 +61,0 @@ * @param oData - The OData information. |
@@ -54,2 +54,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IListItems; | ||
/** | ||
* Queries the collection. | ||
@@ -56,0 +61,0 @@ * @param oData - The OData information. |
@@ -70,2 +70,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): ILists; | ||
/** | ||
* Queries the collection. | ||
@@ -72,0 +77,0 @@ * @param oData - The OData information. |
@@ -62,2 +62,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IRoleAssignments; | ||
/** | ||
* Queries the collection. | ||
@@ -64,0 +69,0 @@ * @param oData - The OData information. |
@@ -60,2 +60,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IRoleDefinitions; | ||
/** | ||
* Queries the collection. | ||
@@ -62,0 +67,0 @@ * @param oData - The OData information. |
@@ -60,2 +60,13 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): ISiteGroups; | ||
/** | ||
* Queries the collection. | ||
* @param oData - The OData information. | ||
*/ | ||
query(oData:ComplexTypes.ODataQuery): ISiteGroups; | ||
/** | ||
* Removes the group with the specified member ID from the collection. | ||
@@ -71,9 +82,3 @@ * @param id - The ID of the group to remove. | ||
removeByLoginName(name): IBase; | ||
/** | ||
* Queries the collection. | ||
* @param oData - The OData information. | ||
*/ | ||
query(oData:ComplexTypes.ODataQuery): ISiteGroups; | ||
} | ||
} |
@@ -59,2 +59,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IUserCustomActions; | ||
/** | ||
* Queries the collection. | ||
@@ -61,0 +66,0 @@ * @param oData - The OData information. |
@@ -66,2 +66,13 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IUsers; | ||
/** | ||
* Queries the collection. | ||
* @param oData - The OData information. | ||
*/ | ||
query(oData:ComplexTypes.ODataQuery): IUsers; | ||
/** | ||
* Removes the user with the specified ID. | ||
@@ -77,9 +88,3 @@ * @param id - The ID of the user to remove. | ||
removeByLoginName(loginName): IBase; | ||
/** | ||
* Queries the collection. | ||
* @param oData - The OData information. | ||
*/ | ||
query(oData:ComplexTypes.ODataQuery): IUsers; | ||
} | ||
} |
@@ -62,2 +62,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IVersions; | ||
/** | ||
* Queries the collection. | ||
@@ -64,0 +69,0 @@ * @param oData - The OData information. |
@@ -61,2 +61,13 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IViewFields; | ||
/** | ||
* Queries the collection. | ||
* @param oData - The OData information. | ||
*/ | ||
query(oData:ComplexTypes.ODataQuery): IViewFields; | ||
/** | ||
* Removes all the fields from the collection. | ||
@@ -71,9 +82,3 @@ */ | ||
removeViewField(fieldName): IBase; | ||
/** | ||
* Queries the collection. | ||
* @param oData - The OData information. | ||
*/ | ||
query(oData:ComplexTypes.ODataQuery): IViewFields; | ||
} | ||
} |
@@ -59,2 +59,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IViews; | ||
/** | ||
* Queries the collection. | ||
@@ -61,0 +66,0 @@ * @param oData - The OData information. |
@@ -48,2 +48,7 @@ declare module $REST.Types { | ||
/** | ||
* Method to get the next set of results. | ||
*/ | ||
next(): IWebs; | ||
/** | ||
* Queries the collection. | ||
@@ -50,0 +55,0 @@ * @param oData - The OData information. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
6113327
27436