Esempio n. 1
0
        public IEnumerator GetArray <T>(Action <IRestResponse <T[]> > callback = null, string path = null)
        {
            var request = new ZumoRequest(ApiUrl(path), Method.GET, false, client.User);

            if (!string.IsNullOrEmpty(key))
            {
                request.AddQueryParam(PARAM_CODE, key, true);
            }
            yield return(request.Request.Send());

            request.ParseJsonArray <T>(callback);
        }
Esempio n. 2
0
        private IEnumerator InvokeApiArray <B, T>(B body, Method httpMethod = Method.POST, Action <IRestResponse <T[]> > callback = null, string path = null, QueryParams query = null)
        {
            var request = new ZumoRequest(ApiUrl(path), httpMethod, false, client.User);

            if (!string.IsNullOrEmpty(key))
            {
                request.AddQueryParam(PARAM_CODE, key, true);
            }
            if (body != null)
            {
                request.AddBody(body);
            }
            yield return(request.Request.Send());

            request.ParseJsonArray <T>(callback);
        }
Esempio n. 3
0
        public IEnumerator Post <B, T>(B body, Action <IRestResponse <T> > callback = null)
        {
            var request = new ZumoRequest(ApiUrl(), Method.POST, false, client.User);

            if (!string.IsNullOrEmpty(key))
            {
                request.AddQueryParam(PARAM_CODE, key, true);
            }
            request.AddBody(body);
            yield return(request.Request.Send());

            if (typeof(T) == typeof(string))
            {
                request.GetText(callback);
            }
            else
            {
                request.ParseJson <T>(callback);
            }
        }
Esempio n. 4
0
        private IEnumerator InvokeApi <T>(Method httpMethod = Method.GET, Action <IRestResponse <T> > callback = null, string path = null, QueryParams query = null)
        {
            var request = new ZumoRequest(ApiUrl(path), httpMethod, false, client.User);

            request.SetQueryParams(query);
            if (!string.IsNullOrEmpty(key))
            {
                request.AddQueryParam(PARAM_CODE, key, true);
            }
            yield return(request.Request.Send());

            if (typeof(T) == typeof(string))
            {
                request.GetText(callback);
            }
            else
            {
                request.ParseJson <T>(callback);
            }
        }