예제 #1
0
 internal UserScopedSocialMethodsAccess(
     ISocialMethodsAccess socialMethodsAccess,
     AuthorizationTokenData token)
 {
     _socialMethodsAccess = socialMethodsAccess;
     _token = token;
 }
예제 #2
0
 public BungieApiAccess(
     IFireteamMethodsAccess fireteamMethodsAccess,
     IContentMethodsAccess contentMethodsAccess,
     IAppMethodsAccess appMethodsAccess,
     IForumMethodsAccess forumMethodsAccess,
     IUserMethodsAccess userMethodsAccess,
     IGroupV2MethodsAccess groupV2MethodsAccess,
     ITokenMethodsAccess tokenMethodsAccess,
     IDestiny2MethodsAccess destiny2MethodsAccess,
     ICommunityContentMethodsAccess communityContentMethodsAccess,
     ITrendingMethodsAccess trendingMethodsAccess,
     IMiscMethodsAccess miscMethodsAccess,
     ISocialMethodsAccess socialMethodsAccess,
     IRenderApiAccess renderApiAccess)
 {
     App       = appMethodsAccess;
     User      = userMethodsAccess;
     Content   = contentMethodsAccess;
     Forum     = forumMethodsAccess;
     GroupV2   = groupV2MethodsAccess;
     Tokens    = tokenMethodsAccess;
     Destiny2  = destiny2MethodsAccess;
     Community = communityContentMethodsAccess;
     Trending  = trendingMethodsAccess;
     Fireteam  = fireteamMethodsAccess;
     Misc      = miscMethodsAccess;
     Social    = socialMethodsAccess;
     RenderApi = renderApiAccess;
 }
예제 #3
0
    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);
        }
    }