Improved the code generator. More to come.
This commit is contained in:
@ -6,42 +6,68 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MontoyaTech.Rest.Net.Example
|
||||
{
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
|
||||
public class Client
|
||||
{
|
||||
public string BaseUrl = null;
|
||||
public string BaseUrl;
|
||||
|
||||
public TestFunctions Test;
|
||||
private HttpClient HttpClient;
|
||||
|
||||
public class TestFunctions
|
||||
{
|
||||
public Client Client;
|
||||
|
||||
public TestFunctions(Client client)
|
||||
{
|
||||
this.Client = client;
|
||||
}
|
||||
|
||||
public void Status()
|
||||
{
|
||||
}
|
||||
|
||||
public void Add()
|
||||
{
|
||||
}
|
||||
|
||||
public void Signup()
|
||||
{
|
||||
}
|
||||
|
||||
public void Json()
|
||||
{
|
||||
}
|
||||
}
|
||||
public TestApi Test;
|
||||
|
||||
public Client(string baseUrl)
|
||||
{
|
||||
this.BaseUrl = baseUrl;
|
||||
this.Test = new TestFunctions(this);
|
||||
this.Test = new TestApi(this);
|
||||
this.HttpClient = new HttpClient();
|
||||
this.HttpClient.DefaultRequestHeaders.Add("Accept", "*/*");
|
||||
this.HttpClient.DefaultRequestHeaders.Add("Connection", "keep-alive");
|
||||
this.HttpClient.DefaultRequestHeaders.Add("Accept-Encoding", "identity");
|
||||
}
|
||||
|
||||
public class TestApi
|
||||
{
|
||||
public Client Client;
|
||||
|
||||
public TestApi(Client client)
|
||||
{
|
||||
this.Client = client;
|
||||
}
|
||||
|
||||
public string Status()
|
||||
{
|
||||
var request = new HttpRequestMessage(HttpMethod.Get, $"{this.Client.BaseUrl}/status");
|
||||
return default;
|
||||
}
|
||||
|
||||
public string Add(double a, double b)
|
||||
{
|
||||
var request = new HttpRequestMessage(HttpMethod.Post, $"{this.Client.BaseUrl}/add/{a}/{b}");
|
||||
return default;
|
||||
}
|
||||
|
||||
public string Signup(User user)
|
||||
{
|
||||
var request = new HttpRequestMessage(HttpMethod.Post, $"{this.Client.BaseUrl}/signup/{user}");
|
||||
return default;
|
||||
}
|
||||
|
||||
public User Json()
|
||||
{
|
||||
var request = new HttpRequestMessage(HttpMethod.Get, $"{this.Client.BaseUrl}/json");
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
public class User
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public System.Collections.Generic.List<string> List;
|
||||
|
||||
public ulong Property { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,10 @@ namespace MontoyaTech.Rest.Net.Example
|
||||
{
|
||||
public string Name = null;
|
||||
|
||||
public List<string> List = null;
|
||||
|
||||
public ulong Property { get; set; }
|
||||
|
||||
public User(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
|
Reference in New Issue
Block a user