Skip to content

Commit

Permalink
Breaking changes in CSharp generator - so updating to 0.0.6
Browse files Browse the repository at this point in the history
Fixed bug in CSharp generator not adding handling query params correctly.
Added support for optional query parameters.
Fixed bug in CSharp where an operation has multiple successes - the nth+1 success reponses would be incorrect.

Reordered usings in CSharp generator so System first as per MS team guidance.
Some minor cleanup.
Added new sample data.
Fixed spelling in sample data readme
  • Loading branch information
rmaclean committed Apr 8, 2016
1 parent f72c798 commit 72e6134
Show file tree
Hide file tree
Showing 28 changed files with 2,084 additions and 354 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.0.5.{build}
version: 0.0.6.{build}
skip_tags: true
os: Visual Studio 2015
configuration:
Expand Down
864 changes: 721 additions & 143 deletions examples/C#-Examples/bookclubbing.cs

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions examples/C#-Examples/devconf.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
//nSwaggerVersion:0.0.5
//nSwaggerVersion:0.0.6
// This file was automatically generated by nSwagger. Changes made to this file will be lost if nSwagger is run again. See https://github.com/rmaclean/nswagger for more information.
// This file was last generated at: 2016-03-30T11:18:47.0164984Z
// This file was last generated at: 2016-04-08T12:38:04.4353452Z
namespace nSwagger
{
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;

public class DevConfRatings
{
Expand Down Expand Up @@ -211,7 +213,7 @@ public async Task<APIResponse<RatingSession[]>> Rating_PostGetRatingAsync(GetRat
case 200:
{
var data = JsonConvert.DeserializeObject<RatingSession[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<RatingSession[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<RatingSession[]>(data, response.StatusCode);
}

case 400:
Expand Down Expand Up @@ -263,7 +265,7 @@ public async Task<APIResponse<string>> Rating_PostAddRatingAsync(Rating rating)
case 204:
{
var data = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
return new APIResponse<string>(successData: data, statusCode: response.StatusCode);
return new APIResponse<string>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -294,7 +296,7 @@ public async Task<APIResponse<TimeSlot[]>> Session_GetSessionsAsync()
case 200:
{
var data = JsonConvert.DeserializeObject<TimeSlot[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<TimeSlot[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<TimeSlot[]>(data, response.StatusCode);
}

default:
Expand Down
64 changes: 34 additions & 30 deletions examples/C#-Examples/kiosk.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
//nSwaggerVersion:0.0.5
//nSwaggerVersion:0.0.6
// This file was automatically generated by nSwagger. Changes made to this file will be lost if nSwagger is run again. See https://github.com/rmaclean/nswagger for more information.
// This file was last generated at: 2016-03-30T11:18:51.4764628Z
// This file was last generated at: 2016-04-08T12:38:11.2734811Z
namespace nSwagger
{
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;

public class API
{
Expand Down Expand Up @@ -664,7 +666,7 @@ public async Task<APIResponse<object>> Admin_DeleteAdminAsync(string oauthToken,
case 200:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -701,7 +703,7 @@ public async Task<APIResponse<AdminResponse[]>> Admin_GetAdminsAsync(string oaut
case 200:
{
var data = JsonConvert.DeserializeObject<AdminResponse[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<AdminResponse[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<AdminResponse[]>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -804,7 +806,7 @@ public async Task<APIResponse<object>> Cart_PutCartItemsAsync(string oauthToken,
case 200:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -846,7 +848,7 @@ public async Task<APIResponse<CartResponse>> Cart_GetAsync(string oauthToken)
case 200:
{
var data = JsonConvert.DeserializeObject<CartResponse>(await response.Content.ReadAsStringAsync());
return new APIResponse<CartResponse>(successData: data, statusCode: response.StatusCode);
return new APIResponse<CartResponse>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -889,13 +891,13 @@ public async Task<APIResponse<object>> Cart_PostCartItemsAsync(string oauthToken
case 200:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

case 204:
{
var data = JsonConvert.DeserializeObject<Object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(data: data, statusCode: response.StatusCode);
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1055,7 +1057,7 @@ public async Task<APIResponse<CategoryResponse[]>> Category_GetCategoriesAsync(s
case 200:
{
var data = JsonConvert.DeserializeObject<CategoryResponse[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<CategoryResponse[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<CategoryResponse[]>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1171,7 +1173,7 @@ public async Task<APIResponse<ItemResponse[]>> Item_GetMenuItemsAsync(string oau
case 200:
{
var data = JsonConvert.DeserializeObject<ItemResponse[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<ItemResponse[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<ItemResponse[]>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1241,7 +1243,7 @@ public async Task<APIResponse<object>> Item_PutItemAsync(string oauthToken, int
case 200:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1427,7 +1429,7 @@ public async Task<APIResponse<LoginResponse>> Login_PostLoginAsync(LoginRequest
case 200:
{
var data = JsonConvert.DeserializeObject<LoginResponse>(await response.Content.ReadAsStringAsync());
return new APIResponse<LoginResponse>(successData: data, statusCode: response.StatusCode);
return new APIResponse<LoginResponse>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1503,7 +1505,7 @@ public async Task<APIResponse<OrderResponse[]>> Order_GetOrdersByStateAsync(stri
case 200:
{
var data = JsonConvert.DeserializeObject<OrderResponse[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<OrderResponse[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<OrderResponse[]>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1545,7 +1547,7 @@ public async Task<APIResponse<OrderResponse[]>> Order_GetTodayOrdersAsync(string
case 200:
{
var data = JsonConvert.DeserializeObject<OrderResponse[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<OrderResponse[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<OrderResponse[]>(data, response.StatusCode);
}

default:
Expand All @@ -1567,7 +1569,9 @@ public async Task<APIResponse<OrderResponse[]>> Order_GetTodayOrdersAsync(string
public async Task<APIResponse<OrderItemResponse[]>> Order_GetUserOrderHistoryAsync(string oauthToken, string userId)
{
{
var response = await httpClient.GetAsync(new Uri(url + "/order/history", UriKind.Absolute), new SwaggerHTTPClientOptions(TimeSpan.FromSeconds(30)), token: oauthToken);
var queryParameters = new Dictionary<string, object>(1);
queryParameters.Add("userId", userId);
var response = await httpClient.GetAsync(new Uri(url + "/order/history" + "?" + queryParameters.Aggregate("", (curr, next) => (curr.Length > 0 ? "?" : "") + next.Key + "=" + next.Value), UriKind.Absolute), new SwaggerHTTPClientOptions(TimeSpan.FromSeconds(30)), token: oauthToken);
if (response == null)
{
return new APIResponse<OrderItemResponse[]>(false);
Expand All @@ -1588,7 +1592,7 @@ public async Task<APIResponse<OrderItemResponse[]>> Order_GetUserOrderHistoryAsy
case 200:
{
var data = JsonConvert.DeserializeObject<OrderItemResponse[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<OrderItemResponse[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<OrderItemResponse[]>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1623,7 +1627,7 @@ public async Task<APIResponse<object>> Reporting_PostAsync(string oauthToken, Re
case 200:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1657,7 +1661,7 @@ public async Task<APIResponse<object>> Signup_PostResendPinAsync(SignupRequest r
case 202:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1727,7 +1731,7 @@ public async Task<APIResponse<TradingHourResponse[]>> TradingHours_GetTradingHou
case 200:
{
var data = JsonConvert.DeserializeObject<TradingHourResponse[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<TradingHourResponse[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<TradingHourResponse[]>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1770,7 +1774,7 @@ public async Task<APIResponse<TradingHourResponse>> TradingHours_PostAddTradingH
case 201:
{
var data = JsonConvert.DeserializeObject<TradingHourResponse>(await response.Content.ReadAsStringAsync());
return new APIResponse<TradingHourResponse>(successData: data, statusCode: response.StatusCode);
return new APIResponse<TradingHourResponse>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1814,7 +1818,7 @@ public async Task<APIResponse<TradingHourResponse>> TradingHours_PutUpdateTradin
case 200:
{
var data = JsonConvert.DeserializeObject<TradingHourResponse>(await response.Content.ReadAsStringAsync());
return new APIResponse<TradingHourResponse>(successData: data, statusCode: response.StatusCode);
return new APIResponse<TradingHourResponse>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1849,7 +1853,7 @@ public async Task<APIResponse<object>> User_PutDisableAdminAsync(string oauthTok
case 204:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1884,7 +1888,7 @@ public async Task<APIResponse<object>> User_PutEnableAdminAsync(string oauthToke
case 204:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1919,7 +1923,7 @@ public async Task<APIResponse<object>> User_PutUserAsync(string oauthToken, Upda
case 204:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1954,7 +1958,7 @@ public async Task<APIResponse<object>> User_PutUserAdminAsync(string oauthToken,
case 204:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -1990,7 +1994,7 @@ public async Task<APIResponse<object>> User_PutUserRoleAsync(string oauthToken,
case 204:
{
var data = JsonConvert.DeserializeObject<object>(await response.Content.ReadAsStringAsync());
return new APIResponse<object>(successData: data, statusCode: response.StatusCode);
return new APIResponse<object>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -2019,7 +2023,7 @@ public async Task<APIResponse<AdminResponse[]>> User_GetAllUsersAsync(string oau
case 200:
{
var data = JsonConvert.DeserializeObject<AdminResponse[]>(await response.Content.ReadAsStringAsync());
return new APIResponse<AdminResponse[]>(successData: data, statusCode: response.StatusCode);
return new APIResponse<AdminResponse[]>(data, response.StatusCode);
}

default:
Expand Down Expand Up @@ -2049,7 +2053,7 @@ public async Task<APIResponse<AdminResponse>> User_GetUserAsync(string oauthToke
case 200:
{
var data = JsonConvert.DeserializeObject<AdminResponse>(await response.Content.ReadAsStringAsync());
return new APIResponse<AdminResponse>(successData: data, statusCode: response.StatusCode);
return new APIResponse<AdminResponse>(data, response.StatusCode);
}

default:
Expand Down
Loading

0 comments on commit 72e6134

Please sign in to comment.