Skip to content

.NET library for composing runtime API information

License

Notifications You must be signed in to change notification settings

agero-core/api-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Api Info

NuGet Version NuGet Downloads

API Info is a library for composing API information.

Usage:

Asynchronous Usage:

//Create instance:
IAsyncApiInfoComposer composer =
      new AsyncApiInfoComposer(
         name: "TestApplication",
         version: "1.2.3.4",
         getApplicationInfoAsync: async () => await Task.FromResult<object>(new
         {
            customApplicationDescription = "Application description specific to the application",
            customApplicationInfo = "Application Info specific to the application"
         }));

//Get Info:
ApiInformation apiInformation = await composer.GetAsync();

//Serialize:
var json = JsonConvert.SerializeObject(apiInformation);

Synchronous Usage:

//Create instance:
IApiInfoComposer composer =
      new ApiInfoComposer(
         name: "TestApplication",
         version: "1.2.3.4",
         getApplicationInfo: () => new
         {
            customApplicationDescription = "Application description specific to the application",
            customApplicationInfo = "Application Info specific to the application"
         }
      );

//Get Info:
ApiInformation apiInformation = composer.Get();

//Serialize:
var json = JsonConvert.SerializeObject(apiInformation);

The above code generates the below json.

{  
   "name":"TestApplication",
   "version":"1.2.3.4",
   "system":{  
      "userName":"DomainName\\user",
      "userDomainName":"DomainName",
      "operatingSystem":"Unix 18.2.0.0",
      "is64BitOperatingSystem":true,
      "processorCount":4,
      "clrVersion":"4.0.30319.42000",
      "is64BitProcess":true,
      "machineName":"MACHINE-NAME",
      "localTime":"2018-12-14T13:26:22.1359566-05:00",
      "utcTime":"2018-12-14T18:26:22.1359605+00:00",
      "hostName":"MACHINE-NAME",
      "ipAddresses":[  
         "123.123.1.0"
      ],
      "isServerGC":false
   },
   "application":{  
      "customApplicationDescription":"Application description specific to the application",
      "customApplicationInfo":"Application Info specific to the application"
   }
}

About

.NET library for composing runtime API information

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages