14
14
import java .io .File ;
15
15
import java .io .IOException ;
16
16
import java .nio .file .Files ;
17
+ import java .nio .file .Path ;
17
18
import java .util .List ;
18
19
19
20
public class PollingTranscriptsClient extends TranscriptsClient {
@@ -35,7 +36,7 @@ public PollingTranscriptsClient(ClientOptions clientOptions, AssemblyAI client)
35
36
* @throws IOException The file will be read and an IOException may be thrown.
36
37
*/
37
38
public Transcript submit (File file ) throws IOException {
38
- return submit (file , EMPTY_PARAMS );
39
+ return submit (file . toPath () , EMPTY_PARAMS );
39
40
}
40
41
41
42
/**
@@ -46,10 +47,48 @@ public Transcript submit(File file) throws IOException {
46
47
* @throws IOException The file will be read and an IOException may be thrown.
47
48
*/
48
49
public Transcript submit (File file , TranscriptOptionalParams transcriptParams ) throws IOException {
49
- UploadedFile uploadedFile = client .files ().upload (Files .readAllBytes (file .toPath ()));
50
+ return submit (file .toPath (), transcriptParams );
51
+ }
52
+
53
+ /**
54
+ * Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
55
+ * @param filePath Path to audio file to transcribe
56
+ * @return Queued transcript
57
+ * @throws IOException The file will be read and an IOException may be thrown.
58
+ */
59
+ public Transcript submit (Path filePath ) throws IOException {
60
+ return submit (filePath , EMPTY_PARAMS );
61
+ }
62
+
63
+ /**
64
+ * Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
65
+ * @param filePath Path to audio file to transcribe
66
+ * @return Queued transcript
67
+ * @throws IOException The file will be read and an IOException may be thrown.
68
+ */
69
+ public Transcript submit (Path filePath , TranscriptOptionalParams transcriptParams ) throws IOException {
70
+ UploadedFile uploadedFile = client .files ().upload (filePath );
50
71
return submit (uploadedFile .getUploadUrl (), transcriptParams );
51
72
}
52
73
74
+ /**
75
+ * Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
76
+ * @param file The file uploaded to AssemblyAI
77
+ * @return Queued transcript
78
+ */
79
+ public Transcript submit (UploadedFile file ) {
80
+ return submit (file .getUploadUrl (), EMPTY_PARAMS );
81
+ }
82
+
83
+ /**
84
+ * Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
85
+ * @param file The file uploaded to AssemblyAI
86
+ * @return Queued transcript
87
+ */
88
+ public Transcript submit (UploadedFile file , TranscriptOptionalParams transcriptParams ) {
89
+ return submit (file .getUploadUrl (), transcriptParams );
90
+ }
91
+
53
92
/**
54
93
* Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
55
94
* @param url URL to the audio file to transcribe
@@ -107,6 +146,28 @@ public Transcript submit(String url, TranscriptOptionalParams transcriptParams)
107
146
return super .submit (createTranscriptParams );
108
147
}
109
148
149
+ /**
150
+ * Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
151
+ * @param filePath Audio file to transcribe
152
+ * @return A transcript with status "completed" or "error"
153
+ * @throws IOException The file will be read and an IOException may be thrown.
154
+ */
155
+ public Transcript transcribe (Path filePath ) throws IOException {
156
+ return transcribe (filePath , EMPTY_PARAMS );
157
+ }
158
+
159
+ /**
160
+ * Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
161
+ * @param filePath Audio file to transcribe
162
+ * @param transcriptParams The parameters to transcribe an audio file.
163
+ * @return A transcript with status "completed" or "error"
164
+ * @throws IOException The file will be read and an IOException may be thrown.
165
+ */
166
+ public Transcript transcribe (Path filePath , TranscriptOptionalParams transcriptParams ) throws IOException {
167
+ UploadedFile uploadedFile = client .files ().upload (filePath );
168
+ return transcribe (uploadedFile .getUploadUrl (), transcriptParams );
169
+ }
170
+
110
171
/**
111
172
* Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
112
173
* @param file Audio file to transcribe
@@ -129,6 +190,26 @@ public Transcript transcribe(File file, TranscriptOptionalParams transcriptParam
129
190
return transcribe (uploadedFile .getUploadUrl (), transcriptParams );
130
191
}
131
192
193
+ /**
194
+ * Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
195
+ * @param file The file uploaded to AssemblyAI
196
+ * @return A transcript with status "completed" or "error"
197
+ * @throws IOException The file will be read and an IOException may be thrown.
198
+ */
199
+ public Transcript transcribe (UploadedFile file ) throws IOException {
200
+ return transcribe (file , EMPTY_PARAMS );
201
+ }
202
+
203
+ /**
204
+ * Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
205
+ * @param file The file uploaded to AssemblyAI
206
+ * @param transcriptParams The parameters to transcribe an audio file.
207
+ * @return A transcript with status "completed" or "error"
208
+ */
209
+ public Transcript transcribe (UploadedFile file , TranscriptOptionalParams transcriptParams ) {
210
+ return transcribe (file .getUploadUrl (), transcriptParams );
211
+ }
212
+
132
213
/**
133
214
* Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
134
215
* @param url URL to the audio file to transcribe
0 commit comments