import * as coreClient from "@azure/core-client" ; import * as Parameters from "./models/parameters" ; import * as Mappers from "./models/mappers" ; import { PetStoreOptionalParams , AddPetUsingByteArray$binaryOptionalParams , AddPetUsingByteArray$xmlOptionalParams , AddPetOptionalParams , UpdatePetOptionalParams , FindPetsByStatusOptionalParams , FindPetsByStatusResponse , FindPetsByTagsOptionalParams , FindPetsByTagsResponse , FindPetsWithByteArrayOptionalParams , FindPetsWithByteArrayResponse , GetPetByIdOptionalParams , GetPetByIdResponse , UpdatePetWithFormOptionalParams , DeletePetOptionalParams , UploadFileOptionalParams , GetInventoryOptionalParams , GetInventoryResponse , PlaceOrderOptionalParams , PlaceOrderResponse , GetOrderByIdOptionalParams , GetOrderByIdResponse , DeleteOrderOptionalParams , CreateUserOptionalParams , CreateUsersWithArrayInputOptionalParams , CreateUsersWithListInputOptionalParams , LoginUserOptionalParams , LoginUserResponse , LogoutUserOptionalParams , GetUserByNameOptionalParams , GetUserByNameResponse , UpdateUserOptionalParams , DeleteUserOptionalParams } from "./models" ; export class PetStore extends coreClient . ServiceClient { $host : string ; param options constructor ( options ? ) { if ( ! options ) { options = { } ; } const defaults = { requestContentType : "application/json; charset=utf-8" } ; const packageDetails = `azsdk-js-petstore/1.0.0-preview1` ; const userAgentPrefix = options . userAgentOptions && options . userAgentOptions . userAgentPrefix ? `${ options . userAgentOptions . userAgentPrefix } ${ packageDetails }` : `${ packageDetails }` ; const optionsWithDefaults = { ... defaults , ... options , userAgentOptions : { userAgentPrefix } , baseUri : options . endpoint || "http://petstore.swagger.io/v2" } ; super ( optionsWithDefaults ) ; this . $host = options . $host || "http://petstore.swagger.io/v2" ; } param contentType param options addPetUsingByteArray ( contentType , options ? ) ; param contentType param options addPetUsingByteArray ( contentType , options ? ) ; param args addPetUsingByteArray ( ... args ) { let operationSpec ; let operationArguments ; let options ; if ( args [ 0 ] === "application/json" ) { operationSpec = addPetUsingByteArray$binaryOperationSpec ; operationArguments = { contentType : args [ 0 ] , options : args [ 1 ] } ; options = args [ 1 ] ; } else if ( args [ 0 ] === "application/xml" ) { operationSpec = addPetUsingByteArray$xmlOperationSpec ; operationArguments = { contentType : args [ 0 ] , options : args [ 1 ] } ; options = args [ 1 ] ; } else { throw new TypeError ( `"contentType" must be a valid value but instead was "${ args [ 0 ] }".` ) ; } operationArguments . options = options || { } ; return this . sendOperationRequest ( operationArguments , operationSpec ) ; } param options addPet ( options ? ) { return this . sendOperationRequest ( { options } , addPetOperationSpec ) ; } param options updatePet ( options ? ) { return this . sendOperationRequest ( { options } , updatePetOperationSpec ) ; } param options findPetsByStatus ( options ? ) { return this . sendOperationRequest ( { options } , findPetsByStatusOperationSpec ) ; } param options findPetsByTags ( options ? ) { return this . sendOperationRequest ( { options } , findPetsByTagsOperationSpec ) ; } param petId param options findPetsWithByteArray ( petId , options ? ) { return this . sendOperationRequest ( { petId , options } , findPetsWithByteArrayOperationSpec ) ; } param petId param options getPetById ( petId , options ? ) { return this . sendOperationRequest ( { petId , options } , getPetByIdOperationSpec ) ; } param petId param options updatePetWithForm ( petId , options ? ) { return this . sendOperationRequest ( { petId , options } , updatePetWithFormOperationSpec ) ; } param petId param options deletePet ( petId , options ? ) { return this . sendOperationRequest ( { petId , options } , deletePetOperationSpec ) ; } param petId param options uploadFile ( petId , options ? ) { return this . sendOperationRequest ( { petId , options } , uploadFileOperationSpec ) ; } param options getInventory ( options ? ) { return this . sendOperationRequest ( { options } , getInventoryOperationSpec ) ; } param options placeOrder ( options ? ) { return this . sendOperationRequest ( { options } , placeOrderOperationSpec ) ; } param orderId param options getOrderById ( orderId , options ? ) { return this . sendOperationRequest ( { orderId , options } , getOrderByIdOperationSpec ) ; } param orderId param options deleteOrder ( orderId , options ? ) { return this . sendOperationRequest ( { orderId , options } , deleteOrderOperationSpec ) ; } param options createUser ( options ? ) { return this . sendOperationRequest ( { options } , createUserOperationSpec ) ; } param options createUsersWithArrayInput ( options ? ) { return this . sendOperationRequest ( { options } , createUsersWithArrayInputOperationSpec ) ; } param options createUsersWithListInput ( options ? ) { return this . sendOperationRequest ( { options } , createUsersWithListInputOperationSpec ) ; } param options loginUser ( options ? ) { return this . sendOperationRequest ( { options } , loginUserOperationSpec ) ; } param options logoutUser ( options ? ) { return this . sendOperationRequest ( { options } , logoutUserOperationSpec ) ; } param username param options getUserByName ( username , options ? ) { return this . sendOperationRequest ( { username , options } , getUserByNameOperationSpec ) ; } param username param options updateUser ( username , options ? ) { return this . sendOperationRequest ( { username , options } , updateUserOperationSpec ) ; } param username param options deleteUser ( username , options ? ) { return this . sendOperationRequest ( { username , options } , deleteUserOperationSpec ) ; } } const xmlSerializer = coreClient . createSerializer ( Mappers , true ) ; const serializer = coreClient . createSerializer ( Mappers , false ) ; const addPetUsingByteArray$binaryOperationSpec = { path : "/pet" , httpMethod : "POST" , responses : { 405 : { } } , requestBody : Parameters . body , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType ] , isXML : true , contentType : "application/xml; charset=utf-8" , mediaType : "binary" , serializer : xmlSerializer } ; const addPetUsingByteArray$xmlOperationSpec = { path : "/pet" , httpMethod : "POST" , responses : { 405 : { } } , requestBody : Parameters . body1 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType1 ] , isXML : true , contentType : "application/xml; charset=utf-8" , mediaType : "xml" , serializer : xmlSerializer } ; const addPetOperationSpec = { path : "/pet" , httpMethod : "POST" , responses : { 405 : { } } , requestBody : Parameters . body2 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType2 ] , mediaType : "json" , serializer } ; const updatePetOperationSpec = { path : "/pet" , httpMethod : "PUT" , responses : { 400 : { } , 404 : { } , 405 : { } } , requestBody : Parameters . body2 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType2 ] , mediaType : "json" , serializer } ; const findPetsByStatusOperationSpec = { path : "/pet/findByStatus" , httpMethod : "GET" , responses : { 200 : { bodyMapper : { type : { name : "Sequence" , element : { type : { name : "Composite" , className : "Pet" } } } , serializedName : "ArrayOfPet" , xmlElementName : "Pet" } } , 400 : { } } , queryParameters : [ Parameters . status ] , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , isXML : true , serializer : xmlSerializer } ; const findPetsByTagsOperationSpec = { path : "/pet/findByTags" , httpMethod : "GET" , responses : { 200 : { bodyMapper : { type : { name : "Sequence" , element : { type : { name : "Composite" , className : "Pet" } } } , serializedName : "ArrayOfPet" , xmlElementName : "Pet" } } , 400 : { } } , queryParameters : [ Parameters . tags ] , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , isXML : true , serializer : xmlSerializer } ; const findPetsWithByteArrayOperationSpec = { path : "/pet/{petId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : { type : { name : "Stream" } , serializedName : "parsedResponse" } } , 400 : { } , 404 : { } } , urlParameters : [ Parameters . $host , Parameters . petId ] , headerParameters : [ Parameters . accept ] , serializer } ; const getPetByIdOperationSpec = { path : "/pet/{petId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Pet } , 400 : { } , 404 : { } } , urlParameters : [ Parameters . $host , Parameters . petId ] , headerParameters : [ Parameters . accept ] , isXML : true , serializer : xmlSerializer } ; const updatePetWithFormOperationSpec = { path : "/pet/{petId}" , httpMethod : "POST" , responses : { 405 : { } } , formDataParameters : [ Parameters . name , Parameters . status1 ] , urlParameters : [ Parameters . $host , Parameters . petId1 ] , headerParameters : [ Parameters . contentType3 ] , serializer } ; const deletePetOperationSpec = { path : "/pet/{petId}" , httpMethod : "DELETE" , responses : { 400 : { } } , urlParameters : [ Parameters . $host , Parameters . petId ] , headerParameters : [ Parameters . apiKey ] , serializer } ; const uploadFileOperationSpec = { path : "/pet/{petId}/uploadImage" , httpMethod : "POST" , responses : { default : { } } , formDataParameters : [ Parameters . additionalMetadata , Parameters . file ] , urlParameters : [ Parameters . $host , Parameters . petId ] , headerParameters : [ Parameters . contentType4 ] , serializer } ; const getInventoryOperationSpec = { path : "/store/inventory" , httpMethod : "GET" , responses : { 200 : { bodyMapper : { type : { name : "Dictionary" , value : { type : { name : "Number" } } } , serializedName : "DictionaryOfInteger" } } } , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , isXML : true , serializer : xmlSerializer } ; const placeOrderOperationSpec = { path : "/store/order" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . Order } , 400 : { } } , requestBody : Parameters . body3 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType2 , Parameters . accept ] , mediaType : "json" , serializer } ; const getOrderByIdOperationSpec = { path : "/store/order/{orderId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Order } , 400 : { } , 404 : { } } , urlParameters : [ Parameters . $host , Parameters . orderId ] , headerParameters : [ Parameters . accept ] , isXML : true , serializer : xmlSerializer } ; const deleteOrderOperationSpec = { path : "/store/order/{orderId}" , httpMethod : "DELETE" , responses : { 400 : { } , 404 : { } } , urlParameters : [ Parameters . $host , Parameters . orderId ] , serializer } ; const createUserOperationSpec = { path : "/user" , httpMethod : "POST" , responses : { default : { } } , requestBody : Parameters . body4 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType2 ] , mediaType : "json" , serializer } ; const createUsersWithArrayInputOperationSpec = { path : "/user/createWithArray" , httpMethod : "POST" , responses : { default : { } } , requestBody : Parameters . body5 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType2 ] , mediaType : "json" , serializer } ; const createUsersWithListInputOperationSpec = { path : "/user/createWithList" , httpMethod : "POST" , responses : { default : { } } , requestBody : Parameters . body5 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType2 ] , mediaType : "json" , serializer } ; const loginUserOperationSpec = { path : "/user/login" , httpMethod : "GET" , responses : { 200 : { bodyMapper : { type : { name : "String" } , serializedName : "String" } } , 400 : { } } , queryParameters : [ Parameters . username , Parameters . password ] , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , isXML : true , serializer : xmlSerializer } ; const logoutUserOperationSpec = { path : "/user/logout" , httpMethod : "GET" , responses : { default : { } } , urlParameters : [ Parameters . $host ] , serializer } ; const getUserByNameOperationSpec = { path : "/user/{username}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . User } , 400 : { } , 404 : { } } , urlParameters : [ Parameters . $host , Parameters . username1 ] , headerParameters : [ Parameters . accept ] , isXML : true , serializer : xmlSerializer } ; const updateUserOperationSpec = { path : "/user/{username}" , httpMethod : "PUT" , responses : { 400 : { } , 404 : { } } , requestBody : Parameters . body4 , urlParameters : [ Parameters . $host , Parameters . username1 ] , headerParameters : [ Parameters . contentType2 ] , mediaType : "json" , serializer } ; const deleteUserOperationSpec = { path : "/user/{username}" , httpMethod : "DELETE" , responses : { 400 : { } , 404 : { } } , urlParameters : [ Parameters . $host , Parameters . username1 ] , serializer } ;