Beispiel #1
0
    public void CreateProject()
    {
        //CreateProject
        ProjectBody b = new ProjectBody();

        b.active = 1;
        b.name   = ProjectName;


        //GetProject
        Uri serverUri = new Uri(ServerAdress + "/addProject");

        SendRequest(serverUri, b, HttpMethod.Post);
    }
Beispiel #2
0
        /// <summary>
        /// Create a new project with the given key and name.
        /// </summary>
        /// <param name="projectBody">Project keys must be unique within an account.</param>
        /// <returns>Project</returns>
        public Project PostProject(ProjectBody projectBody)
        {
            // verify the required parameter 'projectBody' is set
            if (projectBody == null)
            {
                throw new ApiException(400, "Missing required parameter 'projectBody' when calling PostProject");
            }


            var path = "/projects";

            path = path.Replace("{format}", "json");

            var    queryParams  = new Dictionary <String, String>();
            var    headerParams = new Dictionary <String, String>();
            var    formParams   = new Dictionary <String, String>();
            var    fileParams   = new Dictionary <String, FileParameter>();
            String postBody     = null;

            postBody = ApiClient.Serialize(projectBody);                                     // http body (model) parameter

            // authentication setting, if any
            String[] authSettings = new String[] { "Token" };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling PostProject: " + response.Content, response.Content);
            }
            else if (((int)response.StatusCode) == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling PostProject: " + response.ErrorMessage, response.ErrorMessage);
            }

            return((Project)ApiClient.Deserialize(response.Content, typeof(Project), response.Headers));
        }