/// <summary> /// /// </summary> /// <exception cref="Com.MadanaSampleclient.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body"> (optional)</param> /// <returns>Task of ApiResponse (System.IO.Stream)</returns> public async System.Threading.Tasks.Task <ApiResponse <System.IO.Stream> > PostNodeInfoAsyncWithHttpInfo(JsonNodeInfo body = default(JsonNodeInfo)) { var localVarPath = "/nodes"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.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[] { "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "application/xml" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter } else { localVarPostBody = body; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("PostNodeInfo", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <System.IO.Stream>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (System.IO.Stream) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(System.IO.Stream)))); }
public JsonNodeInfo VisitNode(JObject node, MappingContext mappingContext, NodeContext nodeContext) { var result = new JsonNodeInfo(); var idProp = node.Property("id"); var modelsProp = node.Property("models"); if (idProp != null && modelsProp != null) { node.Add("modelLinks", modelsProp.Value); modelsProp.Value = new JArray(); result.ServerTypeNameInfo = new TypeNameInfo("Make", ""); return(result); } var makeProp = node.Property("make"); if (idProp != null && makeProp != null) { node.Add("makeLink", makeProp.Value); makeProp.Value = null; var catsProp = node.Property("categories"); if (catsProp != null) { var styleProps = catsProp["Vehicle Style"]; var styles = styleProps.Select(t => t.Value <String>()).ToAggregateString(", "); node.Add("vehicleStyles", new JValue(styles)); } result.ServerTypeNameInfo = new TypeNameInfo("Model", ""); return(result); } return(result); //// Model parser //else if (node.id && node.makeId) { // // move 'node.make' link so 'make' can be null reference // node.makeLink = node.make; // node.make = null; // // flatten styles and sizes as comma-separated strings // var styles = node.categories && node.categories["Vehicle Style"]; // node.vehicleStyles = styles && styles.join(", "); // var sizes = node.categories && node.categories["Vehicle Size"]; // node.vehicleSizes = sizes && sizes.join(", "); // return { entityType: "Model" }; //} }
/// <summary> /// /// </summary> /// <exception cref="Com.MadanaSampleclient.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body"> (optional)</param> /// <returns>Task of System.IO.Stream</returns> public async System.Threading.Tasks.Task <System.IO.Stream> PostNodeInfoAsync(JsonNodeInfo body = default(JsonNodeInfo)) { ApiResponse <System.IO.Stream> localVarResponse = await PostNodeInfoAsyncWithHttpInfo(body); return(localVarResponse.Data); }
/// <summary> /// /// </summary> /// <exception cref="Com.MadanaSampleclient.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body"> (optional)</param> /// <returns>System.IO.Stream</returns> public System.IO.Stream PostNodeInfo(JsonNodeInfo body = default(JsonNodeInfo)) { ApiResponse <System.IO.Stream> localVarResponse = PostNodeInfoWithHttpInfo(body); return(localVarResponse.Data); }