gd-sprest-def 1.3.8 → 1.3.9
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/customV2.js +82 -0
- package/graph.md +18 -0
- package/lib/Microsoft/Graph/entityTypes.d.ts +41 -2
- package/main.js +38 -2
- package/package.json +1 -1
package/customV2.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Methods for the v2 rest api
|
|
3
|
+
*/
|
|
4
|
+
module.exports = {
|
|
5
|
+
column: [
|
|
6
|
+
{
|
|
7
|
+
name: "update",
|
|
8
|
+
returnType: "void",
|
|
9
|
+
argNames: [{ name: "values", type: "any" }]
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
columnCollection: [
|
|
13
|
+
{
|
|
14
|
+
name: "add",
|
|
15
|
+
returnType: "column",
|
|
16
|
+
argNames: [{ name: "values", type: "any" }]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
contentType: [
|
|
20
|
+
{
|
|
21
|
+
name: "update",
|
|
22
|
+
returnType: "void",
|
|
23
|
+
argNames: [{ name: "values", type: "any" }]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
contentTypeCollection: [
|
|
27
|
+
{
|
|
28
|
+
name: "add",
|
|
29
|
+
returnType: "contentType",
|
|
30
|
+
argNames: [{ name: "values", type: "any" }]
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
item: [
|
|
34
|
+
{
|
|
35
|
+
name: "update",
|
|
36
|
+
returnType: "void",
|
|
37
|
+
argNames: [{ name: "values", type: "any" }]
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
itemCollection: [
|
|
41
|
+
{
|
|
42
|
+
name: "add",
|
|
43
|
+
returnType: "item",
|
|
44
|
+
argNames: [{ name: "values", type: "any" }]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
list: [
|
|
48
|
+
{
|
|
49
|
+
name: "update",
|
|
50
|
+
returnType: "void",
|
|
51
|
+
argNames: [{ name: "values", type: "any" }]
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
listCollection: [
|
|
55
|
+
{
|
|
56
|
+
name: "add",
|
|
57
|
+
returnType: "list",
|
|
58
|
+
argNames: [{ name: "values", type: "any" }]
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
permission: [
|
|
62
|
+
{
|
|
63
|
+
name: "update",
|
|
64
|
+
returnType: "void",
|
|
65
|
+
argNames: [{ name: "values", type: "any" }]
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
permissionCollection: [
|
|
69
|
+
{
|
|
70
|
+
name: "add",
|
|
71
|
+
returnType: "permission",
|
|
72
|
+
argNames: [{ name: "values", type: "any" }]
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
siteCollection: [
|
|
76
|
+
{
|
|
77
|
+
name: "add",
|
|
78
|
+
returnType: "site",
|
|
79
|
+
argNames: [{ name: "values", type: "any" }]
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
}
|
package/graph.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
##### Missing Properties
|
|
2
|
+
|
|
3
|
+
These are missing properties that are relevant to the SharePoint v2 REST API.
|
|
4
|
+
|
|
5
|
+
###### EntityType ListItem
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<Property Name="Title" Type="Edm.String" />
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
###### ComplexType GroupCreationInformation
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
<Property Name="AllowMembersEditMembership" Type="Edm.Boolean" />
|
|
15
|
+
<Property Name="AllowRequestToJoinLeave" Type="Edm.Boolean" />
|
|
16
|
+
<Property Name="AutoAcceptRequestToJoinLeave" Type="Edm.Boolean" />
|
|
17
|
+
<Property Name="OnlyAllowMembersViewMembership" Type="Edm.Boolean" />
|
|
18
|
+
```
|
|
@@ -39,6 +39,7 @@ export interface driveMethods {
|
|
|
39
39
|
**********************************************/
|
|
40
40
|
export interface driveCollection {
|
|
41
41
|
results: drive[];
|
|
42
|
+
|
|
42
43
|
}
|
|
43
44
|
/*********************************************
|
|
44
45
|
* share
|
|
@@ -99,6 +100,7 @@ export interface item {
|
|
|
99
100
|
featureStatus: () => IBaseExecution<featureStatus>;
|
|
100
101
|
listItem: () => IBaseExecution<listItem>;
|
|
101
102
|
versions: () => IBaseExecution<driveItemVersionCollection>;
|
|
103
|
+
update: (values: any) => IBaseExecution<void>;
|
|
102
104
|
}
|
|
103
105
|
/*********************************************
|
|
104
106
|
* item Methods
|
|
@@ -114,12 +116,14 @@ export interface itemMethods {
|
|
|
114
116
|
featureStatus: () => IBaseExecution<featureStatus>;
|
|
115
117
|
listItem: () => IBaseExecution<listItem>;
|
|
116
118
|
versions: () => IBaseExecution<driveItemVersionCollection>;
|
|
119
|
+
update: (values: any) => IBaseExecution<void>;
|
|
117
120
|
}
|
|
118
121
|
/*********************************************
|
|
119
122
|
* item Collection
|
|
120
123
|
**********************************************/
|
|
121
124
|
export interface itemCollection {
|
|
122
125
|
results: item[];
|
|
126
|
+
add: (values: any) => IBaseExecution<item>;
|
|
123
127
|
}
|
|
124
128
|
/*********************************************
|
|
125
129
|
* permission
|
|
@@ -133,19 +137,20 @@ export interface permission {
|
|
|
133
137
|
roles: Array<string>[];
|
|
134
138
|
expirationDateTime: any;
|
|
135
139
|
grantedToIdentities: ComplexTypes.identitySet[];
|
|
136
|
-
|
|
140
|
+
update: (values: any) => IBaseExecution<void>;
|
|
137
141
|
}
|
|
138
142
|
/*********************************************
|
|
139
143
|
* permission Methods
|
|
140
144
|
**********************************************/
|
|
141
145
|
export interface permissionMethods {
|
|
142
|
-
|
|
146
|
+
update: (values: any) => IBaseExecution<void>;
|
|
143
147
|
}
|
|
144
148
|
/*********************************************
|
|
145
149
|
* permission Collection
|
|
146
150
|
**********************************************/
|
|
147
151
|
export interface permissionCollection {
|
|
148
152
|
results: permission[];
|
|
153
|
+
add: (values: any) => IBaseExecution<permission>;
|
|
149
154
|
}
|
|
150
155
|
/*********************************************
|
|
151
156
|
* subscription
|
|
@@ -170,6 +175,7 @@ export interface subscriptionMethods {
|
|
|
170
175
|
**********************************************/
|
|
171
176
|
export interface subscriptionCollection {
|
|
172
177
|
results: subscription[];
|
|
178
|
+
|
|
173
179
|
}
|
|
174
180
|
/*********************************************
|
|
175
181
|
* thumbnailSet
|
|
@@ -192,6 +198,7 @@ export interface thumbnailSetMethods {
|
|
|
192
198
|
**********************************************/
|
|
193
199
|
export interface thumbnailSetCollection {
|
|
194
200
|
results: thumbnailSet[];
|
|
201
|
+
|
|
195
202
|
}
|
|
196
203
|
/*********************************************
|
|
197
204
|
* activityEntity
|
|
@@ -218,6 +225,7 @@ export interface activityEntityMethods {
|
|
|
218
225
|
**********************************************/
|
|
219
226
|
export interface activityEntityCollection {
|
|
220
227
|
results: activityEntity[];
|
|
228
|
+
|
|
221
229
|
}
|
|
222
230
|
/*********************************************
|
|
223
231
|
* analytics
|
|
@@ -271,6 +279,7 @@ export interface listItemMethods {
|
|
|
271
279
|
**********************************************/
|
|
272
280
|
export interface listItemCollection {
|
|
273
281
|
results: listItem[];
|
|
282
|
+
|
|
274
283
|
}
|
|
275
284
|
/*********************************************
|
|
276
285
|
* fieldValueSet
|
|
@@ -307,6 +316,7 @@ export interface listItemVersionMethods {
|
|
|
307
316
|
**********************************************/
|
|
308
317
|
export interface listItemVersionCollection {
|
|
309
318
|
results: listItemVersion[];
|
|
319
|
+
|
|
310
320
|
}
|
|
311
321
|
/*********************************************
|
|
312
322
|
* driveItemVersion
|
|
@@ -326,6 +336,7 @@ export interface driveItemVersionMethods {
|
|
|
326
336
|
**********************************************/
|
|
327
337
|
export interface driveItemVersionCollection {
|
|
328
338
|
results: driveItemVersion[];
|
|
339
|
+
|
|
329
340
|
}
|
|
330
341
|
/*********************************************
|
|
331
342
|
* stream
|
|
@@ -348,6 +359,7 @@ export interface streamMethods {
|
|
|
348
359
|
**********************************************/
|
|
349
360
|
export interface streamCollection {
|
|
350
361
|
results: stream[];
|
|
362
|
+
|
|
351
363
|
}
|
|
352
364
|
/*********************************************
|
|
353
365
|
* columnDefinition
|
|
@@ -387,6 +399,7 @@ export interface columnDefinitionMethods {
|
|
|
387
399
|
**********************************************/
|
|
388
400
|
export interface columnDefinitionCollection {
|
|
389
401
|
results: columnDefinition[];
|
|
402
|
+
|
|
390
403
|
}
|
|
391
404
|
/*********************************************
|
|
392
405
|
* contentType
|
|
@@ -403,18 +416,21 @@ export interface contentType {
|
|
|
403
416
|
readOnly: boolean;
|
|
404
417
|
sealed: boolean;
|
|
405
418
|
columnLinks: () => IBaseExecution<columnLinkCollection>;
|
|
419
|
+
update: (values: any) => IBaseExecution<void>;
|
|
406
420
|
}
|
|
407
421
|
/*********************************************
|
|
408
422
|
* contentType Methods
|
|
409
423
|
**********************************************/
|
|
410
424
|
export interface contentTypeMethods {
|
|
411
425
|
columnLinks: () => IBaseExecution<columnLinkCollection>;
|
|
426
|
+
update: (values: any) => IBaseExecution<void>;
|
|
412
427
|
}
|
|
413
428
|
/*********************************************
|
|
414
429
|
* contentType Collection
|
|
415
430
|
**********************************************/
|
|
416
431
|
export interface contentTypeCollection {
|
|
417
432
|
results: contentType[];
|
|
433
|
+
add: (values: any) => IBaseExecution<contentType>;
|
|
418
434
|
}
|
|
419
435
|
/*********************************************
|
|
420
436
|
* columnLink
|
|
@@ -435,6 +451,7 @@ export interface columnLinkMethods {
|
|
|
435
451
|
**********************************************/
|
|
436
452
|
export interface columnLinkCollection {
|
|
437
453
|
results: columnLink[];
|
|
454
|
+
|
|
438
455
|
}
|
|
439
456
|
/*********************************************
|
|
440
457
|
* itemActivityStatEntity
|
|
@@ -456,6 +473,7 @@ export interface itemActivityStatEntityMethods {
|
|
|
456
473
|
**********************************************/
|
|
457
474
|
export interface itemActivityStatEntityCollection {
|
|
458
475
|
results: itemActivityStatEntity[];
|
|
476
|
+
|
|
459
477
|
}
|
|
460
478
|
/*********************************************
|
|
461
479
|
* driveApp
|
|
@@ -477,6 +495,7 @@ export interface driveAppMethods {
|
|
|
477
495
|
**********************************************/
|
|
478
496
|
export interface driveAppCollection {
|
|
479
497
|
results: driveApp[];
|
|
498
|
+
|
|
480
499
|
}
|
|
481
500
|
/*********************************************
|
|
482
501
|
* driveAppAction
|
|
@@ -501,6 +520,7 @@ export interface driveAppActionMethods {
|
|
|
501
520
|
**********************************************/
|
|
502
521
|
export interface driveAppActionCollection {
|
|
503
522
|
results: driveAppAction[];
|
|
523
|
+
|
|
504
524
|
}
|
|
505
525
|
/*********************************************
|
|
506
526
|
* list
|
|
@@ -515,6 +535,7 @@ export interface list extends baseItem {
|
|
|
515
535
|
contentTypes: () => IBaseExecution<contentTypeCollection>;
|
|
516
536
|
drive: () => IBaseExecution<drive>;
|
|
517
537
|
items: () => IBaseExecution<listItemCollection>;
|
|
538
|
+
update: (values: any) => IBaseExecution<void>;
|
|
518
539
|
}
|
|
519
540
|
/*********************************************
|
|
520
541
|
* list Methods
|
|
@@ -525,12 +546,14 @@ export interface listMethods {
|
|
|
525
546
|
contentTypes: () => IBaseExecution<contentTypeCollection>;
|
|
526
547
|
drive: () => IBaseExecution<drive>;
|
|
527
548
|
items: () => IBaseExecution<listItemCollection>;
|
|
549
|
+
update: (values: any) => IBaseExecution<void>;
|
|
528
550
|
}
|
|
529
551
|
/*********************************************
|
|
530
552
|
* list Collection
|
|
531
553
|
**********************************************/
|
|
532
554
|
export interface listCollection {
|
|
533
555
|
results: list[];
|
|
556
|
+
add: (values: any) => IBaseExecution<list>;
|
|
534
557
|
}
|
|
535
558
|
/*********************************************
|
|
536
559
|
* baseItem
|
|
@@ -559,6 +582,7 @@ export interface baseItemMethods {
|
|
|
559
582
|
**********************************************/
|
|
560
583
|
export interface baseItemCollection {
|
|
561
584
|
results: baseItem[];
|
|
585
|
+
|
|
562
586
|
}
|
|
563
587
|
/*********************************************
|
|
564
588
|
* site
|
|
@@ -595,6 +619,7 @@ export interface siteMethods {
|
|
|
595
619
|
**********************************************/
|
|
596
620
|
export interface siteCollection {
|
|
597
621
|
results: site[];
|
|
622
|
+
add: (values: any) => IBaseExecution<site>;
|
|
598
623
|
}
|
|
599
624
|
/*********************************************
|
|
600
625
|
* sharePoint
|
|
@@ -603,4 +628,18 @@ export interface sharePoint {
|
|
|
603
628
|
|
|
604
629
|
site: () => IBaseExecution<site>;
|
|
605
630
|
sites: () => IBaseExecution<siteCollection>;
|
|
631
|
+
}
|
|
632
|
+
/*********************************************
|
|
633
|
+
* column
|
|
634
|
+
**********************************************/
|
|
635
|
+
export interface column {
|
|
636
|
+
|
|
637
|
+
update: (values: any) => IBaseExecution<void>;
|
|
638
|
+
}
|
|
639
|
+
/*********************************************
|
|
640
|
+
* columnCollection
|
|
641
|
+
**********************************************/
|
|
642
|
+
export interface columnCollection {
|
|
643
|
+
|
|
644
|
+
add: (values: any) => IBaseExecution<column>;
|
|
606
645
|
}
|
package/main.js
CHANGED
|
@@ -2,6 +2,7 @@ let fs = require("fs");
|
|
|
2
2
|
let parser = require("xml2js").parseString;
|
|
3
3
|
let rmDir = require("rimraf");
|
|
4
4
|
let custom = require("./custom");
|
|
5
|
+
let customV2 = require("./customV2");
|
|
5
6
|
|
|
6
7
|
// Method to analyze the interfaces
|
|
7
8
|
function analyzeCollections(directories) {
|
|
@@ -658,6 +659,20 @@ ${props.join('\n')}
|
|
|
658
659
|
"import * as ComplexTypes from \"./complexTypes.d\";",
|
|
659
660
|
"import * as EnumTypes from \"./enumTypes.d\";\n",
|
|
660
661
|
];
|
|
662
|
+
|
|
663
|
+
// Parse the custom methods
|
|
664
|
+
for (let name in customV2) {
|
|
665
|
+
// See if it exists
|
|
666
|
+
if (entities[name]) {
|
|
667
|
+
// Append the methods
|
|
668
|
+
entities[name].methods = entities[name].methods.concat(customV2[name]);
|
|
669
|
+
}
|
|
670
|
+
else if (collections[name.replace("Collection", "")] == null) {
|
|
671
|
+
// Add the entry
|
|
672
|
+
entities[name] = { props: [], methods: customV2[name] }
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
661
676
|
for (let name in entities) {
|
|
662
677
|
let entity = entities[name];
|
|
663
678
|
|
|
@@ -672,7 +687,13 @@ ${props.join('\n')}
|
|
|
672
687
|
let methods = [];
|
|
673
688
|
for (let method of entity.methods) {
|
|
674
689
|
// Add the method
|
|
675
|
-
|
|
690
|
+
let argNames = method.argNames || [];
|
|
691
|
+
let argStrings = [];
|
|
692
|
+
for (let i = 0; i < argNames.length; i++) {
|
|
693
|
+
let argName = argNames[i];
|
|
694
|
+
argStrings.push(argName.name + ": " + argName.type);
|
|
695
|
+
}
|
|
696
|
+
methods.push("\t" + method.name + ": (" + argStrings.join(", ") + ") => IBaseExecution<" + getGraphType(method.returnType, true) + ">;");
|
|
676
697
|
}
|
|
677
698
|
|
|
678
699
|
// Add the endpoint
|
|
@@ -685,7 +706,21 @@ ${methods.join('\n')}
|
|
|
685
706
|
}`);
|
|
686
707
|
|
|
687
708
|
// See if there is a collection required for this
|
|
688
|
-
if(collections[name]) {
|
|
709
|
+
if (collections[name]) {
|
|
710
|
+
let customMethods = [];
|
|
711
|
+
let customProps = customV2[name + "Collection"] || [];
|
|
712
|
+
for (let i = 0; i < customProps.length; i++) {
|
|
713
|
+
let customProp = customProps[i];
|
|
714
|
+
|
|
715
|
+
// Add the method
|
|
716
|
+
let argNames = customProp.argNames || [];
|
|
717
|
+
let argStrings = [];
|
|
718
|
+
for (let i = 0; i < argNames.length; i++) {
|
|
719
|
+
let argName = argNames[i];
|
|
720
|
+
argStrings.push(argName.name + ": " + argName.type);
|
|
721
|
+
}
|
|
722
|
+
customMethods.push(customProp.name + ": (" + argStrings.join(", ") + ") => IBaseExecution<" + getGraphType(customProp.returnType, true) + ">;");
|
|
723
|
+
}
|
|
689
724
|
content.push(`/*********************************************
|
|
690
725
|
* ${name} Methods
|
|
691
726
|
**********************************************/
|
|
@@ -697,6 +732,7 @@ ${methods.join('\n')}
|
|
|
697
732
|
**********************************************/
|
|
698
733
|
export interface ${name}Collection {
|
|
699
734
|
results: ${name}[];
|
|
735
|
+
${customMethods.join(",")}
|
|
700
736
|
}`);
|
|
701
737
|
}
|
|
702
738
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gd-sprest-def",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"description": "TypeScript definition files generated from the $metadata REST endpoint in SharePoint.",
|
|
5
5
|
"author": "Gunjan Datta <me@dattabase.com> (https://gunjandatta.github.io)",
|
|
6
6
|
"license": "MIT",
|