-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from AssemblyAI/fern-bot/07-25-2024-0338AM
🌿 Fern Regeneration -- July 25, 2024
- Loading branch information
Showing
84 changed files
with
1,256 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,44 @@ | ||
/** | ||
* This file was auto-generated by Fern from our API Definition. | ||
*/ | ||
package com.assemblyai.api.core; | ||
|
||
public final class ApiError extends RuntimeException { | ||
/** | ||
* This exception type will be thrown for any non-2XX API responses. | ||
* @deprecated Use {@link AssemblyAIApiException}. ApiError will be removed in a future release. | ||
*/ | ||
@Deprecated | ||
public class ApiError extends AssemblyAIException { | ||
/** | ||
* The error code of the response that triggered the exception. | ||
*/ | ||
private final int statusCode; | ||
|
||
/** | ||
* The body of the response that triggered the exception. | ||
*/ | ||
private final Object body; | ||
|
||
public ApiError(int statusCode, Object body) { | ||
public ApiError(String message, int statusCode, Object body) { | ||
super(message); | ||
this.statusCode = statusCode; | ||
this.body = body; | ||
} | ||
|
||
/** | ||
* @return the statusCode | ||
*/ | ||
public int statusCode() { | ||
return this.statusCode; | ||
} | ||
|
||
/** | ||
* @return the body | ||
*/ | ||
public Object body() { | ||
return this.body; | ||
} | ||
|
||
@java.lang.Override | ||
public String toString() { | ||
return "ApiError{" + "statusCode: " + statusCode + ", body: " + body + "}"; | ||
return "AssemblyAIApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " | ||
+ body + "}"; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/assemblyai/api/core/AssemblyAIApiException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.assemblyai.api.core; | ||
|
||
/** | ||
* This exception type will be thrown for any non-2XX API responses. | ||
*/ | ||
public class AssemblyAIApiException extends ApiError { | ||
public AssemblyAIApiException(String message, int statusCode, Object body) { | ||
super(message, statusCode, body); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/assemblyai/api/core/AssemblyAIException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* This file was auto-generated by Fern from our API Definition. | ||
*/ | ||
package com.assemblyai.api.core; | ||
|
||
/** | ||
* This class serves as the base exception for all errors in the SDK. | ||
*/ | ||
public class AssemblyAIException extends RuntimeException { | ||
public AssemblyAIException(String message) { | ||
super(message); | ||
} | ||
|
||
public AssemblyAIException(String message, Exception e) { | ||
super(message, e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/com/assemblyai/api/core/ResponseBodyInputStream.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* This file was auto-generated by Fern from our API Definition. | ||
*/ | ||
package com.assemblyai.api.core; | ||
|
||
import java.io.FilterInputStream; | ||
import java.io.IOException; | ||
import okhttp3.Response; | ||
|
||
/** | ||
* A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the | ||
* OkHttp Response object is properly closed when the stream is closed. | ||
* | ||
* This class extends FilterInputStream and takes an OkHttp Response object as a parameter. | ||
* It retrieves the InputStream from the Response and overrides the close method to close | ||
* both the InputStream and the Response object, ensuring proper resource management and preventing | ||
* premature closure of the underlying HTTP connection. | ||
*/ | ||
public class ResponseBodyInputStream extends FilterInputStream { | ||
private final Response response; | ||
|
||
/** | ||
* Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp | ||
* Response object. | ||
* | ||
* @param response the OkHttp Response object from which the InputStream is retrieved | ||
* @throws IOException if an I/O error occurs while retrieving the InputStream | ||
*/ | ||
public ResponseBodyInputStream(Response response) throws IOException { | ||
super(response.body().byteStream()); | ||
this.response = response; | ||
} | ||
|
||
/** | ||
* Closes the InputStream and the associated OkHttp Response object. This ensures that the | ||
* underlying HTTP connection is properly closed after the stream is no longer needed. | ||
* | ||
* @throws IOException if an I/O error occurs | ||
*/ | ||
@Override | ||
public void close() throws IOException { | ||
super.close(); | ||
response.close(); // Ensure the response is closed when the stream is closed | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/assemblyai/api/core/ResponseBodyReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* This file was auto-generated by Fern from our API Definition. | ||
*/ | ||
package com.assemblyai.api.core; | ||
|
||
import java.io.FilterReader; | ||
import java.io.IOException; | ||
import okhttp3.Response; | ||
|
||
/** | ||
* A custom Reader that wraps the Reader from the OkHttp Response and ensures that the | ||
* OkHttp Response object is properly closed when the reader is closed. | ||
* | ||
* This class extends FilterReader and takes an OkHttp Response object as a parameter. | ||
* It retrieves the Reader from the Response and overrides the close method to close | ||
* both the Reader and the Response object, ensuring proper resource management and preventing | ||
* premature closure of the underlying HTTP connection. | ||
*/ | ||
public class ResponseBodyReader extends FilterReader { | ||
private final Response response; | ||
|
||
/** | ||
* Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. | ||
* | ||
* @param response the OkHttp Response object from which the Reader is retrieved | ||
* @throws IOException if an I/O error occurs while retrieving the Reader | ||
*/ | ||
public ResponseBodyReader(Response response) throws IOException { | ||
super(response.body().charStream()); | ||
this.response = response; | ||
} | ||
|
||
/** | ||
* Closes the Reader and the associated OkHttp Response object. This ensures that the | ||
* underlying HTTP connection is properly closed after the reader is no longer needed. | ||
* | ||
* @throws IOException if an I/O error occurs | ||
*/ | ||
@Override | ||
public void close() throws IOException { | ||
super.close(); | ||
response.close(); // Ensure the response is closed when the reader is closed | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/assemblyai/api/errors/BadRequestError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* This file was auto-generated by Fern from our API Definition. | ||
*/ | ||
package com.assemblyai.api.errors; | ||
|
||
import com.assemblyai.api.core.AssemblyAIApiException; | ||
import com.assemblyai.api.types.Error; | ||
|
||
public final class BadRequestError extends AssemblyAIApiException { | ||
/** | ||
* The body of the response that triggered the exception. | ||
*/ | ||
private final Error body; | ||
|
||
public BadRequestError(Error body) { | ||
super("BadRequestError", 400, body); | ||
this.body = body; | ||
} | ||
|
||
/** | ||
* @return the body | ||
*/ | ||
@java.lang.Override | ||
public Error body() { | ||
return this.body; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/assemblyai/api/errors/GatewayTimeoutError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* This file was auto-generated by Fern from our API Definition. | ||
*/ | ||
package com.assemblyai.api.errors; | ||
|
||
import com.assemblyai.api.core.AssemblyAIApiException; | ||
|
||
public final class GatewayTimeoutError extends AssemblyAIApiException { | ||
/** | ||
* The body of the response that triggered the exception. | ||
*/ | ||
private final Object body; | ||
|
||
public GatewayTimeoutError(Object body) { | ||
super("GatewayTimeoutError", 504, body); | ||
this.body = body; | ||
} | ||
|
||
/** | ||
* @return the body | ||
*/ | ||
@java.lang.Override | ||
public Object body() { | ||
return this.body; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/assemblyai/api/errors/InternalServerError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* This file was auto-generated by Fern from our API Definition. | ||
*/ | ||
package com.assemblyai.api.errors; | ||
|
||
import com.assemblyai.api.core.AssemblyAIApiException; | ||
import com.assemblyai.api.types.Error; | ||
|
||
public final class InternalServerError extends AssemblyAIApiException { | ||
/** | ||
* The body of the response that triggered the exception. | ||
*/ | ||
private final Error body; | ||
|
||
public InternalServerError(Error body) { | ||
super("InternalServerError", 500, body); | ||
this.body = body; | ||
} | ||
|
||
/** | ||
* @return the body | ||
*/ | ||
@java.lang.Override | ||
public Error body() { | ||
return this.body; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/assemblyai/api/errors/NotFoundError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* This file was auto-generated by Fern from our API Definition. | ||
*/ | ||
package com.assemblyai.api.errors; | ||
|
||
import com.assemblyai.api.core.AssemblyAIApiException; | ||
import com.assemblyai.api.types.Error; | ||
|
||
public final class NotFoundError extends AssemblyAIApiException { | ||
/** | ||
* The body of the response that triggered the exception. | ||
*/ | ||
private final Error body; | ||
|
||
public NotFoundError(Error body) { | ||
super("NotFoundError", 404, body); | ||
this.body = body; | ||
} | ||
|
||
/** | ||
* @return the body | ||
*/ | ||
@java.lang.Override | ||
public Error body() { | ||
return this.body; | ||
} | ||
} |
Oops, something went wrong.