@microsoft/typespec-msgraph 0.0.1-Preview.13 → 0.0.1-Preview.15
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/dist/src/components/annotations.d.ts.map +1 -1
- package/dist/src/components/annotations.js +5 -2
- package/dist/src/components/annotations.js.map +1 -1
- package/dist/src/components/entity-container-element.d.ts.map +1 -1
- package/dist/src/components/entity-container-element.js +9 -6
- package/dist/src/components/entity-container-element.js.map +1 -1
- package/dist/src/components/open-property-type-constraint-annotation-element.d.ts +5 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.d.ts.map +1 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.js +7 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.js.map +1 -0
- package/dist/src/components/operation-element.js +2 -2
- package/dist/src/components/operation-element.js.map +1 -1
- package/dist/src/components/property-element.js +1 -1
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/reference-target-element.d.ts +9 -0
- package/dist/src/components/reference-target-element.d.ts.map +1 -0
- package/dist/src/components/reference-target-element.js +3 -0
- package/dist/src/components/reference-target-element.js.map +1 -0
- package/dist/src/components/select-supported-annotation.d.ts +5 -0
- package/dist/src/components/select-supported-annotation.d.ts.map +1 -0
- package/dist/src/components/select-supported-annotation.js +6 -0
- package/dist/src/components/select-supported-annotation.js.map +1 -0
- package/dist/src/components/structured-type-element.d.ts.map +1 -1
- package/dist/src/components/structured-type-element.js +3 -1
- package/dist/src/components/structured-type-element.js.map +1 -1
- package/dist/src/components/update-restrictions-annotation.d.ts +2 -1
- package/dist/src/components/update-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/update-restrictions-annotation.js +6 -4
- package/dist/src/components/update-restrictions-annotation.js.map +1 -1
- package/dist/src/decorators/address-url-msa.d.ts +12 -0
- package/dist/src/decorators/address-url-msa.d.ts.map +1 -0
- package/dist/src/decorators/address-url-msa.js +19 -0
- package/dist/src/decorators/address-url-msa.js.map +1 -0
- package/dist/src/decorators/address-url.d.ts +16 -0
- package/dist/src/decorators/address-url.d.ts.map +1 -0
- package/dist/src/decorators/address-url.js +19 -0
- package/dist/src/decorators/address-url.js.map +1 -0
- package/dist/src/decorators/function.d.ts +7 -2
- package/dist/src/decorators/function.d.ts.map +1 -1
- package/dist/src/decorators/function.js +2 -2
- package/dist/src/decorators/function.js.map +1 -1
- package/dist/src/decorators/graph-route.d.ts +1 -0
- package/dist/src/decorators/graph-route.d.ts.map +1 -1
- package/dist/src/decorators/graph-route.js +14 -0
- package/dist/src/decorators/graph-route.js.map +1 -1
- package/dist/src/decorators/index.d.ts +6 -0
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +6 -0
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/passthrough-address-url-msa.d.ts +12 -0
- package/dist/src/decorators/passthrough-address-url-msa.d.ts.map +1 -0
- package/dist/src/decorators/passthrough-address-url-msa.js +19 -0
- package/dist/src/decorators/passthrough-address-url-msa.js.map +1 -0
- package/dist/src/decorators/passthrough-address-url.d.ts +12 -0
- package/dist/src/decorators/passthrough-address-url.d.ts.map +1 -0
- package/dist/src/decorators/passthrough-address-url.js +19 -0
- package/dist/src/decorators/passthrough-address-url.js.map +1 -0
- package/dist/src/decorators/reference-target.d.ts +16 -0
- package/dist/src/decorators/reference-target.d.ts.map +1 -0
- package/dist/src/decorators/reference-target.js +52 -0
- package/dist/src/decorators/reference-target.js.map +1 -0
- package/dist/src/decorators/select.d.ts +9 -0
- package/dist/src/decorators/select.d.ts.map +1 -0
- package/dist/src/decorators/select.js +13 -0
- package/dist/src/decorators/select.js.map +1 -0
- package/dist/src/entities/address-url.d.ts +7 -0
- package/dist/src/entities/address-url.d.ts.map +1 -0
- package/dist/src/entities/address-url.js +42 -0
- package/dist/src/entities/address-url.js.map +1 -0
- package/dist/src/entities/annotations.d.ts +11 -2
- package/dist/src/entities/annotations.d.ts.map +1 -1
- package/dist/src/entities/annotations.js +47 -7
- package/dist/src/entities/annotations.js.map +1 -1
- package/dist/src/entities/entity-container.d.ts +16 -0
- package/dist/src/entities/entity-container.d.ts.map +1 -1
- package/dist/src/entities/entity-container.js +9 -0
- package/dist/src/entities/entity-container.js.map +1 -1
- package/dist/src/entities/model.d.ts +7 -1
- package/dist/src/entities/model.d.ts.map +1 -1
- package/dist/src/entities/model.js +63 -5
- package/dist/src/entities/model.js.map +1 -1
- package/dist/src/entities/ms-graph-route.d.ts +13 -0
- package/dist/src/entities/ms-graph-route.d.ts.map +1 -0
- package/dist/src/entities/ms-graph-route.js +64 -0
- package/dist/src/entities/ms-graph-route.js.map +1 -0
- package/dist/src/entities/namespace.d.ts.map +1 -1
- package/dist/src/entities/namespace.js +27 -7
- package/dist/src/entities/namespace.js.map +1 -1
- package/dist/src/entities/operation.d.ts +1 -0
- package/dist/src/entities/operation.d.ts.map +1 -1
- package/dist/src/entities/operation.js +24 -7
- package/dist/src/entities/operation.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +25 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +15 -4
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts +2 -0
- package/dist/src/linter.d.ts.map +1 -0
- package/dist/src/linter.js +15 -0
- package/dist/src/linter.js.map +1 -0
- package/dist/src/rules/address-url.d.ts +18 -0
- package/dist/src/rules/address-url.d.ts.map +1 -0
- package/dist/src/rules/address-url.js +99 -0
- package/dist/src/rules/address-url.js.map +1 -0
- package/dist/src/rules/contains.d.ts +1 -1
- package/dist/src/rules/contains.js +1 -1
- package/dist/src/rules/graph-route.d.ts +6 -0
- package/dist/src/rules/graph-route.d.ts.map +1 -1
- package/dist/src/rules/graph-route.js +83 -3
- package/dist/src/rules/graph-route.js.map +1 -1
- package/dist/src/rules/index.d.ts +4 -0
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +4 -0
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/model.d.ts +4 -0
- package/dist/src/rules/model.d.ts.map +1 -0
- package/dist/src/rules/model.js +36 -0
- package/dist/src/rules/model.js.map +1 -0
- package/dist/src/rules/record-t.d.ts +5 -0
- package/dist/src/rules/record-t.d.ts.map +1 -0
- package/dist/src/rules/record-t.js +78 -0
- package/dist/src/rules/record-t.js.map +1 -0
- package/dist/src/rules/reference-target.d.ts +8 -0
- package/dist/src/rules/reference-target.d.ts.map +1 -0
- package/dist/src/rules/reference-target.js +118 -0
- package/dist/src/rules/reference-target.js.map +1 -0
- package/dist/src/utils.d.ts +19 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +49 -21
- package/dist/src/utils.js.map +1 -1
- package/dist/src/validate.d.ts.map +1 -1
- package/dist/src/validate.js +15 -2
- package/dist/src/validate.js.map +1 -1
- package/lib/decorators.tsp +131 -23
- package/lib/porcelain.tsp +18 -7
- package/lib/responses.tsp +32 -7
- package/lib/shared-models.tsp +0 -50
- package/package.json +4 -4
package/lib/decorators.tsp
CHANGED
|
@@ -16,14 +16,44 @@ extern dec action(target: Operation, name?: valueof string);
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* `@additionalQueryParameters` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace.
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
20
|
* `@additionalQueryParameters` can only be applied to namespaces
|
|
21
21
|
*/
|
|
22
|
-
extern dec additionalQueryParameters(
|
|
22
|
+
extern dec additionalQueryParameters(
|
|
23
|
+
target: Namespace,
|
|
24
|
+
name: valueof string,
|
|
25
|
+
value: valueof string
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* `@addressUrl` - Specifies the URL to which the operation request is forwarded when the request
|
|
30
|
+
* is authenticated with an AAD account.
|
|
31
|
+
*
|
|
32
|
+
* `@addressUrl` can only be applied to routed interfaces (entity sets, singletons and navigation properties) or action operations.
|
|
33
|
+
*/
|
|
34
|
+
extern dec addressUrl(
|
|
35
|
+
target: Interface | Operation,
|
|
36
|
+
url: valueof string,
|
|
37
|
+
omitRootNavigationSegment?: valueof boolean,
|
|
38
|
+
appendSegmentNameToAddress?: valueof boolean
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* `@addressUrlMsa` - Specifies the URL to which the operation request is forwarded when the request
|
|
43
|
+
* is authenticated with a Microsoft Account.
|
|
44
|
+
*
|
|
45
|
+
* `@addressUrlMsa` can only be applied to routed interfaces (entity sets, singletons and navigation properties) or action operations.
|
|
46
|
+
*/
|
|
47
|
+
extern dec addressUrlMsa(
|
|
48
|
+
target: Interface | Operation,
|
|
49
|
+
url: valueof string,
|
|
50
|
+
omitRootNavigationSegment?: valueof boolean,
|
|
51
|
+
appendSegmentNameToAddress?: valueof boolean
|
|
52
|
+
);
|
|
23
53
|
|
|
24
54
|
/**
|
|
25
55
|
* `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
|
|
26
|
-
*
|
|
56
|
+
*
|
|
27
57
|
* `@agsAttribute` - Applies to models.
|
|
28
58
|
*/
|
|
29
59
|
extern dec agsAttribute(
|
|
@@ -34,10 +64,10 @@ extern dec agsAttribute(
|
|
|
34
64
|
|
|
35
65
|
/**
|
|
36
66
|
* `@allowedValues` - mark model property with allowedValues.
|
|
37
|
-
*
|
|
67
|
+
*
|
|
38
68
|
* `@allowedValues` - can only be applied to model properties.
|
|
39
69
|
*/
|
|
40
|
-
|
|
70
|
+
extern dec allowedValues(target: ModelProperty, ...values: valueof unknown[]);
|
|
41
71
|
|
|
42
72
|
/**
|
|
43
73
|
* `@alternateKey` - mark a model property as an alternateKey
|
|
@@ -86,7 +116,17 @@ extern dec deltaCollection(target: Model);
|
|
|
86
116
|
*
|
|
87
117
|
* `@graphDeprecated` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace, Interface.
|
|
88
118
|
*/
|
|
89
|
-
|
|
119
|
+
extern dec graphDeprecated(
|
|
120
|
+
target:
|
|
121
|
+
| Model
|
|
122
|
+
| ModelProperty
|
|
123
|
+
| Enum
|
|
124
|
+
| EnumMember
|
|
125
|
+
| Operation
|
|
126
|
+
| Namespace
|
|
127
|
+
| Interface,
|
|
128
|
+
name: valueof string
|
|
129
|
+
);
|
|
90
130
|
|
|
91
131
|
/**
|
|
92
132
|
* `@deprecatedDefinition` - Allow us create a reusable deprecation definition.
|
|
@@ -115,14 +155,27 @@ extern dec entity(target: Model);
|
|
|
115
155
|
* `properties` - Property names in the model returned from the get that can be used in a $expand query parameter.
|
|
116
156
|
* At least one property must be specified.
|
|
117
157
|
*/
|
|
118
|
-
extern dec expand(
|
|
158
|
+
extern dec expand(
|
|
159
|
+
target: Operation,
|
|
160
|
+
property: valueof string,
|
|
161
|
+
...otherProperties: valueof string[]
|
|
162
|
+
);
|
|
119
163
|
|
|
120
164
|
/**
|
|
121
165
|
* `@experimental` - mark the entity as experimental
|
|
122
166
|
*
|
|
123
167
|
* `@experimental` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace, Interface.
|
|
124
168
|
*/
|
|
125
|
-
extern dec experimental(
|
|
169
|
+
extern dec experimental(
|
|
170
|
+
target:
|
|
171
|
+
| Model
|
|
172
|
+
| ModelProperty
|
|
173
|
+
| Enum
|
|
174
|
+
| EnumMember
|
|
175
|
+
| Operation
|
|
176
|
+
| Namespace
|
|
177
|
+
| Interface
|
|
178
|
+
);
|
|
126
179
|
|
|
127
180
|
/**
|
|
128
181
|
* `@filter` - Applies to: get operations that return collections of @entity or @complex models.
|
|
@@ -131,8 +184,11 @@ extern dec experimental(target: Model | ModelProperty | Enum | EnumMember | Oper
|
|
|
131
184
|
* `properties` - array of property names in the model returned
|
|
132
185
|
* from the get operation that can be used in $filter query parameter.
|
|
133
186
|
*/
|
|
134
|
-
extern dec filter(
|
|
135
|
-
|
|
187
|
+
extern dec filter(
|
|
188
|
+
target: Operation,
|
|
189
|
+
property: valueof string,
|
|
190
|
+
...properties: valueof string[]
|
|
191
|
+
);
|
|
136
192
|
|
|
137
193
|
/**
|
|
138
194
|
* `@flags` - mark an enumeration type as a flag.
|
|
@@ -146,25 +202,27 @@ extern dec flags(target: Enum);
|
|
|
146
202
|
*
|
|
147
203
|
* `@function` can only be applied to operations.
|
|
148
204
|
*/
|
|
149
|
-
extern dec function(target: Operation, name?: valueof string);
|
|
205
|
+
extern dec function(target: Operation, name?: valueof string, isComposable?: valueof boolean);
|
|
150
206
|
|
|
151
207
|
/**
|
|
152
208
|
* `@globalOperation` - mark an operation as a globalOperation
|
|
153
209
|
*
|
|
154
210
|
* `@globalOperation` can only be applied to operations.
|
|
155
211
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
212
|
+
extern dec globalOperation(target: Operation);
|
|
158
213
|
|
|
159
214
|
/**
|
|
160
215
|
* `@graphRoute` - mark an interface or operation with an HTTP route.
|
|
161
|
-
*
|
|
216
|
+
*
|
|
162
217
|
* `@graphRoute` - can only be applied to interfaces or operations.
|
|
163
218
|
*/
|
|
164
219
|
// TODO: Using @graphRoute on an operation currently does not work due to the following TypeSpec core issue
|
|
165
220
|
// https://github.com/microsoft/typespec/issues/2106
|
|
166
221
|
// Disabling all related features while we await the outcome.
|
|
167
|
-
extern dec graphRoute(
|
|
222
|
+
extern dec graphRoute(
|
|
223
|
+
target: Interface, /* | Operation */
|
|
224
|
+
path: valueof string
|
|
225
|
+
);
|
|
168
226
|
|
|
169
227
|
/**
|
|
170
228
|
* `@hasStream` - indicates that an `@entity` model has a stream.
|
|
@@ -185,7 +243,7 @@ extern dec immutable(target: ModelProperty);
|
|
|
185
243
|
*
|
|
186
244
|
* `@ownerless` can only be applied to interfaces.
|
|
187
245
|
*/
|
|
188
|
-
|
|
246
|
+
extern dec ownerless(target: Interface);
|
|
189
247
|
|
|
190
248
|
/**
|
|
191
249
|
* `@open` - mark a model type as open
|
|
@@ -210,7 +268,11 @@ extern dec operationParameters(target: Model);
|
|
|
210
268
|
* `properties` - List of property names in the model returned from the get operation that can be used in a $orderBy query parameter.
|
|
211
269
|
* At least one property must be specified.
|
|
212
270
|
*/
|
|
213
|
-
extern dec orderBy(
|
|
271
|
+
extern dec orderBy(
|
|
272
|
+
target: Operation,
|
|
273
|
+
property: valueof string,
|
|
274
|
+
...otherProperties: valueof string[]
|
|
275
|
+
);
|
|
214
276
|
|
|
215
277
|
/**
|
|
216
278
|
* `@pagedCollection` - mark a model as representing a paged collection.
|
|
@@ -226,6 +288,32 @@ extern dec pagedCollection(target: Model);
|
|
|
226
288
|
*/
|
|
227
289
|
extern dec partial(target: Model, value: Model);
|
|
228
290
|
|
|
291
|
+
/**
|
|
292
|
+
* `@passthroughAddressUrl` - Specifies the URL to which the operation request is forwarded when the request
|
|
293
|
+
* is authenticated with an AAD account and the request is eligible for response passthrough.
|
|
294
|
+
*
|
|
295
|
+
* `@passthroughAddressUrl` can only be applied to routed interfaces (entity sets, singletons and navigation properties) or action operations.
|
|
296
|
+
*/
|
|
297
|
+
extern dec passthroughAddressUrl(
|
|
298
|
+
target: Interface | Operation,
|
|
299
|
+
url: valueof string,
|
|
300
|
+
omitRootNavigationSegment?: valueof boolean,
|
|
301
|
+
appendSegmentNameToAddress?: valueof boolean
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* `@passthroughAddressUrlMsa` - Specifies the URL to which the operation request is forwarded when the request
|
|
306
|
+
* is authenticated with a Microsoft account and the request is eligible for response passthrough.
|
|
307
|
+
*
|
|
308
|
+
* `@passthroughAddressUrlMsa` can only be applied to routed interfaces (entity sets, singletons and navigation properties) or action operations.
|
|
309
|
+
*/
|
|
310
|
+
extern dec passthroughAddressUrlMsa(
|
|
311
|
+
target: Interface | Operation,
|
|
312
|
+
url: valueof string,
|
|
313
|
+
omitRootNavigationSegment?: valueof boolean,
|
|
314
|
+
appendSegmentNameToAddress?: valueof boolean
|
|
315
|
+
);
|
|
316
|
+
|
|
229
317
|
/**
|
|
230
318
|
* `@privatePreview` - Allow us define a privatePreview element.
|
|
231
319
|
* `@privatePreview` - Applies to models, model properties, enums, enum members, namespaces and operations.
|
|
@@ -252,7 +340,9 @@ extern dec privatePreviewDefinition(
|
|
|
252
340
|
*
|
|
253
341
|
* `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
|
|
254
342
|
*/
|
|
255
|
-
extern dec privileged(
|
|
343
|
+
extern dec privileged(
|
|
344
|
+
target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace
|
|
345
|
+
);
|
|
256
346
|
|
|
257
347
|
/**
|
|
258
348
|
* `@publicNamespace` - defines the namespace to be used in generating CSDL output for all elements contained within the namespace
|
|
@@ -275,6 +365,13 @@ extern dec readOnly(target: ModelProperty);
|
|
|
275
365
|
*/
|
|
276
366
|
extern dec references(target: ModelProperty);
|
|
277
367
|
|
|
368
|
+
/**
|
|
369
|
+
* `@referenceTarget` - mark an interface with referenceTarget
|
|
370
|
+
*
|
|
371
|
+
* `@references` can only be applied to interfaces.
|
|
372
|
+
*/
|
|
373
|
+
extern dec referenceTarget(target: Interface, value: valueof string);
|
|
374
|
+
|
|
278
375
|
/**
|
|
279
376
|
* `@requiredForCreate` - mark a model property as required when a request is made to
|
|
280
377
|
* Graph to create or update a resource.
|
|
@@ -295,11 +392,22 @@ extern dec search(target: Operation);
|
|
|
295
392
|
*/
|
|
296
393
|
extern dec skip(target: Operation);
|
|
297
394
|
|
|
395
|
+
/**
|
|
396
|
+
* `@select` - Applies to operations
|
|
397
|
+
* Indicates that the operation supports the OData $select query parameter
|
|
398
|
+
*/
|
|
399
|
+
extern dec select(target: Operation);
|
|
400
|
+
|
|
298
401
|
/**
|
|
299
402
|
* `@term` - Applies to: namespaces.
|
|
300
403
|
* Indicates that a workload wishes to require or return instance annotations in their request / response packets at runtime.
|
|
301
404
|
*/
|
|
302
|
-
extern dec term(
|
|
405
|
+
extern dec term(
|
|
406
|
+
target: Namespace,
|
|
407
|
+
name: valueof string,
|
|
408
|
+
type: Scalar,
|
|
409
|
+
description: valueof string
|
|
410
|
+
);
|
|
303
411
|
|
|
304
412
|
/**
|
|
305
413
|
* `@top` - Applies to: get operations that return collections.
|
|
@@ -315,10 +423,10 @@ extern dec top(target: Operation);
|
|
|
315
423
|
extern dec writeOnly(target: ModelProperty);
|
|
316
424
|
|
|
317
425
|
/**
|
|
318
|
-
* `@isOwner` - specify that this workload is the primary owner of this entity model
|
|
319
|
-
*
|
|
320
|
-
* `@isOwner` can be applied to Model where the model also has an @entity decorator or a ModelProperty where it has either an @contains or @references decorator.
|
|
321
|
-
*/
|
|
426
|
+
* `@isOwner` - specify that this workload is the primary owner of this entity model
|
|
427
|
+
*
|
|
428
|
+
* `@isOwner` can be applied to Model where the model also has an @entity decorator or a ModelProperty where it has either an @contains or @references decorator.
|
|
429
|
+
*/
|
|
322
430
|
extern dec isOwner(target: Model | ModelProperty, value?: valueof boolean);
|
|
323
431
|
|
|
324
432
|
/**
|
package/lib/porcelain.tsp
CHANGED
|
@@ -41,8 +41,6 @@ namespace MsGraph;
|
|
|
41
41
|
@doc("Primary operation shapes for Microsoft Graph")
|
|
42
42
|
interface GraphOps {
|
|
43
43
|
|
|
44
|
-
// TODO: This is how we should make $select standard for Graph. Define a select decorator and use it here.
|
|
45
|
-
// @select("*")
|
|
46
44
|
@get op GetCollection<
|
|
47
45
|
TResource extends {} = Automatic.CalculatedResourceType,
|
|
48
46
|
TParams = {... Automatic.GraphRouteParams},
|
|
@@ -51,7 +49,6 @@ namespace MsGraph;
|
|
|
51
49
|
> is Foundations.GraphFoundations.CollectionOperation<
|
|
52
50
|
TResource, TParams, TResponse, TErrorResponse>;
|
|
53
51
|
|
|
54
|
-
// @select("*")
|
|
55
52
|
@get op GetPagedCollection<
|
|
56
53
|
TResource extends {} = Automatic.CalculatedResourceType,
|
|
57
54
|
TParams = {... Automatic.GraphRouteParams},
|
|
@@ -62,7 +59,6 @@ namespace MsGraph;
|
|
|
62
59
|
|
|
63
60
|
// TODO: GetDelta? FUnction etc.?
|
|
64
61
|
|
|
65
|
-
// @select("*")
|
|
66
62
|
@post op Post<
|
|
67
63
|
TResource extends {} = Automatic.CalculatedResourceType,
|
|
68
64
|
TParams = { ... Automatic.GraphRouteParams, @body body: TResource },
|
|
@@ -71,7 +67,6 @@ namespace MsGraph;
|
|
|
71
67
|
> is Foundations.GraphFoundations.CollectionOperation<
|
|
72
68
|
TResource, TParams, TResponse, TErrorResponse>;
|
|
73
69
|
|
|
74
|
-
// @select("*")
|
|
75
70
|
@get op GetResource<
|
|
76
71
|
TResource extends {} = Automatic.CalculatedResourceType,
|
|
77
72
|
TParams = {... Automatic.GraphRouteParams},
|
|
@@ -96,7 +91,6 @@ namespace MsGraph;
|
|
|
96
91
|
> is Foundations.GraphFoundations.ResourceOperation<
|
|
97
92
|
TResource, TParams, TResponse, TErrorResponse>;
|
|
98
93
|
|
|
99
|
-
// @select("*")
|
|
100
94
|
@patch op PatchWithResponse<
|
|
101
95
|
TResource extends {} = Automatic.CalculatedResourceType,
|
|
102
96
|
TParams = {... Automatic.GraphRouteParams},
|
|
@@ -113,7 +107,6 @@ namespace MsGraph;
|
|
|
113
107
|
> is Foundations.GraphFoundations.ResourceOperation<
|
|
114
108
|
TResource, TParams, TResponse, TErrorResponse>;
|
|
115
109
|
|
|
116
|
-
// @select("*")
|
|
117
110
|
@put op PutWithResponse<
|
|
118
111
|
TResource extends {} = Automatic.CalculatedResourceType,
|
|
119
112
|
TParams = {... Automatic.GraphRouteParams},
|
|
@@ -122,6 +115,24 @@ namespace MsGraph;
|
|
|
122
115
|
> is Foundations.GraphFoundations.ResourceOperation<
|
|
123
116
|
TResource, TParams, TResponse, TErrorResponse>;
|
|
124
117
|
|
|
118
|
+
@action op Action<
|
|
119
|
+
TReturnType = void,
|
|
120
|
+
TActionParams extends {} = {},
|
|
121
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
122
|
+
TParams = {... Automatic.GraphRouteParams, ... TActionParams},
|
|
123
|
+
TResponse = TReturnType,
|
|
124
|
+
TErrorResponse = MsGraph.Responses.OperationErrorResponse
|
|
125
|
+
>(...TParams): TResponse | TErrorResponse;
|
|
126
|
+
|
|
127
|
+
@function op Function<
|
|
128
|
+
TReturnType,
|
|
129
|
+
TFunctionParams extends {} = {},
|
|
130
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
131
|
+
TParams = {... Automatic.GraphRouteParams, ... TFunctionParams},
|
|
132
|
+
TResponse = TReturnType,
|
|
133
|
+
TErrorResponse = MsGraph.Responses.OperationErrorResponse
|
|
134
|
+
>(...TParams): TResponse | TErrorResponse;
|
|
135
|
+
|
|
125
136
|
}
|
|
126
137
|
|
|
127
138
|
namespace Automatic {
|
package/lib/responses.tsp
CHANGED
|
@@ -16,9 +16,27 @@ using MsGraph.SharedModels;
|
|
|
16
16
|
// The content of the types exists for other future emitters that run directly off TypeSpec.
|
|
17
17
|
namespace MsGraph.Responses.Bodies {
|
|
18
18
|
|
|
19
|
+
/** Complex type to represent a nested error that potentially has other recursive nested errors. */
|
|
20
|
+
@error
|
|
21
|
+
model InnerError {
|
|
22
|
+
code: string;
|
|
23
|
+
innererror: InnerError | null; // Small e for error NOT a typo.
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Complex type to represent a standard Microsoft Graph error. */
|
|
27
|
+
@error
|
|
28
|
+
model GraphError {
|
|
29
|
+
code: string;
|
|
30
|
+
message: string;
|
|
31
|
+
localizedMessage: string;
|
|
32
|
+
target: string | null;
|
|
33
|
+
innererror: InnerError | null; // Small e for error NOT a typo.
|
|
34
|
+
details: GraphError[];
|
|
35
|
+
}
|
|
36
|
+
|
|
19
37
|
@error
|
|
20
38
|
model ErrorBody {
|
|
21
|
-
error:
|
|
39
|
+
error: GraphError;
|
|
22
40
|
}
|
|
23
41
|
|
|
24
42
|
model ResourceBody<TResource> {
|
|
@@ -44,33 +62,39 @@ namespace MsGraph.Responses.Bodies {
|
|
|
44
62
|
|
|
45
63
|
// Response models represent the response as a whole, including the status code, headers, and body.
|
|
46
64
|
namespace MsGraph.Responses {
|
|
47
|
-
|
|
65
|
+
/** Response to represent a Microsoft Graph collection response payload. */
|
|
48
66
|
model CollectionResponse<TResource, TStatus = 200, TBody = Bodies.CollectionBody<TResource>>
|
|
49
67
|
is Http.Response<TStatus> {
|
|
50
68
|
...Http.Body<TBody>;
|
|
51
69
|
}
|
|
52
70
|
|
|
53
|
-
|
|
71
|
+
/** Response to represent a Microsoft Graph paged collection response payload. */
|
|
54
72
|
model PagedCollectionResponse<TResource, TStatus = 200, TBody = Bodies.PagedCollectionBody<TResource>>
|
|
55
73
|
is CollectionResponse<TResource, TStatus, TBody>;
|
|
56
74
|
|
|
57
|
-
|
|
75
|
+
/** Response to represent a Microsoft Graph individual resource response payload. */
|
|
58
76
|
model ResourceResponse<TResource, TStatus = 200, TBody = Bodies.ResourceBody<TResource>>
|
|
59
77
|
is Http.Response<TStatus> {
|
|
60
78
|
...Http.Body<TBody>;
|
|
61
79
|
}
|
|
62
80
|
|
|
63
|
-
|
|
81
|
+
/** Response to represent a Microsoft Graph individual resource response payload. */
|
|
82
|
+
model ScalarResponse<TScalar, TStatus = 200, TBody = TScalar>
|
|
83
|
+
is Http.Response<TStatus> {
|
|
84
|
+
...Http.Body<TBody>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Response to represent a Microsoft Graph resource creation response payload. */
|
|
64
88
|
model ResourceCreatedResponse<TResource, TStatus = 201, TBody = Bodies.ResourceBody<TResource>>
|
|
65
89
|
is ResourceResponse<TResource, TStatus, TBody> {
|
|
66
90
|
...Http.LocationHeader
|
|
67
91
|
}
|
|
68
92
|
|
|
69
|
-
|
|
93
|
+
/** Response to represent a Microsoft Graph empty response payload. */
|
|
70
94
|
model EmptyResponse
|
|
71
95
|
is Http.Response<204>;
|
|
72
96
|
|
|
73
|
-
|
|
97
|
+
/** Response to represent a Microsoft Graph error response payload. */
|
|
74
98
|
model ErrorResponse<TStatus>
|
|
75
99
|
is Http.Response<TStatus> {
|
|
76
100
|
...Http.Body<Bodies.ErrorBody>;
|
|
@@ -78,5 +102,6 @@ namespace MsGraph.Responses {
|
|
|
78
102
|
|
|
79
103
|
alias ResourceErrorResponse = ErrorResponse<400 | 404 | 429>;
|
|
80
104
|
alias CollectionErrorResponse = ErrorResponse<400 | 429>;
|
|
105
|
+
alias OperationErrorResponse = ErrorResponse<400 | 429>;
|
|
81
106
|
|
|
82
107
|
}
|
package/lib/shared-models.tsp
CHANGED
|
@@ -16,35 +16,6 @@ namespace MsGraph.SharedModels;
|
|
|
16
16
|
@key id: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
@doc("Complex type to represent an identity principal by id, when a human-readable name is also useful.")
|
|
20
|
-
@complex
|
|
21
|
-
@open
|
|
22
|
-
model identity {
|
|
23
|
-
id: string;
|
|
24
|
-
displayName: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@doc("Complex type to represent a group of identity principals used at a point in time, such as createdBy, lastModifiedBy.")
|
|
28
|
-
@complex
|
|
29
|
-
@open
|
|
30
|
-
model identitySet {
|
|
31
|
-
user: identity | null;
|
|
32
|
-
device: identity | null;
|
|
33
|
-
application: identity | null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@doc("Enum for identifying the format of a text string.")
|
|
37
|
-
enum bodyType {
|
|
38
|
-
text,
|
|
39
|
-
html
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@doc("Complex type to represent a chunk of text that could be either plain text or html.")
|
|
43
|
-
@complex
|
|
44
|
-
model itemBody {
|
|
45
|
-
contentType: bodyType;
|
|
46
|
-
content: string;
|
|
47
|
-
}
|
|
48
19
|
|
|
49
20
|
@doc("Scalar type for URLs that would be expected to work in the browser address bar.")
|
|
50
21
|
scalar webUrl extends string;
|
|
@@ -52,24 +23,3 @@ namespace MsGraph.SharedModels;
|
|
|
52
23
|
@doc("Scalar type for URLs that represent Graph APIs.")
|
|
53
24
|
scalar url extends string;
|
|
54
25
|
|
|
55
|
-
@doc("Complex type to represent a nested error that potentially has other recursive nested errors.")
|
|
56
|
-
@complex
|
|
57
|
-
@open
|
|
58
|
-
model innerError {
|
|
59
|
-
code: string;
|
|
60
|
-
innererror: innerError | null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@doc("""
|
|
64
|
-
Complex type to represent a standard Microsoft Graph error.
|
|
65
|
-
{code}: The error code.
|
|
66
|
-
""")
|
|
67
|
-
@complex
|
|
68
|
-
@error
|
|
69
|
-
model publicError {
|
|
70
|
-
code: string;
|
|
71
|
-
message: string;
|
|
72
|
-
target: string | null;
|
|
73
|
-
innererror: innerError | null;
|
|
74
|
-
details: publicError[];
|
|
75
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/typespec-msgraph",
|
|
3
|
-
"version": "0.0.1-Preview.
|
|
3
|
+
"version": "0.0.1-Preview.15",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec for Microsoft Graph provides a description of the Microsoft Graph APIs. It is used for generating API description languages, client and service code, documentation, and other assets.",
|
|
6
6
|
"homepage": "https://github.com/microsoftgraph/typespec-msgraph",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@xmldom/xmldom": "~0.8.4",
|
|
56
|
-
"@typespec/compiler": "~0.
|
|
57
|
-
"@typespec/http": "~0.
|
|
56
|
+
"@typespec/compiler": "~0.52.0",
|
|
57
|
+
"@typespec/http": "~0.52.0",
|
|
58
58
|
"prettier": "~3.1.1",
|
|
59
59
|
"react-dom": "~18.2.0",
|
|
60
60
|
"react": "~18.2.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/node": "~18.11.9",
|
|
66
66
|
"@types/react": "~18.0.5",
|
|
67
67
|
"@types/react-reconciler": "~0.28.0",
|
|
68
|
-
"@typespec/eslint-config-typespec": "~0.
|
|
68
|
+
"@typespec/eslint-config-typespec": "~0.52.0",
|
|
69
69
|
"c8": "~8.0.1",
|
|
70
70
|
"eslint": "^8.49.0",
|
|
71
71
|
"mocha": "~10.2.0",
|