Example #1
0
        /// <summary>
        /// List all endpoints
        /// </summary>
        /// <param name="service"></param>
        /// <param name="onlyServerState"></param>
        /// <returns></returns>
        public static async Task <IEnumerable <EndpointInfoApiModel> > ListAllEndpointsAsync(
            this IRegistryServiceApi service, bool?onlyServerState = null)
        {
            var registrations = new List <EndpointInfoApiModel>();
            var result        = await service.ListEndpointsAsync(null, onlyServerState, null);

            registrations.AddRange(result.Items);
            while (result.ContinuationToken != null)
            {
                result = await service.ListEndpointsAsync(result.ContinuationToken,
                                                          onlyServerState, null);

                registrations.AddRange(result.Items);
            }
            return(registrations);
        }
Example #2
0
        /// <summary>
        /// Find endpoints
        /// </summary>
        /// <param name="service"></param>
        /// <param name="query"></param>
        /// <param name="onlyServerState"></param>
        /// <param name="ct"></param>
        /// <returns></returns>
        public static async Task <IEnumerable <EndpointInfoApiModel> > QueryAllEndpointsAsync(
            this IRegistryServiceApi service, EndpointRegistrationQueryApiModel query,
            bool?onlyServerState = null, CancellationToken ct = default)
        {
            var registrations = new List <EndpointInfoApiModel>();
            var result        = await service.QueryEndpointsAsync(query, onlyServerState, null, ct);

            registrations.AddRange(result.Items);
            while (result.ContinuationToken != null)
            {
                result = await service.ListEndpointsAsync(result.ContinuationToken,
                                                          onlyServerState, null, ct);

                registrations.AddRange(result.Items);
            }
            return(registrations);
        }