2 Commits
v64 ... v66

Author SHA1 Message Date
Andrew Stein
a8630ceeb0 Simplified some code 2023-11-24 14:45:02 -05:00
andrewstein
7593f3a3f1 Added getDownloadUrl() support for HistoryItem's. 2023-11-24 14:40:30 -05:00
11 changed files with 10 additions and 10 deletions

View File

@@ -60,7 +60,7 @@
<groupId>net.andrewcpu</groupId>
<artifactId>elevenlabs-api</artifactId>
<version>2.7.5-SNAPSHOT</version>
<version>2.7.6-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import net.andrewcpu.elevenlabs.ElevenLabs;
import net.andrewcpu.elevenlabs.model.ElevenModel;
import net.andrewcpu.elevenlabs.util.ElevenNetworkUtil;
import java.io.File;
import java.util.Map;
@@ -131,6 +132,10 @@ public class HistoryItem extends ElevenModel {
return ElevenLabs.getHistoryAPI().getHistoryItemAudio(historyItemId);
}
public String getDownloadUrl() {
return ElevenNetworkUtil.getHistoryItemUrl(historyItemId);
}
@JsonIgnore
@Override
public String toString() {

View File

@@ -37,6 +37,4 @@ public abstract class ElevenLabsRequest<T> {
}
public abstract Object getPayload();
}

View File

@@ -3,7 +3,6 @@ package net.andrewcpu.elevenlabs.requests.projects;
import net.andrewcpu.elevenlabs.requests.DeleteRequest;
public class DeleteChapterByIdRequest extends DeleteRequest<String> {
public DeleteChapterByIdRequest(String projectId, String chapterId) {
super("v1/projects/" + projectId + "/chapters/" + chapterId, String.class);
}

View File

@@ -7,5 +7,4 @@ public class GetChapterSnapshotsRequest extends GetRequest<ChapterSnapshotsModel
public GetChapterSnapshotsRequest(String projectId, String chapterId) {
super("v1/projects/" + projectId + "/chapters/" + chapterId + "/snapshots", ChapterSnapshotsModelResponse.class);
}
}

View File

@@ -6,5 +6,4 @@ public class PostConvertChapterRequest extends PostRequest<String> {
public PostConvertChapterRequest(String projectId, String chapterId) {
super("v1/projects/" + projectId + "/chapters/" + chapterId + "/convert", String.class);
}
}

View File

@@ -6,5 +6,4 @@ public class PostConvertProjectRequest extends PostRequest<String> {
public PostConvertProjectRequest(String projectId) {
super("v1/projects/" + projectId + "/convert", String.class);
}
}

View File

@@ -8,5 +8,4 @@ public class PostStreamChapterSnapshotAudioRequest extends PostRequest<InputStre
public PostStreamChapterSnapshotAudioRequest(String projectId, String chapterId, String chapterSnapshotId) {
super("v1/projects/" + projectId + "/chapters/" + chapterId + "/snapshots/" + chapterSnapshotId + "/stream", InputStream.class);
}
}

View File

@@ -8,5 +8,4 @@ public class PostStreamProjectSnapshotAudioRequest extends PostRequest<InputStre
public PostStreamProjectSnapshotAudioRequest(String projectId, String snapshotId) {
super("v1/projects/" + projectId + "/snapshots/" + snapshotId + "/stream", InputStream.class);
}
}

View File

@@ -25,5 +25,4 @@ public class GetVoiceRequest extends GetRequest<Voice> {
payload.put("with_settings", String.valueOf(withSettings));
return payload;
}
}

View File

@@ -137,6 +137,10 @@ public class ElevenNetworkUtil {
return request;
}
public static String getHistoryItemUrl(String historyItemId) {
return BASE_URL + "v1/history/" + historyItemId + "/audio";
}
public static <T> T sendRequest(HttpRequestType method, String path, Object payload, Class<T> responseType) {
ObjectMapper objectMapper = new ObjectMapper();
path = BASE_URL + path;