예제 #1
0
        public async Task <dynamic> InvokeAsync(IRestRequest request)
        {
            // set the result to the async task that will execute the request and create the dynamic object
            // based on the supplied verb
            if (Verb == "post")
            {
                return(await _client.ExecuteDynamicTaskAsync(request, Method.POST));
            }
            else if (Verb == "get")
            {
                return(await _client.ExecuteDynamicTaskAsync(request, Method.GET));
            }
            else if (Verb == "delete")
            {
                return(await _client.ExecuteDynamicTaskAsync(request, Method.DELETE));
            }
            else if (Verb == "put")
            {
                return(await _client.ExecuteDynamicTaskAsync(request, Method.PUT));
            }
            else if (Verb == "patch")
            {
                return(await _client.ExecuteDynamicTaskAsync(request, Method.PATCH));
            }

            Debug.Assert(false, "unsupported verb");
            throw new InvalidOperationException("unsupported verb: " + Verb);
        }