This repository was archived by the owner on Apr 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
🌿 Fern Regeneration -- August 26, 2024 #47
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,14 @@ | ||
| using System.Runtime.Serialization; | ||
|
|
||
| namespace AssemblyAI.Core; | ||
|
|
||
| internal static class Extensions | ||
| { | ||
| public static string Stringify(this Enum value) | ||
| { | ||
| var field = value.GetType().GetField(value.ToString()); | ||
| var attribute = (EnumMemberAttribute) | ||
| Attribute.GetCustomAttribute(field, typeof(EnumMemberAttribute)); | ||
| return attribute?.Value ?? value.ToString(); | ||
| } | ||
| } |
This file contains hidden or 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 @@ | ||
| using OneOf; | ||
|
|
||
| namespace AssemblyAI.Core; | ||
|
|
||
| internal sealed class HeaderValue(OneOf<string, Func<string>> value) | ||
| : OneOfBase<string, Func<string>>(value) | ||
| { | ||
| public static implicit operator HeaderValue(string value) | ||
| { | ||
| return new HeaderValue(value); | ||
| } | ||
|
|
||
| public static implicit operator HeaderValue(Func<string> value) | ||
| { | ||
| return new HeaderValue(value); | ||
| } | ||
| } |
This file contains hidden or 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 @@ | ||
| namespace AssemblyAI.Core; | ||
|
|
||
| internal sealed class Headers : Dictionary<string, HeaderValue> | ||
| { | ||
| public Headers() { } | ||
|
|
||
| public Headers(Dictionary<string, string> value) | ||
| { | ||
| foreach (var kvp in value) | ||
| { | ||
| this[kvp.Key] = new HeaderValue(kvp.Value); | ||
| } | ||
| } | ||
|
|
||
| public Headers(IEnumerable<KeyValuePair<string, HeaderValue>> value) | ||
| : base(value.ToDictionary(e => e.Key, e => e.Value)) { } | ||
| } |
This file contains hidden or 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,39 +1,35 @@ | ||
| using System; | ||
| using System.Net.Http; | ||
| // ReSharper disable PartialTypeWithSinglePart | ||
| // ReSharper disable AutoPropertyCanBeMadeGetOnly.Global | ||
| // ReSharper disable CheckNamespace | ||
| using AssemblyAI.Core; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace AssemblyAI; | ||
|
|
||
| public partial class ClientOptions | ||
| { | ||
| /// <summary> | ||
| /// The AssemblyAI API key | ||
| /// </summary> | ||
| public required string ApiKey { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The Base URL for the API. | ||
| /// </summary> | ||
| public string BaseUrl { get; set; } = AssemblyAIClientEnvironment.Default; | ||
|
|
||
| /// <summary> | ||
| /// The AssemblyAI user agent | ||
| /// </summary> | ||
| public UserAgent UserAgent { get; set; } = new(); | ||
|
|
||
| /// <summary> | ||
| /// The http client used to make requests. | ||
| /// </summary> | ||
| public HttpClient? HttpClient { get; set; } | ||
| public HttpClient HttpClient { get; set; } = new HttpClient(); | ||
|
|
||
| /// <summary> | ||
| /// The http client used to make requests. | ||
| /// The amount to retry sending the HTTP request if it fails. | ||
| /// </summary> | ||
| public int MaxRetries { get; set; } = 2; | ||
|
|
||
| /// <summary> | ||
| /// The timeout for the request. | ||
| /// </summary> | ||
| public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(30); | ||
|
|
||
| /// <summary> | ||
| /// The http headers sent with the request. | ||
| /// </summary> | ||
| internal Headers Headers { get; init; } = new(); | ||
| } |
This file contains hidden or 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,19 @@ | ||
| using System.Net.Http; | ||
| // ReSharper disable PartialTypeWithSinglePart | ||
| // ReSharper disable AutoPropertyCanBeMadeGetOnly.Global | ||
| // ReSharper disable CheckNamespace | ||
|
|
||
| namespace AssemblyAI; | ||
|
|
||
| public partial class ClientOptions | ||
| { | ||
| /// <summary> | ||
| /// The AssemblyAI API key | ||
| /// </summary> | ||
| public required string ApiKey { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The AssemblyAI user agent | ||
| /// </summary> | ||
| public UserAgent UserAgent { get; set; } = new(); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
cancellationTokenshould be passed toresponse.Raw.Content.ReadAsStringAsynctooThere 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.
Anything that's async usually
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.
Also
.ConfigureAwait(false)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.
You'll need to use conditional compilation tho: