/// <summary> /// Matrix API Post The GET request has an URL length limitation, which hurts for many locations per request. In those cases use a HTTP POST request with JSON data as input. The only parameter in the URL will be the key which stays in the URL. Both request scenarios are identically except that all singular parameter names are named as their plural for a POST request. /// </summary> /// <exception cref="ApiException">Thrown when fails to make API call</exception> /// <param name="key">Get your key at graphhopper.com</param> /// <param name="body"> (optional)</param> /// <returns>Task of ApiResponse (MatrixResponse)</returns> public async System.Threading.Tasks.Task <ApiResponse <MatrixResponse> > MatrixPostAsyncWithHttpInfo(string key, MatrixRequest body = null) { // verify the required parameter 'key' is set if (key == null) { throw new ApiException(400, "Missing required parameter 'key' when calling MatrixApi->MatrixPost"); } var localVarPath = "/matrix"; var localVarPathParams = new Dictionary <string, string>(); var localVarQueryParams = new List <KeyValuePair <string, string> >(); var localVarHeaderParams = new Dictionary <string, string>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <string, string>(); var localVarFileParams = new Dictionary <string, FileParameter>(); object localVarPostBody = null; // to determine the Content-Type header string[] localVarHttpContentTypes = new string[] { }; string localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header string[] localVarHttpHeaderAccepts = new string[] { "application/json" }; string localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (key != null) { localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "key", key)); // query parameter } if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } else { localVarPostBody = body; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("MatrixPost", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <MatrixResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (MatrixResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(MatrixResponse)))); }
/// <summary> /// Matrix API Post The GET request has an URL length limitation, which hurts for many locations per request. In those cases use a HTTP POST request with JSON data as input. The only parameter in the URL will be the key which stays in the URL. Both request scenarios are identically except that all singular parameter names are named as their plural for a POST request. /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="key">Get your key at graphhopper.com</param> /// <param name="body"> (optional)</param> /// <returns>ApiResponse of MatrixResponse</returns> public ApiResponse <MatrixResponse> MatrixPostWithHttpInfo(string key, MatrixRequest body = null) { // verify the required parameter 'key' is set if (key == null) { throw new ApiException(400, "Missing required parameter 'key' when calling MatrixApi->MatrixPost"); } var localVarPath = "/matrix"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <String, String>(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (key != null) { localVarQueryParams.Add("key", Configuration.ApiClient.ParameterToString(key)); // query parameter } if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } else { localVarPostBody = body; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("MatrixPost", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <MatrixResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (MatrixResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(MatrixResponse)))); }