コード例 #1
0
        public async Task RefreshRepoAndDownloadItemsForChangeSet(
            string organization,
            string project,
            string targetPath,
            GetItemParams itemParameters,
            CancellationToken token)
        {
            var builder = new UriBuilder(_baseUri + $"/{organization}/{project}/_apis/tfvc/items");

            var query = HttpUtility.ParseQueryString("?api-version=5.1");

            ConvertParamsToQuery(itemParameters, query);

            builder.Query = query.ToString();

            var uri      = builder.Uri;
            var response = await RetryHttpWithResponse(
                _httpClient,
                () => new HttpRequestMessage(HttpMethod.Get, uri),
                token);

            response.EnsureSuccessStatusCode();

            DeleteFilesApartFromGit(targetPath);

            if (!Directory.Exists(targetPath))
            {
                Directory.CreateDirectory(targetPath);
            }

            await ReadExtractZipFileStream(project, targetPath, token, response);
        }
コード例 #2
0
        public async Task <TfvcItem> GetItem(string organization, string project, string path, GetItemParams parameters,
                                             CancellationToken token)
        {
            var builder = new UriBuilder(_baseUri + $"/{organization}/{project}/_apis/tfvc/items");

            var query = HttpUtility.ParseQueryString("?api-version=5.1");

            query["path"] = path;

            ConvertParamsToQuery(parameters, query);

            builder.Query = query.ToString();

            var uri = builder.Uri;

            return(await RetryHttpWithBodyValue <TfvcItem>(
                       _httpClient,
                       () => new HttpRequestMessage(HttpMethod.Get, uri),
                       token));
        }