Пример #1
0
        /// <summary>
        /// Finds the <see cref="VirgilCard" />s in global scope by specified criteria.
        /// </summary>
        /// <param name="identity">The identity.</param>
        /// <param name="type">Type of the identity.</param>
        /// <returns>
        /// A list of found <see cref="VirgilCard" />s.
        /// </returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public static Task <IEnumerable <VirgilCard> > FindGlobalAsync
        (
            string identity,
            GlobalIdentityType type = GlobalIdentityType.Email
        )
        {
            if (identity == null)
            {
                throw new ArgumentNullException(nameof(identity));
            }

            return(FindGlobalAsync(new[] { identity }, type));
        }
Пример #2
0
        /// <summary>
        /// Finds the <see cref="VirgilCard" />s in global scope by specified criteria.
        /// </summary>
        /// <param name="identities">The identity.</param>
        /// <param name="type">Type of the identity.</param>
        /// <returns>
        /// A list of found <see cref="VirgilCard" />s.
        /// </returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static async Task <IEnumerable <VirgilCard> > FindGlobalAsync
        (
            IEnumerable <string> identities,
            GlobalIdentityType type = GlobalIdentityType.Email
        )
        {
            if (identities == null)
            {
                throw new ArgumentNullException(nameof(identities));
            }

            var client = VirgilConfig.GetService <VirgilClient>();

            var criteria = new SearchCriteria
            {
                Identities   = identities,
                IdentityType = type.ToString().ToLower(),
                Scope        = CardScope.Global
            };

            var cards = await client.SearchCardsAsync(criteria).ConfigureAwait(false);

            return(cards.Select(c => new VirgilCard(c)).ToList());
        }