public static T Get <T>(string serviceName, string relativeURL = "", APIGatewayMode mode = 0) { T t; try { string str = APIStoreHelper.Invoke(serviceName, relativeURL, string.Empty, "GET", mode, "application/json; charset=utf-8", "utf-8", null, null); t = APIStoreHelper.Convert <T>(str); } catch (Exception exception) { DebugUtil.LogException(exception); t = default(T); } return(t); }
public static string Invoke(string serviceName, string relativeURL, string httpBody, string httpMethod = "POST", APIGatewayMode mode = 0, string contentType = "application/json; charset=utf-8", string encodingType = "utf-8", NameValueCollection addHeaders = null, IWebProxy proxy = null) { string empty = string.Empty; string str = string.Empty; if (mode == APIGatewayMode.Redirect) { str = string.Concat(APIRepository.Instance.Lookup(serviceName), relativeURL); } else if (mode == APIGatewayMode.Relay) { str = string.Concat(LocationHelper.Instance.GetAppUri(AppNameEnum.ApiStore), serviceName, relativeURL); } if (!string.IsNullOrEmpty(str)) { empty = APIStoreHelper.InvokeAPI(str, httpBody, httpMethod, contentType, encodingType, addHeaders, proxy); } return(empty); }