Interface ProfileService
Not designed for host implementation; methods may be added in minor releases.
- Since:
- 0.11.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault ProfileCreationResultCreates the profile of an entitled account that does not have one yet, under the given name.fetch()Fetches the full profile.default Optional<PlayerProfile> Fetches the full profile, treating "this account has no profile" as an answer rather than a failure.
-
Method Details
-
fetch
PlayerProfile fetch()Fetches the full profile.An account with no profile (the service answers 404) fails this with kind
AltsFailure.Kind.NOT_ENTITLED, as sign-in and check report it;fetchIfPresent()is the form that treats it as an answer.- Returns:
- the profile
- Throws:
AltsException- if the token was refused, the account has no profile, or the service failed- Since:
- 0.11.0
-
fetchIfPresent
Fetches the full profile, treating "this account has no profile" as an answer rather than a failure.An account can authenticate perfectly well and still have no profile: it owns nothing, or it is entitled — through a subscription, say — and has never chosen a name. The profile read alone cannot tell those two apart; pair an empty result with
EntitlementService.fetch(), and where the account is entitled,create(String)is what gives it a profile.- Returns:
- the profile, or empty when the account has none
- Throws:
AltsException- if the token was refused or the service failed- Since:
- 0.12.0
-
create
Creates the profile of an entitled account that does not have one yet, under the given name.The name is checked locally first — three to sixteen letters, digits, or underscores — and one that could never be accepted is reported as
ProfileCreationResult.Outcome.INVALID_NAMEwithout a request being sent.Never throws for a refusal or an unreachable service: each is a
ProfileCreationResult, a failure beingProfileCreationResult.Outcome.FAILEDwith its kind.- Parameters:
name- the username to create the profile with- Returns:
- the classified outcome, carrying the new profile on success
- Throws:
UnsupportedOperationException- if this implementation predates profile creation- Since:
- 0.12.0
-