OAuthProviders
Namespace: E2E.OAuth
public static class OAuthProvidersThe built-in subscription providers by id, and what e2e login, logout, and models do with them.
Inheritance: object
Properties
Section titled “Properties”public static IReadOnlyList<string> Ids { get; }Upstream’s provider ids, in its order.
Value: IReadOnlyList<string>
Methods
Section titled “Methods”ApiKeyFor(IOAuthProvider)
Section titled “ApiKeyFor(IOAuthProvider)”public static string? ApiKeyFor(IOAuthProvider provider)The provider’s API key from its ApiKeyEnv variable, when that is set.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
IOAuthProvider |
Returns: string
CredentialSource(IOAuthProvider, ICredentialStore?)
Section titled “CredentialSource(IOAuthProvider, ICredentialStore?)”public static (ICredentialStore Store, string LoginHint) CredentialSource(IOAuthProvider provider, ICredentialStore? store = null)Where <code class=“paramref”>provider</code>’s calls read their credential: the API key, when set, as a login with nothing to
refresh, else <code class=“paramref”>store</code>, the default store unless given. The default store is only opened without a
key, so a malformed E2E_OAUTH_CREDENTIALS does not block the key. The hint names the remedy for the
credential actually read.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
IOAuthProvider | |
store |
ICredentialStore |
Returns: (ICredentialStore Store, string LoginHint)
Describe(string)
Section titled “Describe(string)”public static string Describe(string id)A short description of each subscription, for pickers and help.
Parameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns: string
Get(string)
Section titled “Get(string)”public static IOAuthProvider Get(string id)The provider for <code class=“paramref”>id</code>; Misconfigured for an unknown id.
Parameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns: IOAuthProvider
ListModelsAsync(string, ICredentialStore?, CancellationToken)
Section titled “ListModelsAsync(string, ICredentialStore?, CancellationToken)”public static Task<IReadOnlyList<SubscriptionModel>> ListModelsAsync(string providerId, ICredentialStore? store = null, CancellationToken cancellationToken = default)The models <code class=“paramref”>providerId</code>’s credential serves: its API key when set, as its model constructor reads it, else the stored login; NotLoggedIn without either.
Parameters
| Name | Type | Description |
|---|---|---|
providerId |
string | |
store |
ICredentialStore | |
cancellationToken |
CancellationToken |
Returns: Task<IReadOnlyList<SubscriptionModel>>
LoginAsync(string, OAuthLoginCallbacks, OAuthLoginOptions?, ICredentialStore?, CancellationToken)
Section titled “LoginAsync(string, OAuthLoginCallbacks, OAuthLoginOptions?, ICredentialStore?, CancellationToken)”public static Task<OAuthCredentials> LoginAsync(string providerId, OAuthLoginCallbacks callbacks, OAuthLoginOptions? options = null, ICredentialStore? store = null, CancellationToken cancellationToken = default)Signs in to <code class=“paramref”>providerId</code> and stores the credentials.
Parameters
| Name | Type | Description |
|---|---|---|
providerId |
string | |
callbacks |
OAuthLoginCallbacks | |
options |
OAuthLoginOptions | |
store |
ICredentialStore | |
cancellationToken |
CancellationToken |
Returns: Task<OAuthCredentials>
LoginHint(IOAuthProvider)
Section titled “LoginHint(IOAuthProvider)”public static string LoginHint(IOAuthProvider provider)How a missing login is described to the user: the CLI command that fixes it, and the API key variable that does too.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
IOAuthProvider |
Returns: string
LogoutAsync(string, ICredentialStore?, CancellationToken)
Section titled “LogoutAsync(string, ICredentialStore?, CancellationToken)”public static Task<bool> LogoutAsync(string providerId, ICredentialStore? store = null, CancellationToken cancellationToken = default)Forgets the stored login. True when one was stored.
Parameters
| Name | Type | Description |
|---|---|---|
providerId |
string | |
store |
ICredentialStore | |
cancellationToken |
CancellationToken |
Returns: Task<bool>