ArgosiLabs.Freyt.Client
0.2.0
dotnet add package ArgosiLabs.Freyt.Client --version 0.2.0
NuGet\Install-Package ArgosiLabs.Freyt.Client -Version 0.2.0
<PackageReference Include="ArgosiLabs.Freyt.Client" Version="0.2.0" />
<PackageVersion Include="ArgosiLabs.Freyt.Client" Version="0.2.0" />
<PackageReference Include="ArgosiLabs.Freyt.Client" />
paket add ArgosiLabs.Freyt.Client --version 0.2.0
#r "nuget: ArgosiLabs.Freyt.Client, 0.2.0"
#:package ArgosiLabs.Freyt.Client@0.2.0
#addin nuget:?package=ArgosiLabs.Freyt.Client&version=0.2.0
#tool nuget:?package=ArgosiLabs.Freyt.Client&version=0.2.0
ArgosiLabs.Freyt.Client
A lightweight C# client SDK for Freyt, providing presigned upload and download URLs via gRPC.
The client is designed to issue presigned URLs for client-side uploads and downloads, with automatic path-prefix routing for multi-tenant architectures and zero boilerplate.
Features
- Direct gRPC Power: Inherits directly from
FileUrlsServiceClient—supports deadlines, cancellation tokens, metadata/headers, and future proto updates out of the box without wrapper code. - Automatic Path Prefixes: Configure a
basePathPrefix(e.g.tenant-123) once; all upload requests are automatically routed under that prefix via a gRPC interceptor. - Built-in Channel Lifecycle: Manages internal
GrpcChannelconnections cleanly viaIDisposableandIAsyncDisposable, or binds directly to existing channels/invokers in ASP.NET Core DI.
Installation
dotnet add package ArgosiLabs.Freyt.Client
Quickstart
1. Initialize the Client
using ArgosiLabs.Freyt.Client;
// With a base prefix (e.g. tenant or organization scope):
await using var client = new FreytClient("http://localhost:18182", basePathPrefix: "tenant-123");
// Or using options:
await using var client = new FreytClient(new FreytClientOptions
{
ServerAddress = "http://localhost:18182",
BasePathPrefix = "tenant-123"
});
2. Request an Upload URL
The client issues presigned upload URLs. Your web client or frontend then performs the actual file upload (e.g. via multipart POST).
using FileUrls.V1;
var response = await client.GetFileUploadUrlAsync(new GetFileUploadUrlRequest
{
// "avatars" is automatically combined with "tenant-123" -> "tenant-123/avatars"
PathPrefix = "avatars",
MaxSize = 10 * 1024 * 1024, // 10 MB limit
ExpectedMime = "image/png",
ExpiresAt = DateTime.UtcNow.AddMinutes(15).ToString("yyyy-MM-dd'T'HH:mm:ss'Z'")
});
Console.WriteLine($"Upload URL: {response.Url}");
3. Request a Download URL
Generate a presigned, single-use or time-limited download URL for a file UUID:
var response = await client.GetFileDownloadUrlAsync(new GetFileDownloadUrlRequest
{
FileUUID = "your-file-uuid",
ExpiresAt = DateTime.UtcNow.AddMinutes(5).ToString("yyyy-MM-dd'T'HH:mm:ss'Z'"),
CacheUntilSecs = 3600 // Sets 'Cache-Control: private, max-age=3600' on the download
});
Console.WriteLine($"Download URL: {response.Url}");
4. Delete a File
Direct file management is accessible through the Files property:
using Files.V1;
await client.Files.DeleteAsync(new DeleteRequest
{
FileUUID = "your-file-uuid"
});
Dependency Injection (ASP.NET Core)
You can register FreytClient in your service collection using an existing GrpcChannel or CallInvoker:
services.AddSingleton(sp =>
{
var channel = GrpcChannel.ForAddress("http://localhost:18182");
return new FreytClient(channel, basePathPrefix: "tenant-default");
});
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Google.Protobuf (>= 3.36.2)
- Grpc.Core.Api (>= 2.84.0)
- Grpc.Net.Client (>= 2.84.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.