Skip to content

Commit 7b79abe

Browse files
committed
update c# sample
1 parent dbd8909 commit 7b79abe

File tree

7 files changed

+220
-20
lines changed

7 files changed

+220
-20
lines changed

samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs

Lines changed: 88 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,17 @@ public async System.Threading.Tasks.Task UpdatePetAsync (Pet body)
306306
var formParams = new Dictionary<String, String>();
307307
var fileParams = new Dictionary<String, FileParameter>();
308308
String postBody = null;
309-
309+
310+
// to determine the Accept header
311+
String[] http_header_accepts = new String[] {
312+
"application/json", "application/xml"
313+
};
314+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
315+
if (http_header_accept != null)
316+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
317+
318+
// set "format" to json by default
319+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
310320
pathParams.Add("format", "json");
311321

312322

@@ -394,7 +404,17 @@ public async System.Threading.Tasks.Task AddPetAsync (Pet body)
394404
var formParams = new Dictionary<String, String>();
395405
var fileParams = new Dictionary<String, FileParameter>();
396406
String postBody = null;
397-
407+
408+
// to determine the Accept header
409+
String[] http_header_accepts = new String[] {
410+
"application/json", "application/xml"
411+
};
412+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
413+
if (http_header_accept != null)
414+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
415+
416+
// set "format" to json by default
417+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
398418
pathParams.Add("format", "json");
399419

400420

