LLM-2955: JBAccountInfoService: Add JbaServiceConfiguration for essential URLs

GitOrigin-RevId: 8416f8350d612f055a79373497b711ecf8a641da
This commit is contained in:
Eldar Abusalimov
2024-08-07 03:20:01 +00:00
committed by intellij-monorepo-bot
parent 6723b799f7
commit ba946021df
2 changed files with 24 additions and 1 deletions
@@ -76,6 +76,19 @@ public interface JBAccountInfoService {
}
}
/**
* Returns the information retrieved from {@code JetBrainsAccount.xml}.
* This method can either perform a network operation or return a cached copy if it's fresh enough.
* <p>
* The returned future may complete exceptionally with a {@link java.util.concurrent.CompletionException} wrapping
* an {@link java.io.IOException} the caused the failure.
* Note that when awaiting the future from a coroutine using the standard {@code .await()} extension function,
* the original {@link java.io.IOException} is thrown in case of a failure, without an intermediate wrapper exception.
* <p>
* The future may also be cancelled in case of remote dev when the controlling client handling the request is disconnected.
*/
@NotNull CompletableFuture<@NotNull JbaServiceConfiguration> getServiceConfiguration();
/**
* Starts the auth flow by opening the browser and waiting for the user to proceed with logging in.
*/
@@ -106,6 +119,12 @@ public interface JBAccountInfoService {
return JBAccountInfoServiceHolder.INSTANCE;
}
record JbaServiceConfiguration(
@NotNull String accountUrl,
@NotNull String signupUrl,
@NotNull String paymentMethodsUrl
) { }
enum LoginMode {
/**
* Open the auth URL in the browser, start the built-in server, and await for the auth callback.
@@ -37,4 +37,8 @@ object DummyJBAccountInfoService : JBAccountInfoService {
refreshIdToken()
SettingsSyncEvents.getInstance().fireLoginStateChanged()
}
}
override fun getServiceConfiguration(): CompletableFuture<JBAccountInfoService.JbaServiceConfiguration> {
TODO("Not yet implemented")
}
}