/// <summary> /// Updates a pet in the store with form data /// </summary> /// <param name="api">The Api</param> /// <param name="petId">ID of pet that needs to be updated</param> /// <param name="name">Updated name of the pet</param> /// <param name="status">Updated status of the pet</param> public static Task UpdatePetWithFormAsync(this IPetStoreJsonApi api, long petId, string name, string status) { var form = new Dictionary <string, object> { { "name", name }, { "status", status } }; return(api.UpdatePetWithFormAsync(petId, form)); }
/// <summary> /// uploads an image /// </summary> /// <param name="api">The Api</param> /// <param name="petId">ID of pet to update</param> /// <param name="additionalMetadata">Additional data to pass to server</param> /// <param name="file">file to upload</param> public static Task <ApiResponse> UploadFileAsync(this IPetStoreJsonApi api, long petId, string additionalMetadata, System.IO.Stream file) { var content = new MultipartFormDataContent(); var fileContent = new StreamContent(file); content.Add(fileContent); var formUrlEncodedContent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("additionalMetadata", additionalMetadata.ToString()) }); content.Add(formUrlEncodedContent); return(api.UploadFileAsync(petId, content)); }