/// <summary> /// Create iOS device profile Create iOS device profile for the current user /// </summary> /// <param name="options"></param> /// <returns>Task of ApiResponse (InlineResponse20012)</returns> public async System.Threading.Tasks.Task<ApiResponse<InlineResponse20012>> CreateDeviceAsyncWithHttpInfo (Options8 options) { // verify the required parameter 'options' is set if (options == null) throw new ApiException(400, "Missing required parameter 'options' when calling CreateDevice"); var path_ = "/users/me/devices"; var pathParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, FileParameter>(); Object postBody = null; // to determine the Content-Type header String[] httpContentTypes = new String[] { "application/json" }; String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes); // to determine the Accept header String[] httpHeaderAccepts = new String[] { "application/json", "text/plain", "text/html" }; String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts); if (httpHeaderAccept != null) headerParams.Add("Accept", httpHeaderAccept); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); postBody = Configuration.ApiClient.Serialize(options); // http body (model) parameter // authentication (apikey) required // http basic authentication required if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password)) { headerParams["Authorization"] = "Basic " + Base64Encode(Configuration.Username + ":" + Configuration.Password); } // make the HTTP request IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, httpContentType); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling CreateDevice: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling CreateDevice: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<InlineResponse20012>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (InlineResponse20012) Configuration.ApiClient.Deserialize(response, typeof(InlineResponse20012))); }
/// <summary> /// Create iOS device profile Create iOS device profile for the current user /// </summary> /// <param name="options"></param> /// <returns>Task of InlineResponse20012</returns> public async System.Threading.Tasks.Task<InlineResponse20012> CreateDeviceAsync (Options8 options) { ApiResponse<InlineResponse20012> response = await CreateDeviceAsyncWithHttpInfo(options); return response.Data; }
/// <summary> /// Create iOS device profile Create iOS device profile for the current user /// </summary> /// <param name="options"></param> /// <returns>InlineResponse20012</returns> public InlineResponse20012 CreateDevice (Options8 options) { ApiResponse<InlineResponse20012> response = CreateDeviceWithHttpInfo(options); return response.Data; }
/// <summary> /// Create iOS device profile Create iOS device profile for the current user /// </summary> /// <param name="options"></param> /// <returns>Task of ApiResponse (InlineResponse20012)</returns> public async System.Threading.Tasks.Task <ApiResponse <InlineResponse20012> > CreateDeviceAsyncWithHttpInfo(Options8 options) { // verify the required parameter 'options' is set if (options == null) { throw new ApiException(400, "Missing required parameter 'options' when calling CreateDevice"); } var path_ = "/users/me/devices"; var pathParams = new Dictionary <String, String>(); var queryParams = new Dictionary <String, String>(); var headerParams = new Dictionary <String, String>(Configuration.DefaultHeader); var formParams = new Dictionary <String, String>(); var fileParams = new Dictionary <String, FileParameter>(); Object postBody = null; // to determine the Content-Type header String[] httpContentTypes = new String[] { "application/json" }; String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes); // to determine the Accept header String[] httpHeaderAccepts = new String[] { "application/json", "text/plain", "text/html" }; String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts); if (httpHeaderAccept != null) { headerParams.Add("Accept", httpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); postBody = Configuration.ApiClient.Serialize(options); // http body (model) parameter // authentication (apikey) required // http basic authentication required if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password)) { headerParams["Authorization"] = "Basic " + Base64Encode(Configuration.Username + ":" + Configuration.Password); } // make the HTTP request IRestResponse response = (IRestResponse)await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, httpContentType); int statusCode = (int)response.StatusCode; if (statusCode >= 400) { throw new ApiException(statusCode, "Error calling CreateDevice: " + response.Content, response.Content); } else if (statusCode == 0) { throw new ApiException(statusCode, "Error calling CreateDevice: " + response.ErrorMessage, response.ErrorMessage); } return(new ApiResponse <InlineResponse20012>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (InlineResponse20012)Configuration.ApiClient.Deserialize(response, typeof(InlineResponse20012)))); }
/// <summary> /// Create iOS device profile Create iOS device profile for the current user /// </summary> /// <param name="options"></param> /// <returns>Task of InlineResponse20012</returns> public async System.Threading.Tasks.Task <InlineResponse20012> CreateDeviceAsync(Options8 options) { ApiResponse <InlineResponse20012> response = await CreateDeviceAsyncWithHttpInfo(options); return(response.Data); }
/// <summary> /// Create iOS device profile Create iOS device profile for the current user /// </summary> /// <param name="options"></param> /// <returns>InlineResponse20012</returns> public InlineResponse20012 CreateDevice(Options8 options) { ApiResponse <InlineResponse20012> response = CreateDeviceWithHttpInfo(options); return(response.Data); }