@gzhangx/googleapi 0.0.76 → 0.0.78
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/lib/google/drive.d.ts +15 -15
- package/lib/google/drive.js +54 -45
- package/lib/google/drive.js.map +1 -1
- package/lib/google/googleApiServiceAccount.d.ts +129 -132
- package/lib/google/googleApiServiceAccount.js +411 -551
- package/lib/google/googleApiServiceAccount.js.map +1 -1
- package/lib/googleApi.d.ts +58 -58
- package/lib/googleApi.js +325 -459
- package/lib/googleApi.js.map +1 -1
- package/lib/httpRequest.d.ts +24 -25
- package/lib/httpRequest.js +138 -184
- package/lib/httpRequest.js.map +1 -1
- package/lib/index.d.ts +24 -24
- package/lib/index.js +62 -55
- package/lib/index.js.map +1 -1
- package/lib/jwt.d.ts +11 -11
- package/lib/jwt.js +45 -46
- package/lib/jwt.js.map +1 -1
- package/lib/msGraph/msExcell.d.ts +47 -47
- package/lib/msGraph/msExcell.js +69 -157
- package/lib/msGraph/msExcell.js.map +1 -1
- package/lib/msGraph/msauth.d.ts +91 -91
- package/lib/msGraph/msauth.js +309 -533
- package/lib/msGraph/msauth.js.map +1 -1
- package/lib/msGraph/msdir.d.ts +124 -125
- package/lib/msGraph/msdir.js +171 -263
- package/lib/msGraph/msdir.js.map +1 -1
- package/lib/msGraph/types.d.ts +4 -4
- package/lib/msGraph/types.js +2 -2
- package/lib/tests/gtest.d.ts +1 -1
- package/lib/tests/gtest.js +170 -234
- package/lib/tests/gtest.js.map +1 -1
- package/lib/tests/mstest.d.ts +1 -1
- package/lib/tests/mstest.js +184 -269
- package/lib/tests/mstest.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.d.ts +9 -9
- package/lib/util.js +95 -96
- package/lib/util.js.map +1 -1
- package/package.json +3 -3
package/lib/google/drive.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as util from '../util';
|
|
2
|
-
export interface AddPermissionData {
|
|
3
|
-
role: 'writer' | 'reader';
|
|
4
|
-
type: 'user';
|
|
5
|
-
emailAddress: string;
|
|
6
|
-
}
|
|
7
|
-
export interface AddPermissionRequest {
|
|
8
|
-
emailMessage?: string;
|
|
9
|
-
sendNotificationEmail?: boolean;
|
|
10
|
-
fileId: string;
|
|
11
|
-
data: AddPermissionData;
|
|
12
|
-
}
|
|
13
|
-
export declare function getGoogleDriveOps(token: string): {
|
|
14
|
-
addPermission: (req: AddPermissionRequest) => Promise<util.IHttpResponseType>;
|
|
15
|
-
};
|
|
1
|
+
import * as util from '../util';
|
|
2
|
+
export interface AddPermissionData {
|
|
3
|
+
role: 'writer' | 'reader';
|
|
4
|
+
type: 'user';
|
|
5
|
+
emailAddress: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AddPermissionRequest {
|
|
8
|
+
emailMessage?: string;
|
|
9
|
+
sendNotificationEmail?: boolean;
|
|
10
|
+
fileId: string;
|
|
11
|
+
data: AddPermissionData;
|
|
12
|
+
}
|
|
13
|
+
export declare function getGoogleDriveOps(token: string): {
|
|
14
|
+
addPermission: (req: AddPermissionRequest) => Promise<util.IHttpResponseType>;
|
|
15
|
+
};
|
package/lib/google/drive.js
CHANGED
|
@@ -1,46 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getGoogleDriveOps = getGoogleDriveOps;
|
|
37
|
+
const util = __importStar(require("../util"));
|
|
38
|
+
const rootUrl = 'https://www.googleapis.com/drive/v3';
|
|
39
|
+
function addPermission(token, req) {
|
|
40
|
+
return util.doHttpRequest({
|
|
41
|
+
method: 'POST',
|
|
42
|
+
url: `${rootUrl}/files/${req.fileId}/permissions?emailMessage=${req.emailMessage}&sendNotificationEmail=${req.sendNotificationEmail || false}`,
|
|
43
|
+
data: req.data,
|
|
44
|
+
headers: {
|
|
45
|
+
'Content-Type': 'application/json',
|
|
46
|
+
'Authorization': `Bearer ${token}`,
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function getGoogleDriveOps(token) {
|
|
51
|
+
return {
|
|
52
|
+
addPermission: (req) => addPermission(token, req),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
46
55
|
//# sourceMappingURL=drive.js.map
|
package/lib/google/drive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/google/drive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/google/drive.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,8CAIC;AAhCD,8CAA+B;AAE/B,MAA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|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
values: string[][];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
row: number;
|
|
80
|
-
col: number;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
spreadsheetId: string;
|
|
84
|
-
updatedRange: string;
|
|
85
|
-
updatedRows: number;
|
|
86
|
-
updatedColumns: number;
|
|
87
|
-
updatedCells: number;
|
|
88
|
-
error?: IGoogleErrorRet;
|
|
89
|
-
};
|
|
90
|
-
export
|
|
91
|
-
doBatchUpdate: (data: any) => IDoOpReturn;
|
|
92
|
-
appendRowCols: (sheetId: number, ap: RowColOffset) => IDoOpReturn;
|
|
93
|
-
append: (range: string, data: any, opts?: any) => IDoOpReturn;
|
|
94
|
-
read: (range: string) =>
|
|
95
|
-
clear: (sheetName: string, offset?: RowColOffset, clearRange?: RowColOffset) => IDoOpReturn;
|
|
96
|
-
readDataByColumnName: (sheetName: string, readSize?: RowColOffset, offset?: RowColOffset) => Promise<{
|
|
97
|
-
data?: ({
|
|
98
|
-
[name: string]: string;
|
|
99
|
-
}[]);
|
|
100
|
-
message: string;
|
|
101
|
-
}>;
|
|
102
|
-
readData: (sheetName: string, readSize?: RowColOffset, offset?: RowColOffset) => Promise<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
export declare function getClient(creds: IServiceAccountCreds): IGoogleClient;
|
|
132
|
-
export {};
|
|
1
|
+
export interface IServiceAccountCreds {
|
|
2
|
+
private_key_id?: string;
|
|
3
|
+
private_key?: string;
|
|
4
|
+
client_email?: string;
|
|
5
|
+
token?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IGoogleSheetGridProperties {
|
|
8
|
+
rowCount: number;
|
|
9
|
+
columnCount: number;
|
|
10
|
+
frozenRowCount: number;
|
|
11
|
+
frozenColumnCount: number;
|
|
12
|
+
}
|
|
13
|
+
interface IGoogleErrorRet {
|
|
14
|
+
code: number;
|
|
15
|
+
message: string;
|
|
16
|
+
status: string;
|
|
17
|
+
details: {
|
|
18
|
+
"@type": string;
|
|
19
|
+
reason: string;
|
|
20
|
+
domain: string;
|
|
21
|
+
metadata: {
|
|
22
|
+
quota_location: string;
|
|
23
|
+
quota_metric: string;
|
|
24
|
+
consumer: string;
|
|
25
|
+
quota_limit: string;
|
|
26
|
+
service: string;
|
|
27
|
+
quota_limit_value: string;
|
|
28
|
+
};
|
|
29
|
+
links: {
|
|
30
|
+
description: string;
|
|
31
|
+
url: string;
|
|
32
|
+
}[];
|
|
33
|
+
}[];
|
|
34
|
+
url: string;
|
|
35
|
+
}
|
|
36
|
+
interface IGoogleSheetInfo {
|
|
37
|
+
spreadsheetId: string;
|
|
38
|
+
properties: {
|
|
39
|
+
title: string;
|
|
40
|
+
locale: string;
|
|
41
|
+
autoRecalc: string;
|
|
42
|
+
timeZone: string;
|
|
43
|
+
defaultFormat: any;
|
|
44
|
+
};
|
|
45
|
+
sheets: {
|
|
46
|
+
properties: {
|
|
47
|
+
sheetId: number;
|
|
48
|
+
title: string;
|
|
49
|
+
index: number;
|
|
50
|
+
sheetType: string;
|
|
51
|
+
gridProperties: IGoogleSheetGridProperties;
|
|
52
|
+
};
|
|
53
|
+
}[];
|
|
54
|
+
error?: IGoogleErrorRet;
|
|
55
|
+
}
|
|
56
|
+
export interface ISheetInfoSimple extends IGoogleSheetGridProperties {
|
|
57
|
+
sheetId: number;
|
|
58
|
+
title: string;
|
|
59
|
+
index: number;
|
|
60
|
+
}
|
|
61
|
+
export interface IGoogleUpdateParms {
|
|
62
|
+
valueInputOption: 'INPUT_VALUE_OPTION_UNSPECIFIED' | 'RAW' | 'USER_ENTERED';
|
|
63
|
+
includeValuesInResponse?: boolean;
|
|
64
|
+
responseValueRenderOption?: 'FORMATTED_VALUE' | 'UNFORMATTED_VALUE' | 'FORMULA';
|
|
65
|
+
responseDateTimeRenderOption?: 'FORMATTED_STRING' | 'SERIAL_NUMBER';
|
|
66
|
+
}
|
|
67
|
+
interface IIdRange {
|
|
68
|
+
id: string;
|
|
69
|
+
range: string;
|
|
70
|
+
}
|
|
71
|
+
interface IReadReturn {
|
|
72
|
+
range: string;
|
|
73
|
+
values: string[][];
|
|
74
|
+
}
|
|
75
|
+
type IDoOpReturn = Promise<string | object | Buffer>;
|
|
76
|
+
type IAppendFunc = (idRng: IIdRange, data: any, opts?: any) => IDoOpReturn;
|
|
77
|
+
type IReadFunc = (idRng: IIdRange) => Promise<IReadReturn>;
|
|
78
|
+
type RowColOffset = {
|
|
79
|
+
row: number;
|
|
80
|
+
col: number;
|
|
81
|
+
};
|
|
82
|
+
type IDoOpUpdateWithErrorReturn = {
|
|
83
|
+
spreadsheetId: string;
|
|
84
|
+
updatedRange: string;
|
|
85
|
+
updatedRows: number;
|
|
86
|
+
updatedColumns: number;
|
|
87
|
+
updatedCells: number;
|
|
88
|
+
error?: IGoogleErrorRet;
|
|
89
|
+
};
|
|
90
|
+
export type IGetSheetOpsReturn = {
|
|
91
|
+
doBatchUpdate: (data: any) => IDoOpReturn;
|
|
92
|
+
appendRowCols: (sheetId: number, ap: RowColOffset) => IDoOpReturn;
|
|
93
|
+
append: (range: string, data: any, opts?: any) => IDoOpReturn;
|
|
94
|
+
read: (range: string) => Promise<IReadReturn>;
|
|
95
|
+
clear: (sheetName: string, offset?: RowColOffset, clearRange?: RowColOffset) => IDoOpReturn;
|
|
96
|
+
readDataByColumnName: (sheetName: string, readSize?: RowColOffset, offset?: RowColOffset) => Promise<{
|
|
97
|
+
data?: ({
|
|
98
|
+
[name: string]: string;
|
|
99
|
+
}[]);
|
|
100
|
+
message: string;
|
|
101
|
+
}>;
|
|
102
|
+
readData: (sheetName: string, readSize?: RowColOffset, offset?: RowColOffset) => Promise<IReadReturn>;
|
|
103
|
+
sheetInfo: () => Promise<ISheetInfoSimple[]>;
|
|
104
|
+
createSheet: (sheetId: string, title: string) => IDoOpReturn;
|
|
105
|
+
deleteSheet: (sheetId: number) => IDoOpReturn;
|
|
106
|
+
deleteSheetByName: (sheetTitle: string) => IDoOpReturn;
|
|
107
|
+
autoCreateSheet: (title: string) => IDoOpReturn;
|
|
108
|
+
updateValues: (range: string, values: string[][], opts?: IGoogleUpdateParms) => Promise<IDoOpUpdateWithErrorReturn>;
|
|
109
|
+
autoUpdateValues: (sheetName: string, values: string[][], offset?: RowColOffset, opts?: IGoogleUpdateParms) => Promise<IDoOpUpdateWithErrorReturn>;
|
|
110
|
+
addSheet: (title: string) => IDoOpReturn;
|
|
111
|
+
getSheetRange: (sheetName: string, readSize: RowColOffset, offset: RowColOffset) => Promise<string>;
|
|
112
|
+
};
|
|
113
|
+
export interface IGoogleClient {
|
|
114
|
+
getToken: () => string;
|
|
115
|
+
doBatchUpdate: (id: string, data: any) => IDoOpReturn;
|
|
116
|
+
append: IAppendFunc;
|
|
117
|
+
read: IReadFunc;
|
|
118
|
+
getSheetOps: (id: string) => IGetSheetOpsReturn;
|
|
119
|
+
createTopNewSheet: (data: IGoogleSheetInfo) => Promise<IGoogleSheetInfo>;
|
|
120
|
+
}
|
|
121
|
+
export interface IGoogleToken {
|
|
122
|
+
access_token: string;
|
|
123
|
+
expires_in: number;
|
|
124
|
+
refresh_token: string;
|
|
125
|
+
scope: string;
|
|
126
|
+
token_type: string;
|
|
127
|
+
}
|
|
128
|
+
export declare function getClient(creds: IServiceAccountCreds): IGoogleClient;
|
|
129
|
+
export {};
|