ReportSharp.Api
1.0.5
dotnet add package ReportSharp.Api --version 1.0.5
NuGet\Install-Package ReportSharp.Api -Version 1.0.5
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="ReportSharp.Api" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ReportSharp.Api" Version="1.0.5" />
<PackageReference Include="ReportSharp.Api" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ReportSharp.Api --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ReportSharp.Api, 1.0.5"
#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.
#:package ReportSharp.Api@1.0.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ReportSharp.Api&version=1.0.5
#tool nuget:?package=ReportSharp.Api&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ReportSharp.Api-1.0.5:
Description:
Api for ReportSharp.DatabaseReporter of ReportSharp package
Dependencies:
ReportSharp.DatabaseReporter: 1.0.5
Dotnet Core 3.1 or later
Usage:
Note:
You need to install and configure ReportSharp and ReportSharp.DatabaseReporter 1.0.5 or later to use this package.
Dotnet 5 or below:
- Add following lines to
ConfigureServicesmethod inStartupclass:
services.AddReportSharp(options => {
options.ConfigReportSharp(routerOptions =>
routerOptions.SetApiPrefix("/")
.SetUsername("Username")
.SetSecretKey("SecretKey")
);
options.AddApis(apiOptions =>
apiOptions.UseAuthorization<DefaultApiAuthorizationService>()
);
});
- Add following lines to
Configuremethod inStartupclass:
app.UseReportSharp(configure => {
configure.UseApis();
});
Dotnet 6 or later:
- Add following lines to
servicessection, beforebuilder.Build()line:
services.AddReportSharp(options => {
options.ConfigReportSharp(routerOptions =>
routerOptions.SetApiPrefix("/")
.SetUsername("Username")
.SetSecretKey("SecretKey")
);
options.AddApis(apiOptions =>
apiOptions.UseAuthorization<DefaultApiAuthorizationService>()
);
});
- Add following lines to
Configuresection, afterbuilder.Build()line:
app.UseReportSharp(configure => {
configure.UseApis();
});
Available apis:
| URL | Header | , | Query | , | Action |
|---|---|---|---|---|---|
| ApiPrefix+"request/" | username, password | ,page, pageSize | ,List of reported requests to database | ||
| ApiPrefix+"request/{id}" | username, password | ,Get reported request | |||
| ApiPrefix+"exception/" | username, password | ,page, pageSize | ,List of reported exceptions to database | ||
| ApiPrefix+"exception/{id}" | username, password | ,Get reported exceptions | |||
| ApiPrefix+"data/" | username, password | ,page, pageSize | ,List of reported data to database | ||
| ApiPrefix+"data/{id}" | username, password | ,Get reported data |
Default implementation for api password
public string CalculatePassword(string username)
{
var now = DateTime.Now;
var usernameCode = GetAsciiValue(username);
var secretKeyCode = GetAsciiValue(ReportSharpApiConfig.SecretKey);
var mergedUsernameSecretKey = long.Parse($"{usernameCode}{secretKeyCode}");
var todayCode = long.Parse($"{now.Year:0000}{now.Month:00}{now.Day:00}");
var validPassword = mergedUsernameSecretKey ^ todayCode;
return validPassword.ToString();
}
public long GetAsciiValue(string str)
{
return str.ToCharArray().Aggregate(0, (current, c) => current + c);
}
Notes:
- Result of
CalculatePasswordmethod in above source code is password for apis. - Default password implementation is time based.
- you can change default implementation by implementing
IApiAuthorizationServiceinterface in yourAuthorizationclass and enable it byapiOptions.UseAuthorization<YourAuthorization>()
Donation:
If you like it, you can support me with USDT:
TJ57yPBVwwK8rjWDxogkGJH1nF3TGPVq98forUSDT TRC200x743379201B80dA1CB680aC08F54b058Ac01346F1forUSDT ERC20
| Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- ReportSharp.DatabaseReporter (>= 1.0.5)
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.5 | 1,062 | 12/31/2021 |