import { createSpan } from "../tracing" ; import { Polymorphism } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as coreTracing from "@azure/core-tracing" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { BodyComplexWithTracing } from "../bodyComplexWithTracing" ; import { PolymorphismGetValidOptionalParams , PolymorphismGetValidResponse , FishUnion , PolymorphismPutValidOptionalParams , PolymorphismGetDotSyntaxOptionalParams , PolymorphismGetDotSyntaxResponse , PolymorphismGetComposedWithDiscriminatorOptionalParams , PolymorphismGetComposedWithDiscriminatorResponse , PolymorphismGetComposedWithoutDiscriminatorOptionalParams , PolymorphismGetComposedWithoutDiscriminatorResponse , PolymorphismGetComplicatedOptionalParams , PolymorphismGetComplicatedResponse , SalmonUnion , PolymorphismPutComplicatedOptionalParams , PolymorphismPutMissingDiscriminatorOptionalParams , PolymorphismPutMissingDiscriminatorResponse , PolymorphismPutValidMissingRequiredOptionalParams } from "../models" ; /** Class containing Polymorphism operations. */ export class PolymorphismImpl implements Polymorphism { private readonly client : BodyComplexWithTracing ; param client constructor ( client ) { this . client = client ; } param options async getValid ( options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-getValid" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { options } , getValidOperationSpec ) ; return result as PolymorphismGetValidResponse ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } param complexBody param options async putValid ( complexBody , options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-putValid" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { complexBody , options } , putValidOperationSpec ) ; return result as void ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } param options async getDotSyntax ( options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-getDotSyntax" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { options } , getDotSyntaxOperationSpec ) ; return result as PolymorphismGetDotSyntaxResponse ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } param options async getComposedWithDiscriminator ( options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-getComposedWithDiscriminator" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { options } , getComposedWithDiscriminatorOperationSpec ) ; return result as PolymorphismGetComposedWithDiscriminatorResponse ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } param options async getComposedWithoutDiscriminator ( options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-getComposedWithoutDiscriminator" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { options } , getComposedWithoutDiscriminatorOperationSpec ) ; return result as PolymorphismGetComposedWithoutDiscriminatorResponse ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } param options async getComplicated ( options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-getComplicated" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { options } , getComplicatedOperationSpec ) ; return result as PolymorphismGetComplicatedResponse ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } param complexBody param options async putComplicated ( complexBody , options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-putComplicated" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { complexBody , options } , putComplicatedOperationSpec ) ; return result as void ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } param complexBody param options async putMissingDiscriminator ( complexBody , options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-putMissingDiscriminator" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { complexBody , options } , putMissingDiscriminatorOperationSpec ) ; return result as PolymorphismPutMissingDiscriminatorResponse ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } param complexBody param options async putValidMissingRequired ( complexBody , options ? ) { const { span } = createSpan ( "BodyComplexWithTracing-putValidMissingRequired" , options || { } ) ; try { const result = await this . client . sendOperationRequest ( { complexBody , options } , putValidMissingRequiredOperationSpec ) ; return result as void ; } catch ( error ) { span . setStatus ( { code : coreTracing . SpanStatusCode . UNSET , message : error . message } ) ; throw error ; } finally { span . end ( ) ; } } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const getValidOperationSpec = { path : "/complex/polymorphism/valid" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Fish } , default : { bodyMapper : Mappers . ErrorModel } } , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , serializer } ; const putValidOperationSpec = { path : "/complex/polymorphism/valid" , httpMethod : "PUT" , responses : { 200 : { } , default : { bodyMapper : Mappers . ErrorModel } } , requestBody : Parameters . complexBody15 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const getDotSyntaxOperationSpec = { path : "/complex/polymorphism/dotsyntax" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DotFish } , default : { bodyMapper : Mappers . ErrorModel } } , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , serializer } ; const getComposedWithDiscriminatorOperationSpec = { path : "/complex/polymorphism/composedWithDiscriminator" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DotFishMarket } , default : { bodyMapper : Mappers . ErrorModel } } , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , serializer } ; const getComposedWithoutDiscriminatorOperationSpec = { path : "/complex/polymorphism/composedWithoutDiscriminator" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DotFishMarket } , default : { bodyMapper : Mappers . ErrorModel } } , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , serializer } ; const getComplicatedOperationSpec = { path : "/complex/polymorphism/complicated" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Salmon } , default : { bodyMapper : Mappers . ErrorModel } } , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , serializer } ; const putComplicatedOperationSpec = { path : "/complex/polymorphism/complicated" , httpMethod : "PUT" , responses : { 200 : { } , default : { bodyMapper : Mappers . ErrorModel } } , requestBody : Parameters . complexBody16 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const putMissingDiscriminatorOperationSpec = { path : "/complex/polymorphism/missingdiscriminator" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . Salmon } , default : { bodyMapper : Mappers . ErrorModel } } , requestBody : Parameters . complexBody16 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const putValidMissingRequiredOperationSpec = { path : "/complex/polymorphism/missingrequired/invalid" , httpMethod : "PUT" , responses : { 200 : { } , default : { bodyMapper : Mappers . ErrorModel } } , requestBody : Parameters . complexBody15 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ;