-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌿 Fern Regeneration -- August 1, 2024 #37
Changes from all commits
93db068
af49570
a85df3a
45e74bd
0731aa4
3667121
321b017
634b686
b596a4c
fea248b
6713ddd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
using AssemblyAI.Realtime; | ||
|
||
namespace AssemblyAI.IntegrationTests; | ||
|
||
[TestFixture] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using AssemblyAI.Core; | ||
|
||
#nullable enable | ||
|
||
namespace AssemblyAI.Core; | ||
|
||
/// <summary> | ||
/// This exception type will be thrown for any non-2XX API responses. | ||
/// </summary> | ||
public class AssemblyAIClientApiException(string message, int statusCode, object body) | ||
: AssemblyAIClientException(message) | ||
{ | ||
/// <summary> | ||
/// The error code of the response that triggered the exception. | ||
/// </summary> | ||
public int StatusCode { get; } = statusCode; | ||
|
||
/// <summary> | ||
/// The body of the response that triggered the exception. | ||
/// </summary> | ||
public object Body { get; } = body; | ||
|
||
public override string ToString() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exceptions shouldn't override the |
||
{ | ||
return $"AssemblyAIClientApiException {{ message: {Message}, statusCode: {StatusCode}, body: {Body} }}"; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace AssemblyAI.Core; | ||
|
||
public class Environments | ||
public class AssemblyAIClientEnvironment | ||
{ | ||
public static string DEFAULT = "https://api.assemblyai.com"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
#nullable enable | ||
|
||
namespace AssemblyAI.Core; | ||
|
||
/// <summary> | ||
/// Base exception class for all exceptions thrown by the SDK. | ||
/// </summary> | ||
public class AssemblyAIClientException(string message, Exception? innerException = null) | ||
: Exception(message, innerException) { } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Globalization; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace AssemblyAI.Core; | ||
|
||
public class DateTimeSerializer : JsonConverter<DateTime> | ||
{ | ||
public override DateTime Read( | ||
ref Utf8JsonReader reader, | ||
System.Type typeToConvert, | ||
JsonSerializerOptions options | ||
) | ||
{ | ||
return DateTime.Parse(reader.GetString()!, null, DateTimeStyles.RoundtripKind); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(value.ToString(Constants.DateTimeFormat)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to expose a
Core
namespace, so let's put this at the root namespace.