Exemplo n.º 1
0
        /// <summary>
        /// Gets all teams for the given <paramref name="teamHttpClient" />, optionally for a specific project corresponding to the <paramref name="projectNameOrId" />.
        /// </summary>
        /// <param name="teamHttpClient">The team HTTP client.</param>
        /// <param name="projectNameOrId">The project name or identifier.</param>
        /// <param name="mine">If true return all the teams requesting user is member, otherwise return all the teams user has read access</param>
        /// <param name="count">The amount of teams to retrieve at most.</param>
        /// <param name="skip">How many teams to skip.</param>
        /// <param name="expandIdentity">A value indicating whether or not to expand <see cref="T:Microsoft.VisualStudio.Services.Identity.Identity" /> information in the result <see cref="T:Microsoft.TeamFoundation.Core.WebApi.WebApiTeam" /> object.</param>
        /// <param name="userState">The user state object to pass along to the underlying method.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">teamHttpClient</exception>
        public static IAsyncEnumerable <WebApiTeam> GetTeams(
            this TeamHttpClient teamHttpClient, string projectNameOrId = "", bool?mine = null, int?count = null, int?skip = null, bool?expandIdentity = null, object userState = null)
        {
            if (teamHttpClient == null)
            {
                throw new ArgumentNullException(nameof(teamHttpClient));
            }

            return(!string.IsNullOrWhiteSpace(projectNameOrId)
                ? AsyncEnumerabletHelper.GetAsyncEnumerableForListProducer(
                       iterationInput => teamHttpClient.GetTeamsAsync(projectNameOrId, mine, iterationInput.Count, iterationInput.Skip, expandIdentity, userState, iterationInput.CancellationToken), count, skip)
                : AsyncEnumerabletHelper.GetAsyncEnumerableForListProducer(
                       iterationInput => teamHttpClient.GetAllTeamsAsync(mine, iterationInput.Count, iterationInput.Skip, expandIdentity, userState, iterationInput.CancellationToken), count, skip));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets all teams for the given <paramref name="teamHttpClient" />, optionally for a specific project corresponding to the <paramref name="projectNameOrId" />.
        /// </summary>
        /// <param name="teamHttpClient">The team HTTP client.</param>
        /// <param name="projectNameOrId">The project name or identifier.</param>
        /// <param name="mine">If true return all the teams requesting user is member, otherwise return all the teams user has read access</param>
        /// <param name="count">The amount of teams to retrieve at most.</param>
        /// <param name="skip">How many teams to skip.</param>
        /// <param name="expandIdentity">A value indicating whether or not to expand <see cref="T:Microsoft.VisualStudio.Services.Identity.Identity" /> information in the result <see cref="T:Microsoft.TeamFoundation.Core.WebApi.WebApiTeam" /> object.</param>
        /// <param name="userState">The user state object to pass along to the underlying method.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">teamHttpClient</exception>
        public static IObservable <WebApiTeam> GetTeams(
            this TeamHttpClient teamHttpClient, string projectNameOrId = "", bool?mine = null, int?count = null, int?skip = null, bool?expandIdentity = null, object userState = null)
        {
            if (teamHttpClient == null)
            {
                throw new ArgumentNullException(nameof(teamHttpClient));
            }

            return(!string.IsNullOrWhiteSpace(projectNameOrId)
                ? Observable.FromAsync(cancellationToken => teamHttpClient.GetTeamsAsync(projectNameOrId, mine, count, skip, expandIdentity, userState, cancellationToken))
                   .SelectMany(webApiTeams => webApiTeams)
                : Observable.FromAsync(cancellationToken => teamHttpClient.GetAllTeamsAsync(mine, count, skip, expandIdentity, userState, cancellationToken))
                   .SelectMany(webApiTeams => webApiTeams));
        }