gd-sprest
Advanced tools
Comparing version 0.3.7 to 0.3.9
{ | ||
"name": "gd-sprest", | ||
"version": "0.3.7", | ||
"version": "0.3.9", | ||
"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)", |
@@ -12,8 +12,32 @@ /// <reference path="../base.d.ts" /> | ||
constructor(serverRelativeUrl:string, listName?:string, ...args) { | ||
var endpoint = ""; | ||
// Call the base constructor | ||
super(Base.getInputParmeters.apply(null, args)); | ||
// See if the list name exists | ||
if(listName) { | ||
// Update the endpoint | ||
endpoint = "/lists/getByTitle('" + listName + "')/rootfolder"; | ||
// Split the url | ||
var url = serverRelativeUrl ? serverRelativeUrl.split("/") : []; | ||
// Parse the folders | ||
for(var i=0; i < url.length - 1; i++) { | ||
// Update the endpoint | ||
endpoint += "/folders/getByUrl('" + url[i] + "')"; | ||
} | ||
// Add the file | ||
endpoint += "/files/getByUrl('" + url[url.length-1] + "')"; | ||
} | ||
else { | ||
// Update the endpoint | ||
endpoint += "/getFileByServerRelativeUrl('" + serverRelativeUrl + "')"; | ||
} | ||
// Default the properties | ||
this.defaultToWebFl = true; | ||
this.targetInfo.endpoint = "web/" + (listName ? "lists/getByTitle('" + listName + "')/rootfolder/files/getByUrl('" : "getFileByServerRelativeUrl('") + serverRelativeUrl + "')"; | ||
this.targetInfo.endpoint = "web" + endpoint; | ||
@@ -20,0 +44,0 @@ // See if we are executing the request |
@@ -12,8 +12,39 @@ /// <reference path="../base.d.ts" /> | ||
constructor(serverRelativeUrl:string, listName?:string, ...args) { | ||
var endpoint = ""; | ||
var getRootFolder = serverRelativeUrl == null || serverRelativeUrl == "" ? true : false; | ||
// Call the base constructor | ||
super(Base.getInputParmeters.apply(null, args)); | ||
// See if the list name exists | ||
if(listName) { | ||
// Update the endpoint | ||
endpoint = "/lists/getByTitle('" + listName + "')"; | ||
} | ||
// See if we are getting the root folder | ||
if(getRootFolder || listName) { | ||
// Update the endpoint | ||
endpoint += "/rootfolder"; | ||
} | ||
// See if the list name exists | ||
if(listName) { | ||
// Split the url | ||
var url = serverRelativeUrl ? serverRelativeUrl.split("/") : []; | ||
// Parse the url | ||
for(var i=0; i < url.length; i++) { | ||
// Update the endpoint | ||
endpoint += "/folders/getByUrl('" + url[i] + "')"; | ||
} | ||
} | ||
else { | ||
// Update the endpoint | ||
endpoint += getRootFolder ? "" : "/getFolderByServerRelativeUrl('" + serverRelativeUrl + "')"; | ||
} | ||
// Default the properties | ||
this.defaultToWebFl = true; | ||
this.targetInfo.endpoint = "web/" + (listName ? "lists/getByTitle('" + listName + "')/rootfolder/folders/getByUrl('" : "getFolderByServerRelativeUrl('") + serverRelativeUrl + "')"; | ||
this.targetInfo.endpoint = "web" + endpoint; | ||
@@ -20,0 +51,0 @@ // See if we are executing the request |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
849246
13123