@typespec/rest
Advanced tools
Comparing version
@@ -66,2 +66,8 @@ import { DecoratorContext, Interface, Model, ModelProperty, Operation, Program, Scalar, Type } from "@typespec/compiler"; | ||
export declare function $listsResource(context: DecoratorContext, entity: Operation, resourceType: Model): void; | ||
/** | ||
* Returns `true` if the given operation is marked as a list operation. | ||
* @param program the TypeSpec program | ||
* @param target the target operation | ||
*/ | ||
export declare function isListOperation(program: Program, target: Operation): boolean; | ||
export declare function $actionSegment(context: DecoratorContext, entity: Operation, name: string): void; | ||
@@ -68,0 +74,0 @@ export declare function getActionSegment(program: Program, entity: Type): string | undefined; |
@@ -1,2 +0,2 @@ | ||
import { $list, createDiagnosticCollector, setTypeSpecNamespace, } from "@typespec/compiler"; | ||
import { createDiagnosticCollector, setTypeSpecNamespace, } from "@typespec/compiler"; | ||
import { DefaultRouteProducer, getOperationParameters, getOperationVerb, getRoutePath, getRouteProducer, setRouteProducer, } from "@typespec/http"; | ||
@@ -264,4 +264,2 @@ import { createStateSymbol, reportDiagnostic } from "./lib.js"; | ||
export function $listsResource(context, entity, resourceType) { | ||
// Add the @list decorator too so that collection routes are generated correctly | ||
context.call($list, entity, resourceType); | ||
// Add path segment for resource type key | ||
@@ -271,2 +269,12 @@ context.call($segmentOf, entity, resourceType); | ||
} | ||
/** | ||
* Returns `true` if the given operation is marked as a list operation. | ||
* @param program the TypeSpec program | ||
* @param target the target operation | ||
*/ | ||
export function isListOperation(program, target) { | ||
var _a; | ||
// Is the given operation a `list` operation? | ||
return ((_a = getResourceOperation(program, target)) === null || _a === void 0 ? void 0 : _a.operation) === "list"; | ||
} | ||
function lowerCaseFirstChar(str) { | ||
@@ -273,0 +281,0 @@ return str[0].toLocaleLowerCase() + str.substring(1); |
{ | ||
"name": "@typespec/rest", | ||
"version": "0.46.0-dev.6", | ||
"version": "0.46.0-dev.7", | ||
"author": "Microsoft Corporation", | ||
@@ -5,0 +5,0 @@ "description": "TypeSpec REST protocol binding", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
109340
0.61%929
1.53%