private void refreshTokens() throws InvalidTokenException, UpstreamApiUnexpectedResponseException {
        final HttpRequest.Builder refreshRequest =
                buildRefreshRequestUrlForAccessToken(authData, appCredentials);
        final String responseString;
        try {
            responseString = new String(sendAppleCopyRequest(refreshRequest));
        } catch (CopyException e) {
            // TODO(jzacsh, hgandhi90) copious spare time make a lower-level request (than sendAppleCopyRequest is
            // today) that can _ONLY_ throw Http exceptions or InvalidTokenException
            //
            // In the meantime: this is why we are catching all CopyExceptions and re-throw

            monitor.debug(() -> "Failed to refresh Apple Music token", e);
            if (e instanceof InvalidTokenException) {
                throw new InvalidTokenException("Unable to refresh Apple Music token", e);
            } else {
                throw new UpstreamApiUnexpectedResponseException("Unknown Apple Music Library Service Error", e);
            }
        }
        final JSONParser jsonParser = new JSONParser();
        final String refreshedAccessToken;
        try {
            final JSONObject json = (JSONObject) jsonParser.parse(responseString);
            refreshedAccessToken =
                    checkNotNull(
                            (String) json.get("access_token"),
                            "apple oauth server response body missing access_token, despite OK response");
        } catch (IllegalStateException | ParseException e) {
            throw new UpstreamApiUnexpectedResponseException(
                    String.format(
                            "apple oauth server sent back malformed refresh token response for body:\n"
                                    + "\"\"\"\n"
                                    + "%s\"\"\"\n"
                                    + "\"\"\"",
                            responseString),
                    e);
        }
        this.authData = this.authData.rebuildWithRefresh(refreshedAccessToken);

        monitor.debug(() -> "Successfully refreshed Apple Music token");
    }
@return the total number of playlist tracks acknowledged by the Apple Music Library Service in this page
extensions/data-transfer/portability-data-transfer-apple/src/main/java/org/datatransferproject/datatransfer/apple/music/AppleMusicInterface.java