Skip to content

Commit

Permalink
v1.4.0 (#5)
Browse files Browse the repository at this point in the history
* Update swagger

* Update swagger round 2

* Kiota update
  • Loading branch information
Hawxy authored Mar 17, 2024
1 parent 96b67f3 commit 28545e8
Show file tree
Hide file tree
Showing 255 changed files with 1,966 additions and 770 deletions.
4 changes: 2 additions & 2 deletions Package.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>1.3.0</Version>
<Version>1.4.0</Version>
<Authors>Hawxy</Authors>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
Expand All @@ -10,7 +10,7 @@
<Copyright>Hawxy 2023</Copyright>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<IsAotCompatible>true</IsAotCompatible>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">true</IsAotCompatible>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
_Looking for ASP.NET Core w/ Clerk JWTs? [See below](#what-about-jwt-auth)._

### Packages
**`Clerk.Net`**: Provides the standalone API Client as a Kiota-generated wrapper over Clerk's OpenAPI spec.
**`Clerk.Net`**: Provides the standalone API Client as a Kiota-generated wrapper over Clerk's OpenAPI spec. Compatible with .NET 6+ and .NET Framework 4.7.2+.

**`Clerk.Net.DependencyInjection`**: Extensions to register the `ClerkApiClient` into your DI container.
**`Clerk.Net.DependencyInjection`**: Extensions to register the `ClerkApiClient` into your DI container. Compatible with .NET 6+.

These libraries support .NET 6 onwards and are configured as native AoT compatible for .NET 8+ consumers.
These libraries are configured as native AoT compatible for .NET 8+ consumers.

## Getting Started

Expand Down
4 changes: 2 additions & 2 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
Expand All @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="7.0.6" />
<PackageReference Include="Nuke.Common" Version="8.0.0" />
</ItemGroup>

</Project>
5 changes: 4 additions & 1 deletion build/_build.csproj.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -25,4 +27,5 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
6 changes: 3 additions & 3 deletions src/Clerk.Net.Tests/Clerk.Net.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
15 changes: 8 additions & 7 deletions src/Clerk.Net/Clerk.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
<PackageId>Clerk.Net</PackageId>
<Description>Clerk Backend API Wrapper for .NET. This package includes the OpenAPI-generated client.</Description>
<PackageTags>clerk,auth</PackageTags>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.7.3" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.3.3" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.1.1" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.1.2" />
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.1.1" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.1.1" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.7.12" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.3.7" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.1.5" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.1.8" />
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.1.3" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Clerk.Net/ClerkApiClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public static class ClerkApiClientFactory
/// <returns>The <see cref="ClerkApiClient"/></returns>
public static ClerkApiClient Create(string secretKey, HttpClient? httpClient = default)
{
ArgumentNullException.ThrowIfNull(secretKey);
if (string.IsNullOrEmpty(secretKey))
throw new ArgumentNullException(nameof(secretKey));

var authProvider = new ApiKeyAuthenticationProvider($"Bearer {secretKey}", "Authorization", ApiKeyAuthenticationProvider.KeyLocation.Header);
var adapter = new HttpClientRequestAdapter(authProvider, httpClient: httpClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Actor_tokensPostRequestBody : IParsable {
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="Actor_tokensPostRequestBody"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static Actor_tokensPostRequestBody CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
Expand All @@ -37,6 +38,7 @@ public static Actor_tokensPostRequestBody CreateFromDiscriminatorValue(IParseNod
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
return new Dictionary<string, Action<IParseNode>> {
{"actor", n => { Actor = n.GetObjectValue<Actor_tokensPostRequestBody_actor>(Actor_tokensPostRequestBody_actor.CreateFromDiscriminatorValue); } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ public class Actor_tokensPostRequestBody_actor : IAdditionalDataHolder, IParsabl
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
public IDictionary<string, object> AdditionalData { get; set; }
/// <summary>
/// Instantiates a new actor_tokensPostRequestBody_actor and sets the default values.
/// Instantiates a new <see cref="Actor_tokensPostRequestBody_actor"/> and sets the default values.
/// </summary>
public Actor_tokensPostRequestBody_actor() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="Actor_tokensPostRequestBody_actor"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static Actor_tokensPostRequestBody_actor CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
Expand All @@ -28,6 +29,7 @@ public static Actor_tokensPostRequestBody_actor CreateFromDiscriminatorValue(IPa
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
return new Dictionary<string, Action<IParseNode>> {
};
Expand Down
11 changes: 9 additions & 2 deletions src/Clerk.Net/Client/Actor_tokens/Actor_tokensRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ namespace Clerk.Net.Client.Actor_tokens {
public class Actor_tokensRequestBuilder : BaseRequestBuilder {
/// <summary>Gets an item from the Clerk.Net.Client.actor_tokens.item collection</summary>
/// <param name="position">The ID of the actor token to be revoked.</param>
/// <returns>A <see cref="WithActor_token_ItemRequestBuilder"/></returns>
public WithActor_token_ItemRequestBuilder this[string position] { get {
var urlTplParams = new Dictionary<string, object>(PathParameters);
urlTplParams.Add("actor_token_id", position);
return new WithActor_token_ItemRequestBuilder(urlTplParams, RequestAdapter);
} }
/// <summary>
/// Instantiates a new Actor_tokensRequestBuilder and sets the default values.
/// Instantiates a new <see cref="Actor_tokensRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public Actor_tokensRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/actor_tokens", pathParameters) {
}
/// <summary>
/// Instantiates a new Actor_tokensRequestBuilder and sets the default values.
/// Instantiates a new <see cref="Actor_tokensRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
Expand All @@ -38,9 +39,13 @@ public Actor_tokensRequestBuilder(string rawUrl, IRequestAdapter requestAdapter)
/// <summary>
/// Create an actor token that can be used to impersonate the given user.The `actor` parameter needs to include at least a &quot;sub&quot; key whose value is the ID of the actor (impersonating) user.
/// </summary>
/// <returns>A <see cref="ActorToken"/></returns>
/// <param name="body">The request body</param>
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
/// <exception cref="ClerkErrors">When receiving a 400 status code</exception>
/// <exception cref="ClerkErrors">When receiving a 402 status code</exception>
/// <exception cref="ClerkErrors">When receiving a 422 status code</exception>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public async Task<ActorToken?> PostAsync(Actor_tokensPostRequestBody body, Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
Expand All @@ -60,6 +65,7 @@ public async Task<ActorToken> PostAsync(Actor_tokensPostRequestBody body, Action
/// <summary>
/// Create an actor token that can be used to impersonate the given user.The `actor` parameter needs to include at least a &quot;sub&quot; key whose value is the ID of the actor (impersonating) user.
/// </summary>
/// <returns>A <see cref="RequestInformation"/></returns>
/// <param name="body">The request body</param>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
Expand All @@ -79,6 +85,7 @@ public RequestInformation ToPostRequestInformation(Actor_tokensPostRequestBody b
/// <summary>
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
/// </summary>
/// <returns>A <see cref="Actor_tokensRequestBuilder"/></returns>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
public Actor_tokensRequestBuilder WithUrl(string rawUrl) {
return new Actor_tokensRequestBuilder(rawUrl, RequestAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ namespace Clerk.Net.Client.Actor_tokens.Item.Revoke {
/// </summary>
public class RevokeRequestBuilder : BaseRequestBuilder {
/// <summary>
/// Instantiates a new RevokeRequestBuilder and sets the default values.
/// Instantiates a new <see cref="RevokeRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public RevokeRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/actor_tokens/{actor_token_id}/revoke", pathParameters) {
}
/// <summary>
/// Instantiates a new RevokeRequestBuilder and sets the default values.
/// Instantiates a new <see cref="RevokeRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
Expand All @@ -30,8 +30,11 @@ public RevokeRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : bas
/// <summary>
/// Revokes a pending actor token.
/// </summary>
/// <returns>A <see cref="ActorToken"/></returns>
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
/// <exception cref="ClerkErrors">When receiving a 400 status code</exception>
/// <exception cref="ClerkErrors">When receiving a 404 status code</exception>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public async Task<ActorToken?> PostAsync(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
Expand All @@ -49,6 +52,7 @@ public async Task<ActorToken> PostAsync(Action<RequestConfiguration<DefaultQuery
/// <summary>
/// Revokes a pending actor token.
/// </summary>
/// <returns>A <see cref="RequestInformation"/></returns>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
Expand All @@ -65,6 +69,7 @@ public RequestInformation ToPostRequestInformation(Action<RequestConfiguration<D
/// <summary>
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
/// </summary>
/// <returns>A <see cref="RevokeRequestBuilder"/></returns>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
public RevokeRequestBuilder WithUrl(string rawUrl) {
return new RevokeRequestBuilder(rawUrl, RequestAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public class WithActor_token_ItemRequestBuilder : BaseRequestBuilder {
new RevokeRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>
/// Instantiates a new WithActor_token_ItemRequestBuilder and sets the default values.
/// Instantiates a new <see cref="WithActor_token_ItemRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public WithActor_token_ItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/actor_tokens/{actor_token_id}", pathParameters) {
}
/// <summary>
/// Instantiates a new WithActor_token_ItemRequestBuilder and sets the default values.
/// Instantiates a new <see cref="WithActor_token_ItemRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
Expand Down
Loading

0 comments on commit 28545e8

Please sign in to comment.