@@ -482,7 +502,17 @@ public async System.Threading.Tasks.Task<List<Pet>> FindPetsByStatusAsync (List<
482502
var formParams = new Dictionary<String, String>();
483503
var fileParams = new Dictionary<String, FileParameter>();
484504
String postBody = null;
485-
505+
506+
// to determine the Accept header
507+
String[] http_header_accepts = new String[] {
508+
"application/json", "application/xml"
509+
};
510+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
511+
if (http_header_accept != null)
512+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
513+
514+
// set "format" to json by default
515+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
486516
pathParams.Add("format", "json");
487517

488518
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
@@ -569,7 +599,17 @@ public async System.Threading.Tasks.Task<List<Pet>> FindPetsByTagsAsync (List<st
569599
var formParams = new Dictionary<String, String>();
570600
var fileParams = new Dictionary<String, FileParameter>();
571601
String postBody = null;
572-
602+
603+
// to determine the Accept header
604+
String[] http_header_accepts = new String[] {
605+
"application/json", "application/xml"
606+
};
607+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
608+
if (http_header_accept != null)
609+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
610+
611+
// set "format" to json by default
612+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
573613
pathParams.Add("format", "json");
574614

575615
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
@@ -661,7 +701,17 @@ public async System.Threading.Tasks.Task<Pet> GetPetByIdAsync (long? petId)
661701
var formParams = new Dictionary<String, String>();
662702
var fileParams = new Dictionary<String, FileParameter>();
663703
String postBody = null;
664-
704+
705+
// to determine the Accept header
706+
String[] http_header_accepts = new String[] {
707+
"application/json", "application/xml"
708+
};
709+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
710+
if (http_header_accept != null)
711+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
712+
713+
// set "format" to json by default
714+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
665715
pathParams.Add("format", "json");
666716
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
667717

@@ -759,7 +809,17 @@ public async System.Threading.Tasks.Task UpdatePetWithFormAsync (string petId, s
759809
var formParams = new Dictionary<String, String>();
760810
var fileParams = new Dictionary<String, FileParameter>();
761811
String postBody = null;
762-
812+
813+
// to determine the Accept header
814+
String[] http_header_accepts = new String[] {
815+
"application/json", "application/xml"
816+
};
817+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
818+
if (http_header_accept != null)
819+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
820+
821+
// set "format" to json by default
822+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
763823
pathParams.Add("format", "json");
764824
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
765825

@@ -857,7 +917,17 @@ public async System.Threading.Tasks.Task DeletePetAsync (long? petId, string api
857917
var formParams = new Dictionary<String, String>();
858918
var fileParams = new Dictionary<String, FileParameter>();
859919
String postBody = null;
860-
920+
921+
// to determine the Accept header
922+
String[] http_header_accepts = new String[] {
923+
"application/json", "application/xml"
924+
};
925+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
926+
if (http_header_accept != null)
927+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
928+
929+
// set "format" to json by default
930+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
861931
pathParams.Add("format", "json");
862932
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
863933

@@ -957,7 +1027,17 @@ public async System.Threading.Tasks.Task UploadFileAsync (long? petId, string ad
9571027
var formParams = new Dictionary<String, String>();
9581028
var fileParams = new Dictionary<String, FileParameter>();
9591029
String postBody = null;
960-
1030+
1031+
// to determine the Accept header
1032+
String[] http_header_accepts = new String[] {
1033+
"application/json", "application/xml"
1034+
};
1035+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
1036+
if (http_header_accept != null)
1037+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
1038+
1039+
// set "format" to json by default
1040+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
9611041
pathParams.Add("format", "json");
9621042
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
9631043

samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,17 @@ public String GetBasePath()
211211
var formParams = new Dictionary<String, String>();
212212
var fileParams = new Dictionary<String, FileParameter>();
213213
String postBody = null;
214-
214+
215+
// to determine the Accept header
216+
String[] http_header_accepts = new String[] {
217+
"application/json", "application/xml"
218+
};
219+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
220+
if (http_header_accept != null)
221+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
222+
223+
// set "format" to json by default
224+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
215225
pathParams.Add("format", "json");
216226

217227

@@ -297,7 +307,17 @@ public async System.Threading.Tasks.Task<Order> PlaceOrderAsync (Order body)
297307
var formParams = new Dictionary<String, String>();
298308
var fileParams = new Dictionary<String, FileParameter>();
299309
String postBody = null;
300-
310+
311+
// to determine the Accept header
312+
String[] http_header_accepts = new String[] {
313+
"application/json", "application/xml"
314+
};
315+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
316+
if (http_header_accept != null)
317+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
318+
319+
// set "format" to json by default
320+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
301321
pathParams.Add("format", "json");
302322

303323

@@ -389,7 +409,17 @@ public async System.Threading.Tasks.Task<Order> GetOrderByIdAsync (string orderI
389409
var formParams = new Dictionary<String, String>();
390410
var fileParams = new Dictionary<String, FileParameter>();
391411
String postBody = null;
392-
412+
413+
// to determine the Accept header
414+
String[] http_header_accepts = new String[] {
415+
"application/json", "application/xml"
416+
};
417+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
418+
if (http_header_accept != null)
419+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
420+
421+
// set "format" to json by default
422+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
393423
pathParams.Add("format", "json");
394424
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
395425

@@ -481,7 +511,17 @@ public async System.Threading.Tasks.Task DeleteOrderAsync (string orderId)
481511
var formParams = new Dictionary<String, String>();
482512
var fileParams = new Dictionary<String, FileParameter>();
483513
String postBody = null;
484-
514+
515+
// to determine the Accept header
516+
String[] http_header_accepts = new String[] {
517+
"application/json", "application/xml"
518+
};
519+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
520+
if (http_header_accept != null)
521+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
522+
523+
// set "format" to json by default
524+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
485525
pathParams.Add("format", "json");
486526
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
487527

samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs

Lines changed: 88 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,17 @@ public async System.Threading.Tasks.Task CreateUserAsync (User body)
298298
var formParams = new Dictionary<String, String>();
299299
var fileParams = new Dictionary<String, FileParameter>();
300300
String postBody = null;
301-
301+
302+
// to determine the Accept header
303+
String[] http_header_accepts = new String[] {
304+
"application/json", "application/xml"
305+
};
306+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
307+
if (http_header_accept != null)
308+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
309+
310+
// set "format" to json by default
311+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
302312
pathParams.Add("format", "json");
303313

304314

@@ -386,7 +396,17 @@ public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List<Us
386396
var formParams = new Dictionary<String, String>();
387397
var fileParams = new Dictionary<String, FileParameter>();
388398
String postBody = null;
389-
399+
400+
// to determine the Accept header
401+
String[] http_header_accepts = new String[] {
402+
"application/json", "application/xml"
403+
};
404+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
405+
if (http_header_accept != null)
406+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
407+
408+
// set "format" to json by default
409+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
390410
pathParams.Add("format", "json");
391411

392412

@@ -474,7 +494,17 @@ public async System.Threading.Tasks.Task CreateUsersWithListInputAsync (List<Use
474494
var formParams = new Dictionary<String, String>();
475495
var fileParams = new Dictionary<String, FileParameter>();
476496
String postBody = null;
477-
497+
498+
// to determine the Accept header
499+
String[] http_header_accepts = new String[] {
500+
"application/json", "application/xml"
501+
};
502+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
503+
if (http_header_accept != null)
504+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
505+
506+
// set "format" to json by default
507+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
478508
pathParams.Add("format", "json");
479509

480510

@@ -565,7 +595,17 @@ public async System.Threading.Tasks.Task<string> LoginUserAsync (string username
565595
var formParams = new Dictionary<String, String>();
566596
var fileParams = new Dictionary<String, FileParameter>();
567597
String postBody = null;
568-
598+
599+
// to determine the Accept header
600+
String[] http_header_accepts = new String[] {
601+
"application/json", "application/xml"
602+
};
603+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
604+
if (http_header_accept != null)
605+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
606+
607+
// set "format" to json by default
608+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
569609
pathParams.Add("format", "json");
570610

571611
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter
@@ -650,7 +690,17 @@ public async System.Threading.Tasks.Task LogoutUserAsync ()
650690
var formParams = new Dictionary<String, String>();
651691
var fileParams = new Dictionary<String, FileParameter>();
652692
String postBody = null;
653-
693+
694+
// to determine the Accept header
695+
String[] http_header_accepts = new String[] {
696+
"application/json", "application/xml"
697+
};
698+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
699+
if (http_header_accept != null)
700+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
701+
702+
// set "format" to json by default
703+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
654704
pathParams.Add("format", "json");
655705

656706

@@ -742,7 +792,17 @@ public async System.Threading.Tasks.Task<User> GetUserByNameAsync (string userna
742792
var formParams = new Dictionary<String, String>();
743793
var fileParams = new Dictionary<String, FileParameter>();
744794
String postBody = null;
745-
795+
796+
// to determine the Accept header
797+
String[] http_header_accepts = new String[] {
798+
"application/json", "application/xml"
799+
};
800+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
801+
if (http_header_accept != null)
802+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
803+
804+
// set "format" to json by default
805+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
746806
pathParams.Add("format", "json");
747807
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
748808

@@ -837,7 +897,17 @@ public async System.Threading.Tasks.Task UpdateUserAsync (string username, User
837897
var formParams = new Dictionary<String, String>();
838898
var fileParams = new Dictionary<String, FileParameter>();
839899
String postBody = null;
840-
900+
901+
// to determine the Accept header
902+
String[] http_header_accepts = new String[] {
903+
"application/json", "application/xml"
904+
};
905+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
906+
if (http_header_accept != null)
907+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
908+
909+
// set "format" to json by default
910+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
841911
pathParams.Add("format", "json");
842912
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
843913

@@ -931,7 +1001,17 @@ public async System.Threading.Tasks.Task DeleteUserAsync (string username)
9311001
var formParams = new Dictionary<String, String>();
9321002
var fileParams = new Dictionary<String, FileParameter>();
9331003
String postBody = null;
934-
1004+
1005+
// to determine the Accept header
1006+
String[] http_header_accepts = new String[] {
1007+
"application/json", "application/xml"
1008+
};
1009+
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
1010+
if (http_header_accept != null)
1011+
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
1012+
1013+
// set "format" to json by default
1014+
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
9351015
pathParams.Add("format", "json");
9361016
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
9371017

2 KB
Binary file not shown.
360 Bytes
Binary file not shown.
2 KB
Binary file not shown.
360 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)