Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 8a7a2d3

Browse files
authored
Merge pull request #30 from AssemblyAI/fern-bot/07-15-2024-0301PM
🌿 Fern Regeneration -- July 15, 2024
2 parents 2da0aed + 31928e3 commit 8a7a2d3

File tree

80 files changed

+491
-466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+491
-466
lines changed

src/AssemblyAI.sln

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyAI", "AssemblyAI\AssemblyAI.csproj", "{BEAFFC37-A74B-4631-93FF-820AC159F8A2}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyAI", "AssemblyAI\AssemblyAI.csproj", "{6908A082-04F2-4B91-92F1-671DEA06C378}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyAI.Test", "AssemblyAI.Test\AssemblyAI.Test.csproj", "{6850F3A1-514C-40F7-9F9A-E540F215C69C}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyAI.Test", "AssemblyAI.Test\AssemblyAI.Test.csproj", "{4C5A0575-B891-42AA-8F7A-92424E2E27C0}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -16,13 +16,13 @@ Global
1616
HideSolutionNode = FALSE
1717
EndGlobalSection
1818
GlobalSection(ProjectConfigurationPlatforms) = postSolution
19-
{BEAFFC37-A74B-4631-93FF-820AC159F8A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20-
{BEAFFC37-A74B-4631-93FF-820AC159F8A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
21-
{BEAFFC37-A74B-4631-93FF-820AC159F8A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
22-
{BEAFFC37-A74B-4631-93FF-820AC159F8A2}.Release|Any CPU.Build.0 = Release|Any CPU
23-
{6850F3A1-514C-40F7-9F9A-E540F215C69C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24-
{6850F3A1-514C-40F7-9F9A-E540F215C69C}.Debug|Any CPU.Build.0 = Debug|Any CPU
25-
{6850F3A1-514C-40F7-9F9A-E540F215C69C}.Release|Any CPU.ActiveCfg = Release|Any CPU
26-
{6850F3A1-514C-40F7-9F9A-E540F215C69C}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{6908A082-04F2-4B91-92F1-671DEA06C378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{6908A082-04F2-4B91-92F1-671DEA06C378}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{6908A082-04F2-4B91-92F1-671DEA06C378}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{6908A082-04F2-4B91-92F1-671DEA06C378}.Release|Any CPU.Build.0 = Release|Any CPU
23+
{4C5A0575-B891-42AA-8F7A-92424E2E27C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{4C5A0575-B891-42AA-8F7A-92424E2E27C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{4C5A0575-B891-42AA-8F7A-92424E2E27C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{4C5A0575-B891-42AA-8F7A-92424E2E27C0}.Release|Any CPU.Build.0 = Release|Any CPU
2727
EndGlobalSection
2828
EndGlobal

src/AssemblyAI/AssemblyAI.csproj

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,39 @@
1-
1+
22
<Project Sdk="Microsoft.NET.Sdk">
33

44
<PropertyGroup>
5-
<TargetFrameworks>net8.0;net7.0;net6.0;</TargetFrameworks>
5+
<TargetFrameworks>net462;net8.0;net7.0;net6.0;netstandard2.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<NuGetAudit>false</NuGetAudit>
8-
<Version>0.0.1-alpha</Version>
8+
<LangVersion>12</LangVersion>
9+
<Nullable>enable</Nullable>
10+
<Version>0.0.2-alpha</Version>
911
<PackageReadmeFile>README.md</PackageReadmeFile>
1012
<PackageProjectUrl>https://github.com/AssemblyAI/assemblyai-csharp-sdk</PackageProjectUrl>
1113
</PropertyGroup>
14+
15+
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'netstandard2.0'">
16+
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition="'$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'netstandard2.0'">
20+
<PackageReference Include="Portable.System.DateTimeOnly" Version="8.0.1" />
21+
</ItemGroup>
22+
23+
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
24+
<Reference Include="System.Net.Http" />
25+
</ItemGroup>
26+
27+
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' Or '$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'netstandard2.0'">
28+
<PackageReference Include="PolySharp" Version="1.14.1">
29+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
30+
<PrivateAssets>all</PrivateAssets>
31+
</PackageReference>
32+
</ItemGroup>
1233

1334
<ItemGroup>
1435
<PackageReference Include="OneOf" Version="3.0.263" />
36+
<PackageReference Include="OneOf.Extended" Version="3.0.263" />
1537
<PackageReference Include="System.Text.Json" Version="8.0.3" />
1638
</ItemGroup>
1739

src/AssemblyAI/AssemblyAIClient.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using AssemblyAI;
2+
using AssemblyAI.Core;
23

34
#nullable enable
45

@@ -8,42 +9,29 @@ public partial class AssemblyAIClient
89
{
910
private RawClient _client;
1011

11-
public AssemblyAIClient(string apiKey = null, ClientOptions clientOptions = null)
12+
public AssemblyAIClient(string? apiKey = null, ClientOptions? clientOptions = null)
1213
{
1314
_client = new RawClient(
1415
new Dictionary<string, string>()
1516
{
1617
{ "Authorization", apiKey },
1718
{ "X-Fern-Language", "C#" },
1819
{ "X-Fern-SDK-Name", "AssemblyAI" },
19-
{ "X-Fern-SDK-Version", "0.0.1-alpha" },
20+
{ "X-Fern-SDK-Version", "0.0.2-alpha" },
2021
},
2122
clientOptions ?? new ClientOptions()
2223
);
2324
Files = new FilesClient(_client);
2425
Transcripts = new TranscriptsClient(_client);
2526
Realtime = new RealtimeClient(_client);
2627
Lemur = new LemurClient(_client);
27-
Streaming = new StreamingClient(_client);
2828
}
2929

30-
public FilesClient Files { get; }
30+
public FilesClient Files { get; init; }
3131

32-
public TranscriptsClient Transcripts { get; }
32+
public TranscriptsClient Transcripts { get; init; }
3333

34-
public RealtimeClient Realtime { get; }
34+
public RealtimeClient Realtime { get; init; }
3535

36-
public LemurClient Lemur { get; }
37-
38-
public StreamingClient Streaming { get; }
39-
40-
private string GetFromEnvironmentOrThrow(string env, string message)
41-
{
42-
var value = System.Environment.GetEnvironmentVariable(env);
43-
if (value == null)
44-
{
45-
throw new Exception(message);
46-
}
47-
return value;
48-
}
36+
public LemurClient Lemur { get; init; }
4937
}

src/AssemblyAI/Core/ClientOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
using System.Net.Http;
12
using AssemblyAI.Core;
23

34
#nullable enable
45

5-
namespace AssemblyAI;
6+
namespace AssemblyAI.Core;
67

78
public partial class ClientOptions
89
{

src/AssemblyAI/Core/CollectionItemSerializer.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Text.Json;
44
using System.Text.Json.Serialization;
55

6-
namespace AssemblyAI;
6+
namespace AssemblyAI.Core;
77

88
/// <summary>
99
/// Json collection converter.
@@ -21,35 +21,34 @@ public class CollectionItemSerializer<TDatatype, TConverterType>
2121
/// <param name="typeToConvert">Type to convert.</param>
2222
/// <param name="options">Serializer options.</param>
2323
/// <returns>Created object.</returns>
24-
public override IEnumerable<TDatatype> Read(
24+
public override IEnumerable<TDatatype>? Read(
2525
ref Utf8JsonReader reader,
26-
Type typeToConvert,
26+
System.Type typeToConvert,
2727
JsonSerializerOptions options
2828
)
2929
{
3030
if (reader.TokenType == JsonTokenType.Null)
3131
{
32-
return default(IEnumerable<TDatatype>);
32+
return default;
3333
}
3434

35-
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions(options);
35+
var jsonSerializerOptions = new JsonSerializerOptions(options);
3636
jsonSerializerOptions.Converters.Clear();
3737
jsonSerializerOptions.Converters.Add(Activator.CreateInstance<TConverterType>());
3838

39-
List<TDatatype> returnValue = new List<TDatatype>();
39+
var returnValue = new List<TDatatype>();
4040

4141
while (reader.TokenType != JsonTokenType.EndArray)
4242
{
4343
if (reader.TokenType != JsonTokenType.StartArray)
4444
{
45-
returnValue.Add(
46-
(TDatatype)
47-
JsonSerializer.Deserialize(
48-
ref reader,
49-
typeof(TDatatype),
50-
jsonSerializerOptions
51-
)
45+
var item = (TDatatype)(
46+
JsonSerializer.Deserialize(ref reader, typeof(TDatatype), jsonSerializerOptions)
47+
?? throw new Exception(
48+
$"Failed to deserialize collection item of type {typeof(TDatatype)}"
49+
)
5250
);
51+
returnValue.Add(item);
5352
}
5453

5554
reader.Read();
@@ -66,7 +65,7 @@ JsonSerializerOptions options
6665
/// <param name="options">Serializer options.</param>
6766
public override void Write(
6867
Utf8JsonWriter writer,
69-
IEnumerable<TDatatype> value,
68+
IEnumerable<TDatatype>? value,
7069
JsonSerializerOptions options
7170
)
7271
{
@@ -82,7 +81,7 @@ JsonSerializerOptions options
8281

8382
writer.WriteStartArray();
8483

85-
foreach (TDatatype data in value)
84+
foreach (var data in value)
8685
{
8786
JsonSerializer.Serialize(writer, data, jsonSerializerOptions);
8887
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Net.Http;
2+
3+
namespace AssemblyAI.Core;
4+
5+
public static class HttpMethodExtensions
6+
{
7+
public static readonly HttpMethod Patch = new("PATCH");
8+
}

src/AssemblyAI/Core/OneOfSerializer.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
using System.Text.Json.Serialization;
44
using OneOf;
55

6-
namespace AssemblyAI;
6+
namespace AssemblyAI.Core;
77

88
public class OneOfSerializer<TOneOf> : JsonConverter<TOneOf>
99
where TOneOf : IOneOf
1010
{
11-
public override TOneOf Read(
11+
public override TOneOf? Read(
1212
ref Utf8JsonReader reader,
13-
Type typeToConvert,
13+
System.Type typeToConvert,
1414
JsonSerializerOptions options
1515
)
1616
{
@@ -21,10 +21,10 @@ JsonSerializerOptions options
2121
{
2222
try
2323
{
24-
Utf8JsonReader readerCopy = reader;
24+
var readerCopy = reader;
2525
var result = JsonSerializer.Deserialize(ref readerCopy, type, options);
2626
reader.Skip();
27-
return (TOneOf)cast.Invoke(null, new[] { result })!;
27+
return (TOneOf)cast.Invoke(null, [result])!;
2828
}
2929
catch (JsonException) { }
3030
}
@@ -34,14 +34,14 @@ JsonSerializerOptions options
3434
);
3535
}
3636

37-
private static readonly (Type type, MethodInfo cast)[] s_types = GetOneOfTypes();
37+
private static readonly (System.Type type, MethodInfo cast)[] s_types = GetOneOfTypes();
3838

3939
public override void Write(Utf8JsonWriter writer, TOneOf value, JsonSerializerOptions options)
4040
{
4141
JsonSerializer.Serialize(writer, value.Value, options);
4242
}
4343

44-
private static (Type type, MethodInfo cast)[] GetOneOfTypes()
44+
private static (System.Type type, MethodInfo cast)[] GetOneOfTypes()
4545
{
4646
var casts = typeof(TOneOf)
4747
.GetRuntimeMethods()

0 commit comments

Comments
 (0)