Restluent is supposed to be a Fluent Api Client generator.
The only thing needed is an OpenAPI Standard Schema eg. from Swagger.
- Example API
- Open API Component parsing from a Json file
- SourceGenerated classes from parsed components
- Fluent Api builder
- Couple the Api Client with the generated classes
- HttpClient request handling
- Unit Tests
If given a schema with the following components:
"components": {
"schemas": {
"WeatherForecast": {
"type": "object",
"properties": {
"date": {
"type": "string",
"format": "date-time"
},
"temperatureC": {
"type": "integer",
"format": "int32"
},
"temperatureF": {
"type": "integer",
"format": "int32",
"readOnly": true
},
"summary": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
}
}
}
There should be generated a class as:
// Auto-generated code
using System;
namespace Restluent
{
public class WeatherForecast
{
public string date { get; set; }
public int temperatureC { get; set; }
public int temperatureF { get; set; }
public string summary { get; set; }
}
}
With a generated class like:
public class Customer
{
public Guid Id { get; set; }
public string Name { get; set; } = null!;
public bool WithCompanies { get; set; }
}
Then the usage should be:
var customer = RestluentApi.Customers()
.Where(c => c.Name == "tester")
.WithCompanies();
var newCustomer = RestluentApi.Customers()
.Add(new CustomerVariables
{
Name = "Test"
});