Precisamento.Permify 1.0.0

dotnet add package Precisamento.Permify --version 1.0.0                
NuGet\Install-Package Precisamento.Permify -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Precisamento.Permify" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Precisamento.Permify --version 1.0.0                
#r "nuget: Precisamento.Permify, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Precisamento.Permify as a Cake Addin
#addin nuget:?package=Precisamento.Permify&version=1.0.0

// Install Precisamento.Permify as a Cake Tool
#tool nuget:?package=Precisamento.Permify&version=1.0.0                

Precisamento.Permify

Precisamento.Permify is a C# SDK for the Permify API.

Usage

General

There are few interfaces available that have slightly different uses, but they all share the same default implementation (PermifyClient).

  1. IPermifyClient
  • Best for single tenant applications, or applications that only access a single tenant.
  • The methods have descriptive parameters with sane defaults where expected.
  1. IPermifyClientMultiTenant
  • For applications that need to interact with mutliple tenants.
  • All methods take a specific tenant as their first argument.
  • The methods have descriptive parameters with sane defaults where expected.
  1. IPermifyClientRaw
  • Best for single tenant applications, or applications that only access a single tenant.
  • The methods take and return API model objects that directly mirror the JSON requests.
  1. IPermifyClientRawMultiTenant
  • For applications that need to interact with mutliple tenants.
  • All methods take a specific tenant as their first argument.
  • The methods take and return API model objects that directly mirror the JSON requests.
  1. IPermifyClientFull
  • Useful for hybrid applications with one main tenant, but occasionally needing to interact with others.
  • Union of the above interfaces.

Example

var schema = "..."; // Permify schema string

// Typically this would be loaded in from a config file or environment variables.
var options = new PermifyClientOptions()
{
  TenantId = "my-tenant", // Defaults to "t1"
  Secret = "MY_SECRET_KEY", // One of the keys when using the preshared keys authn config.
  Host = "http://localhost:3476" // URL of the Permify server
};

var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri(options.Host);
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {options.Secret}");

var permifyClient = new PermifyClient(httpClient, options.TenantId);

await permifyClient.CreateTenantAsync(options.TenantId, "My Tenant");
await permifyClient.WriteSchemaAsync(schema);

DependencyInjection

If this library is being used in an application using the C# DependencyInjection functionality (ASP.NET for example), the client can be registered using the AddPermify extension method. It will add all of the interface types to the IServiceCollection.

// App startup

// Typically this would be loaded in from a config file or environment variables.
var options = new PermifyClientOptions()
{
  TenantId = "my-tenant", // Defaults to "t1"
  Secret = "MY_SECRET_KEY", // One of the keys when using the preshared keys authn config.
  Host = "http://localhost:3476" // URL of the Permify server
};

var services = new ServiceCollection();

services.AddPermify(options);



// Get IPermifyClient via constructor

class MyController : Controller {
  private IPermifyClient _permify;

  public MyController(IPermifyClient permify) {
    _permify = permify;
  }
}

Docs

The docs site is currently under construction. The library is reasonably well-commented with doc blocks, and the methods on IPermifyClient should be easily identifiable based on the Permify API documentation.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 180 6/27/2024