Class User.ApiKeyClient
A class exposing functionality for users to manage API keys from the client. It is always scoped to a particular User and can only be accessed via ApiKeys.
Namespace: Realms.Sync
Assembly: Realm.dll
Syntax
public class User.ApiKeyClient
Methods
| Edit this page View SourceCreateAsync(string)
Creates an API key that can be used to authenticate as the user.
Declaration
public Task<ApiKey> CreateAsync(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The friendly name of the key. |
Returns
Type | Description |
---|---|
Task<ApiKey> | An awaitable Task<TResult> representing the asynchronous operation. Successful completion indicates that the ApiKey has been created on the server and its Value can be used to create ApiKey(string). |
Remarks
The value of the returned API key must be persisted at this time as this is the only time it is visible. The key is enabled when created. It can be disabled by calling DisableAsync(ObjectId).
DeleteAsync(ObjectId)
Deletes an API key by id.
Declaration
public Task DeleteAsync(ObjectId id)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | id | The id of the key to delete. |
Returns
Type | Description |
---|---|
Task | An awaitable Task representing the asynchronous delete operation. |
DisableAsync(ObjectId)
Disables an API key by id.
Declaration
public Task DisableAsync(ObjectId id)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | id | The id of the key to disable. |
Returns
Type | Description |
---|---|
Task | An awaitable Task representing the asynchronous disable operation. |
See Also
| Edit this page View SourceEnableAsync(ObjectId)
Enables an API key by id.
Declaration
public Task EnableAsync(ObjectId id)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | id | The id of the key to enable. |
Returns
Type | Description |
---|---|
Task | An awaitable Task representing the asynchronous enable operation. |
See Also
| Edit this page View SourceFetchAllAsync()
Fetches all API keys associated with the user.
Declaration
public Task<IEnumerable<ApiKey>> FetchAllAsync()
Returns
Type | Description |
---|---|
Task<IEnumerable<ApiKey>> | An awaitable task representing the asynchronous lookup operation. Upon completion, the result contains a collection of all API keys for that user. |
FetchAsync(ObjectId)
Fetches a specific user API key by id.
Declaration
public Task<ApiKey?> FetchAsync(ObjectId id)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | id | The id of the key to fetch. |
Returns
Type | Description |
---|---|
Task<ApiKey> | An awaitable Task<TResult> representing the asynchronous lookup operation. |