Пример #1
0
        /// <summary>
        /// Enumerate projects that belong to the team,
        /// doing requests page by page while enumerating.
        /// https://developer.atlassian.com/bitbucket/api/2/reference/resource/teams/%7Busername%7D/projects/#get
        /// </summary>
        /// <param name="parameters">Parameters for the query.</param>
        public IAsyncEnumerable <Project> EnumerateProjectsAsync(EnumerateParameters parameters, CancellationToken token = default)
        {
            _ = parameters ?? throw new ArgumentNullException(nameof(parameters));
            var overrideUrl = _baseUrl + "projects/";

            return(_sharpBucketV2.EnumeratePaginatedValuesAsync <Project>(overrideUrl, parameters.ToDictionary(), parameters.PageLen, token));
        }
Пример #2
0
        /// <summary>
        /// Enumerate comments associated with this resource,
        /// doing requests page by page while enumerating.
        /// </summary>
        /// <param name="parameters">Parameters for the queries.</param>
        public IEnumerable <TComment> EnumerateComments(EnumerateParameters parameters)
        {
            _ = parameters ?? throw new ArgumentNullException(nameof(parameters));

            return(_sharpBucketV2.EnumeratePaginatedValues <TComment>(
                       _baseUrl, parameters.ToDictionary(), parameters.PageLen));
        }
Пример #3
0
        /// <summary>
        /// Enumerate projects that belong to the team,
        /// doing requests page by page while enumerating.
        /// https://developer.atlassian.com/bitbucket/api/2/reference/resource/teams/%7Busername%7D/projects/#get
        /// </summary>
        /// <param name="parameters">Parameters for the query.</param>
        public IEnumerable <Project> EnumerateProjects(EnumerateParameters parameters)
        {
            _ = parameters ?? throw new ArgumentNullException(nameof(parameters));
            var overrideUrl = _baseUrl + "projects/";

            return(_sharpBucketV2.EnumeratePaginatedValues <Project>(overrideUrl, parameters.ToDictionary(), parameters.PageLen));
        }
Пример #4
0
 /// <summary>
 /// Enumerate issues on the repository asynchronously, doing requests page by page.
 /// </summary>
 /// <param name="parameters">Parameters for the queries.</param>
 /// <param name="token">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
 public IAsyncEnumerable <Issue> EnumerateIssuesAsync(EnumerateParameters parameters, CancellationToken token = default)
 {
     if (parameters == null)
     {
         throw new ArgumentNullException(nameof(parameters));
     }
     return(_sharpBucketV2.EnumeratePaginatedValuesAsync <Issue>(_baseUrl, parameters.ToDictionary(), parameters.PageLen, token));
 }
Пример #5
0
 /// <summary>
 /// Enumerate issues on the repository.
 /// </summary>
 /// <param name="parameters">Parameters for the queries.</param>
 public IEnumerable <Issue> EnumerateIssues(EnumerateParameters parameters)
 {
     if (parameters == null)
     {
         throw new ArgumentNullException(nameof(parameters));
     }
     return(_sharpBucketV2.EnumeratePaginatedValues <Issue>(_baseUrl, parameters.ToDictionary(), parameters.PageLen));
 }
Пример #6
0
        /// <summary>
        /// Enumerate comments associated with this resource,
        /// doing async requests page by page while enumerating.
        /// </summary>
        /// <param name="parameters">Parameters for the queries.</param>
        /// <param name="token">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        public IAsyncEnumerable <TComment> EnumerateCommentsAsync(
            EnumerateParameters parameters, CancellationToken token = default)
        {
            _ = parameters ?? throw new ArgumentNullException(nameof(parameters));

            return(_sharpBucketV2.EnumeratePaginatedValuesAsync <TComment>(
                       _baseUrl, parameters.ToDictionary(), parameters.PageLen, token));
        }
Пример #7
0
        /// <summary>
        /// Enumerate the tree entries that are present at the root of this resource, or in the specified sub directory.
        /// <remarks>
        /// Since it can be difficult to guess which field is filled or not in a <see cref="TreeEntry"/>,
        /// we suggest you to use <see cref="EnumerateSrcEntriesAsync"/> method instead of that one,
        /// except if you really want to retrieve the raw model as returned by BitBucket.
        /// </remarks>
        /// </summary>
        /// <param name="subDirPath">The path to a sub directory, or null to list the root directory of this resource.</param>
        /// <param name="parameters">Parameters for the query.</param>
        /// <param name="token">The cancellation token</param>
        public IAsyncEnumerable <TreeEntry> EnumerateTreeEntriesAsync(
            string subDirPath = null, EnumerateParameters parameters = null, CancellationToken token = default)
        {
            var overrideUrl = UrlHelper.ConcatPathSegments(_baseUrl, SrcPath.Value, subDirPath);

            return(_sharpBucketV2.EnumeratePaginatedValuesAsync <TreeEntry>(
                       overrideUrl, parameters?.ToDictionary(), parameters?.PageLen, token));
        }
Пример #8
0
 /// <summary>
 /// Enumerate the source files and directories that are present at the root of this resource,
 /// or in the specified sub directory.
 /// </summary>
 /// <param name="subDirPath">The path to a sub directory, or null to list the root directory of this resource.</param>
 /// <param name="parameters">Parameters for the query.</param>
 /// <param name="token">The cancellation token</param>
 public async IAsyncEnumerable <SrcEntry> EnumerateSrcEntriesAsync(
     string subDirPath = null,
     EnumerateParameters parameters = null,
     [EnumeratorCancellation] CancellationToken token = default)
 {
     await foreach (var treeEntry in EnumerateTreeEntriesAsync(subDirPath, parameters, token))
     {
         yield return(treeEntry.ToSrcEntry());
     }
 }
Пример #9
0
 /// <summary>
 /// Enumerate the source files and directories that are present at the root of this resource,
 /// or in the specified sub directory.
 /// </summary>
 /// <param name="subDirPath">The path to a sub directory, or null to list the root directory of this resource.</param>
 /// <param name="parameters">Parameters for the query.</param>
 public IEnumerable <SrcEntry> EnumerateSrcEntries(string subDirPath = null, EnumerateParameters parameters = null)
 {
     return(EnumerateTreeEntries(subDirPath, parameters)
            .Select(treeEntry => treeEntry.ToSrcEntry()));
 }
Пример #10
0
        /// <summary>
        /// Enumerate the tree entries that are present at the root of this resource, or in the specified sub directory.
        /// <remarks>
        /// Since it can be difficult to guess which field is filled or not in a <see cref="TreeEntry"/>,
        /// we suggest you to use <see cref="EnumerateSrcEntries"/> method instead of that one,
        /// except if you really want to retrieve the raw model as returned by BitBucket.
        /// </remarks>
        /// </summary>
        /// <param name="subDirPath">The path to a sub directory, or null to list the root directory of this resource.</param>
        /// <param name="parameters">Parameters for the query.</param>
        public IEnumerable <TreeEntry> EnumerateTreeEntries(string subDirPath = null, EnumerateParameters parameters = null)
        {
            var overrideUrl = UrlHelper.ConcatPathSegments(_baseUrl, SrcPath.Value, subDirPath);

            return(_sharpBucketV2.EnumeratePaginatedValues <TreeEntry>(
                       overrideUrl, parameters?.ToDictionary(), parameters?.PageLen));
        }