MongoAdapter
The MongoDB storage adapter.
Extends
Type parameters
| Type parameter |
|---|
K extends ConnectionTypes |
Constructors
new MongoAdapter()
1new MongoAdapter<K>(): MongoAdapter<K>Returns
MongoAdapter<K>
Overrides
Source
twitchfy/packages/eventsub/src/storage/adapters/MongoAdapter.ts:12
Methods
delete()
1delete(id: string): Promise<void>Deletes a subscription from the storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The id of the subscription which will be deleted. |
Returns
Promise<void>
Overrides
Source
twitchfy/packages/eventsub/src/storage/adapters/MongoAdapter.ts:54
get()
1get<T>(id: string): Promise<StorageAdapterGet<K, T>>Gets a subscription from the storage.
Type parameters
| Type parameter | Value |
|---|---|
T extends SubscriptionTypes | SubscriptionTypes |
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The id of the subscription which will be get. |
Returns
Promise<StorageAdapterGet<K, T>>
The basic data which will be needed to reload the subscription. You can attach other data to the object.
Overrides
Source
twitchfy/packages/eventsub/src/storage/adapters/MongoAdapter.ts:48
getAll()
1getAll(): Promise<StorageAdapterGet<K, SubscriptionTypes>[]>Gets all subscriptions from the storage.
Returns
Promise<StorageAdapterGet<K, SubscriptionTypes>[]>
Overrides
Source
twitchfy/packages/eventsub/src/storage/adapters/MongoAdapter.ts:62
set()
1set<T>(id: string, subscription: SubscriptionType<T, K>): Promise<void>Sets a subscription into the storage.
Type parameters
| Type parameter | Value |
|---|---|
T extends SubscriptionTypes | SubscriptionTypes |
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The id of the subscription which will be set. Probably you want to use the id as a key. |
subscription | SubscriptionType<T, K> | The subscription which will be set. |
Returns
Promise<void>
Overrides
Source
twitchfy/packages/eventsub/src/storage/adapters/MongoAdapter.ts:16