Skip to content

Commit

Permalink
v1.11.0 (#20)
Browse files Browse the repository at this point in the history
* v1.11.0

* Move back to TryAdd

* Bump version

---------

Co-authored-by: JT <Hawxy@users.noreply.github.com>
  • Loading branch information
Hawxy and Hawxy authored Feb 8, 2025
1 parent 8216574 commit 9ebca21
Show file tree
Hide file tree
Showing 35 changed files with 370 additions and 380 deletions.
1 change: 1 addition & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"Compile",
"NugetPack",
"NugetPush",
"PostProcess",
"Restore",
"Test",
"Update"
Expand Down
5 changes: 3 additions & 2 deletions Package.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>1.10.0</Version>
<Version>1.11.0</Version>
<Authors>Hawxy</Authors>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
Expand All @@ -10,7 +10,8 @@
<Copyright>Hawxy 2023-2025</Copyright>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">true</IsAotCompatible>
<IsNet8OrHigher>$([MSBuild]::VersionGreaterThanOrEquals('$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)'))','8.0'))</IsNet8OrHigher>
<IsAotCompatible Condition="$(IsNet8OrHigher)">true</IsAotCompatible>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
Expand Down
65 changes: 43 additions & 22 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using CaseConverter;
using Microsoft.Playwright;
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Execution;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.EnvironmentInfo;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using Serilog;
using static Nuke.Common.Tools.DotNet.DotNetTasks;


Expand All @@ -32,20 +25,19 @@
On = [GitHubActionsTrigger.WorkflowDispatch],
InvokedTargets = [nameof(NugetPush)],
ImportSecrets = [nameof(NugetApiKey)])]
class Build : NukeBuild
partial class Build : NukeBuild
{
/// Support plugins are available for:
/// - JetBrains ReSharper https://nuke.build/resharper
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode

public static int Main () => Execute<Build>(x => x.Compile);
public static int Main() => Execute<Build>(x => x.Compile);

[Solution(GenerateProjects = true)] readonly Solution Solution;

[NuGetPackage("Microsoft.OpenApi.Kiota", "kiota.dll")]
readonly Tool Kiota;
[NuGetPackage("Microsoft.OpenApi.Kiota", "kiota.dll")] readonly Tool Kiota;
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";

Target Clean => _ => _
Expand All @@ -72,7 +64,7 @@ class Build : NukeBuild
.SetConfiguration("Release")
.EnableNoRestore());
});

Target Test => _ => _
.DependsOn(Compile)
.Executes(() =>
Expand Down Expand Up @@ -112,17 +104,17 @@ class Build : NukeBuild
.EnableNoSymbols()
.SetApiKey(NugetApiKey));
});



Target Update => _ => _
.Requires(() => Kiota)
.Triggers(PostProcess)
.Executes(async () =>
{
// swagger URL is a client-side blob...
using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions() {Channel = "msedge"});

await using var browser =
await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions() { Channel = "msedge" });

var page = await browser.NewPageAsync();
await page.GotoAsync("https://clerk.com/docs/reference/backend-api");

Expand All @@ -132,8 +124,37 @@ class Build : NukeBuild

var projectDir = Solution.Clerk_Net.Directory;
await download.SaveAsAsync($"{projectDir}/swagger.json");

Kiota(workingDirectory: projectDir, arguments: $"update -o {projectDir / "Client"} --clean-output");

});


// We do a little bit of cleanup to fix some builder paths output as snake_Case. This is temporary and won't be needed with Kiota 2.0
Target PostProcess => _ => _
.Executes(async () =>
{
var dir = Solution.Clerk_Net.Directory / "Client";

static async Task ProcessFile(string file)
{
var data = await File.ReadAllTextAsync(file);
var output = FindBuilder().Replace(data, match => match.Value.ToPascalCase());
await File.WriteAllTextAsync(file, output);
}

foreach (var file in Directory.EnumerateFiles(dir, "*Builder.cs", SearchOption.AllDirectories))
{
Log.Information("Formatting {File}", file);
await ProcessFile(file);
}

await ProcessFile(dir / "ClerkApiClient.cs");

});

