UNPKG

@autorest/powershell

Version:
40 lines 3.04 kB
import { KnownMediaType } from '@azure-tools/codemodel-v3'; import { Expression, ExpressionOrLiteral } from '@azure-tools/codegen-csharp'; import { OneOrMoreStatements } from '@azure-tools/codegen-csharp'; import { TypeDeclaration } from '@azure-tools/codegen-csharp'; import { Variable } from '@azure-tools/codegen-csharp'; import { Schema as NewSchema } from '@autorest/codemodel'; /** A TypeDeclaration that can assist in generating code for a variety of serialization, validation and other common use cases */ export interface EnhancedTypeDeclaration extends TypeDeclaration { /** emits an expression to deserialize a property from a member inside a container */ deserializeFromContainerMember(mediaType: KnownMediaType, container: ExpressionOrLiteral, serializedName: string, defaultValue: Expression): Expression; /** emits an expression to deserialze a container as the value itself. */ deserializeFromNode(mediaType: KnownMediaType, node: ExpressionOrLiteral, defaultValue: Expression): Expression; /** emits an expression to deserialize content from a string */ deserializeFromString(mediaType: KnownMediaType, content: ExpressionOrLiteral, defaultValue: Expression): Expression | undefined; /** emits an expression to deserialize content from a content/response */ deserializeFromResponse(mediaType: KnownMediaType, content: ExpressionOrLiteral, defaultValue: Expression): Expression | undefined; /** emits an expression to deserialize content from a content/response */ deserializeFromResponse(mediaType: KnownMediaType, content: ExpressionOrLiteral, defaultValue: Expression): Expression | undefined; /** emits an expression serialize this to the value required by the container */ serializeToNode(mediaType: KnownMediaType, value: ExpressionOrLiteral, serializedName: string, mode: Expression): Expression; /** emits an expression serialize this to a HttpContent */ serializeToContent(mediaType: KnownMediaType, value: ExpressionOrLiteral, mode: Expression): Expression; /** emits the code required to serialize this into a container */ serializeToContainerMember(mediaType: KnownMediaType, value: ExpressionOrLiteral, container: Variable, serializedName: string, mode: Expression): OneOrMoreStatements; /** defaultOfType */ readonly defaultOfType: Expression; readonly convertObjectMethod: string; /** is a value for this required */ isRequired: boolean; /** when encoding as xml, is this encoded as an attribute */ isXmlAttribute: boolean; /** the underlying schema for this type declarartion. */ schema: NewSchema; isNullable: boolean; /** emits the code required to validate that this is set to a value */ validatePresence(eventListener: Variable, property: Variable): OneOrMoreStatements; /** emits the code required to validate that this has a permissable value */ validateValue(eventListener: Variable, property: Variable): OneOrMoreStatements; } //# sourceMappingURL=extended-type-declaration.d.ts.map