CodedThought.Core.Data.ApiServer
1.0.0.4
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package CodedThought.Core.Data.ApiServer --version 1.0.0.4
NuGet\Install-Package CodedThought.Core.Data.ApiServer -Version 1.0.0.4
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="CodedThought.Core.Data.ApiServer" Version="1.0.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CodedThought.Core.Data.ApiServer --version 1.0.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CodedThought.Core.Data.ApiServer, 1.0.0.4"
#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 CodedThought.Core.Data.ApiServer as a Cake Addin #addin nuget:?package=CodedThought.Core.Data.ApiServer&version=1.0.0.4 // Install CodedThought.Core.Data.ApiServer as a Cake Tool #tool nuget:?package=CodedThought.Core.Data.ApiServer&version=1.0.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CodedThought.Core.Data.ApiServer
A .NET Core Data Entity Provider for REST APIs.
Requirements
ApiServer requires CodedThough.Core.Configuration and CodedThought.Core. These can be found in NuGet. - CodedThought.Core.Configuration - CodedThought.Core
Usage
- Install required packages. See requirements above.
- Add the Api Connection settings in the appSetting.json or a custom .json file.
Note: See CodedThought.Core.Configuration for JSON configguration specifications.
- Add a new class and inherit from
CodedThough.Core.Data.GenericApiDataStoreController
. Below is a sample class file.
[ApiController]
[Route("api/[controller]/[action]")]
[Produces("application/json")]
public class AppApiController : GenericApiDataStoreController {
public AppApiController(IMemoryCache cache, CodedThough.Core.Configuration.ConnectionSetting connectionSetting){
try{
DataStore = new GenericApiDataStore(cache, connectionSetting)
} catch {
throw;
}
}
public async Task<ApiResponse<Person>> GetPeople(string email) {
try {
ParameterCollection param = DataStore.CreateParameterCollection();
param.AddApiParameter(DataStore.GetApiParameterNameFromProperty<Person>("EmailAddress"), email);
ApiResponse<Person> response = await DataStore.Get<ApiResponse<Person>, Person>(action: "person", param);
return response;
} catch {
throw;
}
}
}
///<summary>
/// Generic response class to accept the data or value response, any message,
/// and status code for the call.
////</summary>
public class ApiResponse<T>{
public List<T> Data { get; set; }
public object? Value { get; set; }
public string? Message { get; set; }
public HttpStatusCode StatusCode { get; set; }
public ApiResponse(){
Data = new List<T>();
Value = null;
StatusCode = HttpStatusCode.OK;
}
public ApiResponse(List<T> data, string? message){
Data = data;
Message = message;
Value = null;
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- CodedThought.Core (>= 7.0.1.34)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.