[GeneratedRegex("""(?<=\bglobal\S*::\S*\s)[a-zA-Z]+(?:_[a-zA-Z]+)+\b""")]
private static partial Regex FindBuilder();
}


7 changes: 4 additions & 3 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Playwright" Version="1.49.0" />
<PackageReference Include="Nuke.Common" Version="9.0.3" />
<PackageDownload Include="Microsoft.OpenApi.Kiota" Version="[1.22.0]" />
<PackageReference Include="CaseConverter" Version="2.0.1" />
<PackageReference Include="Microsoft.Playwright" Version="1.50.0" />
<PackageReference Include="Nuke.Common" Version="9.0.4" />
<PackageDownload Include="Microsoft.OpenApi.Kiota" Version="[1.23.0]" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using Clerk.Net.Client;
using System.Diagnostics.CodeAnalysis;
using Clerk.Net.Client;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using Microsoft.Kiota.Http.HttpClientLibrary;
using Microsoft.Kiota.Http.HttpClientLibrary.Middleware;
using Microsoft.Kiota.Http.HttpClientLibrary.Middleware.Options;

namespace Clerk.Net.DependencyInjection;

Expand Down Expand Up @@ -30,9 +33,10 @@ public static IHttpClientBuilder AddClerkApiClient(this IServiceCollection colle
PooledConnectionLifetime = TimeSpan.FromMinutes(2)
})
.SetHandlerLifetime(Timeout.InfiniteTimeSpan);

var types = KiotaClientFactory.GetDefaultHandlerTypes();



var types = KiotaClientFactory.GetDefaultHandlerActivatableTypes();

