コード例 #1
0
        /// <summary>
        /// Gets a list of issues from a project. To narrow the list of 
        /// returned issues, use a simple query string in the request URL.
        /// </summary>
        /// <param name="accessToken">
        /// accessToken to use for the request
        /// </param>
        /// <returns>
        /// IssueList JSON object
        /// </returns>
        static async Task<IssuesList> GetIssuesList(AccessToken accessToken)
        {
            IssuesList responseBody = null;

            try
            {
                // Builds the request
                var url = projectName + "/issues";
                var request = new HttpRequestMessage(HttpMethod.Get, url);
                SetRequestAccessToken(ref request, accessToken);
                responseBody = await SendRequest<IssuesList>(request);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }

            if (responseBody != null)
            {
                for (int index = 0; index < responseBody.issues.Length; index++)
                    System.Diagnostics.Debug.WriteLine(responseBody.issues[index].tag);
            }

            return responseBody;
        }
コード例 #2
0
        /// <summary>
        /// Runs the program and blocks until it completes. Most HttpClient methods are async
        /// because they perform network I/O. All of the async tasks are done inside RunAsync.
        /// Normally, an app does note block the main thread, but this app does not allow any interaction.
        /// </summary>
        static async Task RunAsync()
        {
            // S etup the client
            InitClient();

            // Gets the list of projects
            ProjectList projectList;
            projectList = await GetProjectList();

            // Gets an authorization token
            AccessToken accessToken;
            accessToken = await GetAuthorizationToken();

            // Gets a list of issues
            IssuesList issuesList = await GetIssuesList(accessToken);

            // Gets issue 1 and changes a value
            await UpdateIssuePriorityExample(accessToken);

            // Adds a new Reported by record
            await AddReportedByRecordExample(accessToken);

            // Adds a workflow event
            await AddWorkflowEventExample(accessToken);

            // Generates and passes a test run
            await GenerateAndPassTestRun(accessToken);
        }