public static async IAsyncEnumerable <PlatformFriendResponse> GetPlatformFriendList( this ISocialMethodsAccess socialMethodsAccess, int maxPages, PlatformFriendType friendPlatform, AuthorizationTokenData authorizationToken, [EnumeratorCancellation] CancellationToken cancellationToken = default) { var currentPage = 0; var hasMoreToGet = true; while (currentPage < maxPages && hasMoreToGet) { var response = await socialMethodsAccess.GetPlatformFriendList( friendPlatform, authorizationToken, currentPage, cancellationToken); if (!response.IsSuccessfulResponseCode || response.Response is null) { throw response.ToException(); } hasMoreToGet = response.Response.HasMore; currentPage = response.Response.CurrentPage + 1; yield return(response.Response); } }
public async ValueTask <BungieResponse <PlatformFriendResponse> > GetPlatformFriendList( PlatformFriendType friendPlatform, int page = 0, CancellationToken cancellationToken = default) { return(await _socialMethodsAccess .GetPlatformFriendList(friendPlatform, _token, page, cancellationToken) .ConfigureAwait(false)); }
public async ValueTask <BungieResponse <PlatformFriendResponse> > GetPlatformFriendList( PlatformFriendType friendPlatform, AuthorizationTokenData authorizationToken, int page = 0, CancellationToken cancellationToken = default) { var url = StringBuilderPool .GetBuilder(cancellationToken) .Append("/Social/PlatformFriends/") .AddUrlParam(((int)friendPlatform).ToString()) .AddUrlParam(page.ToString()) .Build(); return(await _dotNetBungieApiHttpClient .GetFromBungieNetPlatform <PlatformFriendResponse>( url, cancellationToken, authorizationToken.AccessToken) .ConfigureAwait(false)); }