webapiclientgen
webapiclientgen copied to clipboard
Add Refit Support
This PR add the Refit Support. Refit is a library heavily inspired by Square's Retrofit library, and it turns your REST API into a live interface:
public interface IGitHubApi
{
[Get("/users/{user}")]
Task<User> GetUser(string user);
}
Add the Refit Client File by this setting
{
"ApiSelections": {
"ExcludedControllerNames": [
"DemoWebApi.Controllers.Home"
],
"DataModels": [
{
"AssemblyName": "DemoWebApi.DemoDataCore",
"CherryPickingMethods": 3
},
{
"AssemblyName": "DemoCoreWeb",
"CherryPickingMethods": 1
}
],
"CherryPickingMethods": 0
},
"ClientApiOutputs": {
"FileName":"WebApiClientRefit.cs",
"ContainerNameSuffix":"",
"ClientLibraryProjectFolderName": "..\\..\\DemoCoreWeb.ClientApi",
"CamelCase": true,
"CSClientNamespaceSuffix": "Refit.Client",
"UseEnsureSuccessStatusCodeEx": false,
"DataAnnotationsEnabled": true,
"DataAnnotationsToComments": true,
"HandleHttpRequestHeaders": true,
"GenerateBothAsyncAndSync ":false,
"CancellationTokenEnabled": true,
"DecorateDataModelWithDataContract": true,
"DataContractNamespace": "http://fonlowdemo.com/2020/09",
"DecorateDataModelWithSerializable": true,
"IEnumerableToArray": false,
"MaybeNullAttributeOnMethod": true,
"NotNullAttributeOnMethod": true,
"UseSystemTextJson": true,
"UseRefit":true,
"Plugins": [
]
}
}
Btw, refit support upload files also。 It's the first time i use the codedom,it seems lack a lot skills with your great the source code.
What are the benefits to client programmers to use refit and its httpClient construction?