gd-sprest 9.5.7 → 9.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/lib/web.d.ts +6 -0
- package/build/lib/web.js +13 -0
- package/build/rest.js +1 -1
- package/dist/gd-sprest.d.ts +6 -0
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +1 -1
package/@types/lib/web.d.ts
CHANGED
|
@@ -45,6 +45,12 @@ export interface IWeb {
|
|
|
45
45
|
*/
|
|
46
46
|
(url?: string, targetInfo?: ITargetInfoProps): SP.IWeb;
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Method to return the web of the current user's OneDrive.
|
|
50
|
+
* @param token - The token to use for the call.
|
|
51
|
+
*/
|
|
52
|
+
getOneDrive(token?: string): SP.IWeb;
|
|
53
|
+
|
|
48
54
|
/**
|
|
49
55
|
* Method to get a remote web.
|
|
50
56
|
* @param requestUrl - The absolute url of the remote web.
|
package/build/lib/web.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Web = void 0;
|
|
4
4
|
var contextInfo_1 = require("./contextInfo");
|
|
5
5
|
var utils_1 = require("../utils");
|
|
6
|
+
var graph_1 = require("./graph");
|
|
6
7
|
exports.Web = (function (url, targetInfo) {
|
|
7
8
|
var web = new utils_1.Base(targetInfo);
|
|
8
9
|
// Default the properties
|
|
@@ -18,6 +19,18 @@ exports.Web = (function (url, targetInfo) {
|
|
|
18
19
|
// Return the web
|
|
19
20
|
return web;
|
|
20
21
|
});
|
|
22
|
+
// Method to get the onedive web for the current user
|
|
23
|
+
exports.Web.getOneDrive = function (token) {
|
|
24
|
+
// Set the url of the drive
|
|
25
|
+
var host = document.location.host.split('.');
|
|
26
|
+
var url = "https://".concat(host[0], "-my.").concat(host[1], ".").concat(host[2], "/personal/").concat(contextInfo_1.ContextInfo.userPrincipalName.replace(/[@,.]/g, '_'));
|
|
27
|
+
// Return the web for the user's onedrive
|
|
28
|
+
return (0, exports.Web)(url, {
|
|
29
|
+
requestHeader: {
|
|
30
|
+
Authorization: "Bearer " + (token || graph_1.Graph.Token)
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
21
34
|
// Static method to get a remote web
|
|
22
35
|
exports.Web.getRemoteWeb = (function (requestUrl) {
|
|
23
36
|
// Return the remote web information
|
package/build/rest.js
CHANGED
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -4566,6 +4566,12 @@ declare module 'gd-sprest/lib/web' {
|
|
|
4566
4566
|
*/
|
|
4567
4567
|
(url?: string, targetInfo?: ITargetInfoProps): SP.IWeb;
|
|
4568
4568
|
|
|
4569
|
+
/**
|
|
4570
|
+
* Method to return the web of the current user's OneDrive.
|
|
4571
|
+
* @param token - The token to use for the call.
|
|
4572
|
+
*/
|
|
4573
|
+
getOneDrive(token?: string): SP.IWeb;
|
|
4574
|
+
|
|
4569
4575
|
/**
|
|
4570
4576
|
* Method to get a remote web.
|
|
4571
4577
|
* @param requestUrl - The absolute url of the remote web.
|