foreach (var type in types)
{
collection.TryAddTransient(type);
Expand Down
4 changes: 2 additions & 2 deletions src/Clerk.Net.Tests/Clerk.Net.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit.v3" Version="1.0.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<PackageReference Include="xunit.v3" Version="1.1.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/Clerk.Net/Clerk.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.16.3" />
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.17.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class Beta_featuresRequestBuilder : BaseRequestBuilder
get => new global::Clerk.Net.Client.Beta_features.Domain.DomainRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The instance_settings property</summary>
public global::Clerk.Net.Client.Beta_features.Instance_settings.Instance_settingsRequestBuilder Instance_settings
public global::Clerk.Net.Client.Beta_features.Instance_settings.Instance_settingsRequestBuilder InstanceSettings
{
get => new global::Clerk.Net.Client.Beta_features.Instance_settings.Instance_settingsRequestBuilder(PathParameters, RequestAdapter);
}
Expand Down
34 changes: 17 additions & 17 deletions src/Clerk.Net/Client/ClerkApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ namespace Clerk.Net.Client
public partial class ClerkApiClient : BaseRequestBuilder
{
/// <summary>The actor_tokens property</summary>
public global::Clerk.Net.Client.Actor_tokens.Actor_tokensRequestBuilder Actor_tokens
public global::Clerk.Net.Client.Actor_tokens.Actor_tokensRequestBuilder ActorTokens
{
get => new global::Clerk.Net.Client.Actor_tokens.Actor_tokensRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The allowlist_identifiers property</summary>
public global::Clerk.Net.Client.Allowlist_identifiers.Allowlist_identifiersRequestBuilder Allowlist_identifiers
public global::Clerk.Net.Client.Allowlist_identifiers.Allowlist_identifiersRequestBuilder AllowlistIdentifiers
{
get => new global::Clerk.Net.Client.Allowlist_identifiers.Allowlist_identifiersRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The beta_features property</summary>
public global::Clerk.Net.Client.Beta_features.Beta_featuresRequestBuilder Beta_features
public global::Clerk.Net.Client.Beta_features.Beta_featuresRequestBuilder BetaFeatures
{
get => new global::Clerk.Net.Client.Beta_features.Beta_featuresRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The blocklist_identifiers property</summary>
public global::Clerk.Net.Client.Blocklist_identifiers.Blocklist_identifiersRequestBuilder Blocklist_identifiers
public global::Clerk.Net.Client.Blocklist_identifiers.Blocklist_identifiersRequestBuilder BlocklistIdentifiers
{
get => new global::Clerk.Net.Client.Blocklist_identifiers.Blocklist_identifiersRequestBuilder(PathParameters, RequestAdapter);
}
Expand All @@ -77,7 +77,7 @@ public partial class ClerkApiClient : BaseRequestBuilder
get => new global::Clerk.Net.Client.Domains.DomainsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The email_addresses property</summary>
public global::Clerk.Net.Client.Email_addresses.Email_addressesRequestBuilder Email_addresses
public global::Clerk.Net.Client.Email_addresses.Email_addressesRequestBuilder EmailAddresses
{
get => new global::Clerk.Net.Client.Email_addresses.Email_addressesRequestBuilder(PathParameters, RequestAdapter);
}
Expand All @@ -97,22 +97,22 @@ public partial class ClerkApiClient : BaseRequestBuilder
get => new global::Clerk.Net.Client.Jwks.JwksRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The jwt_templates property</summary>
public global::Clerk.Net.Client.Jwt_templates.Jwt_templatesRequestBuilder Jwt_templates
public global::Clerk.Net.Client.Jwt_templates.Jwt_templatesRequestBuilder JwtTemplates
{
get => new global::Clerk.Net.Client.Jwt_templates.Jwt_templatesRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The oauth_applications property</summary>
public global::Clerk.Net.Client.Oauth_applications.Oauth_applicationsRequestBuilder Oauth_applications
public global::Clerk.Net.Client.Oauth_applications.Oauth_applicationsRequestBuilder OauthApplications
{
get => new global::Clerk.Net.Client.Oauth_applications.Oauth_applicationsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The organization_invitations property</summary>
public global::Clerk.Net.Client.Organization_invitations.Organization_invitationsRequestBuilder Organization_invitations
public global::Clerk.Net.Client.Organization_invitations.Organization_invitationsRequestBuilder OrganizationInvitations
{
get => new global::Clerk.Net.Client.Organization_invitations.Organization_invitationsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The organization_memberships property</summary>
public global::Clerk.Net.Client.Organization_memberships.Organization_membershipsRequestBuilder Organization_memberships
public global::Clerk.Net.Client.Organization_memberships.Organization_membershipsRequestBuilder OrganizationMemberships
{
get => new global::Clerk.Net.Client.Organization_memberships.Organization_membershipsRequestBuilder(PathParameters, RequestAdapter);
}
Expand All @@ -122,12 +122,12 @@ public partial class ClerkApiClient : BaseRequestBuilder
get => new global::Clerk.Net.Client.Organizations.OrganizationsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The phone_numbers property</summary>
public global::Clerk.Net.Client.Phone_numbers.Phone_numbersRequestBuilder Phone_numbers
public global::Clerk.Net.Client.Phone_numbers.Phone_numbersRequestBuilder PhoneNumbers
{
get => new global::Clerk.Net.Client.Phone_numbers.Phone_numbersRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The proxy_checks property</summary>
public global::Clerk.Net.Client.Proxy_checks.Proxy_checksRequestBuilder Proxy_checks
public global::Clerk.Net.Client.Proxy_checks.Proxy_checksRequestBuilder ProxyChecks
{
get => new global::Clerk.Net.Client.Proxy_checks.Proxy_checksRequestBuilder(PathParameters, RequestAdapter);
}
Expand All @@ -137,12 +137,12 @@ public partial class ClerkApiClient : BaseRequestBuilder
get => new global::Clerk.Net.Client.Public.PublicRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The redirect_urls property</summary>
public global::Clerk.Net.Client.Redirect_urls.Redirect_urlsRequestBuilder Redirect_urls
public global::Clerk.Net.Client.Redirect_urls.Redirect_urlsRequestBuilder RedirectUrls
{
get => new global::Clerk.Net.Client.Redirect_urls.Redirect_urlsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The saml_connections property</summary>
public global::Clerk.Net.Client.Saml_connections.Saml_connectionsRequestBuilder Saml_connections
public global::Clerk.Net.Client.Saml_connections.Saml_connectionsRequestBuilder SamlConnections
{
get => new global::Clerk.Net.Client.Saml_connections.Saml_connectionsRequestBuilder(PathParameters, RequestAdapter);
}
Expand All @@ -152,12 +152,12 @@ public partial class ClerkApiClient : BaseRequestBuilder
get => new global::Clerk.Net.Client.Sessions.SessionsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The sign_in_tokens property</summary>
public global::Clerk.Net.Client.Sign_in_tokens.Sign_in_tokensRequestBuilder Sign_in_tokens
public global::Clerk.Net.Client.Sign_in_tokens.Sign_in_tokensRequestBuilder SignInTokens
{
get => new global::Clerk.Net.Client.Sign_in_tokens.Sign_in_tokensRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The sign_ups property</summary>
public global::Clerk.Net.Client.Sign_ups.Sign_upsRequestBuilder Sign_ups
public global::Clerk.Net.Client.Sign_ups.Sign_upsRequestBuilder SignUps
{
get => new global::Clerk.Net.Client.Sign_ups.Sign_upsRequestBuilder(PathParameters, RequestAdapter);
}
Expand All @@ -167,7 +167,7 @@ public partial class ClerkApiClient : BaseRequestBuilder
get => new global::Clerk.Net.Client.Templates.TemplatesRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The testing_tokens property</summary>
public global::Clerk.Net.Client.Testing_tokens.Testing_tokensRequestBuilder Testing_tokens
public global::Clerk.Net.Client.Testing_tokens.Testing_tokensRequestBuilder TestingTokens
{
get => new global::Clerk.Net.Client.Testing_tokens.Testing_tokensRequestBuilder(PathParameters, RequestAdapter);
}
Expand All @@ -177,7 +177,7 @@ public partial class ClerkApiClient : BaseRequestBuilder
get => new global::Clerk.Net.Client.Users.UsersRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The waitlist_entries property</summary>
public global::Clerk.Net.Client.Waitlist_entries.Waitlist_entriesRequestBuilder Waitlist_entries
public global::Clerk.Net.Client.Waitlist_entries.Waitlist_entriesRequestBuilder WaitlistEntries
{
get => new global::Clerk.Net.Client.Waitlist_entries.Waitlist_entriesRequestBuilder(PathParameters, RequestAdapter);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Clerk.Net/Client/Instance/InstanceRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ namespace Clerk.Net.Client.Instance
public partial class InstanceRequestBuilder : BaseRequestBuilder
{
/// <summary>The change_domain property</summary>
public global::Clerk.Net.Client.Instance.Change_domain.Change_domainRequestBuilder Change_domain
public global::Clerk.Net.Client.Instance.Change_domain.Change_domainRequestBuilder ChangeDomain
{
get => new global::Clerk.Net.Client.Instance.Change_domain.Change_domainRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The organization_settings property</summary>
public global::Clerk.Net.Client.Instance.Organization_settings.Organization_settingsRequestBuilder Organization_settings
public global::Clerk.Net.Client.Instance.Organization_settings.Organization_settingsRequestBuilder OrganizationSettings
{
get => new global::Clerk.Net.Client.Instance.Organization_settings.Organization_settingsRequestBuilder(PathParameters, RequestAdapter);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Clerk.Net/Client/Invitations/Bulk/Bulk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public partial class Bulk : IParsable
#else
public global::Clerk.Net.Client.Invitations.Bulk.Bulk_public_metadata PublicMetadata { get; set; }
#endif
/// <summary>Optional URL which specifies where to redirect the user once they click the invitation link.This is only required if you have implemented a [custom flow](https://clerk.com/docs/authentication/invitations#custom-flow) and you&apos;re not using Clerk Hosted Pages or Clerk Components.</summary>
/// <summary>The URL where the user is redirected upon visiting the invitation link, where they can accept the invitation. Required if you have implemented a [custom flow for handling application invitations](/docs/custom-flows/invitations).</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public string? RedirectUrl { get; set; }
Expand Down
Loading

0 comments on commit 9ebca21

Please sign in to comment.