@typespec/rest 0.44.0-dev.6 → 0.44.0
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/resource.tsp +85 -11
- package/package.json +7 -8
package/lib/resource.tsp
CHANGED
|
@@ -59,6 +59,10 @@ model ResourceCollectionParameters<TResource extends object> {
|
|
|
59
59
|
@Private.validateHasKey(TResource)
|
|
60
60
|
@Private.validateIsError(TError)
|
|
61
61
|
interface ResourceRead<TResource extends object, TError> {
|
|
62
|
+
/**
|
|
63
|
+
* Gets an instance of the resource.
|
|
64
|
+
* @template TResource The resource model.
|
|
65
|
+
*/
|
|
62
66
|
@autoRoute
|
|
63
67
|
@doc("Gets an instance of the resource.")
|
|
64
68
|
@readsResource(TResource)
|
|
@@ -81,8 +85,13 @@ model ResourceCreatedResponse<T> {
|
|
|
81
85
|
* @template TError The error response.
|
|
82
86
|
*/
|
|
83
87
|
interface ResourceCreateOrReplace<TResource extends object, TError> {
|
|
88
|
+
/**
|
|
89
|
+
* Creates or replaces a instance of the resource.
|
|
90
|
+
* @template TResource The resource model to create or replace.
|
|
91
|
+
* @template TError The error response.
|
|
92
|
+
*/
|
|
84
93
|
@autoRoute
|
|
85
|
-
@doc("Creates or replaces
|
|
94
|
+
@doc("Creates or replaces an instance of the resource.")
|
|
86
95
|
@createsOrReplacesResource(TResource)
|
|
87
96
|
createOrReplace(
|
|
88
97
|
...ResourceParameters<TResource>,
|
|
@@ -104,8 +113,13 @@ model ResourceCreateOrUpdateModel<TResource extends object>
|
|
|
104
113
|
* @template TError The error response.
|
|
105
114
|
*/
|
|
106
115
|
interface ResourceCreateOrUpdate<TResource extends object, TError> {
|
|
116
|
+
/**
|
|
117
|
+
* Creates or update an instance of the resource.
|
|
118
|
+
* @template TResource The resource model to create or update.
|
|
119
|
+
* @template TError The error response.
|
|
120
|
+
*/
|
|
107
121
|
@autoRoute
|
|
108
|
-
@doc("Creates or update
|
|
122
|
+
@doc("Creates or update an instance of the resource.")
|
|
109
123
|
@createsOrUpdatesResource(TResource)
|
|
110
124
|
createOrUpdate(
|
|
111
125
|
...ResourceParameters<TResource>,
|
|
@@ -127,6 +141,11 @@ model ResourceCreateModel<TResource extends object>
|
|
|
127
141
|
* @template TError The error response.
|
|
128
142
|
*/
|
|
129
143
|
interface ResourceCreate<TResource extends object, TError> {
|
|
144
|
+
/**
|
|
145
|
+
* Creates a new instance of the resource.
|
|
146
|
+
* @template TResource The resource model to create.
|
|
147
|
+
* @template TError The error response.
|
|
148
|
+
*/
|
|
130
149
|
@autoRoute
|
|
131
150
|
@doc("Creates a new instance of the resource.")
|
|
132
151
|
@createsResource(TResource)
|
|
@@ -144,6 +163,11 @@ interface ResourceCreate<TResource extends object, TError> {
|
|
|
144
163
|
@Private.validateHasKey(TResource)
|
|
145
164
|
@Private.validateIsError(TError)
|
|
146
165
|
interface ResourceUpdate<TResource extends object, TError> {
|
|
166
|
+
/**
|
|
167
|
+
* Updates an existing instance of the resource.
|
|
168
|
+
* @template TResource The resource model to update.
|
|
169
|
+
* @template TError The error response.
|
|
170
|
+
*/
|
|
147
171
|
@autoRoute
|
|
148
172
|
@doc("Updates an existing instance of the resource.")
|
|
149
173
|
@updatesResource(TResource)
|
|
@@ -168,6 +192,11 @@ model ResourceDeletedResponse {
|
|
|
168
192
|
@Private.validateHasKey(TResource)
|
|
169
193
|
@Private.validateIsError(TError)
|
|
170
194
|
interface ResourceDelete<TResource extends object, TError> {
|
|
195
|
+
/**
|
|
196
|
+
* Deletes an existing instance of the resource.
|
|
197
|
+
* @template TResource The resource model to delete.
|
|
198
|
+
* @template TError The error response.
|
|
199
|
+
*/
|
|
171
200
|
@autoRoute
|
|
172
201
|
@doc("Deletes an existing instance of the resource.")
|
|
173
202
|
@deletesResource(TResource)
|
|
@@ -196,6 +225,11 @@ model CollectionWithNextLink<T extends object> {
|
|
|
196
225
|
* @template TError The error response.
|
|
197
226
|
*/
|
|
198
227
|
interface ResourceList<TResource extends object, TError> {
|
|
228
|
+
/**
|
|
229
|
+
* Lists all instances of the resource.
|
|
230
|
+
* @template TResource The resource model to list.
|
|
231
|
+
* @template TError The error response.
|
|
232
|
+
*/
|
|
199
233
|
@autoRoute
|
|
200
234
|
@doc("Lists all instances of the resource.")
|
|
201
235
|
@listsResource(TResource)
|
|
@@ -245,11 +279,16 @@ interface ResourceOperations<TResource extends object, TError>
|
|
|
245
279
|
@Private.validateHasKey(TResource)
|
|
246
280
|
@Private.validateIsError(TError)
|
|
247
281
|
interface SingletonResourceRead<TSingleton extends object, TResource extends object, TError> {
|
|
282
|
+
/**
|
|
283
|
+
* Gets the singleton resource.
|
|
284
|
+
* @template TSingleton The singleton resource model.
|
|
285
|
+
* @template TResource The resource model.
|
|
286
|
+
*/
|
|
248
287
|
@autoRoute
|
|
249
288
|
@doc("Gets the singleton resource.")
|
|
250
289
|
@segmentOf(TSingleton)
|
|
251
290
|
@readsResource(TSingleton)
|
|
252
|
-
|
|
291
|
+
get(...ResourceParameters<TResource>): TSingleton | TError;
|
|
253
292
|
}
|
|
254
293
|
|
|
255
294
|
/**
|
|
@@ -261,11 +300,16 @@ interface SingletonResourceRead<TSingleton extends object, TResource extends obj
|
|
|
261
300
|
@Private.validateHasKey(TResource)
|
|
262
301
|
@Private.validateIsError(TError)
|
|
263
302
|
interface SingletonResourceUpdate<TSingleton extends object, TResource extends object, TError> {
|
|
303
|
+
/**
|
|
304
|
+
* Updates the singleton resource.
|
|
305
|
+
* @template TSingleton The singleton resource model.
|
|
306
|
+
* @template TResource The resource model.
|
|
307
|
+
*/
|
|
264
308
|
@autoRoute
|
|
265
309
|
@doc("Updates the singleton resource.")
|
|
266
310
|
@segmentOf(TSingleton)
|
|
267
311
|
@updatesResource(TSingleton)
|
|
268
|
-
|
|
312
|
+
update(
|
|
269
313
|
...ResourceParameters<TResource>,
|
|
270
314
|
|
|
271
315
|
@body
|
|
@@ -292,10 +336,15 @@ interface SingletonResourceOperations<TSingleton extends object, TResource exten
|
|
|
292
336
|
@Private.validateHasKey(TResource)
|
|
293
337
|
@Private.validateIsError(TError)
|
|
294
338
|
interface ExtensionResourceRead<TExtension extends object, TResource extends object, TError> {
|
|
339
|
+
/**
|
|
340
|
+
* Gets an instance of the extension resource.
|
|
341
|
+
* @template TExtension The extension resource model.
|
|
342
|
+
* @template TResource The resource model.
|
|
343
|
+
*/
|
|
295
344
|
@autoRoute
|
|
296
345
|
@doc("Gets an instance of the extension resource.")
|
|
297
346
|
@readsResource(TExtension)
|
|
298
|
-
|
|
347
|
+
get(...ResourceParameters<TResource>, ...ResourceParameters<TExtension>): TExtension | TError;
|
|
299
348
|
}
|
|
300
349
|
|
|
301
350
|
/**
|
|
@@ -309,10 +358,15 @@ interface ExtensionResourceCreateOrUpdate<
|
|
|
309
358
|
TResource extends object,
|
|
310
359
|
TError
|
|
311
360
|
> {
|
|
361
|
+
/**
|
|
362
|
+
* Creates or update an instance of the extension resource.
|
|
363
|
+
* @template TExtension The extension resource model.
|
|
364
|
+
* @template TResource The resource model.
|
|
365
|
+
*/
|
|
312
366
|
@autoRoute
|
|
313
|
-
@doc("Creates or update
|
|
367
|
+
@doc("Creates or update an instance of the extension resource.")
|
|
314
368
|
@createsOrUpdatesResource(TExtension)
|
|
315
|
-
|
|
369
|
+
createOrUpdate(
|
|
316
370
|
...ResourceParameters<TResource>,
|
|
317
371
|
...ResourceParameters<TExtension>,
|
|
318
372
|
@body resource: ResourceCreateOrUpdateModel<TExtension>
|
|
@@ -326,10 +380,15 @@ interface ExtensionResourceCreateOrUpdate<
|
|
|
326
380
|
* @template TError The error response.
|
|
327
381
|
*/
|
|
328
382
|
interface ExtensionResourceCreate<TExtension extends object, TResource extends object, TError> {
|
|
383
|
+
/**
|
|
384
|
+
* Creates a new instance of the extension resource.
|
|
385
|
+
* @template TExtension The extension resource model.
|
|
386
|
+
* @template TResource The resource model.
|
|
387
|
+
*/
|
|
329
388
|
@autoRoute
|
|
330
389
|
@doc("Creates a new instance of the extension resource.")
|
|
331
390
|
@createsResource(TExtension)
|
|
332
|
-
|
|
391
|
+
create(
|
|
333
392
|
...ResourceParameters<TResource>,
|
|
334
393
|
@body resource: ResourceCreateModel<TExtension>
|
|
335
394
|
): TExtension | ResourceCreatedResponse<TExtension> | TError;
|
|
@@ -342,10 +401,15 @@ interface ExtensionResourceCreate<TExtension extends object, TResource extends o
|
|
|
342
401
|
* @template TError The error response.
|
|
343
402
|
*/
|
|
344
403
|
interface ExtensionResourceUpdate<TExtension extends object, TResource extends object, TError> {
|
|
404
|
+
/**
|
|
405
|
+
* Updates an existing instance of the extension resource.
|
|
406
|
+
* @template TExtension The extension resource model.
|
|
407
|
+
* @template TResource The resource model.
|
|
408
|
+
*/
|
|
345
409
|
@autoRoute
|
|
346
410
|
@doc("Updates an existing instance of the extension resource.")
|
|
347
411
|
@updatesResource(TExtension)
|
|
348
|
-
|
|
412
|
+
update(
|
|
349
413
|
...ResourceParameters<TResource>,
|
|
350
414
|
...ResourceParameters<TExtension>,
|
|
351
415
|
|
|
@@ -361,10 +425,15 @@ interface ExtensionResourceUpdate<TExtension extends object, TResource extends o
|
|
|
361
425
|
* @template TError The error response.
|
|
362
426
|
*/
|
|
363
427
|
interface ExtensionResourceDelete<TExtension extends object, TResource extends object, TError> {
|
|
428
|
+
/**
|
|
429
|
+
* Deletes an existing instance of the extension resource.
|
|
430
|
+
* @template TExtension The extension resource model.
|
|
431
|
+
* @template TResource The resource model.
|
|
432
|
+
*/
|
|
364
433
|
@autoRoute
|
|
365
434
|
@doc("Deletes an existing instance of the extension resource.")
|
|
366
435
|
@deletesResource(TExtension)
|
|
367
|
-
|
|
436
|
+
delete(
|
|
368
437
|
...ResourceParameters<TResource>,
|
|
369
438
|
...ResourceParameters<TExtension>
|
|
370
439
|
): ResourceDeletedResponse | TError;
|
|
@@ -377,10 +446,15 @@ interface ExtensionResourceDelete<TExtension extends object, TResource extends o
|
|
|
377
446
|
* @template TError The error response.
|
|
378
447
|
*/
|
|
379
448
|
interface ExtensionResourceList<TExtension extends object, TResource extends object, TError> {
|
|
449
|
+
/**
|
|
450
|
+
* Lists all instances of the extension resource.
|
|
451
|
+
* @template TExtension The extension resource model.
|
|
452
|
+
* @template TResource The resource model.
|
|
453
|
+
*/
|
|
380
454
|
@autoRoute
|
|
381
455
|
@doc("Lists all instances of the extension resource.")
|
|
382
456
|
@listsResource(TExtension)
|
|
383
|
-
|
|
457
|
+
list(
|
|
384
458
|
...ResourceParameters<TResource>,
|
|
385
459
|
...ResourceCollectionParameters<TExtension>
|
|
386
460
|
): CollectionWithNextLink<TExtension> | TError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/rest",
|
|
3
|
-
"version": "0.44.0
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec REST protocol binding",
|
|
6
6
|
"homepage": "https://microsoft.github.io/typespec",
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
"!dist/test/**"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@typespec/compiler": "
|
|
45
|
+
"@typespec/compiler": "~0.44.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/mocha": "~10.0.0",
|
|
49
49
|
"@types/node": "~18.11.9",
|
|
50
|
-
"@typespec/compiler": "
|
|
51
|
-
"@typespec/http": "
|
|
52
|
-
"@typespec/eslint-config-typespec": "
|
|
53
|
-
"@typespec/library-linter": "
|
|
54
|
-
"@typespec/eslint-plugin": "
|
|
50
|
+
"@typespec/compiler": "~0.44.0",
|
|
51
|
+
"@typespec/http": "~0.44.0",
|
|
52
|
+
"@typespec/eslint-config-typespec": "~0.7.0",
|
|
53
|
+
"@typespec/library-linter": "~0.44.0",
|
|
54
|
+
"@typespec/eslint-plugin": "~0.44.0",
|
|
55
55
|
"eslint": "^8.36.0",
|
|
56
56
|
"mocha": "~10.2.0",
|
|
57
57
|
"mocha-junit-reporter": "~2.2.0",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"rimraf": "~5.0.0",
|
|
61
61
|
"typescript": "~5.0.2"
|
|
62
62
|
},
|
|
63
|
-
"dependencies": {},
|
|
64
63
|
"scripts": {
|
|
65
64
|
"clean": "rimraf ./dist ./temp",
|
|
66
65
|
"build": "tsc -p . && npm run lint-typespec-library",
|