import { Formdata } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as coreRestPipeline from "@azure/core-rest-pipeline" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { BodyFormDataClient } from "../bodyFormDataClient" ; import { FormdataUploadFileOptionalParams , FormdataUploadFileResponse , FormdataUploadFileViaBodyOptionalParams , FormdataUploadFileViaBodyResponse , FormdataUploadFilesOptionalParams , FormdataUploadFilesResponse } from "../models" ; /** Class containing Formdata operations. */ export class FormdataImpl implements Formdata { private readonly client : BodyFormDataClient ; param client constructor ( client ) { this . client = client ; } param fileContent param fileName param options uploadFile ( fileContent , fileName , options ? ) { return this . client . sendOperationRequest ( { fileContent , fileName , options } , uploadFileOperationSpec ) ; } param fileContent param options uploadFileViaBody ( fileContent , options ? ) { return this . client . sendOperationRequest ( { fileContent , options } , uploadFileViaBodyOperationSpec ) ; } param fileContent param options uploadFiles ( fileContent , options ? ) { return this . client . sendOperationRequest ( { fileContent , options } , uploadFilesOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const uploadFileOperationSpec = { path : "/formdata/stream/uploadfile" , httpMethod : "POST" , responses : { 200 : { bodyMapper : { type : { name : "Stream" } , serializedName : "parsedResponse" } } , default : { bodyMapper : Mappers . ErrorModel } } , formDataParameters : [ Parameters . fileContent , Parameters . fileName ] , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , serializer } ; const uploadFileViaBodyOperationSpec = { path : "/formdata/stream/uploadfile" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : { type : { name : "Stream" } , serializedName : "parsedResponse" } } , default : { bodyMapper : Mappers . ErrorModel } } , requestBody : Parameters . fileContent1 , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType1 , Parameters . accept1 ] , mediaType : "binary" , serializer } ; const uploadFilesOperationSpec = { path : "/formdata/stream/uploadfiles" , httpMethod : "POST" , responses : { 200 : { bodyMapper : { type : { name : "Stream" } , serializedName : "parsedResponse" } } , default : { bodyMapper : Mappers . ErrorModel } } , formDataParameters : [ Parameters . fileContent2 ] , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , serializer } ;