FR911.Api.Client
2.2.26.43
dotnet add package FR911.Api.Client --version 2.2.26.43
NuGet\Install-Package FR911.Api.Client -Version 2.2.26.43
<PackageReference Include="FR911.Api.Client" Version="2.2.26.43" />
<PackageVersion Include="FR911.Api.Client" Version="2.2.26.43" />
<PackageReference Include="FR911.Api.Client" />
paket add FR911.Api.Client --version 2.2.26.43
#r "nuget: FR911.Api.Client, 2.2.26.43"
#:package FR911.Api.Client@2.2.26.43
#addin nuget:?package=FR911.Api.Client&version=2.2.26.43
#tool nuget:?package=FR911.Api.Client&version=2.2.26.43
FR911.Api.Client
Provides typed HTTP clients for interacting with FR911 APIs, supporting both API key-based authentication for system integrations and bearer token-based authentication for web applications.
Installation
Install the package via NuGet:
dotnet add package FR911.Api.Client
Or via Package Manager:
Install-Package FR911.Api.Client
Key Features
- API Key Client: Authenticate using API keys for system-to-system integrations (e.g., service settings, server settings, initialization).
- Web API Client: Authenticate using bearer tokens for web applications (e.g., authentication, incidents, compliance, users).
- Typed Responses: Strongly-typed request and response objects using DTOs from FR911.Api.Dto.
- Dependency Injection Ready: Designed for use with HttpClientFactory and DI containers.
- Comprehensive Coverage: Endpoints for authentication, incidents, compliance, users, agencies, and service settings.
Usage
Setup
Configure the clients using HttpClientFactory for proper lifecycle management:
// In Program.cs or Startup.cs
builder.Services.AddHttpClient<FR911ApiKeyApiClient>(client =>
{
client.BaseAddress = new Uri("https://your-fr911-api-url/");
});
builder.Services.AddHttpClient<FR911WebApiClient>(client =>
{
client.BaseAddress = new Uri("https://your-fr911-api-url/");
});
API Key Client
Use for system integrations requiring API key authentication:
public class MyService
{
private readonly FR911ApiKeyApiClient _client;
public MyService(FR911ApiKeyApiClient client)
{
_client = client;
}
public async Task InitializeAsync(string apiKey)
{
// Get service settings
var settingsResponse = await _client.GetServiceSettings(apiKey, "serviceSettingsId");
if (settingsResponse.IsSuccessStatusCode)
{
var settings = await settingsResponse.Content.ReadFromJsonAsync<ServiceSettingsDto>();
// Process settings...
}
// Initialize and subscribe
var initRequest = new InitRequest { /* populate request */ };
var initResponse = await _client.InitAndSubscribe(apiKey, initRequest);
// Handle response...
}
}
Web API Client
Use for web applications with user authentication via bearer tokens:
public class WebApiService
{
private readonly FR911WebApiClient _client;
public WebApiService(FR911WebApiClient client)
{
_client = client;
}
public async Task AuthenticateAsync()
{
// Authenticate
var authRequest = new WebAuthRequest { Username = "user", Password = "pass" };
var authResult = await _client.AuthAsync(authRequest);
if (authResult.IsSuccess)
{
var token = authResult.Data.IdToken;
// Store token for subsequent requests...
// Refresh token when needed
var refreshRequest = new RefreshAuthRequest { RefreshToken = authResult.Data.RefreshToken };
var refreshResult = await _client.RefreshAuthAsync(refreshRequest);
// Handle refreshed token...
}
}
public async Task GetIncidentsAsync(string bearerToken)
{
// Get current incident IDs
var idsResult = await _client.GetIncidentIdsAsync(bearerToken, TimeSpan.FromHours(1));
if (idsResult.IsSuccess)
{
// Process incident IDs...
}
// Get incidents for a date range
var incidentsResult = await _client.GetIncidentsAsync(bearerToken, new DateOnly(2023, 1, 1));
if (incidentsResult.IsSuccess)
{
var incidents = incidentsResult.Data.Incidents;
// Process incidents...
}
}
public async Task HandleComplianceAsync(string bearerToken)
{
// Get compliance exceptions
var exceptionsResult = await _client.GetComplianceExceptionsAsync(bearerToken, new DateOnly(2023, 1, 1));
if (exceptionsResult.IsSuccess)
{
var exceptions = exceptionsResult.Data.Exceptions;
// Process exceptions...
}
// Create justification
var justificationRequest = new CreateComplianceExceptionJustificationRequest { /* details */ };
var justificationResult = await _client.CreateComplianceExceptionJustificationAsync(
bearerToken, "exceptionId", justificationRequest);
// Handle result...
}
public async Task ManageUsersAsync(string bearerToken)
{
// Get users for an agency
var usersResult = await _client.GetUsersAsync(bearerToken, "agencyId", enabledOnly: true);
if (usersResult.IsSuccess)
{
var users = usersResult.Data.Users;
// Process users...
}
}
}
Error Handling
All client methods return typed results. Check for success and handle errors appropriately:
var result = await _client.GetIncidentsAsync(bearerToken, startDate);
if (result.IsSuccess)
{
// Process result.Data
}
else
{
// Handle error: check result.HttpResponseMessage.StatusCode, etc.
}
Configuration Options
Clients use FR911ApiClientOptions for advanced configuration:
builder.Services.Configure<FR911ApiClientOptions>(options =>
{
options.Timeout = TimeSpan.FromSeconds(30);
// Additional options...
});
API Reference
FR911ApiKeyApiClient
GetServiceSettings: Retrieve service settings by ID.GetServerSettings: Retrieve server settings.InitAndSubscribe: Initialize and subscribe to FR911 system.GetZones: Retrieve zones for an agency.
FR911WebApiClient
- Authentication:
AuthAsync,RefreshAuthAsync,PingAsync,AssignUserRolesAsync. - Incidents:
GetIncidentIdsAsync,GetIncidentsAsync,GetIncidentAsync. - Compliance:
GetComplianceConfigAsync,GetComplianceExceptionsAsync,GetComplianceStatisticsAsync,CreateComplianceExceptionJustificationAsync,UpdateJustificationReasonAsync,UpdateJustificationResolutionAsync,RequestIntervalEndOverrideAsync,OverrideExceptionEndIntervalAsync,AddJustificationAttachmentAsync,DownloadJustificationAttachmentAsync. - Users:
GetUsersAsync. - Agencies:
GetAgencyRolesAsync. - Service Settings:
GetServiceSettings.
Refer to the method documentation in the source code for detailed parameter information.
Dependencies
- FR911.Api.Dto: For typed request/response objects.
- Microsoft.Extensions.Http: For HttpClientFactory integration.
- System.Net.Http.Json: For JSON serialization.
Contributing
For contributions or issues, please refer to the main FR911 repository.
Version History
See the NuGet package versions for changelog details.
| 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
- FR911.Api.Dto (>= 2.2.26.42)
- Microsoft.AspNetCore.WebUtilities (>= 10.0.2)
- Microsoft.Extensions.Configuration (>= 10.0.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection (>= 10.0.7)
- Microsoft.Extensions.Http (>= 10.0.7)
- Microsoft.Extensions.Logging (>= 10.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Primitives (>= 10.0.7)
- MimeTypesMap (>= 1.0.9)
- ObjectsComparer (>= 1.4.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FR911.Api.Client:
| Package | Downloads |
|---|---|
|
FR911.Webhooks.Integration
Support for FirstResponse911 Webhooks integration. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.2.26.43 | 0 | 6/4/2026 |
| 2.2.26.42 | 42 | 6/2/2026 |
| 2.2.26.41 | 97 | 5/25/2026 |
| 2.2.26.40 | 92 | 5/24/2026 |
| 2.2.26.39 | 95 | 5/23/2026 |
| 2.2.26.38 | 97 | 5/10/2026 |
| 2.2.26.37 | 96 | 5/10/2026 |
| 2.2.26.36 | 209 | 4/21/2026 |
| 2.2.26.35 | 116 | 4/21/2026 |
| 2.2.26.34 | 106 | 4/12/2026 |
| 2.2.26.33 | 199 | 3/31/2026 |
| 2.2.26.32 | 103 | 3/27/2026 |
| 2.2.26.31 | 124 | 3/15/2026 |
| 2.2.26.30 | 119 | 3/7/2026 |
| 2.2.26.29 | 95 | 3/7/2026 |
| 2.2.26.28 | 96 | 3/6/2026 |
| 2.2.26.27 | 100 | 3/4/2026 |
| 2.2.26.26 | 334 | 2/5/2026 |
| 2.2.26.25 | 106 | 2/5/2026 |
| 2.2.26.24 | 109 | 2/5/2026 |
Initial release