From 163fe93a76400a4201727db4bd093df5ff1279fc Mon Sep 17 00:00:00 2001 From: Darren Reid Date: Mon, 25 Nov 2024 14:55:31 +1100 Subject: [PATCH] Rename FileUpload to UploadFile to match other ServiceStack libraries. --- README.md | 4 +++ src/AndroidClient/android/build.gradle | 2 +- .../android/AndroidServiceClient.java | 20 +++++++-------- .../client/AsyncServiceClient.java | 13 +++++----- .../client/JsonServiceClient.java | 25 +++++++++---------- .../servicestack/client/ServiceClient.java | 12 ++++----- .../{FileUpload.java => UploadFile.java} | 10 ++++---- src/AndroidClient/client/build.gradle | 2 +- src/AndroidClient/client/pom.xml | 2 +- .../client/AsyncServiceClient.java | 13 +++++----- .../client/JsonServiceClient.java | 25 +++++++++---------- .../servicestack/client/ServiceClient.java | 12 ++++----- .../{FileUpload.java => UploadFile.java} | 10 ++++---- .../servicestack/client/AiServerTests.java | 6 ++--- .../client/JsonServiceClientTests.java | 14 ++++------- 15 files changed, 82 insertions(+), 88 deletions(-) rename src/AndroidClient/android/src/main/java/net/servicestack/client/{FileUpload.java => UploadFile.java} (66%) rename src/AndroidClient/client/src/main/java/net/servicestack/client/{FileUpload.java => UploadFile.java} (66%) diff --git a/README.md b/README.md index 43d620f..56bd769 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ for updates, or [StackOverflow](http://stackoverflow.com/questions/ask) or the [ This repository contains the source for ServiceStack plugins for the leading Android Studio, IntelliJ and Eclipse Java IDE's providing Java developers a highly productive development experience for consuming Typed ServiceStack Services by leveraging [Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/Add-ServiceStack-Reference) directly within their IDE! +### v1.1.5 Changes + +- Rename FileUpload to `UploadFile` to match other ServiceStack libraries + ### v1.1.4 Changes Added new ServiceClient APIs: diff --git a/src/AndroidClient/android/build.gradle b/src/AndroidClient/android/build.gradle index 6966607..2c37cd8 100644 --- a/src/AndroidClient/android/build.gradle +++ b/src/AndroidClient/android/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'maven-publish' apply plugin: 'signing' // Define the version and group for the Maven package -version = "1.1.4" +version = "1.1.5" group = "net.servicestack" if (project.hasProperty('versionSuffix')) { diff --git a/src/AndroidClient/android/src/main/java/net/servicestack/android/AndroidServiceClient.java b/src/AndroidClient/android/src/main/java/net/servicestack/android/AndroidServiceClient.java index a742f63..e12be4e 100644 --- a/src/AndroidClient/android/src/main/java/net/servicestack/android/AndroidServiceClient.java +++ b/src/AndroidClient/android/src/main/java/net/servicestack/android/AndroidServiceClient.java @@ -17,7 +17,7 @@ import net.servicestack.client.JsonServiceClient; import net.servicestack.client.Utils; import net.servicestack.cookies.SerializableCookieStore; -import net.servicestack.client.FileUpload; +import net.servicestack.client.UploadFile; import java.lang.reflect.Type; import java.net.CookieHandler; @@ -911,29 +911,29 @@ public void deleteAsync(String path, AsyncSuccess success) { } @Override - public void postFileWithRequestAsync(IReturn request, FileUpload file, final AsyncResult asyncResult) { - this.postFilesWithRequestAsync(this.apiUrl(request), request, new FileUpload[]{file}, request.getResponseType(), asyncResult); + public void postFileWithRequestAsync(IReturn request, UploadFile file, final AsyncResult asyncResult) { + this.postFilesWithRequestAsync(this.apiUrl(request), request, new UploadFile[]{file}, request.getResponseType(), asyncResult); } @Override - public void postFileWithRequestAsync(Object request, FileUpload file, Object responseType, final AsyncResult asyncResult) { - this.postFilesWithRequestAsync(this.apiUrl(request), request, new FileUpload[]{file}, responseType, asyncResult); + public void postFileWithRequestAsync(Object request, UploadFile file, Object responseType, final AsyncResult asyncResult) { + this.postFilesWithRequestAsync(this.apiUrl(request), request, new UploadFile[]{file}, responseType, asyncResult); } @Override - public void postFileWithRequestAsync(String path, Object request, FileUpload file, Object responseType, final AsyncResult asyncResult) { - this.postFilesWithRequestAsync(path, request, new FileUpload[]{file}, responseType, asyncResult); + public void postFileWithRequestAsync(String path, Object request, UploadFile file, Object responseType, final AsyncResult asyncResult) { + this.postFilesWithRequestAsync(path, request, new UploadFile[]{file}, responseType, asyncResult); } @Override - public void postFilesWithRequestAsync(IReturn request, FileUpload[] files, final AsyncResult asyncResult) { + public void postFilesWithRequestAsync(IReturn request, UploadFile[] files, final AsyncResult asyncResult) { this.postFilesWithRequestAsync(this.apiUrl(request), request, files, request.getResponseType(), asyncResult); } @Override - public void postFilesWithRequestAsync(Object request, FileUpload[] files, Object responseType, final AsyncResult asyncResult) { + public void postFilesWithRequestAsync(Object request, UploadFile[] files, Object responseType, final AsyncResult asyncResult) { this.postFilesWithRequestAsync(this.apiUrl(request), request, files, responseType, asyncResult); } @Override - public void postFilesWithRequestAsync(String path, Object request, FileUpload[] files, Object responseType, final AsyncResult asyncResult) { + public void postFilesWithRequestAsync(String path, Object request, UploadFile[] files, Object responseType, final AsyncResult asyncResult) { final AndroidServiceClient client = this; execTask(new AsyncTask() { @Override diff --git a/src/AndroidClient/android/src/main/java/net/servicestack/client/AsyncServiceClient.java b/src/AndroidClient/android/src/main/java/net/servicestack/client/AsyncServiceClient.java index 280da15..1817145 100644 --- a/src/AndroidClient/android/src/main/java/net/servicestack/client/AsyncServiceClient.java +++ b/src/AndroidClient/android/src/main/java/net/servicestack/client/AsyncServiceClient.java @@ -4,7 +4,6 @@ package net.servicestack.client; import java.lang.reflect.Type; -import java.net.HttpURLConnection; import java.util.Map; public interface AsyncServiceClient { @@ -79,11 +78,11 @@ public interface AsyncServiceClient { void deleteAsync(String path, final AsyncResult asyncResult); void deleteAsync(String path, final AsyncSuccess success); - void postFileWithRequestAsync(IReturn request, FileUpload file, final AsyncResult asyncResult); - void postFileWithRequestAsync(Object request, FileUpload file, Object responseType, final AsyncResult asyncResult); - void postFileWithRequestAsync(String path, Object request, FileUpload file, Object responseType, final AsyncResult asyncResult); + void postFileWithRequestAsync(IReturn request, UploadFile file, final AsyncResult asyncResult); + void postFileWithRequestAsync(Object request, UploadFile file, Object responseType, final AsyncResult asyncResult); + void postFileWithRequestAsync(String path, Object request, UploadFile file, Object responseType, final AsyncResult asyncResult); - void postFilesWithRequestAsync(IReturn request, FileUpload[] files, final AsyncResult asyncResult); - void postFilesWithRequestAsync(Object request, FileUpload[] files, Object responseType, final AsyncResult asyncResult); - void postFilesWithRequestAsync(String path, Object request, FileUpload[] files, Object responseType, final AsyncResult asyncResult); + void postFilesWithRequestAsync(IReturn request, UploadFile[] files, final AsyncResult asyncResult); + void postFilesWithRequestAsync(Object request, UploadFile[] files, Object responseType, final AsyncResult asyncResult); + void postFilesWithRequestAsync(String path, Object request, UploadFile[] files, Object responseType, final AsyncResult asyncResult); } diff --git a/src/AndroidClient/android/src/main/java/net/servicestack/client/JsonServiceClient.java b/src/AndroidClient/android/src/main/java/net/servicestack/client/JsonServiceClient.java index 671f5e7..2f66e74 100644 --- a/src/AndroidClient/android/src/main/java/net/servicestack/client/JsonServiceClient.java +++ b/src/AndroidClient/android/src/main/java/net/servicestack/client/JsonServiceClient.java @@ -21,7 +21,6 @@ import java.net.URLEncoder; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; -import java.nio.file.Paths; import java.util.Date; import java.util.List; import java.util.Map; @@ -685,31 +684,31 @@ public void clearCookies() { // Convenience method for single file upload @Override - public TResponse postFileWithRequest(IReturn request, FileUpload file) { - return postFilesWithRequest(this.apiUrl(request), request, new FileUpload[]{file}, request.getResponseType()); + public TResponse postFileWithRequest(IReturn request, UploadFile file) { + return postFilesWithRequest(this.apiUrl(request), request, new UploadFile[]{file}, request.getResponseType()); } @Override - public TResponse postFileWithRequest(Object request, FileUpload file, Object responseType) { - return postFilesWithRequest(this.apiUrl(request), request, new FileUpload[]{file}, responseType); + public TResponse postFileWithRequest(Object request, UploadFile file, Object responseType) { + return postFilesWithRequest(this.apiUrl(request), request, new UploadFile[]{file}, responseType); } @Override - public TResponse postFileWithRequest(String path, Object request, FileUpload file, Object responseType) { - return postFilesWithRequest(path, request, new FileUpload[]{file}, responseType); + public TResponse postFileWithRequest(String path, Object request, UploadFile file, Object responseType) { + return postFilesWithRequest(path, request, new UploadFile[]{file}, responseType); } @Override - public TResponse postFilesWithRequest(IReturn request, FileUpload[] files) { + public TResponse postFilesWithRequest(IReturn request, UploadFile[] files) { return this.postFilesWithRequest(this.apiUrl(request), request, files, request.getResponseType()); } @Override - public TResponse postFilesWithRequest(Object request, FileUpload[] files, Object responseType) { + public TResponse postFilesWithRequest(Object request, UploadFile[] files, Object responseType) { return this.postFilesWithRequest(this.apiUrl(request), request, files, responseType); } private static final String BOUNDARY = "---" + UUID.randomUUID().toString() + "---"; @Override - public TResponse postFilesWithRequest(String path, Object request, FileUpload[] files, Object responseType) { + public TResponse postFilesWithRequest(String path, Object request, UploadFile[] files, Object responseType) { try { // Prepare multipart data ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -724,7 +723,7 @@ public TResponse postFilesWithRequest(String path, Object request, F } // Add files - for (FileUpload file : files) { + for (UploadFile file : files) { writeMultipartFile(dos, file); } @@ -751,13 +750,13 @@ private void writeMultipartField(DataOutputStream dos, String fieldName, String dos.writeBytes(value + "\r\n"); } - private void writeMultipartFile(DataOutputStream dos, FileUpload file) throws IOException { + private void writeMultipartFile(DataOutputStream dos, UploadFile file) throws IOException { dos.writeBytes("--" + BOUNDARY + "\r\n"); dos.writeBytes("Content-Disposition: form-data; name=\"" + file.getFieldName() + "\"; filename=\"" + file.getFileName() + "\"\r\n"); dos.writeBytes("Content-Type: " + file.getContentType() + "\r\n"); dos.writeBytes("\r\n"); - dos.write(file.getFileBytes()); + dos.write(file.getContents()); dos.writeBytes("\r\n"); } } diff --git a/src/AndroidClient/android/src/main/java/net/servicestack/client/ServiceClient.java b/src/AndroidClient/android/src/main/java/net/servicestack/client/ServiceClient.java index dd8443c..e815946 100644 --- a/src/AndroidClient/android/src/main/java/net/servicestack/client/ServiceClient.java +++ b/src/AndroidClient/android/src/main/java/net/servicestack/client/ServiceClient.java @@ -61,11 +61,11 @@ public interface ServiceClient { String getTokenCookie(); String getRefreshTokenCookie(); - TResponse postFileWithRequest(IReturn request, FileUpload file); - TResponse postFileWithRequest(Object request, FileUpload file, Object responseType); - TResponse postFileWithRequest(String path, Object request, FileUpload file, Object responseType); + TResponse postFileWithRequest(IReturn request, UploadFile file); + TResponse postFileWithRequest(Object request, UploadFile file, Object responseType); + TResponse postFileWithRequest(String path, Object request, UploadFile file, Object responseType); - TResponse postFilesWithRequest(IReturn request, FileUpload[] files); - TResponse postFilesWithRequest(Object request, FileUpload[] files, Object responseType); - TResponse postFilesWithRequest(String path, Object request, FileUpload[] files, Object responseType); + TResponse postFilesWithRequest(IReturn request, UploadFile[] files); + TResponse postFilesWithRequest(Object request, UploadFile[] files, Object responseType); + TResponse postFilesWithRequest(String path, Object request, UploadFile[] files, Object responseType); } diff --git a/src/AndroidClient/android/src/main/java/net/servicestack/client/FileUpload.java b/src/AndroidClient/android/src/main/java/net/servicestack/client/UploadFile.java similarity index 66% rename from src/AndroidClient/android/src/main/java/net/servicestack/client/FileUpload.java rename to src/AndroidClient/android/src/main/java/net/servicestack/client/UploadFile.java index fd2bce8..c1f4638 100644 --- a/src/AndroidClient/android/src/main/java/net/servicestack/client/FileUpload.java +++ b/src/AndroidClient/android/src/main/java/net/servicestack/client/UploadFile.java @@ -1,20 +1,20 @@ package net.servicestack.client; -public class FileUpload { +public class UploadFile { private String fieldName; private String fileName; private String contentType; - private byte[] fileBytes; + private byte[] contents; - public FileUpload(String fieldName, String fileName, String contentType, byte[] fileBytes) { + public UploadFile(String fieldName, String fileName, String contentType, byte[] contents) { this.fieldName = fieldName; this.fileName = fileName; this.contentType = contentType != null ? contentType : "application/octet-stream"; - this.fileBytes = fileBytes; + this.contents = contents; } public String getFieldName() { return fieldName != null ? fieldName : "upload"; } public String getFileName() { return fileName; } public String getContentType() { return contentType; } - public byte[] getFileBytes() { return fileBytes; } + public byte[] getContents() { return contents; } } diff --git a/src/AndroidClient/client/build.gradle b/src/AndroidClient/client/build.gradle index dbeb8a0..dbaeb2b 100644 --- a/src/AndroidClient/client/build.gradle +++ b/src/AndroidClient/client/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'maven-publish' apply plugin: 'signing' // Define the version and group for the Maven package -version = "1.1.4" +version = "1.1.5" group = "net.servicestack" if (project.hasProperty('versionSuffix')) { diff --git a/src/AndroidClient/client/pom.xml b/src/AndroidClient/client/pom.xml index fec0241..b699d99 100644 --- a/src/AndroidClient/client/pom.xml +++ b/src/AndroidClient/client/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.servicestack client - 1.1.4 + 1.1.5 ServiceStack.Client A client library to call your ServiceStack webservices. https://github.com/ServiceStack/ServiceStack.Java diff --git a/src/AndroidClient/client/src/main/java/net/servicestack/client/AsyncServiceClient.java b/src/AndroidClient/client/src/main/java/net/servicestack/client/AsyncServiceClient.java index 280da15..1817145 100644 --- a/src/AndroidClient/client/src/main/java/net/servicestack/client/AsyncServiceClient.java +++ b/src/AndroidClient/client/src/main/java/net/servicestack/client/AsyncServiceClient.java @@ -4,7 +4,6 @@ package net.servicestack.client; import java.lang.reflect.Type; -import java.net.HttpURLConnection; import java.util.Map; public interface AsyncServiceClient { @@ -79,11 +78,11 @@ public interface AsyncServiceClient { void deleteAsync(String path, final AsyncResult asyncResult); void deleteAsync(String path, final AsyncSuccess success); - void postFileWithRequestAsync(IReturn request, FileUpload file, final AsyncResult asyncResult); - void postFileWithRequestAsync(Object request, FileUpload file, Object responseType, final AsyncResult asyncResult); - void postFileWithRequestAsync(String path, Object request, FileUpload file, Object responseType, final AsyncResult asyncResult); + void postFileWithRequestAsync(IReturn request, UploadFile file, final AsyncResult asyncResult); + void postFileWithRequestAsync(Object request, UploadFile file, Object responseType, final AsyncResult asyncResult); + void postFileWithRequestAsync(String path, Object request, UploadFile file, Object responseType, final AsyncResult asyncResult); - void postFilesWithRequestAsync(IReturn request, FileUpload[] files, final AsyncResult asyncResult); - void postFilesWithRequestAsync(Object request, FileUpload[] files, Object responseType, final AsyncResult asyncResult); - void postFilesWithRequestAsync(String path, Object request, FileUpload[] files, Object responseType, final AsyncResult asyncResult); + void postFilesWithRequestAsync(IReturn request, UploadFile[] files, final AsyncResult asyncResult); + void postFilesWithRequestAsync(Object request, UploadFile[] files, Object responseType, final AsyncResult asyncResult); + void postFilesWithRequestAsync(String path, Object request, UploadFile[] files, Object responseType, final AsyncResult asyncResult); } diff --git a/src/AndroidClient/client/src/main/java/net/servicestack/client/JsonServiceClient.java b/src/AndroidClient/client/src/main/java/net/servicestack/client/JsonServiceClient.java index 671f5e7..2f66e74 100644 --- a/src/AndroidClient/client/src/main/java/net/servicestack/client/JsonServiceClient.java +++ b/src/AndroidClient/client/src/main/java/net/servicestack/client/JsonServiceClient.java @@ -21,7 +21,6 @@ import java.net.URLEncoder; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; -import java.nio.file.Paths; import java.util.Date; import java.util.List; import java.util.Map; @@ -685,31 +684,31 @@ public void clearCookies() { // Convenience method for single file upload @Override - public TResponse postFileWithRequest(IReturn request, FileUpload file) { - return postFilesWithRequest(this.apiUrl(request), request, new FileUpload[]{file}, request.getResponseType()); + public TResponse postFileWithRequest(IReturn request, UploadFile file) { + return postFilesWithRequest(this.apiUrl(request), request, new UploadFile[]{file}, request.getResponseType()); } @Override - public TResponse postFileWithRequest(Object request, FileUpload file, Object responseType) { - return postFilesWithRequest(this.apiUrl(request), request, new FileUpload[]{file}, responseType); + public TResponse postFileWithRequest(Object request, UploadFile file, Object responseType) { + return postFilesWithRequest(this.apiUrl(request), request, new UploadFile[]{file}, responseType); } @Override - public TResponse postFileWithRequest(String path, Object request, FileUpload file, Object responseType) { - return postFilesWithRequest(path, request, new FileUpload[]{file}, responseType); + public TResponse postFileWithRequest(String path, Object request, UploadFile file, Object responseType) { + return postFilesWithRequest(path, request, new UploadFile[]{file}, responseType); } @Override - public TResponse postFilesWithRequest(IReturn request, FileUpload[] files) { + public TResponse postFilesWithRequest(IReturn request, UploadFile[] files) { return this.postFilesWithRequest(this.apiUrl(request), request, files, request.getResponseType()); } @Override - public TResponse postFilesWithRequest(Object request, FileUpload[] files, Object responseType) { + public TResponse postFilesWithRequest(Object request, UploadFile[] files, Object responseType) { return this.postFilesWithRequest(this.apiUrl(request), request, files, responseType); } private static final String BOUNDARY = "---" + UUID.randomUUID().toString() + "---"; @Override - public TResponse postFilesWithRequest(String path, Object request, FileUpload[] files, Object responseType) { + public TResponse postFilesWithRequest(String path, Object request, UploadFile[] files, Object responseType) { try { // Prepare multipart data ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -724,7 +723,7 @@ public TResponse postFilesWithRequest(String path, Object request, F } // Add files - for (FileUpload file : files) { + for (UploadFile file : files) { writeMultipartFile(dos, file); } @@ -751,13 +750,13 @@ private void writeMultipartField(DataOutputStream dos, String fieldName, String dos.writeBytes(value + "\r\n"); } - private void writeMultipartFile(DataOutputStream dos, FileUpload file) throws IOException { + private void writeMultipartFile(DataOutputStream dos, UploadFile file) throws IOException { dos.writeBytes("--" + BOUNDARY + "\r\n"); dos.writeBytes("Content-Disposition: form-data; name=\"" + file.getFieldName() + "\"; filename=\"" + file.getFileName() + "\"\r\n"); dos.writeBytes("Content-Type: " + file.getContentType() + "\r\n"); dos.writeBytes("\r\n"); - dos.write(file.getFileBytes()); + dos.write(file.getContents()); dos.writeBytes("\r\n"); } } diff --git a/src/AndroidClient/client/src/main/java/net/servicestack/client/ServiceClient.java b/src/AndroidClient/client/src/main/java/net/servicestack/client/ServiceClient.java index dd8443c..e815946 100644 --- a/src/AndroidClient/client/src/main/java/net/servicestack/client/ServiceClient.java +++ b/src/AndroidClient/client/src/main/java/net/servicestack/client/ServiceClient.java @@ -61,11 +61,11 @@ public interface ServiceClient { String getTokenCookie(); String getRefreshTokenCookie(); - TResponse postFileWithRequest(IReturn request, FileUpload file); - TResponse postFileWithRequest(Object request, FileUpload file, Object responseType); - TResponse postFileWithRequest(String path, Object request, FileUpload file, Object responseType); + TResponse postFileWithRequest(IReturn request, UploadFile file); + TResponse postFileWithRequest(Object request, UploadFile file, Object responseType); + TResponse postFileWithRequest(String path, Object request, UploadFile file, Object responseType); - TResponse postFilesWithRequest(IReturn request, FileUpload[] files); - TResponse postFilesWithRequest(Object request, FileUpload[] files, Object responseType); - TResponse postFilesWithRequest(String path, Object request, FileUpload[] files, Object responseType); + TResponse postFilesWithRequest(IReturn request, UploadFile[] files); + TResponse postFilesWithRequest(Object request, UploadFile[] files, Object responseType); + TResponse postFilesWithRequest(String path, Object request, UploadFile[] files, Object responseType); } diff --git a/src/AndroidClient/client/src/main/java/net/servicestack/client/FileUpload.java b/src/AndroidClient/client/src/main/java/net/servicestack/client/UploadFile.java similarity index 66% rename from src/AndroidClient/client/src/main/java/net/servicestack/client/FileUpload.java rename to src/AndroidClient/client/src/main/java/net/servicestack/client/UploadFile.java index fd2bce8..c1f4638 100644 --- a/src/AndroidClient/client/src/main/java/net/servicestack/client/FileUpload.java +++ b/src/AndroidClient/client/src/main/java/net/servicestack/client/UploadFile.java @@ -1,20 +1,20 @@ package net.servicestack.client; -public class FileUpload { +public class UploadFile { private String fieldName; private String fileName; private String contentType; - private byte[] fileBytes; + private byte[] contents; - public FileUpload(String fieldName, String fileName, String contentType, byte[] fileBytes) { + public UploadFile(String fieldName, String fileName, String contentType, byte[] contents) { this.fieldName = fieldName; this.fileName = fileName; this.contentType = contentType != null ? contentType : "application/octet-stream"; - this.fileBytes = fileBytes; + this.contents = contents; } public String getFieldName() { return fieldName != null ? fieldName : "upload"; } public String getFileName() { return fileName; } public String getContentType() { return contentType; } - public byte[] getFileBytes() { return fileBytes; } + public byte[] getContents() { return contents; } } diff --git a/src/AndroidClient/client/src/test/java/net/servicestack/client/AiServerTests.java b/src/AndroidClient/client/src/test/java/net/servicestack/client/AiServerTests.java index 52fdf42..eeb2ba9 100644 --- a/src/AndroidClient/client/src/test/java/net/servicestack/client/AiServerTests.java +++ b/src/AndroidClient/client/src/test/java/net/servicestack/client/AiServerTests.java @@ -3,10 +3,8 @@ import junit.framework.TestCase; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.nio.file.Files; -import java.util.List; import net.servicestack.openai.dtos.*; // You'll need to generate these DTOs @@ -54,7 +52,7 @@ public void test_Can_SpeechToText_with_File() throws IOException { byte[] fileBytes = Files.readAllBytes(audioFile.toPath()); // Create file upload - FileUpload upload = new FileUpload( + UploadFile upload = new UploadFile( "audio", // field name "test_audio.wav", // filename "audio/wav", // content type @@ -65,7 +63,7 @@ public void test_Can_SpeechToText_with_File() throws IOException { GenerationResponse response = client.postFilesWithRequest( "/api/SpeechToText", request, - new FileUpload[]{upload}, + new UploadFile[]{upload}, GenerationResponse.class ); diff --git a/src/AndroidClient/client/src/test/java/net/servicestack/client/JsonServiceClientTests.java b/src/AndroidClient/client/src/test/java/net/servicestack/client/JsonServiceClientTests.java index 51ec80d..5183e29 100644 --- a/src/AndroidClient/client/src/test/java/net/servicestack/client/JsonServiceClientTests.java +++ b/src/AndroidClient/client/src/test/java/net/servicestack/client/JsonServiceClientTests.java @@ -3,10 +3,7 @@ package net.servicestack.client; import junit.framework.TestCase; -import net.servicestack.client.ConnectionFilter; -import net.servicestack.client.JsonServiceClient; -import net.servicestack.client.WebServiceException; import net.servicestack.client.tests.TestDtos; import test.dtos.*; @@ -15,7 +12,6 @@ import java.util.Calendar; import java.util.Date; import java.util.List; -import java.util.Optional; public class JsonServiceClientTests extends TestCase { @@ -105,8 +101,8 @@ public void test_Can_Post_file_with_Request() { request.setRefId("zid"); byte[] fileBytes = "Hello World".getBytes(StandardCharsets.UTF_8); - FileUpload[] files = new FileUpload[]{ - new FileUpload( + UploadFile[] files = new UploadFile[]{ + new UploadFile( "audio", // fieldName "test.txt", // fileName "text/plain", // contentType @@ -143,14 +139,14 @@ public void test_Can_Post_Multiple_files_with_Request() { byte[] textFileBytes = "Hello World".getBytes(StandardCharsets.UTF_8); byte[] markdownFileBytes = "## Heading".getBytes(StandardCharsets.UTF_8); - FileUpload[] files = new FileUpload[]{ - new FileUpload( + UploadFile[] files = new UploadFile[]{ + new UploadFile( "audio", // fieldName "test.txt", // fileName "text/plain", // contentType textFileBytes // data ), - new FileUpload( + new UploadFile( "content", // fieldName "test.md", // fileName "text/markdown", // contentType