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

View File

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

View File

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

View File

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