/// <summary> /// Create build target for a project /// </summary> /// <param name="orgid">Organization identifier</param> /// <param name="projectid">Project identifier</param> /// <param name="options">Options for build target create/update</param> /// <returns>ApiResponse of InlineResponse2003</returns> public ApiResponse< InlineResponse2003 > AddBuildTargetWithHttpInfo (string orgid, string projectid, Options2 options) { // verify the required parameter 'orgid' is set if (orgid == null) throw new ApiException(400, "Missing required parameter 'orgid' when calling BuildtargetsApi->AddBuildTarget"); // verify the required parameter 'projectid' is set if (projectid == null) throw new ApiException(400, "Missing required parameter 'projectid' when calling BuildtargetsApi->AddBuildTarget"); // verify the required parameter 'options' is set if (options == null) throw new ApiException(400, "Missing required parameter 'options' when calling BuildtargetsApi->AddBuildTarget"); var path_ = "/orgs/{orgid}/projects/{projectid}/buildtargets"; 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"); if (orgid != null) pathParams.Add("orgid", Configuration.ApiClient.ParameterToString(orgid)); // path parameter if (projectid != null) pathParams.Add("projectid", Configuration.ApiClient.ParameterToString(projectid)); // path parameter if (options.GetType() != typeof(byte[])) { postBody = Configuration.ApiClient.Serialize(options); // http body (model) parameter } else { postBody = options; // byte array } // authentication (apikey) required // http basic authentication required if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password)) { headerParams["Authorization"] = "Basic " + Base64Encode(Configuration.Username + ":" + Configuration.Password); } // authentication (permissions) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { headerParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // make the HTTP request IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, httpContentType); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling AddBuildTarget: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling AddBuildTarget: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<InlineResponse2003>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (InlineResponse2003) Configuration.ApiClient.Deserialize(response, typeof(InlineResponse2003))); }