Interface ProfileLookupService


public interface ProfileLookupService
Looks up a player's public identity by name or by UUID. These are the public endpoints: no token is sent and no account is involved, so this is reachable without one — for resolving a name a user typed, or checking what a stored account is called now.

Reached through AltsRuntime#profileLookup; there is no public factory.

"No such player" is an answer here, not a failure: a lookup that finds nobody returns empty, and an AltsException is kept for a service that could not be reached or refused to answer.

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

Since:
0.12.0
  • Method Details

    • byName

      Optional<PublicProfile> byName(String name)
      Looks a player up by username. Names match without regard to case, and the result carries the name as the player capitalised it.
      Parameters:
      name - the username
      Returns:
      the player, or empty when nobody has that name — including a name that no player could hold at all (empty, longer than 16 characters, or using a character outside letters, digits, and underscore), which is answered without a request. A name of one or two characters is looked up: none can be taken today, but accounts that predate the minimum still hold them
      Throws:
      AltsException - if the service was rate limiting, refused, or could not be reached
      Since:
      0.12.0
    • byUuid

      Optional<PublicProfile> byUuid(String uuid)
      Looks a player up by UUID.
      Parameters:
      uuid - the UUID, dashed or undashed
      Returns:
      the player, or empty when no player has that UUID — including a value that is not a UUID at all, which is answered without a request
      Throws:
      AltsException - if the service was rate limiting, refused, or could not be reached
      Since:
      0.12.0
    • byNames

      List<PublicProfile> byNames(Collection<String> names)
      Looks up several players by username. A name nobody has is simply absent from the result, as is one that is not a valid username; a name given more than once, in any capitalisation, is resolved once.

      Any number of names is accepted. They are sent to the batch endpoint ten at a time, so the distinct valid names cost one request per ten. A very long list is still the caller's to pace: a rate limit part-way through fails the call with an exception for which the failure's kind is AltsFailure.Kind.RATE_LIMITED and its AltsFailure.retryAfter() carries any stated wait, rather than returning a partial answer that reads as "those players do not exist".

      Parameters:
      names - the usernames to resolve
      Returns:
      the players found, in the order their names were first given
      Throws:
      AltsException - if the service was rate limiting, refused, or could not be reached
      Since:
      0.12.0