Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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());
     }
 }
Esempio n. 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()));
 }
Esempio n. 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));
        }