1 using System.Collections.Immutable;
3 using System.Threading.Tasks;
11 private readonly ImmutableArray<FriendProvider> providers;
15 this.providers = providers.ToImmutableArray();
20 return (await Task.WhenAll(providers
21 .Select(p => p.RetrieveFriend(
id))))
22 .NotNone().FirstOrNone();
27 var friends = await Task.WhenAll(providers.Select(p => p.RetrieveFriends()));
28 return friends.SelectMany(a => a).ToImmutableArray();
33 var subTasks = await Task.WhenAll(providers.Select(p => p.RetrieveAvatar(
friend, avatarSize)));
34 return subTasks.FirstOrDefault(t => t.IsSome());
39 foreach (var provider
in providers)
41 string userName = await provider.GetSelfUserName();
42 if (userName is { Length: > 0 }) {
return userName; }
override async Task< ImmutableArray< FriendInfo > > RetrieveFriends()
override async Task< Option< Sprite > > RetrieveAvatar(FriendInfo friend, int avatarSize)
CompositeFriendProvider(params FriendProvider[] providers)
override async Task< Option< FriendInfo > > RetrieveFriend(AccountId id)
override async Task< string > GetSelfUserName()