Class EndpointProviderBase<T>
- Namespace
- TypedRest.CommandLine
- Assembly
- TypedRest.CommandLine.dll
Builds EntryEndpoints using config files, interactive authentication, OAuth tokens, etc.
public abstract class EndpointProviderBase<T> : IEndpointProvider<T> where T : EntryEndpoint
Type Parameters
T
The type of entry endpoint to be created. Must have a constructor with the following signature: (Uri)
- Inheritance
-
EndpointProviderBase<T>
- Implements
- Derived
- Inherited Members
Properties
ConfigDir
protected virtual string ConfigDir { get; }
Property Value
TokenCacheFile
protected virtual string TokenCacheFile { get; }
Property Value
Methods
Build()
Builds a new endpoint.
public T Build()
Returns
- T
GetUri()
Gets an URI and stores it.
protected virtual Uri GetUri()
Returns
NewEndpoint(Uri)
Instantiates a T
.
protected virtual T NewEndpoint(Uri uri)
Parameters
uri
UriThe base URI of the REST API.
Returns
- T
RequestToken(Uri)
Asks the user or a service for the OAuth token to present as a "Bearer" to the REST API.
protected abstract string? RequestToken(Uri uri)
Parameters
uri
Uri
Returns
- string
The OAuth token or
null
if it cannot be requested.
RequestUri()
Asks the user or a service for the base URI of the REST API.
protected abstract Uri? RequestUri()
Returns
- Uri
The endpoint URI or
null
if it cannot be requested.
ResetAuthentication()
Clears any cached authentication information.
public void ResetAuthentication()