From d4ea74c238617d24f9c5242d8b52068c505a65c6 Mon Sep 17 00:00:00 2001 From: "Jose M. Palomar" Date: Tue, 22 Jun 2021 15:46:24 +0200 Subject: [PATCH 01/28] Change to close Response instances --- src/main/java/com/convertapi/client/ConvertApi.java | 8 +++----- src/main/java/com/convertapi/client/Http.java | 6 ++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/convertapi/client/ConvertApi.java b/src/main/java/com/convertapi/client/ConvertApi.java index 98dbcd3..c26c5c7 100644 --- a/src/main/java/com/convertapi/client/ConvertApi.java +++ b/src/main/java/com/convertapi/client/ConvertApi.java @@ -40,7 +40,7 @@ public static CompletableFuture convert(String fromFormat, Str .addPathSegment(toFormat); for (Param param : params) { - if (param.getName().toLowerCase().equals("converter")) { + if (param.getName().equalsIgnoreCase("converter")) { try { urlBuilder = urlBuilder .addPathSegment("converter") @@ -77,8 +77,7 @@ public static CompletableFuture convert(String fromFormat, Str .build(); String bodyString; - try { - Response response = Http.getClient(config).newCall(request).execute(); + try (Response response = Http.getClient(config).newCall(request).execute()) { //noinspection ConstantConditions bodyString = response.body().string(); if (response.code() != 200) { @@ -107,8 +106,7 @@ public static User getUser(Config config) { .build(); String bodyString; - try { - Response response = Http.getClient().newCall(request).execute(); + try (Response response = Http.getClient().newCall(request).execute()) { //noinspection ConstantConditions bodyString = response.body().string(); if (response.code() != 200) { diff --git a/src/main/java/com/convertapi/client/Http.java b/src/main/java/com/convertapi/client/Http.java index e8a9635..38c7aca 100644 --- a/src/main/java/com/convertapi/client/Http.java +++ b/src/main/java/com/convertapi/client/Http.java @@ -49,8 +49,7 @@ static CompletableFuture requestGet(String url) { static CompletableFuture requestDelete(String url) { return CompletableFuture.supplyAsync(() -> { Request request = getRequestBuilder().delete().url(url).build(); - try { - getClient().newCall(request).execute(); + try (Response response = getClient().newCall(request).execute()) { } catch (IOException e) { throw new RuntimeException(e); } @@ -76,8 +75,7 @@ static RemoteUploadResponse remoteUpload(String urlToFile, Config config) { .build(); String bodyString; - try { - Response response = Http.getClient().newCall(request).execute(); + try (Response response = Http.getClient().newCall(request).execute()) { //noinspection ConstantConditions bodyString = response.body().string(); if (response.code() != 200) { From aaae1810795635cf182733eb3fb7374b140c0f63 Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 29 Nov 2022 01:57:11 +0000 Subject: [PATCH 02/28] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e5c02e1..9e1c844 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ convertapi jar - 2.9 + 2.10-SNAPSHOT ConvertAPI Java Client The ConvertAPI helps converting various file formats. @@ -48,7 +48,7 @@ scm:git:git://github.com/ConvertAPI/convertapi-java.git scm:git:git@github.com:ConvertAPI/convertapi-java.git https://github.com/ConvertAPI/convertapi-java - v2.9 + HEAD From dac4743248ebd65e1fc34ab4476fe803fd3ef1be Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Tue, 29 Nov 2022 12:53:59 +0000 Subject: [PATCH 03/28] Increment version --- README.md | 2 +- examples/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3c3466d..322012e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add the following dependency to your pom.xml: com.convertapi.client convertapi - 2.8 + 2.9 ``` diff --git a/examples/pom.xml b/examples/pom.xml index 142c235..1880299 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -15,7 +15,7 @@ com.convertapi.client convertapi - 2.8 + 2.9 From efba7c9b29bbb0adc4b3235ab61b8dd884810f55 Mon Sep 17 00:00:00 2001 From: Jonas Jasas Date: Thu, 25 May 2023 09:32:27 +0300 Subject: [PATCH 04/28] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 322012e..8848355 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ CompletableFuture result = ConvertApi.convert("pptx", "pdf", #### Additional conversion parameters ConvertAPI accepts extra conversion parameters depending on converted formats. All conversion -parameters and explanations can be found [here](https://www.convertapi.com). +parameters and explanations can be found [here](https://www.convertapi.com/conversions). ```java CompletableFuture result = ConvertApi.convert("pdf", "jpg", From c1ca5e552150c5ae17dedc14f41867ca4a4adbf0 Mon Sep 17 00:00:00 2001 From: Jonas Jasas Date: Tue, 4 Jul 2023 14:51:20 +0300 Subject: [PATCH 05/28] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 8848355..9117312 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,14 @@ User user = ConvertApi.getUser(); int secondsLeft = user.SecondsLeft; ``` +### Alternative domain + +Create `Config` instance with the alternative domain and provide it in `convert` method. Dedicated to the region [domain list](https://www.convertapi.com/doc/servers-location). + +```java +Config config = new Config(secret, "https", "eu-v2.convertapi.com", 0, httpClientBuilder); +``` + ### More examples You can find more advanced examples in the [examples](https://github.com/ConvertAPI/convertapi-java/tree/master/examples/src/main/java/com/convertapi/examples) folder. From 4582c38034daa2756d5ae5d6d3b1ca99cb672da5 Mon Sep 17 00:00:00 2001 From: Jonas Jasas Date: Tue, 22 Aug 2023 14:48:32 +0300 Subject: [PATCH 06/28] Delete GETTING-STARTED.md --- GETTING-STARTED.md | 161 --------------------------------------------- 1 file changed, 161 deletions(-) delete mode 100644 GETTING-STARTED.md diff --git a/GETTING-STARTED.md b/GETTING-STARTED.md deleted file mode 100644 index 1bb8945..0000000 --- a/GETTING-STARTED.md +++ /dev/null @@ -1,161 +0,0 @@ -#### 1. Install the ConvertAPI library - -Go to the [ConvertAPI Java client](https://github.com/ConvertAPI/convertapi-java) page and download the JAR file. -Place JAR into your project library directory. - -The library is also available in Maven. -Add the following dependency to your pom.xml: -```xml - - com.convertapi.client - convertapi - 2.2 - -``` - -#### 2.a. Simple conversion methods - -```java -import com.convertapi.*; - -Config.setDefaultSecret("your-api-secret"); - -// Simplified file to file conversion example -ConvertApi.convertFile("test.docx", "/tmp/result.pdf"); - -// Simplified web site to pdf conversion example -ConvertApi.convertUrl("http://example.com", "/tmp/example.pdf"); - -// Simplified remote file to local file conversion example -ConvertApi.convertRemoteFile("https://cdn.convertapi.com/cara/testfiles/document.docx", "/tmp/demo.pdf"); -``` - - -#### 2.b. Convert a local file - -```java -import com.convertapi.*; - -Config.setDefaultSecret("your-api-secret"); - -//Set input and output formats and pass file parameter. -//Word to PDF API. Read more https://www.convertapi.com/docx-to-pdf -ConvertApi.convert("docx", "pdf", - new Param("file", Paths.get("test.docx")) -).get().saveFile(Paths.get("/tmp")).get(); -``` - - -#### 2.c. Convert a remote file and set additional parameters - -```java -import com.convertapi.*; - -Config.setDefaultSecret("your-api-secret"); - -//Set input and output formats and pass file parameter. -//PowerPoint to PNG API. Read more https://www.convertapi.com/pptx-to-png -ConvertApi.convert("pdf", "png", - new Param("file", "https://cdn.convertapi.com/cara/testfiles/presentation.pptx"), - new Param("scaleimage", "true"), - new Param("scaleproportions", "true"), - new Param("imageheight", 300) -).get().saveFile(Paths.get("/tmp")).get(); -``` - - -#### 2.d. Convert from a stream - -```java -import com.convertapi.*; - -Config.setDefaultSecret("your-api-secret"); - -// Create stream from HTML string -String streamContent = "

My First Heading

My first paragraph.

"; -InputStream stream = new ByteArrayInputStream(streamContent.getBytes()); - -// Html to PDF API. Read more https://www.convertapi.com/html-to-pdf -CompletableFuture result = ConvertApi.convert("html", "pdf", - new Param("file", stream, "test.html") -); - -// PDF as stream -InputStream resultStream = result.get().asStream().get(); -``` - - -#### 2.e. Conversions chaining - -```java -// Split PDF document and merge first and last pages to new PDF -import com.convertapi.*; - -Config.setDefaultSecret("your-api-secret"); - -// Set input and output formats and pass file parameter. -// Split PDF API. Read more https://www.convertapi.com/pdf-to-split -CompletableFuture splitResult = ConvertApi.convert("pdf", "split", - new Param("file", Paths.get("test.pdf")) -); - -// Get result of the first conversion and use it in Merge conversion. -// Chains are executed on server without moving files. -// Merge PDF API. Read more https://www.convertapi.com/pdf-to-merge -CompletableFuture mergeResult = ConvertApi.convert("pdf", "merge", - new Param("files", splitResult, 0), - new Param("files", splitResult, -1) -); - -mergeResult.get().saveFile(Paths.get("/tmp")).get(); -``` - - -#### 3. Read account status - -```java -import com.convertapi.*; -import com.convertapi.model.*; - -Config.setDefaultSecret("your-api-secret"); - -// Read full account data -User user = ConvertApi.getUser(); - -// Find out how much seconds left -int secondsLeft = user.SecondsLeft; -``` - - -#### 4. Exception handling (asynchronous) - -```java -import com.convertapi.*; - -Config.setDefaultSecret("your-api-secret"); - -// Creating an exception -CompletableFuture resultFuture = ConvertApi.convert("pdf", "pptx", - new Param("file", Paths.get("test-files/test.pdf")), - new Param("AutoRotate","WrongParameter") -).exceptionally(t -> { - // Handling and exception - System.out.println("Error message: " + t.getMessage()); - return null; -}); - -ConversionResult result = resultFuture.get(); -// Saving file if there was no exception -if (result != null) { - result.saveFile(Paths.get("/tmp")).get(); -} -``` - - -#### 5. Supported file formats, conversions and actions - -https://www.convertapi.com/doc/supported-formats - -#### 6. GitHub - -https://github.com/ConvertAPI/convertapi-java From 4717fe9c78d0610b5c7a915b57ad158fe5b41650 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Tue, 30 Jan 2024 00:52:44 +0000 Subject: [PATCH 07/28] Remove seconds left property --- README.md | 5 +++-- .../main/java/com/convertapi/examples/UserInformation.java | 3 ++- src/main/java/com/convertapi/client/model/User.java | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9117312..feb2fe4 100644 --- a/README.md +++ b/README.md @@ -82,11 +82,12 @@ CompletableFuture result = ConvertApi.convert("pdf", "jpg", ### User information -You can always check remaining seconds amount by fetching [user information](https://www.convertapi.com/doc/user). +You can always check the remaining conversions amount and other account information by fetching [user information](https://www.convertapi.com/doc/user). ```java User user = ConvertApi.getUser(); -int secondsLeft = user.SecondsLeft; +int conversionsTotal = user.ConversionsTotal; +int conversionsConsumed = user.ConversionsConsumed; ``` ### Alternative domain diff --git a/examples/src/main/java/com/convertapi/examples/UserInformation.java b/examples/src/main/java/com/convertapi/examples/UserInformation.java index 96a0568..80095fd 100644 --- a/examples/src/main/java/com/convertapi/examples/UserInformation.java +++ b/examples/src/main/java/com/convertapi/examples/UserInformation.java @@ -22,6 +22,7 @@ public static void main(String[] args) { System.out.println("Name: " + user.FullName); System.out.println("Status: " + user.Status); System.out.println("Active: " + user.Active); - System.out.println("Seconds left: " + user.SecondsLeft); + System.out.println("Total Conversions: " + user.ConversionsTotal); + System.out.println("Conversions Consumed: " + user.ConversionsConsumed); } } diff --git a/src/main/java/com/convertapi/client/model/User.java b/src/main/java/com/convertapi/client/model/User.java index 9c385d3..ae8bb46 100644 --- a/src/main/java/com/convertapi/client/model/User.java +++ b/src/main/java/com/convertapi/client/model/User.java @@ -8,6 +8,7 @@ public class User { public boolean Active; public String FullName; public String Email; - public int SecondsLeft; + public int ConversionsTotal; + public int ConversionsConsumed; public String Status; } From a50afdea1f04baca000588d61b53ccced98313d1 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Thu, 1 Feb 2024 23:59:26 +0000 Subject: [PATCH 08/28] Set content-type --- src/main/java/com/convertapi/client/ConvertApi.java | 1 + src/main/java/com/convertapi/client/Http.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/com/convertapi/client/ConvertApi.java b/src/main/java/com/convertapi/client/ConvertApi.java index 2393292..f85bc20 100644 --- a/src/main/java/com/convertapi/client/ConvertApi.java +++ b/src/main/java/com/convertapi/client/ConvertApi.java @@ -71,6 +71,7 @@ public static CompletableFuture convert(String fromFormat, Str Request request = Http.getRequestBuilder() .url(url) .addHeader("Accept", "application/json") + .addHeader("Content-Type", "multipart/form-data") .post(multipartBuilder.build()) .build(); diff --git a/src/main/java/com/convertapi/client/Http.java b/src/main/java/com/convertapi/client/Http.java index 1d86a34..bca3562 100644 --- a/src/main/java/com/convertapi/client/Http.java +++ b/src/main/java/com/convertapi/client/Http.java @@ -66,6 +66,7 @@ static CompletableFuture requestDelete(String url) { } catch (IOException e) { throw new RuntimeException(e); } + return null; }); } From b48cf56c7d4aca83a5148736f66cd40df8deaf47 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Fri, 16 Feb 2024 00:25:01 +0000 Subject: [PATCH 09/28] [maven-release-plugin] prepare release v2.10 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9e1c844..e037ae0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ convertapi jar - 2.10-SNAPSHOT + 2.10 ConvertAPI Java Client The ConvertAPI helps converting various file formats. @@ -48,7 +48,7 @@ scm:git:git://github.com/ConvertAPI/convertapi-java.git scm:git:git@github.com:ConvertAPI/convertapi-java.git https://github.com/ConvertAPI/convertapi-java - HEAD + v2.10 From e5d2ce01f3c34947448221cbcb0ff8e6bb02b9a6 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Fri, 16 Feb 2024 00:25:01 +0000 Subject: [PATCH 10/28] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e037ae0..cd8e03c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ convertapi jar - 2.10 + 2.11-SNAPSHOT ConvertAPI Java Client The ConvertAPI helps converting various file formats. @@ -48,7 +48,7 @@ scm:git:git://github.com/ConvertAPI/convertapi-java.git scm:git:git@github.com:ConvertAPI/convertapi-java.git https://github.com/ConvertAPI/convertapi-java - v2.10 + HEAD From dff49fd45cafaa6e2527f6e1a833e5078ad9450e Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Fri, 16 Feb 2024 01:22:50 +0000 Subject: [PATCH 11/28] Fix release script --- Dockerfile | 2 +- README.md | 2 +- examples/pom.xml | 2 +- maven-release.sh | 4 +--- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 85a747c..add5885 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ENV GPG_PASSPHRASE= ARG GIT_EMAIL= ARG FULL_NAME= -ARG MAVEN_VERSION=3.3.9 +ARG MAVEN_VERSION=3.9.6 ARG USER_HOME_DIR="/root" ENV MAVEN_HOME /usr/share/maven ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2" diff --git a/README.md b/README.md index feb2fe4..34bbbb4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add the following dependency to your pom.xml: com.convertapi.client convertapi - 2.9 + 2.10 ``` diff --git a/examples/pom.xml b/examples/pom.xml index 1880299..2177648 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -15,7 +15,7 @@ com.convertapi.client convertapi - 2.9 + 2.10 diff --git a/maven-release.sh b/maven-release.sh index 21409a4..2fac3bc 100644 --- a/maven-release.sh +++ b/maven-release.sh @@ -7,11 +7,9 @@ echo "Set private key..." cp -vr /gpg ~/.gnupg echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf cp -vpr /maven ~/.m2 -cp -vr /ssh ~/.ssh echo "Cloning convertapi-java..." -ssh-keyscan github.com >> ~/.ssh/known_hosts -git clone git@github.com:ConvertAPI/convertapi-java.git +git clone https://${GIT_USERNAME}:${GIT_SECRET}@github.com/ConvertAPI/convertapi-java.git cd convertapi-java echo "Switching to the release branch..." From 6500a849cf38b2886ab36ca52809ffbdc7cdf918 Mon Sep 17 00:00:00 2001 From: Jonas Jasas Date: Tue, 9 Apr 2024 14:43:49 +0300 Subject: [PATCH 12/28] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 34bbbb4..77a5fe0 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,9 @@ You can get your secret at https://www.convertapi.com/a ```java Config.setDefaultSecret("your-api-secret"); +// or token authentication +Config.setDefaultToken("your-token"); +Config.setDefaultApiKey("your-api-key"); ``` ### File conversion From dafd887d7d1414f4faa41d278b26f58b746865a5 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Tue, 10 Sep 2024 00:55:45 +0100 Subject: [PATCH 13/28] Use bearer auth --- .../java/com/convertapi/client/Config.java | 73 ++++--------------- .../com/convertapi/client/ConvertApi.java | 58 ++++----------- src/main/java/com/convertapi/client/Http.java | 25 ++++--- .../java/com/convertapi/client/Param.java | 2 +- 4 files changed, 42 insertions(+), 116 deletions(-) diff --git a/src/main/java/com/convertapi/client/Config.java b/src/main/java/com/convertapi/client/Config.java index ead84dc..109656f 100644 --- a/src/main/java/com/convertapi/client/Config.java +++ b/src/main/java/com/convertapi/client/Config.java @@ -6,83 +6,44 @@ public class Config { - private static String defaultSecret; - private static String defaultToken; - private static String defaultApiKey; + private static String defaultApiCredentials; private static int defaultTimeout = 0; // Infinite read waiting private static Function defaultHttpClientBuilder = b -> b; private static final String SCHEME = "https"; private static final String HOST = "v2.convertapi.com"; private final String scheme; private final String host; - private final String secret; - private final String token; - private final String apiKey; + private final String apiCredentials; private final int timeout; private final Function httpClientBuilder; @SuppressWarnings("unused") - public Config(String secret, String scheme, String host, int timeout, Function httpClientBuilder) { + public Config(String apiCredentials, String scheme, String host, int timeout, Function httpClientBuilder) { this.scheme = scheme; this.host = host; - this.secret = secret; - this.token = null; - this.apiKey = null; - this.timeout = timeout; - this.httpClientBuilder = httpClientBuilder; - } - - @SuppressWarnings("unused") - public Config(String token, String apiKey, String scheme, String host, int timeout, Function httpClientBuilder) { - this.scheme = scheme; - this.host = host; - this.secret = null; - this.token = token; - this.apiKey = apiKey; + this.apiCredentials = apiCredentials; this.timeout = timeout; this.httpClientBuilder = httpClientBuilder; } @SuppressWarnings("WeakerAccess") public static Config defaults() { - if (Config.defaultSecret != null) - return new Config(Config.defaultSecret, SCHEME, HOST, defaultTimeout, Config.defaultHttpClientBuilder); - return new Config(Config.defaultToken, Config.defaultApiKey, SCHEME, HOST, defaultTimeout, Config.defaultHttpClientBuilder); - } - - @SuppressWarnings("WeakerAccess") - public static Config defaults(String secret) { - return new Config(secret, SCHEME, HOST, defaultTimeout, Config.defaultHttpClientBuilder); + return new Config(Config.defaultApiCredentials, SCHEME, HOST, defaultTimeout, Config.defaultHttpClientBuilder); } @SuppressWarnings("WeakerAccess") - public static Config defaults(String token, String apiKey) { - return new Config(token, apiKey, SCHEME, HOST, defaultTimeout, Config.defaultHttpClientBuilder); + public static Config defaults(String apiCredentials) { + return new Config(apiCredentials, SCHEME, HOST, defaultTimeout, Config.defaultHttpClientBuilder); } @SuppressWarnings("WeakerAccess") - public static Config defaults(String secret, Function httpClientBuilder) { - return new Config(secret, SCHEME, HOST, defaultTimeout, httpClientBuilder); - } - - @SuppressWarnings("WeakerAccess") - public static Config defaults(String token, String apiKey, Function httpClientBuilder) { - return new Config(token, apiKey, SCHEME, HOST, defaultTimeout, httpClientBuilder); - } - - @SuppressWarnings("unused") - public static void setDefaultSecret(String defaultSecret) { - Config.defaultSecret = defaultSecret; + public static Config defaults(String apiCredentials, Function httpClientBuilder) { + return new Config(apiCredentials, SCHEME, HOST, defaultTimeout, httpClientBuilder); } @SuppressWarnings("unused") - public static void setDefaultToken(String defaultToken) { - Config.defaultToken = defaultToken; - } - - @SuppressWarnings("unused") - public static void setDefaultApiKey(String defaultApiKey) { - Config.defaultApiKey = defaultApiKey; + public static void setDefaultApiCredentials(String defaultApiCredentials) { + Config.defaultApiCredentials = defaultApiCredentials; } @SuppressWarnings("unused") @@ -107,16 +68,8 @@ String getHost() { return host; } - String getSecret() { - return secret; - } - - String getToken() { - return token; - } - - String getApiKey() { - return apiKey; + String getApiCredentials() { + return apiCredentials; } Function getHttpClientBuilder() { diff --git a/src/main/java/com/convertapi/client/ConvertApi.java b/src/main/java/com/convertapi/client/ConvertApi.java index f85bc20..f7f5054 100644 --- a/src/main/java/com/convertapi/client/ConvertApi.java +++ b/src/main/java/com/convertapi/client/ConvertApi.java @@ -68,7 +68,7 @@ public static CompletableFuture convert(String fromFormat, Str } } - Request request = Http.getRequestBuilder() + Request request = Http.getRequestBuilder(config) .url(url) .addHeader("Accept", "application/json") .addHeader("Content-Type", "multipart/form-data") @@ -99,7 +99,7 @@ public static User getUser() { public static User getUser(Config config) { HttpUrl url = Http.getUrlBuilder(config).addPathSegment("user").build(); - Request request = Http.getRequestBuilder() + Request request = Http.getRequestBuilder(config) .url(url) .addHeader("Accept", "application/json") .build(); @@ -124,13 +124,8 @@ public static CompletableFuture convertFile(Path fromFile, Str } @SuppressWarnings("unused") - public static CompletableFuture convertFile(Path fromFile, String toFormat, String secret, Param... params) throws IOException { - return convertFile(fromFile, toFormat, Config.defaults(secret), params); - } - - @SuppressWarnings("unused") - public static CompletableFuture convertFile(Path fromFile, String toFormat, String token, String apiKey, Param... params) throws IOException { - return convertFile(fromFile, toFormat, Config.defaults(token, apiKey), params); + public static CompletableFuture convertFile(Path fromFile, String toFormat, String apiCredentials, Param... params) throws IOException { + return convertFile(fromFile, toFormat, Config.defaults(apiCredentials), params); } public static CompletableFuture convertFile(Path fromFile, String toFormat, Config config, Param... params) throws IOException { @@ -144,13 +139,8 @@ public static void convertFile(String fromPathToFile, String toPathToFile) { } @SuppressWarnings("unused") - public static void convertFile(String fromPathToFile, String toPathToFile, String secret) { - convertFile(fromPathToFile, toPathToFile, Config.defaults(secret)); - } - - @SuppressWarnings("unused") - public static void convertFile(String fromPathToFile, String toPathToFile, String token, String apiKey) { - convertFile(fromPathToFile, toPathToFile, Config.defaults(token, apiKey)); + public static void convertFile(String fromPathToFile, String toPathToFile, String apiCredentials) { + convertFile(fromPathToFile, toPathToFile, Config.defaults(apiCredentials)); } public static void convertFile(String fromPathToFile, String toPathToFile, Config config) { @@ -169,13 +159,8 @@ public static List convertFileToDir(String fromPathToFile, String toFormat } @SuppressWarnings("unused") - public static List convertFileToDir(String fromPathToFile, String toFormat, String outputDirectory, String secret, Param... params) { - return convertFileToDir(fromPathToFile, toFormat, outputDirectory, Config.defaults(secret), params); - } - - @SuppressWarnings("unused") - public static List convertFileToDir(String fromPathToFile, String toFormat, String outputDirectory, String token, String apiKey, Param... params) { - return convertFileToDir(fromPathToFile, toFormat, outputDirectory, Config.defaults(token, apiKey), params); + public static List convertFileToDir(String fromPathToFile, String toFormat, String outputDirectory, String apiCredentials, Param... params) { + return convertFileToDir(fromPathToFile, toFormat, outputDirectory, Config.defaults(apiCredentials), params); } public static List convertFileToDir(String fromPathToFile, String toFormat, String outputDirectory, Config config, Param... params) { @@ -194,13 +179,8 @@ public static Path convertUrl(String url, String toPathToFile, Param... params) } @SuppressWarnings("unused") - public static Path convertUrl(String url, String toPathToFile, String secret, Param... params) { - return convertUrl(url, toPathToFile, Config.defaults(secret), params); - } - - @SuppressWarnings("unused") - public static Path convertUrl(String url, String toPathToFile, String token, String apiKey, Param... params) { - return convertUrl(url, toPathToFile, Config.defaults(token, apiKey), params); + public static Path convertUrl(String url, String toPathToFile, String apiCredentials, Param... params) { + return convertUrl(url, toPathToFile, Config.defaults(apiCredentials), params); } public static Path convertUrl(String url, String toPathToFile, Config config, Param... params) { @@ -219,13 +199,8 @@ public static Path convertRemoteFile(String url, String toPathToFile, Param... p } @SuppressWarnings("unused") - public static Path convertRemoteFile(String url, String toPathToFile, String secret, Param... params) { - return convertRemoteFile(url, toPathToFile, Config.defaults(secret), params); - } - - @SuppressWarnings("unused") - public static Path convertRemoteFile(String url, String toPathToFile, String token, String apiKey, Param... params) { - return convertRemoteFile(url, toPathToFile, Config.defaults(token, apiKey), params); + public static Path convertRemoteFile(String url, String toPathToFile, String apiCredentials, Param... params) { + return convertRemoteFile(url, toPathToFile, Config.defaults(apiCredentials), params); } public static Path convertRemoteFile(String url, String toPathToFile, Config config, Param... params) { @@ -245,13 +220,8 @@ public static List convertRemoteFileToDir(String url, String toFormat, Str } @SuppressWarnings("unused") - public static List convertRemoteFileToDir(String url, String toFormat, String outputDirectory, String secret, Param... params) { - return convertRemoteFileToDir(url, toFormat, outputDirectory, Config.defaults(secret), params); - } - - @SuppressWarnings("unused") - public static List convertRemoteFileToDir(String url, String toFormat, String outputDirectory, String token, String apiKey, Param... params) { - return convertRemoteFileToDir(url, toFormat, outputDirectory, Config.defaults(token, apiKey), params); + public static List convertRemoteFileToDir(String url, String toFormat, String outputDirectory, String apiCredentials, Param... params) { + return convertRemoteFileToDir(url, toFormat, outputDirectory, Config.defaults(apiCredentials), params); } public static List convertRemoteFileToDir(String url, String toFormat, String outputDirectory, Config config, Param... params) { diff --git a/src/main/java/com/convertapi/client/Http.java b/src/main/java/com/convertapi/client/Http.java index bca3562..19c8755 100644 --- a/src/main/java/com/convertapi/client/Http.java +++ b/src/main/java/com/convertapi/client/Http.java @@ -3,6 +3,7 @@ import com.convertapi.client.model.RemoteUploadResponse; import com.google.gson.Gson; import okhttp3.*; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.io.InputStream; @@ -26,17 +27,9 @@ static OkHttpClient getClient(Config config) { } static HttpUrl.Builder getUrlBuilder(Config config) { - HttpUrl.Builder urlBuilder = new HttpUrl.Builder() + return new HttpUrl.Builder() .scheme(config.getScheme()) .host(config.getHost()); - - if (config.getSecret() != null) { - return urlBuilder.addQueryParameter("secret", config.getSecret()); - } else { - return urlBuilder - .addQueryParameter("token", config.getToken()) - .addQueryParameter("apikey", config.getApiKey()); - } } static CompletableFuture requestGet(String url) { @@ -71,8 +64,18 @@ static CompletableFuture requestDelete(String url) { } static Request.Builder getRequestBuilder() { + return getRequestBuilder(null); + } + + static Request.Builder getRequestBuilder(@Nullable Config config) { String agent = String.format("ConvertAPI-Java/%s (%s)", Http.class.getPackage().getImplementationVersion(), System.getProperty("os.name")); - return new Request.Builder().header("User-Agent", agent); + Request.Builder request = new Request.Builder() + .header("User-Agent", agent); + + if (config != null) { + request = request.header("Authorization", "Bearer " + config.getApiCredentials()); + } + return request; } static RemoteUploadResponse remoteUpload(String urlToFile, Config config) { @@ -81,7 +84,7 @@ static RemoteUploadResponse remoteUpload(String urlToFile, Config config) { .addQueryParameter("url", urlToFile) .build(); - Request request = Http.getRequestBuilder() + Request request = Http.getRequestBuilder(config) .url(url) .method("POST", RequestBody.create("", null)) .addHeader("Accept", "application/json") diff --git a/src/main/java/com/convertapi/client/Param.java b/src/main/java/com/convertapi/client/Param.java index 4344729..8a7ee27 100644 --- a/src/main/java/com/convertapi/client/Param.java +++ b/src/main/java/com/convertapi/client/Param.java @@ -105,7 +105,7 @@ public List getValue() throws ExecutionException, InterruptedException { private static CompletableFuture> upload(InputStream stream, String fileName, Config config) { return CompletableFuture.supplyAsync(() -> { - Request request = Http.getRequestBuilder() + Request request = Http.getRequestBuilder(config) .url(Http.getUrlBuilder(config).addPathSegment("upload") .addQueryParameter("filename", fileName) .build()) From f19475a142b47eced7522771d547463870c466c1 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Thu, 12 Sep 2024 23:58:20 +0100 Subject: [PATCH 14/28] Remove alternative converter support --- examples/pom.xml | 2 +- .../com/convertapi/examples/Advanced.java | 2 +- .../examples/AlternativeConverter.java | 37 ------------------- .../examples/ConversionChaining.java | 2 +- .../examples/ConvertRemoteFile.java | 2 +- .../convertapi/examples/ConvertStream.java | 2 +- .../convertapi/examples/ConvertWebToPdf.java | 2 +- .../examples/ConvertWordToPdfAndPng.java | 2 +- .../examples/CreatePdfThumbnail.java | 2 +- .../convertapi/examples/SimpleConversion.java | 2 +- .../convertapi/examples/SplitAndMergePdf.java | 2 +- .../examples/TokenAuthentication.java | 24 ------------ .../convertapi/examples/UserInformation.java | 2 +- .../com/convertapi/client/ConvertApi.java | 12 ------ 14 files changed, 11 insertions(+), 84 deletions(-) delete mode 100644 examples/src/main/java/com/convertapi/examples/AlternativeConverter.java delete mode 100644 examples/src/main/java/com/convertapi/examples/TokenAuthentication.java diff --git a/examples/pom.xml b/examples/pom.xml index 2177648..b5401d2 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -15,7 +15,7 @@ com.convertapi.client convertapi - 2.10 + 2.11 diff --git a/examples/src/main/java/com/convertapi/examples/Advanced.java b/examples/src/main/java/com/convertapi/examples/Advanced.java index ce5861d..afeb269 100644 --- a/examples/src/main/java/com/convertapi/examples/Advanced.java +++ b/examples/src/main/java/com/convertapi/examples/Advanced.java @@ -21,7 +21,7 @@ public class Advanced { public static void main(String[] args) throws ExecutionException, InterruptedException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a // Advanced HTTP client setup Config.setDefaultHttpBuilder(builder -> { diff --git a/examples/src/main/java/com/convertapi/examples/AlternativeConverter.java b/examples/src/main/java/com/convertapi/examples/AlternativeConverter.java deleted file mode 100644 index 07bfc3a..0000000 --- a/examples/src/main/java/com/convertapi/examples/AlternativeConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.convertapi.examples; - -import com.convertapi.client.Config; -import com.convertapi.client.ConversionResult; -import com.convertapi.client.ConvertApi; -import com.convertapi.client.Param; - -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import static java.lang.System.getenv; - -/** - * Example of saving Word docx to PDF using alternative OpenOffice converter - * Conversion is made by using same file parameter and processing two conversions simultaneously - * https://www.convertapi.com/docx-to-pdf - * https://www.convertapi.com/docx-to-png - */ - -public class AlternativeConverter { - - public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a - Path tempDir = Paths.get(System.getProperty("java.io.tmpdir")); - - System.out.println("Converting DOCX to PDF with OpenOffice converter"); - Param docxFileParam = new Param("file", Paths.get("files/test.docx")); - Param converterParam = new Param("converter", "openoffice"); - - CompletableFuture pdfResult = ConvertApi.convert("docx", "pdf", docxFileParam, converterParam); - - System.out.println("PDF file saved to: " + pdfResult.get().saveFile(tempDir).get()); - } -} \ No newline at end of file diff --git a/examples/src/main/java/com/convertapi/examples/ConversionChaining.java b/examples/src/main/java/com/convertapi/examples/ConversionChaining.java index 33aa2c2..f41e3f4 100644 --- a/examples/src/main/java/com/convertapi/examples/ConversionChaining.java +++ b/examples/src/main/java/com/convertapi/examples/ConversionChaining.java @@ -21,7 +21,7 @@ public class ConversionChaining { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a System.out.println("Converting PDF to JPG and compressing result files with ZIP"); CompletableFuture jpgResult = ConvertApi.convert("docx", "jpg", new Param("file", Paths.get("files/test.docx"))); diff --git a/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java b/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java index ee5b52b..37c2a38 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java @@ -20,7 +20,7 @@ public class ConvertRemoteFile { public static void main(String[] args) throws ExecutionException, InterruptedException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a System.out.println("Converting remote PPTX to PDF"); CompletableFuture result = ConvertApi.convert("pptx", "pdf", diff --git a/examples/src/main/java/com/convertapi/examples/ConvertStream.java b/examples/src/main/java/com/convertapi/examples/ConvertStream.java index 96a32dc..da392bb 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertStream.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertStream.java @@ -22,7 +22,7 @@ public class ConvertStream { public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a // Creating file data stream InputStream stream = Files.newInputStream(new File("src/main/resources/test.docx").toPath()); diff --git a/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java b/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java index 681c941..ad35ca1 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java @@ -20,7 +20,7 @@ public class ConvertWebToPdf { public static void main(String[] args) throws ExecutionException, InterruptedException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a System.out.println("Converting WEB to PDF"); CompletableFuture result = ConvertApi.convert("web", "pdf", diff --git a/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java b/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java index c49f7ab..f7c8f14 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java @@ -23,7 +23,7 @@ public class ConvertWordToPdfAndPng { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a Path tempDir = Paths.get(System.getProperty("java.io.tmpdir")); System.out.println("Converting DOCX to PDF and JPG in parallel"); diff --git a/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java b/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java index c5faeef..ddca452 100644 --- a/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java +++ b/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java @@ -21,7 +21,7 @@ public class CreatePdfThumbnail { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a Path tempDir = Paths.get(System.getProperty("java.io.tmpdir")); System.out.println("Creating PDF thumbnail"); diff --git a/examples/src/main/java/com/convertapi/examples/SimpleConversion.java b/examples/src/main/java/com/convertapi/examples/SimpleConversion.java index 8a378ac..97b290d 100644 --- a/examples/src/main/java/com/convertapi/examples/SimpleConversion.java +++ b/examples/src/main/java/com/convertapi/examples/SimpleConversion.java @@ -11,7 +11,7 @@ public class SimpleConversion { public static void main(String[] args) { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a String resourcePath = "files/test.docx"; String tmpDir = System.getProperty("java.io.tmpdir") + "/"; diff --git a/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java b/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java index 716fa66..22d0498 100644 --- a/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java +++ b/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java @@ -21,7 +21,7 @@ public class SplitAndMergePdf { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a Path tempDir = Paths.get(System.getProperty("java.io.tmpdir")); System.out.println("Creating PDF with the first and the last pages"); diff --git a/examples/src/main/java/com/convertapi/examples/TokenAuthentication.java b/examples/src/main/java/com/convertapi/examples/TokenAuthentication.java deleted file mode 100644 index 994e238..0000000 --- a/examples/src/main/java/com/convertapi/examples/TokenAuthentication.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.convertapi.examples; - -import com.convertapi.client.Config; -import com.convertapi.client.ConvertApi; - -import static java.lang.System.getenv; - -/** - * Most simple conversion example with token authentication - */ -public class TokenAuthentication { - - public static void main(String[] args) { - Config.setDefaultToken(getenv("CONVERTAPI_TOKEN")); // Generate your token: https://www.convertapi.com/doc/auth - Config.setDefaultApiKey(getenv("CONVERTAPI_APIKEY")); // Get your api key: https://www.convertapi.com/a - String resourcePath = "files/test.docx"; - String tmpDir = System.getProperty("java.io.tmpdir") + "/"; - - // Simplified file to file conversion example - ConvertApi.convertFile(resourcePath, tmpDir + "/result.pdf"); - - System.out.println("PDF file saved to: " + tmpDir + "result.pdf"); - } -} diff --git a/examples/src/main/java/com/convertapi/examples/UserInformation.java b/examples/src/main/java/com/convertapi/examples/UserInformation.java index 80095fd..c09a38e 100644 --- a/examples/src/main/java/com/convertapi/examples/UserInformation.java +++ b/examples/src/main/java/com/convertapi/examples/UserInformation.java @@ -13,7 +13,7 @@ public class UserInformation { public static void main(String[] args) { - Config.setDefaultSecret(getenv("CONVERTAPI_SECRET")); //Get your secret at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a User user = ConvertApi.getUser(); System.out.println("API Key: " + user.ApiKey); diff --git a/src/main/java/com/convertapi/client/ConvertApi.java b/src/main/java/com/convertapi/client/ConvertApi.java index f7f5054..a1e558b 100644 --- a/src/main/java/com/convertapi/client/ConvertApi.java +++ b/src/main/java/com/convertapi/client/ConvertApi.java @@ -38,18 +38,6 @@ public static CompletableFuture convert(String fromFormat, Str .addPathSegment("to") .addPathSegment(toFormat); - for (Param param : params) { - if (param.getName().equalsIgnoreCase("converter")) { - try { - urlBuilder = urlBuilder - .addPathSegment("converter") - .addPathSegment(param.getValue().get(0)); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } - } - } - HttpUrl url = urlBuilder.addQueryParameter("storefile", "true").build(); MultipartBody.Builder multipartBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); From 0da940fd939c848f4934a0851c00065c71c587f4 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Fri, 13 Sep 2024 00:10:25 +0100 Subject: [PATCH 15/28] Update readme --- README.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 77a5fe0..2c1eae4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ And many others files manipulations. In just few minutes you can integrate it into your application and use it easily. The ConvertAPI-Java library makes it easier to use the Convert API from your Java 8 projects without having to build your own API calls. -You can get your free API secret at https://www.convertapi.com/a +You can get your free API credentials at https://www.convertapi.com/a ## Installation @@ -19,7 +19,7 @@ Add the following dependency to your pom.xml: com.convertapi.client convertapi - 2.10 + 2.11 ``` @@ -27,13 +27,10 @@ Add the following dependency to your pom.xml: ### Configuration -You can get your secret at https://www.convertapi.com/a +You can get your credentials at https://www.convertapi.com/a ```java -Config.setDefaultSecret("your-api-secret"); -// or token authentication -Config.setDefaultToken("your-token"); -Config.setDefaultApiKey("your-api-key"); +Config.setDefaultApiCredentials("your-api-secret"); ``` ### File conversion @@ -98,7 +95,7 @@ int conversionsConsumed = user.ConversionsConsumed; Create `Config` instance with the alternative domain and provide it in `convert` method. Dedicated to the region [domain list](https://www.convertapi.com/doc/servers-location). ```java -Config config = new Config(secret, "https", "eu-v2.convertapi.com", 0, httpClientBuilder); +Config config = new Config(credentials, "https", "eu-v2.convertapi.com", 0, httpClientBuilder); ``` ### More examples @@ -114,13 +111,13 @@ import com.convertapi.ConvertApi; public class SimpleConversion { public static void main(String[] args) { - ConvertApi.convert("source.docx", "result.pdf", "your-api-secret"); + ConvertApi.convert("source.docx", "result.pdf", "your-api-credentials"); } } ``` This is the bare-minimum to convert a file using the ConvertAPI client, but you can do a great deal more with the ConvertAPI Java library. -Take special note that you should replace `your-api-secret` with the secret you obtained in item two of the pre-requisites. +Take special note that you should replace `your-api-credentials` with the secret you obtained in item two of the pre-requisites. ### Issues & Comments Please leave all comments, bugs, requests, and issues on the Issues page. We'll respond to your request ASAP! From d4e8df68da66fb7bba769c3f11b47a5da3c382db Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Fri, 13 Sep 2024 00:14:17 +0100 Subject: [PATCH 16/28] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c1eae4..97774e0 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add the following dependency to your pom.xml: You can get your credentials at https://www.convertapi.com/a ```java -Config.setDefaultApiCredentials("your-api-secret"); +Config.setDefaultApiCredentials("your-api-credentials"); ``` ### File conversion @@ -117,7 +117,7 @@ public class SimpleConversion { ``` This is the bare-minimum to convert a file using the ConvertAPI client, but you can do a great deal more with the ConvertAPI Java library. -Take special note that you should replace `your-api-credentials` with the secret you obtained in item two of the pre-requisites. +Take special note that you should replace `your-api-credentials` with the credentials you obtained in item two of the pre-requisites. ### Issues & Comments Please leave all comments, bugs, requests, and issues on the Issues page. We'll respond to your request ASAP! From b4a846f9667b21d140c7dd6994cd03ef53e55583 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Fri, 13 Sep 2024 01:04:19 +0100 Subject: [PATCH 17/28] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cd8e03c..4433ecf 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ convertapi jar - 2.11-SNAPSHOT + 2.12-SNAPSHOT ConvertAPI Java Client The ConvertAPI helps converting various file formats. From 925f2170952b198bb5521d380223d5cc710b63b9 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Sat, 14 Sep 2024 01:34:52 +0100 Subject: [PATCH 18/28] Bump dependencies --- pom.xml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 4433ecf..d2eaed3 100644 --- a/pom.xml +++ b/pom.xml @@ -7,10 +7,10 @@ 2.12-SNAPSHOT ConvertAPI Java Client - The ConvertAPI helps converting various file formats. - Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. + The ConvertAPI helps to convert various file formats. + Creating PDF and Images from various sources like Word, Excel, PowerPoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files. - And many others files manipulations. + And many others file manipulations. In just few minutes you can integrate it into your application and use it easily. The ConvertAPI client library makes it easier to use the Convert API from your Java 8 projects without having to build your own API calls. @@ -71,12 +71,12 @@ com.google.code.gson gson - 2.8.9 + 2.11.0 com.squareup.okhttp3 okhttp - 4.9.2 + 4.12.0 @@ -95,7 +95,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.1 + 3.4.2 @@ -107,7 +107,7 @@ maven-deploy-plugin - 2.8.2 + 3.1.3 default-deploy @@ -122,7 +122,7 @@ org.apache.maven.plugins maven-release-plugin - 2.5.3 + 3.1.1 true false @@ -133,7 +133,7 @@ org.apache.maven.scm maven-scm-provider-gitexe - 1.9.5 + 2.1.0 @@ -141,7 +141,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.7 + 1.7.0 true ossrh @@ -153,7 +153,7 @@ org.apache.maven.plugins maven-source-plugin - 3.1.0 + 3.3.1 attach-sources @@ -167,7 +167,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.10.0 attach-javadocs @@ -198,7 +198,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.2.5 sign-artifacts From 7ff4b27a7eec89b6b46413f5f7088064c817f058 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Sat, 14 Sep 2024 01:53:14 +0100 Subject: [PATCH 19/28] Fix gpg --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index d2eaed3..73f7e79 100644 --- a/pom.xml +++ b/pom.xml @@ -193,6 +193,9 @@ true + + false + From e56fb57367666319c3da6f3a15391483bf75b821 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Sat, 14 Sep 2024 02:03:59 +0100 Subject: [PATCH 20/28] Fix release --- README.md | 2 +- examples/pom.xml | 2 +- maven-release.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 97774e0..68514ba 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add the following dependency to your pom.xml: com.convertapi.client convertapi - 2.11 + 2.12 ``` diff --git a/examples/pom.xml b/examples/pom.xml index b5401d2..17c7301 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -15,7 +15,7 @@ com.convertapi.client convertapi - 2.11 + 2.12 diff --git a/maven-release.sh b/maven-release.sh index 2fac3bc..06f249c 100644 --- a/maven-release.sh +++ b/maven-release.sh @@ -17,10 +17,10 @@ git fetch git checkout $branch_to_release echo "Preparing release..." -mvn release:prepare -DreleaseVersion=${VERSION} -DdevelopmentVersion=${NEXT_VERSION} -Dtag=v${VERSION} -Dresume=false -Darguments=-Dgpg.passphrase=${GPG_PASSPHRASE} +mvn release:prepare -Prelease-sign-artifacts -DreleaseVersion=${VERSION} -DdevelopmentVersion=${NEXT_VERSION} -Dtag=v${VERSION} -Dresume=false -Darguments=-Dgpg.passphrase=${GPG_PASSPHRASE} echo "Performing release..." -mvn release:perform +mvn release:perform -Prelease-sign-artifacts echo "Push the new release tag..." git push --tags From 8a29f26da475e0514e67e567abf5f29915d7ac72 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Sat, 14 Sep 2024 02:05:29 +0100 Subject: [PATCH 21/28] [maven-release-plugin] prepare release v2.12 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 73f7e79..f87044c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ convertapi jar - 2.12-SNAPSHOT + 2.12 ConvertAPI Java Client The ConvertAPI helps to convert various file formats. @@ -48,7 +48,7 @@ scm:git:git://github.com/ConvertAPI/convertapi-java.git scm:git:git@github.com:ConvertAPI/convertapi-java.git https://github.com/ConvertAPI/convertapi-java - HEAD + v2.12 From 2fbceddb098114531d9fbc8b101f97a8fe3a9661 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Sat, 14 Sep 2024 02:05:29 +0100 Subject: [PATCH 22/28] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f87044c..213eb9d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ convertapi jar - 2.12 + 2.13-SNAPSHOT ConvertAPI Java Client The ConvertAPI helps to convert various file formats. @@ -48,7 +48,7 @@ scm:git:git://github.com/ConvertAPI/convertapi-java.git scm:git:git@github.com:ConvertAPI/convertapi-java.git https://github.com/ConvertAPI/convertapi-java - v2.12 + HEAD From 81ca3ebaafa0612c7a4aa597dc4762a134b0f337 Mon Sep 17 00:00:00 2001 From: Jonas Jasas Date: Tue, 3 Jun 2025 10:45:20 +0300 Subject: [PATCH 23/28] Remove all references to Secret and ApiKey #44 --- README.md | 10 +++++----- .../main/java/com/convertapi/examples/Advanced.java | 2 +- .../com/convertapi/examples/ConversionChaining.java | 2 +- .../com/convertapi/examples/ConvertRemoteFile.java | 2 +- .../java/com/convertapi/examples/ConvertStream.java | 2 +- .../java/com/convertapi/examples/ConvertWebToPdf.java | 2 +- .../convertapi/examples/ConvertWordToPdfAndPng.java | 2 +- .../com/convertapi/examples/CreatePdfThumbnail.java | 2 +- .../java/com/convertapi/examples/SimpleConversion.java | 2 +- .../java/com/convertapi/examples/SplitAndMergePdf.java | 2 +- .../java/com/convertapi/examples/UserInformation.java | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 68514ba..fffa0eb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ And many others files manipulations. In just few minutes you can integrate it into your application and use it easily. The ConvertAPI-Java library makes it easier to use the Convert API from your Java 8 projects without having to build your own API calls. -You can get your free API credentials at https://www.convertapi.com/a +You can get your free API token at https://www.convertapi.com/a/authentication ## Installation @@ -27,10 +27,10 @@ Add the following dependency to your pom.xml: ### Configuration -You can get your credentials at https://www.convertapi.com/a +You can get your token at https://www.convertapi.com/a/authentication ```java -Config.setDefaultApiCredentials("your-api-credentials"); +Config.setDefaultApiCredentials("api-token"); ``` ### File conversion @@ -111,13 +111,13 @@ import com.convertapi.ConvertApi; public class SimpleConversion { public static void main(String[] args) { - ConvertApi.convert("source.docx", "result.pdf", "your-api-credentials"); + ConvertApi.convert("source.docx", "result.pdf", "api-token"); } } ``` This is the bare-minimum to convert a file using the ConvertAPI client, but you can do a great deal more with the ConvertAPI Java library. -Take special note that you should replace `your-api-credentials` with the credentials you obtained in item two of the pre-requisites. +Take special note that you should replace `api-token` with the token you obtained in item two of the pre-requisites. ### Issues & Comments Please leave all comments, bugs, requests, and issues on the Issues page. We'll respond to your request ASAP! diff --git a/examples/src/main/java/com/convertapi/examples/Advanced.java b/examples/src/main/java/com/convertapi/examples/Advanced.java index afeb269..c85477c 100644 --- a/examples/src/main/java/com/convertapi/examples/Advanced.java +++ b/examples/src/main/java/com/convertapi/examples/Advanced.java @@ -21,7 +21,7 @@ public class Advanced { public static void main(String[] args) throws ExecutionException, InterruptedException { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication // Advanced HTTP client setup Config.setDefaultHttpBuilder(builder -> { diff --git a/examples/src/main/java/com/convertapi/examples/ConversionChaining.java b/examples/src/main/java/com/convertapi/examples/ConversionChaining.java index f41e3f4..53ff39c 100644 --- a/examples/src/main/java/com/convertapi/examples/ConversionChaining.java +++ b/examples/src/main/java/com/convertapi/examples/ConversionChaining.java @@ -21,7 +21,7 @@ public class ConversionChaining { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication System.out.println("Converting PDF to JPG and compressing result files with ZIP"); CompletableFuture jpgResult = ConvertApi.convert("docx", "jpg", new Param("file", Paths.get("files/test.docx"))); diff --git a/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java b/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java index 37c2a38..bcffc08 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java @@ -20,7 +20,7 @@ public class ConvertRemoteFile { public static void main(String[] args) throws ExecutionException, InterruptedException { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication System.out.println("Converting remote PPTX to PDF"); CompletableFuture result = ConvertApi.convert("pptx", "pdf", diff --git a/examples/src/main/java/com/convertapi/examples/ConvertStream.java b/examples/src/main/java/com/convertapi/examples/ConvertStream.java index da392bb..460794d 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertStream.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertStream.java @@ -22,7 +22,7 @@ public class ConvertStream { public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication // Creating file data stream InputStream stream = Files.newInputStream(new File("src/main/resources/test.docx").toPath()); diff --git a/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java b/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java index ad35ca1..6bdaa81 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java @@ -20,7 +20,7 @@ public class ConvertWebToPdf { public static void main(String[] args) throws ExecutionException, InterruptedException { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication System.out.println("Converting WEB to PDF"); CompletableFuture result = ConvertApi.convert("web", "pdf", diff --git a/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java b/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java index f7c8f14..ff4c656 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java @@ -23,7 +23,7 @@ public class ConvertWordToPdfAndPng { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication Path tempDir = Paths.get(System.getProperty("java.io.tmpdir")); System.out.println("Converting DOCX to PDF and JPG in parallel"); diff --git a/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java b/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java index ddca452..65d3ecf 100644 --- a/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java +++ b/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java @@ -21,7 +21,7 @@ public class CreatePdfThumbnail { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication Path tempDir = Paths.get(System.getProperty("java.io.tmpdir")); System.out.println("Creating PDF thumbnail"); diff --git a/examples/src/main/java/com/convertapi/examples/SimpleConversion.java b/examples/src/main/java/com/convertapi/examples/SimpleConversion.java index 97b290d..befbbd1 100644 --- a/examples/src/main/java/com/convertapi/examples/SimpleConversion.java +++ b/examples/src/main/java/com/convertapi/examples/SimpleConversion.java @@ -11,7 +11,7 @@ public class SimpleConversion { public static void main(String[] args) { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication String resourcePath = "files/test.docx"; String tmpDir = System.getProperty("java.io.tmpdir") + "/"; diff --git a/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java b/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java index 22d0498..7da120c 100644 --- a/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java +++ b/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java @@ -21,7 +21,7 @@ public class SplitAndMergePdf { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication Path tempDir = Paths.get(System.getProperty("java.io.tmpdir")); System.out.println("Creating PDF with the first and the last pages"); diff --git a/examples/src/main/java/com/convertapi/examples/UserInformation.java b/examples/src/main/java/com/convertapi/examples/UserInformation.java index c09a38e..93e5c01 100644 --- a/examples/src/main/java/com/convertapi/examples/UserInformation.java +++ b/examples/src/main/java/com/convertapi/examples/UserInformation.java @@ -13,7 +13,7 @@ public class UserInformation { public static void main(String[] args) { - Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a + Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication User user = ConvertApi.getUser(); System.out.println("API Key: " + user.ApiKey); From 06c51ac174d498d14ff5478ee319a3a129624b0a Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Thu, 12 Jun 2025 00:59:00 +0100 Subject: [PATCH 24/28] Fix error on InputStream conversion --- .../com/convertapi/examples/ConvertStream.java | 16 ++++++++-------- .../com/convertapi/client/RequestBodyStream.java | 9 --------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/examples/src/main/java/com/convertapi/examples/ConvertStream.java b/examples/src/main/java/com/convertapi/examples/ConvertStream.java index 460794d..a261c2d 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertStream.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertStream.java @@ -25,16 +25,16 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication // Creating file data stream - InputStream stream = Files.newInputStream(new File("src/main/resources/test.docx").toPath()); - - System.out.println("Converting stream of DOCX data to PDF"); - CompletableFuture result = ConvertApi.convert("docx", "pdf", + try (InputStream stream = Files.newInputStream(new File("src/main/resources/test.docx").toPath())) { + System.out.println("Converting stream of DOCX data to PDF"); + CompletableFuture result = ConvertApi.convert("docx", "pdf", new Param("file", stream, "test.docx") - ); + ); - Path pdfFile = Paths.get(System.getProperty("java.io.tmpdir") + "/myfile.pdf"); - result.get().saveFile(pdfFile).get(); + Path pdfFile = Paths.get(System.getProperty("java.io.tmpdir") + "/myfile.pdf"); + result.get().saveFile(pdfFile).get(); - System.out.println("PDF file saved to: " + pdfFile.toString()); + System.out.println("PDF file saved to: " + pdfFile.toString()); + } } } diff --git a/src/main/java/com/convertapi/client/RequestBodyStream.java b/src/main/java/com/convertapi/client/RequestBodyStream.java index 1e617d0..dbf44aa 100644 --- a/src/main/java/com/convertapi/client/RequestBodyStream.java +++ b/src/main/java/com/convertapi/client/RequestBodyStream.java @@ -19,15 +19,6 @@ public MediaType contentType() { return mediaType; } - @Override - public long contentLength() { - try { - return inputStream.available(); - } catch (IOException e) { - return 0; - } - } - @Override public void writeTo(BufferedSink sink) throws IOException { Source source = null; From 61c01247253e8f861d595c4e9ede9ebf39703b62 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Thu, 19 Jun 2025 00:20:26 +0100 Subject: [PATCH 25/28] [maven-release-plugin] prepare release v2.13 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 213eb9d..b36818f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ convertapi jar - 2.13-SNAPSHOT + 2.13 ConvertAPI Java Client The ConvertAPI helps to convert various file formats. @@ -48,7 +48,7 @@ scm:git:git://github.com/ConvertAPI/convertapi-java.git scm:git:git@github.com:ConvertAPI/convertapi-java.git https://github.com/ConvertAPI/convertapi-java - HEAD + v2.13 From c2b3404ab375b616b522d5bdecf04fec43e90638 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Thu, 19 Jun 2025 00:20:26 +0100 Subject: [PATCH 26/28] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b36818f..57699e8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ convertapi jar - 2.13 + 2.14-SNAPSHOT ConvertAPI Java Client The ConvertAPI helps to convert various file formats. @@ -48,7 +48,7 @@ scm:git:git://github.com/ConvertAPI/convertapi-java.git scm:git:git@github.com:ConvertAPI/convertapi-java.git https://github.com/ConvertAPI/convertapi-java - v2.13 + HEAD From 2f833ec17346248363d7368bb2754c939e0efaf4 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Thu, 19 Jun 2025 00:23:50 +0100 Subject: [PATCH 27/28] Bump version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fffa0eb..b9c465d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add the following dependency to your pom.xml: com.convertapi.client convertapi - 2.12 + 2.13 ``` From cc1a2f70f0966e6e867ee238c377abf8e0879344 Mon Sep 17 00:00:00 2001 From: Krisztian Mozsi Date: Thu, 19 Jun 2025 00:29:54 +0100 Subject: [PATCH 28/28] Upgrade maven dependency in release Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index add5885..9a301fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ENV GPG_PASSPHRASE= ARG GIT_EMAIL= ARG FULL_NAME= -ARG MAVEN_VERSION=3.9.6 +ARG MAVEN_VERSION=3.9.10 ARG USER_HOME_DIR="/root" ENV MAVEN_HOME /usr/share/maven ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2" @@ -22,7 +22,7 @@ COPY maven-release.sh /maven-release.sh # Install Maven, Git and gpg RUN apk add --no-cache curl tar bash git gnupg openssh RUN mkdir -p /usr/share/maven && \ - curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && \ + curl -fsSL https://downloads.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && \ ln -s /usr/share/maven/bin/mvn /usr/bin/mvn RUN git config --global user.email ${GIT_EMAIL} && \ git config --global user.name ${FULL_NAME}