Interface BulkOperations


public interface BulkOperations
Running one operation over many accounts, paced so the service does not treat it as an attack.

No operation here installs a session. A host writing its own loop over AltLoginService.loginAccount(AltAccount) gets fifty session switches and, on account nine, a rate limit it has no way to recognise.

Not designed for host implementation; methods may be added in minor releases.

Since:
0.9.0
  • Method Details

    • importCredentials

      BulkHandle importCredentials(List<String> entries, LoginMode mode, BulkOptions options, BulkProgress progress)
      Resolves a list of pasted credentials into accounts.

      Each line is classified by CredentialKind.detect(String) and sent to the route that fits it. A line that cannot be placed fails as that entry rather than being guessed at. With LoginMode.ADD the resolved accounts are stored; the live session is not touched either way, so the host chooses afterwards what to log into. Neither is the store's current account, and no account is stamped as used: a sign-in the user makes while the import runs stays current.

      Parameters:
      entries - the credential lines, one per account
      mode - whether to store what is resolved
      options - how to pace the run
      progress - where to report progress, or BulkProgress.NONE
      Returns:
      a handle on the running operation
      Since:
      0.9.0
    • refreshAll

      BulkHandle refreshAll(List<AltAccount> accounts, BulkOptions options, BulkProgress progress)
      Refreshes every given account, renewing the ones whose tokens are spent and persisting each rotation.
      Parameters:
      accounts - the accounts to refresh
      options - how to pace the run
      progress - where to report progress, or BulkProgress.NONE
      Returns:
      a handle on the running operation
      Since:
      0.9.0
    • checkAll

      BulkHandle checkAll(List<AltAccount> accounts, BulkOptions options, BulkProgress progress)
      Checks every given account without renewing anything.

      The one to reach for when only looking: the token endpoint rotates the refresh token on every redemption, so a sweep built on refreshAll(List, BulkOptions, BulkProgress) spends one rotation per account per sweep.

      Parameters:
      accounts - the accounts to check
      options - how to pace the run
      progress - where to report progress, or BulkProgress.NONE
      Returns:
      a handle on the running operation
      Since:
      0.9.0
    • entitlementsAll

      default BulkHandle entitlementsAll(List<AltAccount> accounts, BulkOptions options, BulkProgress progress)
      Reads what every given account owns, without renewing or changing anything.

      "Which of these own Java outright, and which are riding a subscription that can lapse" is a question about the whole list, so it is paced like the other sweeps: the same spacing, retries, progress, cancellation and stop-on-rate-limit, with each request routed for its own account. A successful entry carries the product set on BulkEntryResult.entitlements(); an account that owns nothing succeeds with an empty set, because the read worked.

      Each account is read with the access token it currently holds. One whose token has expired fails its entry as AltsFailure.Kind.UNAUTHORIZED; run refreshAll(List, BulkOptions, BulkProgress) first when the tokens may be stale. An account with no token at all — an offline one — fails the same way without a request being made.

      Parameters:
      accounts - the accounts to read
      options - how to pace the run
      progress - where to report progress, or BulkProgress.NONE
      Returns:
      a handle on the running operation
      Throws:
      UnsupportedOperationException - if this implementation predates the entitlement sweep
      Since:
      0.12.0