@autorest/codemodel
Version:
AutoRest code model library
67 lines • 3.21 kB
TypeScript
import { DeepPartial } from "@azure-tools/codegen";
import { ApiVersion } from "./api-version";
import { Aspect } from "./aspect";
import { Metadata } from "./metadata";
import { Parameter } from "./parameter";
import { Response } from "./response";
/** represents a single callable endpoint with a discrete set of inputs, and any number of output possibilities (responses or exceptions) */
export interface Operation extends Aspect {
/**
* Original Operation ID if present.
* This can be used to identify the original id of an operation before it is styled.
* THIS IS NOT the name of the operation that should be used in the generator. Use `.language.default.name` for this
*/
operationId?: string;
/** common parameters when there are multiple requests */
parameters?: Array<Parameter>;
/** a common filtered list of parameters that is (assumably) the actual method signature parameters */
signatureParameters?: Array<Parameter>;
/**
* Mapping of all the content types available for this operation to the coresponding request.
*/
requestMediaTypes?: Record<string, Request>;
/**
* List of headers that parameters should not handle as parameters but with special logic.
* See https://github.com/Azure/autorest/tree/main/packages/extensions/modelerfour for configuration `skip-special-headers` to exclude headers.
*/
specialHeaders?: string[];
/** the different possibilities to build the request. */
requests?: Array<Request>;
/** responses that indicate a successful call */
responses?: Array<Response>;
/** responses that indicate a failed call */
exceptions?: Array<Response>;
/** the apiVersion to use for a given profile name */
profile?: Record<string, ApiVersion>;
}
export interface Request extends Metadata {
/** the parameter inputs to the operation */
parameters?: Array<Parameter>;
/** a filtered list of parameters that is (assumably) the actual method signature parameters */
signatureParameters?: Array<Parameter>;
}
export declare class Request extends Metadata implements Request {
constructor(initializer?: DeepPartial<Request>);
addParameter(parameter: Parameter): Parameter;
updateSignatureParameters(): void;
}
export declare class Operation extends Aspect implements Operation {
constructor($key: string, description: string, initializer?: DeepPartial<Operation>);
/** add a request to the operation */
addRequest(request: Request): Request;
addParameter(parameter: Parameter): Parameter;
updateSignatureParameters(): void;
addResponse(response: Response): Response;
addException(exception: Response): Response;
addProfile(profileName: string, apiVersion: ApiVersion): this;
}
/** an operation group represents a container around set of operations */
export interface OperationGroup extends Metadata {
$key: string;
operations: Array<Operation>;
}
export declare class OperationGroup extends Metadata implements OperationGroup {
constructor(name: string, objectInitializer?: DeepPartial<OperationGroup>);
addOperation(operation: Operation): Operation;
}
//# sourceMappingURL=operation.d.ts.map