From 06914e9dcc7968b79c9bbc9317f63f884e8ff630 Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Mon, 30 Jul 2018 23:24:37 -0300 Subject: [PATCH 1/4] Adds ISubscription and ISubscriptionRead --- package-lock.json | 2 +- src/accessors/IRead.ts | 4 ++++ src/accessors/ISubscriptionRead.ts | 15 +++++++++++++++ src/accessors/index.ts | 2 ++ src/subscriptions/ISubscription.ts | 3 +++ src/subscriptions/index.ts | 2 ++ 6 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/accessors/ISubscriptionRead.ts create mode 100644 src/subscriptions/ISubscription.ts create mode 100644 src/subscriptions/index.ts diff --git a/package-lock.json b/package-lock.json index 9884752..e38ad80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@rocket.chat/apps-ts-definition", - "version": "0.9.12", + "version": "0.9.13", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/accessors/IRead.ts b/src/accessors/IRead.ts index a08571f..20b46fa 100644 --- a/src/accessors/IRead.ts +++ b/src/accessors/IRead.ts @@ -3,6 +3,7 @@ import { IMessageRead } from './IMessageRead'; import { INotifier } from './IModify'; import { IPersistenceRead } from './IPersistenceRead'; import { IRoomRead } from './IRoomRead'; +import { ISubscriptionRead } from './ISubscriptionRead'; import { IUserRead } from './IUserRead'; /** @@ -23,6 +24,9 @@ export interface IRead { /** Gets the IRoomRead instance. */ getRoomReader(): IRoomRead; + /** Gets the ISubscriptionRead instance */ + getSubscriptionReader(): ISubscriptionRead; + /** Gets the IUserRead instance. */ getUserReader(): IUserRead; diff --git a/src/accessors/ISubscriptionRead.ts b/src/accessors/ISubscriptionRead.ts new file mode 100644 index 0000000..9d45641 --- /dev/null +++ b/src/accessors/ISubscriptionRead.ts @@ -0,0 +1,15 @@ +import { ISubscription } from '../subscriptions/ISubscription'; + +/** + * This accessor provides methods for accessing + * subscriptions in a read-only-fashion. + */ +export interface ISubscriptionRead { + /** + * Gets a subscription by a room id. + * + * @param roomId the id of the room + * @returns the subscription + */ + getByRoomId(roomId: string): Promise; +} diff --git a/src/accessors/index.ts b/src/accessors/index.ts index bad8de8..cf77eb6 100644 --- a/src/accessors/index.ts +++ b/src/accessors/index.ts @@ -36,6 +36,7 @@ import { ISettingRead } from './ISettingRead'; import { ISettingsExtend } from './ISettingsExtend'; import { ISlashCommandsExtend } from './ISlashCommandsExtend'; import { ISlashCommandsModify } from './ISlashCommandsModify'; +import { ISubscriptionRead } from './ISubscriptionRead'; import { IUserRead } from './IUserRead'; export { @@ -72,6 +73,7 @@ export { ISettingsExtend, ISlashCommandsExtend, ISlashCommandsModify, + ISubscriptionRead, IUserRead, LogMessageSeverity, RequestMethod, diff --git a/src/subscriptions/ISubscription.ts b/src/subscriptions/ISubscription.ts new file mode 100644 index 0000000..3c3b21e --- /dev/null +++ b/src/subscriptions/ISubscription.ts @@ -0,0 +1,3 @@ +export interface ISubscription { + id: string; +} diff --git a/src/subscriptions/index.ts b/src/subscriptions/index.ts new file mode 100644 index 0000000..669c044 --- /dev/null +++ b/src/subscriptions/index.ts @@ -0,0 +1,2 @@ +import { ISubscription } from './ISubscription'; +export { ISubscription }; From f501359565fba518135e3289b088528b9efe8f4f Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Tue, 31 Jul 2018 17:48:43 -0300 Subject: [PATCH 2/4] Return IterableIterator of ISubscription, instead of single item --- src/accessors/ISubscriptionRead.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/accessors/ISubscriptionRead.ts b/src/accessors/ISubscriptionRead.ts index 9d45641..037b2d8 100644 --- a/src/accessors/ISubscriptionRead.ts +++ b/src/accessors/ISubscriptionRead.ts @@ -11,5 +11,5 @@ export interface ISubscriptionRead { * @param roomId the id of the room * @returns the subscription */ - getByRoomId(roomId: string): Promise; + getByRoomId(roomId: string): Promise>; } From 6cb20259e2686281aebc25d35bc3a988e18f32d3 Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Tue, 31 Jul 2018 18:14:45 -0300 Subject: [PATCH 3/4] fix comment --- src/accessors/ISubscriptionRead.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/accessors/ISubscriptionRead.ts b/src/accessors/ISubscriptionRead.ts index 037b2d8..6ed58f0 100644 --- a/src/accessors/ISubscriptionRead.ts +++ b/src/accessors/ISubscriptionRead.ts @@ -9,7 +9,7 @@ export interface ISubscriptionRead { * Gets a subscription by a room id. * * @param roomId the id of the room - * @returns the subscription + * @returns an iterator of subscriptions */ getByRoomId(roomId: string): Promise>; } From 79e28c6cad54fa47eba6823f80c658a9bff60070 Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Tue, 31 Jul 2018 19:55:48 -0300 Subject: [PATCH 4/4] fix comments (again) --- src/accessors/ISubscriptionRead.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/accessors/ISubscriptionRead.ts b/src/accessors/ISubscriptionRead.ts index 6ed58f0..b30e0e2 100644 --- a/src/accessors/ISubscriptionRead.ts +++ b/src/accessors/ISubscriptionRead.ts @@ -6,7 +6,7 @@ import { ISubscription } from '../subscriptions/ISubscription'; */ export interface ISubscriptionRead { /** - * Gets a subscription by a room id. + * Gets a list of subscriptions by a room id. * * @param roomId the id of the room * @returns an iterator of subscriptions