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.
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.
// Install ReportSharp.Api as a Cake Addin
#addin nuget:?package=ReportSharp.Api&version=1.0.5
// Install ReportSharp.Api as a Cake Tool
#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
ConfigureServices
method inStartup
class:
services.AddReportSharp(options => {
options.ConfigReportSharp(routerOptions =>
routerOptions.SetApiPrefix("/")
.SetUsername("Username")
.SetSecretKey("SecretKey")
);
options.AddApis(apiOptions =>
apiOptions.UseAuthorization<DefaultApiAuthorizationService>()
);
});
- Add following lines to
Configure
method inStartup
class:
app.UseReportSharp(configure => {
configure.UseApis();
});
Dotnet 6 or later:
- Add following lines to
services
section, 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
Configure
section, 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
CalculatePassword
method in above source code is password for apis. - Default password implementation is time based.
- you can change default implementation by implementing
IApiAuthorizationService
interface in yourAuthorization
class and enable it byapiOptions.UseAuthorization<YourAuthorization>()
Donation:
If you like it, you can support me with USDT
:
TJ57yPBVwwK8rjWDxogkGJH1nF3TGPVq98
forUSDT TRC20
0x743379201B80dA1CB680aC08F54b058Ac01346F1
forUSDT 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. |
.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 | 771 | 12/31/2021 |