10 Commits

Author SHA1 Message Date
Andrew Stein
1f9c48eac6 Merge remote-tracking branch 'origin/main' 2023-09-03 13:55:48 -04:00
Andrew Stein
b3ea0e2a09 Updated POM.xml 2023-09-03 13:55:35 -04:00
Andrew Stein
75eb64a077 Update README.md 2023-09-03 13:55:18 -04:00
Andrew Stein
c5706317aa Updated build name. 2023-06-11 19:36:05 -04:00
Andrew Stein
0a2f6d1869 Reorganized files. 2023-06-11 19:35:13 -04:00
Andrew Stein
b753769a53 Updated POM version. 2023-06-11 19:33:09 -04:00
Andrew Stein
8162cada71 Reorganized directories 2023-06-11 19:32:49 -04:00
Andrew Stein
fdcc12ee41 Updated README 2023-06-11 19:07:28 -04:00
Andrew Stein
8c526a1539 Updated README and added new functions for parity. 2023-06-11 19:02:16 -04:00
Andrew Stein
95cf38c620 Updated action 2023-06-11 18:48:53 -04:00
37 changed files with 260 additions and 198 deletions

View File

@@ -1,4 +1,4 @@
name: Dev Build
name: Build
on:
push:
@@ -23,9 +23,6 @@ jobs:
- name: Build with Maven
run: mvn clean package -Dmaven.test.skip
- name: Deploy with Maven
run: mvn deploy -Dmaven.test.skip=true
- name: Read version from POM file
id: version
run: echo ::set-output name=version::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)

116
README.md
View File

