Merge pull request #588 from wing328/csharp_response_warning

Eliminated warning related to response in CSharp API files
This commit is contained in:
Tony Tam 2015-04-04 21:00:31 -07:00
commit a57588caa1
4 changed files with 1092 additions and 1033 deletions

View File

@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using {{invokerPackage}}; using {{invokerPackage}};
using {{modelPackage}}; using {{modelPackage}};
{{#imports}} {{#imports}}
{{/imports}} {{/imports}}
namespace {{package}} { namespace {{package}} {
{{#operations}} {{#operations}}
public class {{classname}} { public class {{classname}} {
string basePath; string basePath;
@ -75,16 +75,28 @@
try { try {
if (typeof({{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}) == typeof(byte[])) { if (typeof({{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}) == typeof(byte[])) {
{{#returnType}}
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return {{#returnType}}((object)response) as {{{returnType}}}{{/returnType}}; return ((object)response) as {{{returnType}}};
{{/returnType}}
{{^returnType}}
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
{{/returnType}}
} else { } else {
{{#returnType}}
var response = apiInvoker.invokeAPI(basePath, path, "{{httpMethod}}", queryParams, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "{{httpMethod}}", queryParams, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, headerParams, formParams);
if(response != null){ if (response != null){
return {{#returnType}}({{{returnType}}}) ApiInvoker.deserialize(response, typeof({{{returnType}}})){{/returnType}}; return ({{{returnType}}}) ApiInvoker.deserialize(response, typeof({{{returnType}}}));
} }
else { else {
return {{#returnType}}null{{/returnType}}; return null;
} }
{{/returnType}}
{{^returnType}}
apiInvoker.invokeAPI(basePath, path, "{{httpMethod}}", queryParams, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, headerParams, formParams);
return;
{{/returnType}}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -98,4 +110,4 @@
{{/operation}} {{/operation}}
} }
{{/operations}} {{/operations}}
} }

View File

@ -1,14 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using io.swagger.client; using io.swagger.client;
using io.swagger.Model; using io.swagger.Model;
namespace io.swagger.Api {
namespace io.swagger.Api {
public class PetApi { public class PetApi {
string basePath; string basePath;
@ -60,16 +55,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, Body, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, Body, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -107,16 +103,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -158,16 +155,22 @@
try { try {
if (typeof(List<Pet>) == typeof(byte[])) { if (typeof(List<Pet>) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as List<Pet>; return ((object)response) as List<Pet>;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if(response != null){ if (response != null){
return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>)); return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>));
} }
else { else {
return null; return null;
} }
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -209,16 +212,22 @@
try { try {
if (typeof(List<Pet>) == typeof(byte[])) { if (typeof(List<Pet>) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as List<Pet>; return ((object)response) as List<Pet>;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if(response != null){ if (response != null){
return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>)); return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>));
} }
else { else {
return null; return null;
} }
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -256,16 +265,22 @@
try { try {
if (typeof(Pet) == typeof(byte[])) { if (typeof(Pet) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as Pet; return ((object)response) as Pet;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if(response != null){ if (response != null){
return (Pet) ApiInvoker.deserialize(response, typeof(Pet)); return (Pet) ApiInvoker.deserialize(response, typeof(Pet));
} }
else { else {
return null; return null;
} }
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -321,16 +336,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -370,16 +386,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -435,16 +452,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -458,4 +476,4 @@
} }
} }

View File

@ -1,13 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using io.swagger.client; using io.swagger.client;
using io.swagger.Model; using io.swagger.Model;
namespace io.swagger.Api {
namespace io.swagger.Api {
public class StoreApi { public class StoreApi {
string basePath; string basePath;
@ -58,16 +54,22 @@
try { try {
if (typeof(Dictionary<String, int?>) == typeof(byte[])) { if (typeof(Dictionary<String, int?>) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as Dictionary<String, int?>; return ((object)response) as Dictionary<String, int?>;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if(response != null){ if (response != null){
return (Dictionary<String, int?>) ApiInvoker.deserialize(response, typeof(Dictionary<String, int?>)); return (Dictionary<String, int?>) ApiInvoker.deserialize(response, typeof(Dictionary<String, int?>));
} }
else { else {
return null; return null;
} }
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -105,16 +107,22 @@
try { try {
if (typeof(Order) == typeof(byte[])) { if (typeof(Order) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as Order; return ((object)response) as Order;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
if(response != null){ if (response != null){
return (Order) ApiInvoker.deserialize(response, typeof(Order)); return (Order) ApiInvoker.deserialize(response, typeof(Order));
} }
else { else {
return null; return null;
} }
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -152,16 +160,22 @@
try { try {
if (typeof(Order) == typeof(byte[])) { if (typeof(Order) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as Order; return ((object)response) as Order;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if(response != null){ if (response != null){
return (Order) ApiInvoker.deserialize(response, typeof(Order)); return (Order) ApiInvoker.deserialize(response, typeof(Order));
} }
else { else {
return null; return null;
} }
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -199,16 +213,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -222,4 +237,4 @@
} }
} }

View File

@ -1,13 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using io.swagger.client; using io.swagger.client;
using io.swagger.Model; using io.swagger.Model;
namespace io.swagger.Api {
namespace io.swagger.Api {
public class UserApi { public class UserApi {
string basePath; string basePath;
@ -59,16 +55,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -106,16 +103,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -153,16 +151,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -209,16 +208,22 @@
try { try {
if (typeof(string) == typeof(byte[])) { if (typeof(string) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as string; return ((object)response) as string;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if(response != null){ if (response != null){
return (string) ApiInvoker.deserialize(response, typeof(string)); return (string) ApiInvoker.deserialize(response, typeof(string));
} }
else { else {
return null; return null;
} }
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -255,16 +260,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -302,16 +308,22 @@
try { try {
if (typeof(User) == typeof(byte[])) { if (typeof(User) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as User; return ((object)response) as User;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if(response != null){ if (response != null){
return (User) ApiInvoker.deserialize(response, typeof(User)); return (User) ApiInvoker.deserialize(response, typeof(User));
} }
else { else {
return null; return null;
} }
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -350,16 +362,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, Body, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, Body, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -397,16 +410,17 @@
try { try {
if (typeof(void) == typeof(byte[])) { if (typeof(void) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ;
apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams);
if(response != null){
return ; apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams);
} return;
else {
return ;
}
} }
} catch (ApiException ex) { } catch (ApiException ex) {
if(ex.ErrorCode == 404) { if(ex.ErrorCode == 404) {
@ -420,4 +434,4 @@
} }
} }