Groups
Groups
Sign in
Groups
Groups
AltNet-Hispano
Conversations
About
Send feedback
Help
REST API Client Code Generator
89 views
Skip to first unread message
Carlos Admirador
unread,
Aug 31, 2022, 7:22:05 AM
8/31/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to AltNet-Hispano
Recomiendan alguna utilidad para generar código para un API client REST API ?
https://marketplace.visualstudio.com/items?itemName=ChristianResmaHelle.ApiClientCodeGenerator2022
Carlos Admirador
unread,
Aug 31, 2022, 7:23:16 AM
8/31/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to AltNet-Hispano
https://www.c-sharpcorner.com/article/generate-the-client-code-of-web-api-using-swagger-api-specification/
Carlos Admirador
unread,
Aug 31, 2022, 10:41:58 AM
8/31/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to AltNet-Hispano
https://github.com/RicoSuter/NSwag/wiki/NSwagStudio
Parte del código (no sé si con buenas prácticas) que genera:
[
System.CodeDom.Compiler.GeneratedCode("NSwag", "13.16.1.0 (NJsonSchema v10.7.2.0 (Newtonsoft.Json v12.0.0.0))")]
public partial class Client
{
private string _baseUrl = "";
private
System.Net
.Http.HttpClient _httpClient;
private System.Lazy<Newtonsoft.Json.JsonSerializerSettings> _settings;
public Client(string baseUrl,
System.Net
.Http.HttpClient httpClient)
{
BaseUrl = baseUrl;
_httpClient = httpClient;
_settings = new System.Lazy<Newtonsoft.Json.JsonSerializerSettings>(CreateSerializerSettings);
}
private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
{
var settings = new Newtonsoft.Json.JsonSerializerSettings();
UpdateJsonSerializerSettings(settings);
return settings;
}
public string BaseUrl
{
get { return _baseUrl; }
set { _baseUrl = value; }
}
protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } }
partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings);
partial void PrepareRequest(
System.Net
.Http.HttpClient client,
System.Net
.Http.HttpRequestMessage request, string url);
partial void PrepareRequest(
System.Net
.Http.HttpClient client,
System.Net
.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
partial void ProcessResponse(
System.Net
.Http.HttpClient client,
System.Net
.Http.HttpResponseMessage response);
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual System.Threading.Tasks.Task GetEnvironmentAsync()
{
return GetEnvironmentAsync(System.Threading.CancellationToken.None);
}
Reply all
Reply to author
Forward
0 new messages