@@ -4,15 +4,19 @@
## Getting Started
So you wanna make custom voices, huh? Well you've come to the right place.
### Note: This repo is undergoing an upgrade to v2.0
If any of the documentation is out of place or issues occur, please submit a PR or create an issue.
I downgraded the repo from JDK 17 to JDK 11 as well.
### Installation
**Maven**
To add `elevenlabs-api` to your Maven project, use:
```xml
<dependency>
<groupId>net.andrewcpu.elevenlabs</groupId>
<groupId>net.andrewcpu</groupId>
<artifactId>elevenlabs-api</artifactId>
<version>1.0-SNAPSHOT</version>
<version>2.1</version>
</dependency>
```
The most up-to date package information can be found on the [Packages tab](https://github.com/AndrewCPU/elevenlabs-api/packages/)
@@ -27,11 +31,10 @@ Compiled JARs are available via the [Releases tab](https://github.com/AndrewCPU/
To access your ElevenLabs API key, head to the [official website](https://elevenlabs.io/), you can view your `xi-api-key` using the 'Profile' tab on the website.
To set up your ElevenLabs API key, you must register it with the ElevenLabsAPI Java API like below:
```java
ElevenLabsAPI.getInstance().setAPIKey("YOUR_API_KEY_HERE");
ElevenLabs.setApiKey("YOUR_API_KEY_HERE");
```
*For any public repository security, you should store your API key in an environment variable, or external from your source code.*
Once you've injected your API Key, you can safely assume that you will not receive a `ElevenLabsAPINotInitiatedException`.
- - -
<!-- TOC -->
@@ -66,9 +69,6 @@ Once you've injected your API Key, you can safely assume that you will not recei
* [Exceptions](#exceptions)
* [*ElevenLabsAPINotInitiatedException*](#elevenlabsapinotinitiatedexception)
* [*ElevenLabsValidationException*](#elevenlabsvalidationexception)
* [Built in Types](#built-in-types)
* [`Voice` Related Types](#voice-related-types)
* [`User` Related Types](#user-related-types)
* [Misc](#misc)
* [Links to ElevenLabs](#links-to-elevenlabs)
@@ -168,8 +168,15 @@ To generate an audio file with a given `Voice`, you can utilize the `Voice#gener
Depending on how you access your `Voice`, (with or without settings), will decide whether you can use the implicit `voiceSettings` or if you have to specify the `VoiceSettings` object to use. Unless explicitly requesting the `Voice` without settings, every `Voice` object SHOULD contain its default `VoiceSettings`.
```java
Voice voice;
File outputFile = voice.generate(String text, VoiceSettings voiceSettings, File output);
File outputFile = voice.generate(String text, File output); // Uses default voice settings
File file = voice.generate(String text);
File file = voice.generate(String text, VoiceSettings settings);
File file = voice.generate(String text, String model, VoiceSettings settings);
File file = voice.generate(String text, String model);
InputStream inputStream = voice.generateStream(String text);
InputStream inputStream = voice.generateStream(String text, VoiceSettings settings);
InputStream inputStream = voice.generateStream(String text, String model, VoiceSettings settings);
InputStream inputStream = voice.generateStream(String text, String model);
```
- - -
@@ -186,7 +193,7 @@ You can download a `Sample` via the `Sample#downloadAudio(File outputFile)` func
The `File` parameter of `downloadAudio()` is the location of where you want to locally download the sample.
```java
Voice voice;
File file = voice.getSamples().get(0).downloadAudio(File outputFile);
File file = voice.getSamples().get(0).downloadAudio();
```
### Deleting a Sample
@@ -214,11 +221,11 @@ HistoryItem item = history.getHistoryItem("itemId");
### Downloading History
The official API of ElevenLabs provides an endpoint for downloading multiple `HistoryItem`'s as a ZIP file. To download such items, you can pass a `String[]` containing the `HistoryItem` IDs, OR you can provide a `List<HistoryItem>` parameter.
The second parameter is the path in which you would like to save the ZIP file.
```java
History history;
File download = history.downloadHistory(new String[]{"item-id1", "item-id2"}, new File("outputFile.zip"));
File download = history.downloadHistory(List<HistoryItem> historyItems, File outputFile);
File download = history.downloadHistory(new String[]{"item-id1", "item-id2"});
File download = history.downloadHistory(List<HistoryItem> historyItems);
```
### Deleting a HistoryItem
@@ -236,10 +243,10 @@ Voice voice = item.getVoice();
```
### Downloading a HistoryItem Audio
A `HistoryItem` is a previous TTS generation. You can download the generation as an MP3 file by providing the `downloadAudio(File file)` function with the target location for the downloaded file. The return value is the same `File` provided as a parameter.
A `HistoryItem` is a previous TTS generation. You can download the generation as an MP3 file by executing the `downloadAudio()` function. The return value is the tmp `File` location of your download.
```java
HistoryItem item;
File file = item.downloadAudio(File outputFile);
File file = item.downloadAudio();
```
- - -
@@ -259,77 +266,8 @@ User user = User.get();
- - -
## Exceptions
You'll find most actions that make network requests also will throw `IOException`, `ElevenLabsAPINotInitiatedException`, and `ElevenLabsValidationException`.
*The only function that will make a network request **without throwing an exception is*** `HistoryItem#getVoice()`.
### *ElevenLabsAPINotInitiatedException*
This exception will be thrown if you attempt to use the library without setting an API key.
### *ElevenLabsValidationException*
This error indicates a malformed request to the ElevenLabs API. The exception should provide the location of any syntactically incorrect parameters within the request.
- - -
# Built in Types
There are a few objects and enums defined for this API.
## `Voice` Related Types
```java
Voice(String voiceId, String name, List<Sample> samples, String category,
Map<String, String> labels, String previewUrl, List<String> availableForTiers,
VoiceSettings settings)
```
```java
VoiceSettings(double stability, double similarityBoost)
```
```java
Sample(String sampleId, String fileName, String mimeType, long sizeBytes, String hash)
```
```java
History(List<HistoryItem> history)
```
```java
History.HistoryItem(String historyItemId, String voiceId, String voiceName, String text,
long dateUnix, int characterCountChangeFrom, int characterCountChangeTo,
String contentType, GenerationState state)
```
```java
public enum GenerationState {
CREATED,
DELETED,
PROCESSING;
}
```
- - -
## `User` Related Types
```java
User(Subscription subscription, boolean isNewUser, String xiApiKey)
```
```java
Subscription(String tier, int characterCount, int characterLimit, boolean canExtendCharacterLimit,
boolean allowedToExtendCharacterLimit, long nextCharacterCountResetUnix, int voiceLimit,
boolean canExtendVoiceLimit, boolean canUseInstantVoiceCloning, List<AvailableModel> availableModels,
AccountStatus status, NextInvoice nextInvoice)
```
```java
AvailableModel(String modelId, String displayName, List<SupportedLanguage> supportedLanguages)
```
```java
SupportedLanguage(String isoCode, String displayName)
```
```java
NextInvoice(int amountDueCents, long nextPaymentAttemptUnix)
```
```java
public enum AccountStatus {
TRIALING,
ACTIVE,
INCOMPLETE,
INCOMPLETE_EXPIRED,
PAST_DUE,
CANCELED,
UNPAID,
FREE;
}
```
- - -
@@ -341,7 +279,15 @@ If you like what you see, give it a star! :)
- - -
#### Unit Testing
*Todo*
Unit tests have been created, these endpoints are destructive and not included in the testing:
* deleteHistoryItem - WONT TEST
* deleteSample - WONT TEST
* deleteVoice - WONT TEST
* editVoiceSettings - WONT TEST
* createVoice - WONT TEST
* editVoice - WONT TEST
To run the unit tests yourself, you have to clone this repo and update the ElevenLabsTest.java file with your API key and your voice to test on.
Thanks to ElevenLabs for making an awesome tool 🥂

95
pom.xml
View File

@@ -6,6 +6,7 @@
<name>Unofficial Java ElevenLabs Voice API</name>
<description>An API level interaction between Java and the ElevenLabs Voice Generation Web API.</description>
<url>https://github.com/AndrewCPU/elevenlabs-api</url>
<developers>
<developer>
<id>Andrewcpu</id>
@@ -24,17 +25,42 @@
<tag>HEAD</tag>
</scm>
<distributionManagement>
<repository>
<profiles>
<profile>
<id>github</id>
<name>GitHub AndrewCPU Apache Maven Packages</name>
<url>https://maven.pkg.github.com/AndrewCPU/elevenlabs-api</url>
</repository>
</distributionManagement>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub AndrewCPU Apache Maven Packages</name>
<url>https://maven.pkg.github.com/AndrewCPU/elevenlabs-api</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
<groupId>net.andrewcpu</groupId>
<artifactId>elevenlabs-api</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.1</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
@@ -94,6 +120,20 @@
<build>
<finalName>elevenlabs-api-${version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
@@ -114,6 +154,47 @@
</execution>
</executions>
</plugin>
<!-- Generates JAR's source file -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<!-- Generates Javadoc JAR file -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -9,16 +9,16 @@ import net.andrewcpu.elevenlabs.model.user.Subscription;
import net.andrewcpu.elevenlabs.model.user.User;
import net.andrewcpu.elevenlabs.model.voice.Voice;
import net.andrewcpu.elevenlabs.model.voice.VoiceSettings;
import net.andrewcpu.elevenlabs.net.ElevenRequest;
import net.andrewcpu.elevenlabs.net.history.*;
import net.andrewcpu.elevenlabs.net.models.GetModelsRequest;
import net.andrewcpu.elevenlabs.net.samples.DeleteSampleRequest;
import net.andrewcpu.elevenlabs.net.samples.GetSampleRequest;
import net.andrewcpu.elevenlabs.net.tts.PostTextToSpeechRequest;
import net.andrewcpu.elevenlabs.net.tts.PostTextToSpeechStreamedRequest;
import net.andrewcpu.elevenlabs.net.user.GetSubscriptionRequest;
import net.andrewcpu.elevenlabs.net.user.GetUserRequest;
import net.andrewcpu.elevenlabs.net.voices.*;
import net.andrewcpu.elevenlabs.requests.ElevenLabsRequest;
import net.andrewcpu.elevenlabs.requests.history.*;
import net.andrewcpu.elevenlabs.requests.models.GetModelsRequest;
import net.andrewcpu.elevenlabs.requests.samples.DeleteSampleRequest;
import net.andrewcpu.elevenlabs.requests.samples.GetSampleRequest;
import net.andrewcpu.elevenlabs.requests.tts.PostTextToSpeechRequest;
import net.andrewcpu.elevenlabs.requests.tts.PostTextToSpeechStreamedRequest;
import net.andrewcpu.elevenlabs.requests.user.GetSubscriptionRequest;
import net.andrewcpu.elevenlabs.requests.user.GetUserRequest;
import net.andrewcpu.elevenlabs.requests.voices.*;
import net.andrewcpu.elevenlabs.util.ElevenNetworkUtil;
import java.io.File;
@@ -37,7 +37,7 @@ public class ElevenLabs {
API_KEY = apiKey;
}
private static <T> T sendRequest(ElevenRequest<T> request) {
private static <T> T sendRequest(ElevenLabsRequest<T> request) {
return ElevenNetworkUtil.sendRequest(request.getType(),request.getEndpoint(), request.getPayload(),request.getResponseClass());
}

View File

@@ -1,4 +1,4 @@
package net.andrewcpu.elevenlabs;
package net.andrewcpu.elevenlabs.enums;
public enum HttpRequestType {
POST, GET, PUT, DELETE;

View File

@@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import net.andrewcpu.elevenlabs.ElevenLabs;
import net.andrewcpu.elevenlabs.model.ElevenModel;
import java.io.File;
import java.util.Arrays;
import java.util.List;
public class History extends ElevenModel {
@@ -31,8 +33,8 @@ public class History extends ElevenModel {
@JsonIgnore
public HistoryItem getHistoryItem(String id) {
for(HistoryItem item : historyItems) {
if(item.getHistoryItemId().equals(id)){
for (HistoryItem item : historyItems) {
if (item.getHistoryItemId().equals(id)) {
return item;
}
}
@@ -54,6 +56,14 @@ public class History extends ElevenModel {
return hasMore;
}
public File downloadHistory(String... historyIds) {
return ElevenLabs.getHistoryItemAudio(historyIds);
}
public File downloadHistory(HistoryItem... items) {
return ElevenLabs.getHistoryItemAudio(Arrays.stream(items).map(HistoryItem::getHistoryItemId).toArray(String[]::new));
}
@JsonIgnore
@Override
public String toString() {

View File

@@ -6,6 +6,8 @@ import net.andrewcpu.elevenlabs.ElevenLabs;
import net.andrewcpu.elevenlabs.model.ElevenModel;
import net.andrewcpu.elevenlabs.model.tuning.FineTuning;
import java.io.File;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -144,6 +146,39 @@ public class Voice extends ElevenModel {
return this;
}
public File generate(String text, String model) {
return ElevenLabs.generateTextToSpeech(voiceId, text, model, settings);
}
public File generate(String text, String model, VoiceSettings settings) {
return ElevenLabs.generateTextToSpeech(voiceId, text, model, settings);
}
public File generate(String text, VoiceSettings settings) {
return ElevenLabs.generateTextToSpeech(voiceId, text, "eleven_monolingual_v1", settings);
}
public File generate(String text) {
return ElevenLabs.generateTextToSpeech(voiceId, text, "eleven_monolingual_v1", settings);
}
public InputStream generateStream(String text, String model) {
return ElevenLabs.generateTextToSpeechStreamed(voiceId, text, model, settings);
}
public InputStream generateStream(String text, String model, VoiceSettings settings) {
return ElevenLabs.generateTextToSpeechStreamed(voiceId, text, model, settings);
}
public InputStream generateStream(String text, VoiceSettings settings) {
return ElevenLabs.generateTextToSpeechStreamed(voiceId, text, "eleven_monolingual_v1", settings);
}
public InputStream generateStream(String text) {
return ElevenLabs.generateTextToSpeechStreamed(voiceId, text, "eleven_monolingual_v1", settings);
}
@JsonIgnore
@Override
public String toString() {

View File

@@ -1,9 +0,0 @@
package net.andrewcpu.elevenlabs.net;
import net.andrewcpu.elevenlabs.HttpRequestType;
public abstract class DeleteRequest<T> extends ElevenRequest<T> {
public DeleteRequest(String endpoint, Class<T> clazz) {
super(HttpRequestType.DELETE, endpoint, clazz);
}
}

View File

@@ -1,9 +0,0 @@
package net.andrewcpu.elevenlabs.net;
import net.andrewcpu.elevenlabs.HttpRequestType;
public abstract class GetRequest<T> extends ElevenRequest<T> {
public GetRequest(String endpoint, Class<T> clazz) {
super(HttpRequestType.GET, endpoint, clazz);
}
}

View File

@@ -1,9 +0,0 @@
package net.andrewcpu.elevenlabs.net;
import net.andrewcpu.elevenlabs.HttpRequestType;
public abstract class PostRequest<T> extends ElevenRequest<T> {
public PostRequest(String endpoint, Class<T> clazz) {
super(HttpRequestType.POST, endpoint, clazz);
}
}

View File

@@ -1,9 +0,0 @@
package net.andrewcpu.elevenlabs.net;
import net.andrewcpu.elevenlabs.HttpRequestType;
public abstract class PutRequest<T> extends ElevenRequest<T> {
public PutRequest(String endpoint, Class<T> clazz) {
super(HttpRequestType.PUT, endpoint, clazz);
}
}

View File

@@ -0,0 +1,9 @@
package net.andrewcpu.elevenlabs.requests;
import net.andrewcpu.elevenlabs.enums.HttpRequestType;
public abstract class DeleteRequest<T> extends ElevenLabsRequest<T> {
public DeleteRequest(String endpoint, Class<T> clazz) {
super(HttpRequestType.DELETE, endpoint, clazz);
}
}

View File

@@ -1,14 +1,13 @@
package net.andrewcpu.elevenlabs.net;
package net.andrewcpu.elevenlabs.requests;
import net.andrewcpu.elevenlabs.HttpRequestType;
import net.andrewcpu.elevenlabs.util.ElevenNetworkUtil;
import net.andrewcpu.elevenlabs.enums.HttpRequestType;
public abstract class ElevenRequest<T> {
public abstract class ElevenLabsRequest<T> {
private HttpRequestType type;
private String endpoint;
private Class<T> responseClass;
public ElevenRequest(HttpRequestType type, String endpoint, Class<T> clazz) {
public ElevenLabsRequest(HttpRequestType type, String endpoint, Class<T> clazz) {
this.type = type;
this.endpoint = endpoint;
this.responseClass = clazz;

View File

@@ -0,0 +1,9 @@
package net.andrewcpu.elevenlabs.requests;
import net.andrewcpu.elevenlabs.enums.HttpRequestType;
public abstract class GetRequest<T> extends ElevenLabsRequest<T> {
public GetRequest(String endpoint, Class<T> clazz) {
super(HttpRequestType.GET, endpoint, clazz);
}
}

View File

@@ -0,0 +1,9 @@
package net.andrewcpu.elevenlabs.requests;
import net.andrewcpu.elevenlabs.enums.HttpRequestType;
public abstract class PostRequest<T> extends ElevenLabsRequest<T> {
public PostRequest(String endpoint, Class<T> clazz) {
super(HttpRequestType.POST, endpoint, clazz);
}
}

View File

@@ -0,0 +1,9 @@
package net.andrewcpu.elevenlabs.requests;
import net.andrewcpu.elevenlabs.enums.HttpRequestType;
public abstract class PutRequest<T> extends ElevenLabsRequest<T> {
public PutRequest(String endpoint, Class<T> clazz) {
super(HttpRequestType.PUT, endpoint, clazz);
}
}

View File

@@ -1,6 +1,6 @@
package net.andrewcpu.elevenlabs.net.history;
package net.andrewcpu.elevenlabs.requests.history;
import net.andrewcpu.elevenlabs.net.DeleteRequest;
import net.andrewcpu.elevenlabs.requests.DeleteRequest;
public class DeleteHistoryItemRequest extends DeleteRequest<String> {
public DeleteHistoryItemRequest(String historyItemId) {

View File

@@ -1,6 +1,6 @@
package net.andrewcpu.elevenlabs.net.history;
package net.andrewcpu.elevenlabs.requests.history;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
import java.io.File;

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.history;
package net.andrewcpu.elevenlabs.requests.history;
import net.andrewcpu.elevenlabs.model.history.HistoryItem;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
public class GetHistoryItemByIdRequest extends GetRequest<HistoryItem> {
public GetHistoryItemByIdRequest(String historyId) {

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.history;
package net.andrewcpu.elevenlabs.requests.history;
import net.andrewcpu.elevenlabs.model.history.History;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
public class GetHistoryRequest extends GetRequest<History> {
public GetHistoryRequest() {

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.history;
package net.andrewcpu.elevenlabs.requests.history;
import net.andrewcpu.elevenlabs.model.history.HistoryItemList;
import net.andrewcpu.elevenlabs.net.PostRequest;
import net.andrewcpu.elevenlabs.requests.PostRequest;
import java.io.File;
import java.util.Arrays;

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.models;
package net.andrewcpu.elevenlabs.requests.models;
import net.andrewcpu.elevenlabs.model.response.GenerationTypeModel;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
public class GetModelsRequest extends GetRequest<GenerationTypeModel[]> {
public GetModelsRequest() {

View File

@@ -1,6 +1,6 @@
package net.andrewcpu.elevenlabs.net.samples;
package net.andrewcpu.elevenlabs.requests.samples;
import net.andrewcpu.elevenlabs.net.DeleteRequest;
import net.andrewcpu.elevenlabs.requests.DeleteRequest;
public class DeleteSampleRequest extends DeleteRequest<String> {
public DeleteSampleRequest(String voiceId, String sampleId) {

View File

@@ -1,6 +1,6 @@
package net.andrewcpu.elevenlabs.net.samples;
package net.andrewcpu.elevenlabs.requests.samples;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
import java.io.File;

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.tts;
package net.andrewcpu.elevenlabs.requests.tts;
import net.andrewcpu.elevenlabs.model.request.TextToSpeechRequest;
import net.andrewcpu.elevenlabs.net.PostRequest;
import net.andrewcpu.elevenlabs.requests.PostRequest;
import java.io.File;

View File

@@ -1,9 +1,8 @@
package net.andrewcpu.elevenlabs.net.tts;
package net.andrewcpu.elevenlabs.requests.tts;
import net.andrewcpu.elevenlabs.model.request.TextToSpeechRequest;
import net.andrewcpu.elevenlabs.net.PostRequest;
import net.andrewcpu.elevenlabs.requests.PostRequest;
import java.io.File;
import java.io.InputStream;
public class PostTextToSpeechStreamedRequest extends PostRequest<InputStream> {

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.user;
package net.andrewcpu.elevenlabs.requests.user;
import net.andrewcpu.elevenlabs.model.user.Subscription;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
public class GetSubscriptionRequest extends GetRequest<Subscription> {

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.user;
package net.andrewcpu.elevenlabs.requests.user;
import net.andrewcpu.elevenlabs.model.user.User;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
public class GetUserRequest extends GetRequest<User> {
public GetUserRequest() {

View File

@@ -1,6 +1,6 @@
package net.andrewcpu.elevenlabs.net.voices;
package net.andrewcpu.elevenlabs.requests.voices;
import net.andrewcpu.elevenlabs.net.DeleteRequest;
import net.andrewcpu.elevenlabs.requests.DeleteRequest;
public class DeleteVoiceRequest extends DeleteRequest<String> {
public DeleteVoiceRequest(String voiceId) {

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.voices;
package net.andrewcpu.elevenlabs.requests.voices;
import net.andrewcpu.elevenlabs.model.voice.VoiceSettings;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
public class GetDefaultVoiceSettingsRequest extends GetRequest<VoiceSettings> {
public GetDefaultVoiceSettingsRequest() {

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.voices;
package net.andrewcpu.elevenlabs.requests.voices;
import net.andrewcpu.elevenlabs.model.voice.Voice;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
import java.util.HashMap;
import java.util.Map;

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.voices;
package net.andrewcpu.elevenlabs.requests.voices;
import net.andrewcpu.elevenlabs.model.voice.VoiceSettings;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
public class GetVoiceSettingsRequest extends GetRequest<VoiceSettings> {
public GetVoiceSettingsRequest(String voiceId) {

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.voices;
package net.andrewcpu.elevenlabs.requests.voices;
import net.andrewcpu.elevenlabs.model.response.VoiceModelResponse;
import net.andrewcpu.elevenlabs.net.GetRequest;
import net.andrewcpu.elevenlabs.requests.GetRequest;
public class GetVoicesRequest extends GetRequest<VoiceModelResponse> {
public GetVoicesRequest() {

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.voices;
package net.andrewcpu.elevenlabs.requests.voices;
import net.andrewcpu.elevenlabs.model.response.CreateVoiceResponse;
import net.andrewcpu.elevenlabs.net.PostRequest;
import net.andrewcpu.elevenlabs.requests.PostRequest;
import java.io.File;
import java.util.HashMap;

View File

@@ -1,7 +1,6 @@
package net.andrewcpu.elevenlabs.net.voices;
package net.andrewcpu.elevenlabs.requests.voices;
import net.andrewcpu.elevenlabs.model.response.CreateVoiceResponse;
import net.andrewcpu.elevenlabs.net.PostRequest;
import net.andrewcpu.elevenlabs.requests.PostRequest;
import java.io.File;
import java.util.HashMap;

View File

@@ -1,7 +1,7 @@
package net.andrewcpu.elevenlabs.net.voices;
package net.andrewcpu.elevenlabs.requests.voices;
import net.andrewcpu.elevenlabs.model.voice.VoiceSettings;
import net.andrewcpu.elevenlabs.net.PostRequest;
import net.andrewcpu.elevenlabs.requests.PostRequest;
public class PostEditVoiceSettingsRequest extends PostRequest<String> {
private VoiceSettings voiceSettings;

View File

@@ -3,12 +3,10 @@ package net.andrewcpu.elevenlabs.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.andrewcpu.elevenlabs.ElevenLabs;
import net.andrewcpu.elevenlabs.HttpRequestType;
import net.andrewcpu.elevenlabs.enums.HttpRequestType;
import net.andrewcpu.elevenlabs.exceptions.ValidationException;
import net.andrewcpu.elevenlabs.model.error.ValidationError;
import org.apache.hc.client5.http.classic.HttpClient;
import org.apache.hc.client5.http.classic.methods.*;
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
import org.apache.hc.client5.http.entity.mime.FileBody;
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
@@ -23,8 +21,6 @@ import org.apache.hc.core5.net.URIBuilder;
import java.io.*;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.security.interfaces.DSAParams;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;