@jeongsu816/matrix-bot-sdk 0.0.0-stage → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/lib/AdminApis.d.ts +52 -0
- package/lib/AdminApis.js +29 -0
- package/lib/AdminApis.js.map +1 -0
- package/lib/DMs.d.ts +48 -0
- package/lib/DMs.js +160 -0
- package/lib/DMs.js.map +1 -0
- package/lib/IFilter.d.ts +7 -0
- package/lib/IFilter.js +3 -0
- package/lib/IFilter.js.map +1 -0
- package/lib/MatrixAuth.d.ts +45 -0
- package/lib/MatrixAuth.js +125 -0
- package/lib/MatrixAuth.js.map +1 -0
- package/lib/MatrixClient.d.ts +834 -0
- package/lib/MatrixClient.js +2268 -0
- package/lib/MatrixClient.js.map +1 -0
- package/lib/PantalaimonClient.d.ts +42 -0
- package/lib/PantalaimonClient.js +44 -0
- package/lib/PantalaimonClient.js.map +1 -0
- package/lib/SynapseAdminApis.d.ts +350 -0
- package/lib/SynapseAdminApis.js +244 -0
- package/lib/SynapseAdminApis.js.map +1 -0
- package/lib/SynchronousMatrixClient.d.ts +82 -0
- package/lib/SynchronousMatrixClient.js +130 -0
- package/lib/SynchronousMatrixClient.js.map +1 -0
- package/lib/UnstableApis.d.ts +43 -0
- package/lib/UnstableApis.js +74 -0
- package/lib/UnstableApis.js.map +1 -0
- package/lib/appservice/Appservice.d.ts +328 -0
- package/lib/appservice/Appservice.js +803 -0
- package/lib/appservice/Appservice.js.map +1 -0
- package/lib/appservice/Intent.d.ts +113 -0
- package/lib/appservice/Intent.js +363 -0
- package/lib/appservice/Intent.js.map +1 -0
- package/lib/appservice/MatrixBridge.d.ts +85 -0
- package/lib/appservice/MatrixBridge.js +111 -0
- package/lib/appservice/MatrixBridge.js.map +1 -0
- package/lib/appservice/UnstableAppserviceApis.d.ts +41 -0
- package/lib/appservice/UnstableAppserviceApis.js +62 -0
- package/lib/appservice/UnstableAppserviceApis.js.map +1 -0
- package/lib/appservice/http_responses.d.ts +77 -0
- package/lib/appservice/http_responses.js +3 -0
- package/lib/appservice/http_responses.js.map +1 -0
- package/lib/b64.d.ts +42 -0
- package/lib/b64.js +68 -0
- package/lib/b64.js.map +1 -0
- package/lib/e2ee/CrossSigningBootstrap.d.ts +73 -0
- package/lib/e2ee/CrossSigningBootstrap.js +86 -0
- package/lib/e2ee/CrossSigningBootstrap.js.map +1 -0
- package/lib/e2ee/CryptoClient.d.ts +163 -0
- package/lib/e2ee/CryptoClient.js +382 -0
- package/lib/e2ee/CryptoClient.js.map +1 -0
- package/lib/e2ee/ICryptoRoomInformation.d.ts +8 -0
- package/lib/e2ee/ICryptoRoomInformation.js +3 -0
- package/lib/e2ee/ICryptoRoomInformation.js.map +1 -0
- package/lib/e2ee/RoomTracker.d.ts +41 -0
- package/lib/e2ee/RoomTracker.js +96 -0
- package/lib/e2ee/RoomTracker.js.map +1 -0
- package/lib/e2ee/RustEngine.d.ts +149 -0
- package/lib/e2ee/RustEngine.js +467 -0
- package/lib/e2ee/RustEngine.js.map +1 -0
- package/lib/e2ee/decorators.d.ts +10 -0
- package/lib/e2ee/decorators.js +37 -0
- package/lib/e2ee/decorators.js.map +1 -0
- package/lib/helpers/MatrixEntity.d.ts +37 -0
- package/lib/helpers/MatrixEntity.js +67 -0
- package/lib/helpers/MatrixEntity.js.map +1 -0
- package/lib/helpers/MatrixGlob.d.ts +22 -0
- package/lib/helpers/MatrixGlob.js +35 -0
- package/lib/helpers/MatrixGlob.js.map +1 -0
- package/lib/helpers/MentionPill.d.ts +40 -0
- package/lib/helpers/MentionPill.js +91 -0
- package/lib/helpers/MentionPill.js.map +1 -0
- package/lib/helpers/Permalinks.d.ts +58 -0
- package/lib/helpers/Permalinks.js +73 -0
- package/lib/helpers/Permalinks.js.map +1 -0
- package/lib/helpers/ProfileCache.d.ts +48 -0
- package/lib/helpers/ProfileCache.js +114 -0
- package/lib/helpers/ProfileCache.js.map +1 -0
- package/lib/helpers/RichReply.d.ts +17 -0
- package/lib/helpers/RichReply.js +47 -0
- package/lib/helpers/RichReply.js.map +1 -0
- package/lib/helpers/UnpaddedBase64.d.ts +31 -0
- package/lib/helpers/UnpaddedBase64.js +45 -0
- package/lib/helpers/UnpaddedBase64.js.map +1 -0
- package/lib/http.d.ts +17 -0
- package/lib/http.js +147 -0
- package/lib/http.js.map +1 -0
- package/lib/identity/IdentityClient.d.ts +93 -0
- package/lib/identity/IdentityClient.js +248 -0
- package/lib/identity/IdentityClient.js.map +1 -0
- package/lib/index.d.ts +91 -0
- package/lib/index.js +125 -0
- package/lib/index.js.map +1 -0
- package/lib/logging/ConsoleLogger.d.ts +12 -0
- package/lib/logging/ConsoleLogger.js +28 -0
- package/lib/logging/ConsoleLogger.js.map +1 -0
- package/lib/logging/ILogger.d.ts +36 -0
- package/lib/logging/ILogger.js +3 -0
- package/lib/logging/ILogger.js.map +1 -0
- package/lib/logging/LogService.d.ts +100 -0
- package/lib/logging/LogService.js +169 -0
- package/lib/logging/LogService.js.map +1 -0
- package/lib/logging/RichConsoleLogger.d.ts +20 -0
- package/lib/logging/RichConsoleLogger.js +41 -0
- package/lib/logging/RichConsoleLogger.js.map +1 -0
- package/lib/metrics/IMetricListener.d.ts +52 -0
- package/lib/metrics/IMetricListener.js +3 -0
- package/lib/metrics/IMetricListener.js.map +1 -0
- package/lib/metrics/Metrics.d.ts +66 -0
- package/lib/metrics/Metrics.js +128 -0
- package/lib/metrics/Metrics.js.map +1 -0
- package/lib/metrics/contexts.d.ts +51 -0
- package/lib/metrics/contexts.js +3 -0
- package/lib/metrics/contexts.js.map +1 -0
- package/lib/metrics/decorators.d.ts +15 -0
- package/lib/metrics/decorators.js +92 -0
- package/lib/metrics/decorators.js.map +1 -0
- package/lib/metrics/names.d.ts +45 -0
- package/lib/metrics/names.js +49 -0
- package/lib/metrics/names.js.map +1 -0
- package/lib/mixins/AutojoinRoomsMixin.d.ts +10 -0
- package/lib/mixins/AutojoinRoomsMixin.js +25 -0
- package/lib/mixins/AutojoinRoomsMixin.js.map +1 -0
- package/lib/mixins/AutojoinUpgradedRoomsMixin.d.ts +10 -0
- package/lib/mixins/AutojoinUpgradedRoomsMixin.js +40 -0
- package/lib/mixins/AutojoinUpgradedRoomsMixin.js.map +1 -0
- package/lib/models/Account.d.ts +8 -0
- package/lib/models/Account.js +3 -0
- package/lib/models/Account.js.map +1 -0
- package/lib/models/CreateRoom.d.ts +125 -0
- package/lib/models/CreateRoom.js +3 -0
- package/lib/models/CreateRoom.js.map +1 -0
- package/lib/models/Crypto.d.ts +167 -0
- package/lib/models/Crypto.js +31 -0
- package/lib/models/Crypto.js.map +1 -0
- package/lib/models/EventContext.d.ts +19 -0
- package/lib/models/EventContext.js +3 -0
- package/lib/models/EventContext.js.map +1 -0
- package/lib/models/IdentityServerModels.d.ts +20 -0
- package/lib/models/IdentityServerModels.js +3 -0
- package/lib/models/IdentityServerModels.js.map +1 -0
- package/lib/models/MSC2176.d.ts +42 -0
- package/lib/models/MSC2176.js +3 -0
- package/lib/models/MSC2176.js.map +1 -0
- package/lib/models/MatrixError.d.ts +38 -0
- package/lib/models/MatrixError.js +30 -0
- package/lib/models/MatrixError.js.map +1 -0
- package/lib/models/MatrixProfile.d.ts +43 -0
- package/lib/models/MatrixProfile.js +43 -0
- package/lib/models/MatrixProfile.js.map +1 -0
- package/lib/models/OpenIDConnect.d.ts +10 -0
- package/lib/models/OpenIDConnect.js +3 -0
- package/lib/models/OpenIDConnect.js.map +1 -0
- package/lib/models/Policies.d.ts +25 -0
- package/lib/models/Policies.js +3 -0
- package/lib/models/Policies.js.map +1 -0
- package/lib/models/PowerLevelAction.d.ts +27 -0
- package/lib/models/PowerLevelAction.js +32 -0
- package/lib/models/PowerLevelAction.js.map +1 -0
- package/lib/models/PowerLevelBounds.d.ts +15 -0
- package/lib/models/PowerLevelBounds.js +3 -0
- package/lib/models/PowerLevelBounds.js.map +1 -0
- package/lib/models/Presence.d.ts +25 -0
- package/lib/models/Presence.js +38 -0
- package/lib/models/Presence.js.map +1 -0
- package/lib/models/ServerVersions.d.ts +8 -0
- package/lib/models/ServerVersions.js +3 -0
- package/lib/models/ServerVersions.js.map +1 -0
- package/lib/models/Spaces.d.ts +116 -0
- package/lib/models/Spaces.js +91 -0
- package/lib/models/Spaces.js.map +1 -0
- package/lib/models/Threepid.d.ts +8 -0
- package/lib/models/Threepid.js +3 -0
- package/lib/models/Threepid.js.map +1 -0
- package/lib/models/events/AliasesEvent.d.ts +27 -0
- package/lib/models/events/AliasesEvent.js +27 -0
- package/lib/models/events/AliasesEvent.js.map +1 -0
- package/lib/models/events/CanonicalAliasEvent.d.ts +23 -0
- package/lib/models/events/CanonicalAliasEvent.js +21 -0
- package/lib/models/events/CanonicalAliasEvent.js.map +1 -0
- package/lib/models/events/CreateEvent.d.ts +63 -0
- package/lib/models/events/CreateEvent.js +33 -0
- package/lib/models/events/CreateEvent.js.map +1 -0
- package/lib/models/events/EncryptedRoomEvent.d.ts +42 -0
- package/lib/models/events/EncryptedRoomEvent.js +28 -0
- package/lib/models/events/EncryptedRoomEvent.js.map +1 -0
- package/lib/models/events/EncryptionEvent.d.ts +47 -0
- package/lib/models/events/EncryptionEvent.js +42 -0
- package/lib/models/events/EncryptionEvent.js.map +1 -0
- package/lib/models/events/Event.d.ts +26 -0
- package/lib/models/events/Event.js +40 -0
- package/lib/models/events/Event.js.map +1 -0
- package/lib/models/events/EventKind.d.ts +15 -0
- package/lib/models/events/EventKind.js +20 -0
- package/lib/models/events/EventKind.js.map +1 -0
- package/lib/models/events/InvalidEventError.d.ts +14 -0
- package/lib/models/events/InvalidEventError.js +24 -0
- package/lib/models/events/InvalidEventError.js.map +1 -0
- package/lib/models/events/JoinRulesEvent.d.ts +29 -0
- package/lib/models/events/JoinRulesEvent.js +21 -0
- package/lib/models/events/JoinRulesEvent.js.map +1 -0
- package/lib/models/events/MembershipEvent.d.ts +54 -0
- package/lib/models/events/MembershipEvent.js +49 -0
- package/lib/models/events/MembershipEvent.js.map +1 -0
- package/lib/models/events/MessageEvent.d.ts +233 -0
- package/lib/models/events/MessageEvent.js +49 -0
- package/lib/models/events/MessageEvent.js.map +1 -0
- package/lib/models/events/PinnedEventsEvent.d.ts +23 -0
- package/lib/models/events/PinnedEventsEvent.js +21 -0
- package/lib/models/events/PinnedEventsEvent.js.map +1 -0
- package/lib/models/events/PowerLevelsEvent.d.ts +96 -0
- package/lib/models/events/PowerLevelsEvent.js +70 -0
- package/lib/models/events/PowerLevelsEvent.js.map +1 -0
- package/lib/models/events/PresenceEvent.d.ts +56 -0
- package/lib/models/events/PresenceEvent.js +21 -0
- package/lib/models/events/PresenceEvent.js.map +1 -0
- package/lib/models/events/RedactionEvent.d.ts +28 -0
- package/lib/models/events/RedactionEvent.js +36 -0
- package/lib/models/events/RedactionEvent.js.map +1 -0
- package/lib/models/events/RoomAvatarEvent.d.ts +28 -0
- package/lib/models/events/RoomAvatarEvent.js +21 -0
- package/lib/models/events/RoomAvatarEvent.js.map +1 -0
- package/lib/models/events/RoomEvent.d.ts +58 -0
- package/lib/models/events/RoomEvent.js +57 -0
- package/lib/models/events/RoomEvent.js.map +1 -0
- package/lib/models/events/RoomNameEvent.d.ts +20 -0
- package/lib/models/events/RoomNameEvent.js +21 -0
- package/lib/models/events/RoomNameEvent.js.map +1 -0
- package/lib/models/events/RoomTopicEvent.d.ts +20 -0
- package/lib/models/events/RoomTopicEvent.js +21 -0
- package/lib/models/events/RoomTopicEvent.js.map +1 -0
- package/lib/models/events/SpaceChildEvent.d.ts +53 -0
- package/lib/models/events/SpaceChildEvent.js +49 -0
- package/lib/models/events/SpaceChildEvent.js.map +1 -0
- package/lib/models/events/converter.d.ts +8 -0
- package/lib/models/events/converter.js +50 -0
- package/lib/models/events/converter.js.map +1 -0
- package/lib/models/unstable/MediaInfo.d.ts +16 -0
- package/lib/models/unstable/MediaInfo.js +3 -0
- package/lib/models/unstable/MediaInfo.js.map +1 -0
- package/lib/preprocessors/IPreprocessor.d.ts +22 -0
- package/lib/preprocessors/IPreprocessor.js +3 -0
- package/lib/preprocessors/IPreprocessor.js.map +1 -0
- package/lib/preprocessors/RichRepliesPreprocessor.d.ts +67 -0
- package/lib/preprocessors/RichRepliesPreprocessor.js +112 -0
- package/lib/preprocessors/RichRepliesPreprocessor.js.map +1 -0
- package/lib/request.d.ts +13 -0
- package/lib/request.js +23 -0
- package/lib/request.js.map +1 -0
- package/lib/simple-validation.d.ts +10 -0
- package/lib/simple-validation.js +30 -0
- package/lib/simple-validation.js.map +1 -0
- package/lib/storage/IAppserviceStorageProvider.d.ts +48 -0
- package/lib/storage/IAppserviceStorageProvider.js +3 -0
- package/lib/storage/IAppserviceStorageProvider.js.map +1 -0
- package/lib/storage/ICryptoStorageProvider.d.ts +32 -0
- package/lib/storage/ICryptoStorageProvider.js +3 -0
- package/lib/storage/ICryptoStorageProvider.js.map +1 -0
- package/lib/storage/IStorageProvider.d.ts +47 -0
- package/lib/storage/IStorageProvider.js +3 -0
- package/lib/storage/IStorageProvider.js.map +1 -0
- package/lib/storage/MemoryStorageProvider.d.ts +26 -0
- package/lib/storage/MemoryStorageProvider.js +55 -0
- package/lib/storage/MemoryStorageProvider.js.map +1 -0
- package/lib/storage/RustSdkCryptoStorageProvider.d.ts +38 -0
- package/lib/storage/RustSdkCryptoStorageProvider.js +69 -0
- package/lib/storage/RustSdkCryptoStorageProvider.js.map +1 -0
- package/lib/storage/SimpleFsStorageProvider.d.ts +31 -0
- package/lib/storage/SimpleFsStorageProvider.js +122 -0
- package/lib/storage/SimpleFsStorageProvider.js.map +1 -0
- package/lib/storage/SimplePostgresStorageProvider.d.ts +32 -0
- package/lib/storage/SimplePostgresStorageProvider.js +148 -0
- package/lib/storage/SimplePostgresStorageProvider.js.map +1 -0
- package/lib/strategies/AppserviceJoinRoomStrategy.d.ts +14 -0
- package/lib/strategies/AppserviceJoinRoomStrategy.js +54 -0
- package/lib/strategies/AppserviceJoinRoomStrategy.js.map +1 -0
- package/lib/strategies/JoinRoomStrategy.d.ts +11 -0
- package/lib/strategies/JoinRoomStrategy.js +44 -0
- package/lib/strategies/JoinRoomStrategy.js.map +1 -0
- package/package.json +136 -4
- package/src/AdminApis.ts +60 -0
- package/src/DMs.ts +164 -0
- package/src/IFilter.ts +7 -0
- package/src/MatrixAuth.ts +129 -0
- package/src/MatrixClient.ts +2046 -0
- package/src/PantalaimonClient.ts +62 -0
- package/src/SynapseAdminApis.ts +482 -0
- package/src/SynchronousMatrixClient.ts +129 -0
- package/src/UnstableApis.ts +75 -0
- package/src/appservice/Appservice.ts +1089 -0
- package/src/appservice/Intent.ts +342 -0
- package/src/appservice/MatrixBridge.ts +139 -0
- package/src/appservice/UnstableAppserviceApis.ts +63 -0
- package/src/appservice/http_responses.ts +77 -0
- package/src/b64.ts +63 -0
- package/src/e2ee/CrossSigningBootstrap.ts +141 -0
- package/src/e2ee/CryptoClient.ts +378 -0
- package/src/e2ee/ICryptoRoomInformation.ts +9 -0
- package/src/e2ee/RoomTracker.ts +99 -0
- package/src/e2ee/RustEngine.ts +580 -0
- package/src/e2ee/decorators.ts +38 -0
- package/src/helpers/MatrixEntity.ts +65 -0
- package/src/helpers/MatrixGlob.ts +38 -0
- package/src/helpers/MentionPill.ts +95 -0
- package/src/helpers/Permalinks.ts +101 -0
- package/src/helpers/ProfileCache.ts +119 -0
- package/src/helpers/RichReply.ts +46 -0
- package/src/helpers/UnpaddedBase64.ts +44 -0
- package/src/http.ts +166 -0
- package/src/identity/IdentityClient.ts +225 -0
- package/src/index.ts +125 -0
- package/src/logging/ConsoleLogger.ts +31 -0
- package/src/logging/ILogger.ts +40 -0
- package/src/logging/LogService.ts +167 -0
- package/src/logging/RichConsoleLogger.ts +70 -0
- package/src/metrics/IMetricListener.ts +57 -0
- package/src/metrics/Metrics.ts +134 -0
- package/src/metrics/contexts.ts +56 -0
- package/src/metrics/decorators.ts +94 -0
- package/src/metrics/names.ts +53 -0
- package/src/mixins/AutojoinRoomsMixin.ts +24 -0
- package/src/mixins/AutojoinUpgradedRoomsMixin.ts +37 -0
- package/src/models/Account.ts +8 -0
- package/src/models/CreateRoom.ts +144 -0
- package/src/models/Crypto.ts +188 -0
- package/src/models/EventContext.ts +23 -0
- package/src/models/IdentityServerModels.ts +18 -0
- package/src/models/MSC2176.ts +47 -0
- package/src/models/MatrixError.ts +39 -0
- package/src/models/MatrixProfile.ts +55 -0
- package/src/models/OpenIDConnect.ts +10 -0
- package/src/models/Policies.ts +28 -0
- package/src/models/PowerLevelAction.ts +31 -0
- package/src/models/PowerLevelBounds.ts +16 -0
- package/src/models/Presence.ts +38 -0
- package/src/models/ServerVersions.ts +8 -0
- package/src/models/Spaces.ts +167 -0
- package/src/models/Threepid.ts +8 -0
- package/src/models/events/AliasesEvent.ts +37 -0
- package/src/models/events/CanonicalAliasEvent.ts +30 -0
- package/src/models/events/CreateEvent.ts +82 -0
- package/src/models/events/EncryptedRoomEvent.ts +58 -0
- package/src/models/events/EncryptionEvent.ts +63 -0
- package/src/models/events/Event.ts +38 -0
- package/src/models/events/EventKind.ts +16 -0
- package/src/models/events/InvalidEventError.ts +19 -0
- package/src/models/events/JoinRulesEvent.ts +37 -0
- package/src/models/events/MembershipEvent.ts +77 -0
- package/src/models/events/MessageEvent.ts +292 -0
- package/src/models/events/PinnedEventsEvent.ts +30 -0
- package/src/models/events/PowerLevelsEvent.ts +135 -0
- package/src/models/events/PresenceEvent.ts +69 -0
- package/src/models/events/RedactionEvent.ts +44 -0
- package/src/models/events/RoomAvatarEvent.ts +36 -0
- package/src/models/events/RoomEvent.ts +83 -0
- package/src/models/events/RoomNameEvent.ts +27 -0
- package/src/models/events/RoomTopicEvent.ts +27 -0
- package/src/models/events/SpaceChildEvent.ts +74 -0
- package/src/models/events/_MissingEvents.md +35 -0
- package/src/models/events/converter.ts +47 -0
- package/src/models/unstable/MediaInfo.ts +16 -0
- package/src/preprocessors/IPreprocessor.ts +24 -0
- package/src/preprocessors/RichRepliesPreprocessor.ts +159 -0
- package/src/request.ts +21 -0
- package/src/simple-validation.ts +30 -0
- package/src/storage/IAppserviceStorageProvider.ts +54 -0
- package/src/storage/ICryptoStorageProvider.ts +36 -0
- package/src/storage/IStorageProvider.ts +53 -0
- package/src/storage/MemoryStorageProvider.ts +65 -0
- package/src/storage/RustSdkCryptoStorageProvider.ts +81 -0
- package/src/storage/SimpleFsStorageProvider.ts +142 -0
- package/src/storage/SimplePostgresStorageProvider.ts +168 -0
- package/src/strategies/AppserviceJoinRoomStrategy.ts +47 -0
- package/src/strategies/JoinRoomStrategy.ts +45 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,834 @@
|
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
import { IStorageProvider } from "./storage/IStorageProvider";
|
|
3
|
+
import { IJoinRoomStrategy } from "./strategies/JoinRoomStrategy";
|
|
4
|
+
import { UnstableApis } from "./UnstableApis";
|
|
5
|
+
import { IPreprocessor } from "./preprocessors/IPreprocessor";
|
|
6
|
+
import { Metrics } from "./metrics/Metrics";
|
|
7
|
+
import { AdminApis } from "./AdminApis";
|
|
8
|
+
import { Presence } from "./models/Presence";
|
|
9
|
+
import { Membership, MembershipEvent } from "./models/events/MembershipEvent";
|
|
10
|
+
import { EventContext } from "./models/EventContext";
|
|
11
|
+
import { PowerLevelBounds } from "./models/PowerLevelBounds";
|
|
12
|
+
import { IdentityClient } from "./identity/IdentityClient";
|
|
13
|
+
import { OpenIDConnectToken } from "./models/OpenIDConnect";
|
|
14
|
+
import { Space, SpaceCreateOptions } from "./models/Spaces";
|
|
15
|
+
import { PowerLevelAction } from "./models/PowerLevelAction";
|
|
16
|
+
import { CryptoClient } from "./e2ee/CryptoClient";
|
|
17
|
+
import { FallbackKey, MultiUserDeviceListResponse, OTKAlgorithm, OTKClaimResponse, OTKCounts, OTKs, OwnUserDevice } from "./models/Crypto";
|
|
18
|
+
import { ICryptoStorageProvider } from "./storage/ICryptoStorageProvider";
|
|
19
|
+
import { IWhoAmI } from "./models/Account";
|
|
20
|
+
import { DMs } from "./DMs";
|
|
21
|
+
import { ServerVersions } from "./models/ServerVersions";
|
|
22
|
+
import { RoomCreateOptions } from "./models/CreateRoom";
|
|
23
|
+
import { PresenceState } from './models/events/PresenceEvent';
|
|
24
|
+
/**
|
|
25
|
+
* A client that is capable of interacting with a matrix homeserver.
|
|
26
|
+
*/
|
|
27
|
+
export declare class MatrixClient extends EventEmitter {
|
|
28
|
+
readonly homeserverUrl: string;
|
|
29
|
+
readonly accessToken: string;
|
|
30
|
+
private storage;
|
|
31
|
+
readonly cryptoStore: ICryptoStorageProvider;
|
|
32
|
+
/**
|
|
33
|
+
* The presence status to use while syncing. The valid values are "online" to set the account as online,
|
|
34
|
+
* "offline" to set the user as offline, "unavailable" for marking the user away, and null for not setting
|
|
35
|
+
* an explicit presence (the default).
|
|
36
|
+
*
|
|
37
|
+
* Has no effect if the client is not syncing. Does not apply until the next sync request.
|
|
38
|
+
*/
|
|
39
|
+
syncingPresence: PresenceState | null;
|
|
40
|
+
/**
|
|
41
|
+
* The number of milliseconds to wait for new events for on the next sync.
|
|
42
|
+
*
|
|
43
|
+
* Has no effect if the client is not syncing. Does not apply until the next sync request.
|
|
44
|
+
*/
|
|
45
|
+
syncingTimeout: number;
|
|
46
|
+
/**
|
|
47
|
+
* The crypto manager instance for this client. Generally speaking, this shouldn't
|
|
48
|
+
* need to be accessed but is made available.
|
|
49
|
+
*
|
|
50
|
+
* Will be null/undefined if crypto is not possible.
|
|
51
|
+
*/
|
|
52
|
+
readonly crypto: CryptoClient;
|
|
53
|
+
/**
|
|
54
|
+
* The DM manager instance for this client.
|
|
55
|
+
*/
|
|
56
|
+
readonly dms: DMs;
|
|
57
|
+
private userId;
|
|
58
|
+
private requestId;
|
|
59
|
+
private lastJoinedRoomIds;
|
|
60
|
+
private impersonatedUserId;
|
|
61
|
+
private impersonatedDeviceId;
|
|
62
|
+
private joinStrategy;
|
|
63
|
+
private eventProcessors;
|
|
64
|
+
private filterId;
|
|
65
|
+
private stopSyncing;
|
|
66
|
+
private metricsInstance;
|
|
67
|
+
private unstableApisInstance;
|
|
68
|
+
private cachedVersions;
|
|
69
|
+
private versionsLastFetched;
|
|
70
|
+
/**
|
|
71
|
+
* Set this to true to have the client only persist the sync token after the sync
|
|
72
|
+
* has been processed successfully. Note that if this is true then when the sync
|
|
73
|
+
* loop throws an error the client will not persist a token.
|
|
74
|
+
*/
|
|
75
|
+
protected persistTokenAfterSync: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a new matrix client
|
|
78
|
+
* @param {string} homeserverUrl The homeserver's client-server API URL
|
|
79
|
+
* @param {string} accessToken The access token for the homeserver
|
|
80
|
+
* @param {IStorageProvider} storage The storage provider to use. Defaults to MemoryStorageProvider.
|
|
81
|
+
* @param {ICryptoStorageProvider} cryptoStore Optional crypto storage provider to use. If not supplied,
|
|
82
|
+
* end-to-end encryption will not be functional in this client.
|
|
83
|
+
*/
|
|
84
|
+
constructor(homeserverUrl: string, accessToken: string, storage?: IStorageProvider, cryptoStore?: ICryptoStorageProvider);
|
|
85
|
+
/**
|
|
86
|
+
* The storage provider for this client. Direct access is usually not required.
|
|
87
|
+
*/
|
|
88
|
+
get storageProvider(): IStorageProvider;
|
|
89
|
+
/**
|
|
90
|
+
* The metrics instance for this client
|
|
91
|
+
*/
|
|
92
|
+
get metrics(): Metrics;
|
|
93
|
+
/**
|
|
94
|
+
* Assigns a new metrics instance, overwriting the old one.
|
|
95
|
+
* @param {Metrics} metrics The new metrics instance.
|
|
96
|
+
*/
|
|
97
|
+
set metrics(metrics: Metrics);
|
|
98
|
+
/**
|
|
99
|
+
* Gets the unstable API access class. This is generally not recommended to be
|
|
100
|
+
* used by clients.
|
|
101
|
+
* @return {UnstableApis} The unstable API access class.
|
|
102
|
+
*/
|
|
103
|
+
get unstableApis(): UnstableApis;
|
|
104
|
+
/**
|
|
105
|
+
* Gets the admin API access class.
|
|
106
|
+
* @return {AdminApis} The admin API access class.
|
|
107
|
+
*/
|
|
108
|
+
get adminApis(): AdminApis;
|
|
109
|
+
/**
|
|
110
|
+
* Sets a user ID to impersonate as. This will assume that the access token for this client
|
|
111
|
+
* is for an application service, and that the userId given is within the reach of the
|
|
112
|
+
* application service. Setting this to null will stop future impersonation. The user ID is
|
|
113
|
+
* assumed to already be valid
|
|
114
|
+
* @param {string} userId The user ID to masquerade as, or `null` to clear masquerading.
|
|
115
|
+
* @param {string} deviceId Optional device ID to impersonate under the given user, if supported
|
|
116
|
+
* by the server. Check the whoami response after setting.
|
|
117
|
+
*/
|
|
118
|
+
impersonateUserId(userId: string | null, deviceId?: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Acquires an identity server client for communicating with an identity server. Note that
|
|
121
|
+
* this will automatically do the login portion to establish a usable token with the identity
|
|
122
|
+
* server provided, but it will not automatically accept any terms of service.
|
|
123
|
+
*
|
|
124
|
+
* The identity server name provided will in future be resolved to a server address - for now
|
|
125
|
+
* that resolution is assumed to be prefixing the name with `https://`.
|
|
126
|
+
* @param {string} identityServerName The domain of the identity server to connect to.
|
|
127
|
+
* @returns {Promise<IdentityClient>} Resolves to a prepared identity client.
|
|
128
|
+
*/
|
|
129
|
+
getIdentityServerClient(identityServerName: string): Promise<IdentityClient>;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the strategy to use for when joinRoom is called on this client
|
|
132
|
+
* @param {IJoinRoomStrategy} strategy The strategy to use, or null to use none
|
|
133
|
+
*/
|
|
134
|
+
setJoinStrategy(strategy: IJoinRoomStrategy): void;
|
|
135
|
+
/**
|
|
136
|
+
* Adds a preprocessor to the event pipeline. When this client encounters an event, it
|
|
137
|
+
* will try to run it through the preprocessors it can in the order they were added.
|
|
138
|
+
* @param {IPreprocessor} preprocessor the preprocessor to add
|
|
139
|
+
*/
|
|
140
|
+
addPreprocessor(preprocessor: IPreprocessor): void;
|
|
141
|
+
private processEvent;
|
|
142
|
+
/**
|
|
143
|
+
* Retrieves the server's supported specification versions and unstable features.
|
|
144
|
+
* @returns {Promise<ServerVersions>} Resolves to the server's supported versions.
|
|
145
|
+
*/
|
|
146
|
+
getServerVersions(): Promise<ServerVersions>;
|
|
147
|
+
/**
|
|
148
|
+
* Determines if the server supports a given unstable feature flag. Useful for determining
|
|
149
|
+
* if the server can support an unstable MSC.
|
|
150
|
+
* @param {string} feature The feature name to look for.
|
|
151
|
+
* @returns {Promise<boolean>} Resolves to true if the server supports the flag, false otherwise.
|
|
152
|
+
*/
|
|
153
|
+
doesServerSupportUnstableFeature(feature: string): Promise<boolean>;
|
|
154
|
+
/**
|
|
155
|
+
* Determines if the server supports a given version of the specification or not.
|
|
156
|
+
* @param {string} version The version to look for. Eg: "v1.1"
|
|
157
|
+
* @returns {Promise<boolean>} Resolves to true if the server supports the version, false otherwise.
|
|
158
|
+
*/
|
|
159
|
+
doesServerSupportVersion(version: string): Promise<boolean>;
|
|
160
|
+
/**
|
|
161
|
+
* Determines if the server supports at least one of the given specification versions or not.
|
|
162
|
+
* @param {string[]} versions The versions to look for. Eg: ["v1.1"]
|
|
163
|
+
* @returns {Promise<boolean>} Resolves to true if the server supports any of the versions, false otherwise.
|
|
164
|
+
*/
|
|
165
|
+
doesServerSupportAnyOneVersion(versions: string[]): Promise<boolean>;
|
|
166
|
+
/**
|
|
167
|
+
* Retrieves an OpenID Connect token from the homeserver for the current user.
|
|
168
|
+
* @returns {Promise<OpenIDConnectToken>} Resolves to the token.
|
|
169
|
+
*/
|
|
170
|
+
getOpenIDConnectToken(): Promise<OpenIDConnectToken>;
|
|
171
|
+
/**
|
|
172
|
+
* Retrieves content from account data.
|
|
173
|
+
* @param {string} eventType The type of account data to retrieve.
|
|
174
|
+
* @returns {Promise<any>} Resolves to the content of that account data.
|
|
175
|
+
*/
|
|
176
|
+
getAccountData<T>(eventType: string): Promise<T>;
|
|
177
|
+
/**
|
|
178
|
+
* Retrieves content from room account data.
|
|
179
|
+
* @param {string} eventType The type of room account data to retrieve.
|
|
180
|
+
* @param {string} roomId The room to read the account data from.
|
|
181
|
+
* @returns {Promise<any>} Resolves to the content of that account data.
|
|
182
|
+
*/
|
|
183
|
+
getRoomAccountData<T>(eventType: string, roomId: string): Promise<T>;
|
|
184
|
+
/**
|
|
185
|
+
* Retrieves content from account data. If the account data request throws an error,
|
|
186
|
+
* this simply returns the default provided.
|
|
187
|
+
* @param {string} eventType The type of account data to retrieve.
|
|
188
|
+
* @param {any} defaultContent The default value. Defaults to null.
|
|
189
|
+
* @returns {Promise<any>} Resolves to the content of that account data, or the default.
|
|
190
|
+
*/
|
|
191
|
+
getSafeAccountData<T>(eventType: string, defaultContent?: T): Promise<T>;
|
|
192
|
+
/**
|
|
193
|
+
* Retrieves content from room account data. If the account data request throws an error,
|
|
194
|
+
* this simply returns the default provided.
|
|
195
|
+
* @param {string} eventType The type of room account data to retrieve.
|
|
196
|
+
* @param {string} roomId The room to read the account data from.
|
|
197
|
+
* @param {any} defaultContent The default value. Defaults to null.
|
|
198
|
+
* @returns {Promise<any>} Resolves to the content of that room account data, or the default.
|
|
199
|
+
*/
|
|
200
|
+
getSafeRoomAccountData<T>(eventType: string, roomId: string, defaultContent?: T): Promise<T>;
|
|
201
|
+
/**
|
|
202
|
+
* Sets account data.
|
|
203
|
+
* @param {string} eventType The type of account data to set
|
|
204
|
+
* @param {any} content The content to set
|
|
205
|
+
* @returns {Promise<any>} Resolves when updated
|
|
206
|
+
*/
|
|
207
|
+
setAccountData(eventType: string, content: any): Promise<any>;
|
|
208
|
+
/**
|
|
209
|
+
* Sets room account data.
|
|
210
|
+
* @param {string} eventType The type of room account data to set
|
|
211
|
+
* @param {string} roomId The room to set account data in
|
|
212
|
+
* @param {any} content The content to set
|
|
213
|
+
* @returns {Promise<any>} Resolves when updated
|
|
214
|
+
*/
|
|
215
|
+
setRoomAccountData(eventType: string, roomId: string, content: any): Promise<any>;
|
|
216
|
+
/**
|
|
217
|
+
* Gets the presence information for the current user.
|
|
218
|
+
* @returns {Promise<Presence>} Resolves to the presence status of the user.
|
|
219
|
+
*/
|
|
220
|
+
getPresenceStatus(): Promise<Presence>;
|
|
221
|
+
/**
|
|
222
|
+
* Gets the presence information for a given user.
|
|
223
|
+
* @param {string} userId The user ID to look up the presence of.
|
|
224
|
+
* @returns {Promise<Presence>} Resolves to the presence status of the user.
|
|
225
|
+
*/
|
|
226
|
+
getPresenceStatusFor(userId: string): Promise<Presence>;
|
|
227
|
+
/**
|
|
228
|
+
* Sets the presence status for the current user.
|
|
229
|
+
* @param {PresenceState} presence The new presence state for the user.
|
|
230
|
+
* @param {string?} statusMessage Optional status message to include with the presence.
|
|
231
|
+
* @returns {Promise<any>} Resolves when complete.
|
|
232
|
+
*/
|
|
233
|
+
setPresenceStatus(presence: PresenceState, statusMessage?: string | undefined): Promise<any>;
|
|
234
|
+
/**
|
|
235
|
+
* Gets a published alias for the given room. These are supplied by the room admins
|
|
236
|
+
* and should point to the room, but may not. This is primarily intended to be used
|
|
237
|
+
* in the context of rendering a mention (pill) for a room.
|
|
238
|
+
* @param {string} roomIdOrAlias The room ID or alias to get an alias for.
|
|
239
|
+
* @returns {Promise<string>} Resolves to a published room alias, or falsey if none found.
|
|
240
|
+
*/
|
|
241
|
+
getPublishedAlias(roomIdOrAlias: string): Promise<string>;
|
|
242
|
+
/**
|
|
243
|
+
* Adds a new room alias to the room directory
|
|
244
|
+
* @param {string} alias The alias to add (eg: "#my-room:matrix.org")
|
|
245
|
+
* @param {string} roomId The room ID to add the alias to
|
|
246
|
+
* @returns {Promise} resolves when the alias has been added
|
|
247
|
+
*/
|
|
248
|
+
createRoomAlias(alias: string, roomId: string): Promise<any>;
|
|
249
|
+
/**
|
|
250
|
+
* Removes a room alias from the room directory
|
|
251
|
+
* @param {string} alias The alias to remove
|
|
252
|
+
* @returns {Promise} resolves when the alias has been deleted
|
|
253
|
+
*/
|
|
254
|
+
deleteRoomAlias(alias: string): Promise<any>;
|
|
255
|
+
/**
|
|
256
|
+
* Sets the visibility of a room in the directory.
|
|
257
|
+
* @param {string} roomId The room ID to manipulate the visibility of
|
|
258
|
+
* @param {"public" | "private"} visibility The visibility to set for the room
|
|
259
|
+
* @return {Promise} resolves when the visibility has been updated
|
|
260
|
+
*/
|
|
261
|
+
setDirectoryVisibility(roomId: string, visibility: "public" | "private"): Promise<any>;
|
|
262
|
+
/**
|
|
263
|
+
* Gets the visibility of a room in the directory.
|
|
264
|
+
* @param {string} roomId The room ID to query the visibility of
|
|
265
|
+
* @return {Promise<"public"|"private">} The visibility of the room
|
|
266
|
+
*/
|
|
267
|
+
getDirectoryVisibility(roomId: string): Promise<"public" | "private">;
|
|
268
|
+
/**
|
|
269
|
+
* Resolves a room ID or alias to a room ID. If the given ID or alias looks like a room ID
|
|
270
|
+
* already, it will be returned as-is. If the room ID or alias looks like a room alias, it
|
|
271
|
+
* will be resolved to a room ID if possible. If the room ID or alias is neither, an error
|
|
272
|
+
* will be raised.
|
|
273
|
+
* @param {string} roomIdOrAlias the room ID or alias to resolve to a room ID
|
|
274
|
+
* @returns {Promise<string>} resolves to the room ID
|
|
275
|
+
*/
|
|
276
|
+
resolveRoom(roomIdOrAlias: string): Promise<string>;
|
|
277
|
+
/**
|
|
278
|
+
* Does a room directory lookup for a given room alias
|
|
279
|
+
* @param {string} roomAlias the room alias to look up in the room directory
|
|
280
|
+
* @returns {Promise<RoomDirectoryLookupResponse>} resolves to the room's information
|
|
281
|
+
*/
|
|
282
|
+
lookupRoomAlias(roomAlias: string): Promise<RoomDirectoryLookupResponse>;
|
|
283
|
+
/**
|
|
284
|
+
* Invites a user to a room.
|
|
285
|
+
* @param {string} userId the user ID to invite
|
|
286
|
+
* @param {string} roomId the room ID to invite the user to
|
|
287
|
+
* @returns {Promise<any>} resolves when completed
|
|
288
|
+
*/
|
|
289
|
+
inviteUser(userId: any, roomId: any): Promise<any>;
|
|
290
|
+
/**
|
|
291
|
+
* Kicks a user from a room.
|
|
292
|
+
* @param {string} userId the user ID to kick
|
|
293
|
+
* @param {string} roomId the room ID to kick the user in
|
|
294
|
+
* @param {string?} reason optional reason for the kick
|
|
295
|
+
* @returns {Promise<any>} resolves when completed
|
|
296
|
+
*/
|
|
297
|
+
kickUser(userId: any, roomId: any, reason?: any): Promise<any>;
|
|
298
|
+
/**
|
|
299
|
+
* Bans a user from a room.
|
|
300
|
+
* @param {string} userId the user ID to ban
|
|
301
|
+
* @param {string} roomId the room ID to set the ban in
|
|
302
|
+
* @param {string?} reason optional reason for the ban
|
|
303
|
+
* @returns {Promise<any>} resolves when completed
|
|
304
|
+
*/
|
|
305
|
+
banUser(userId: any, roomId: any, reason?: any): Promise<any>;
|
|
306
|
+
/**
|
|
307
|
+
* Unbans a user in a room.
|
|
308
|
+
* @param {string} userId the user ID to unban
|
|
309
|
+
* @param {string} roomId the room ID to lift the ban in
|
|
310
|
+
* @returns {Promise<any>} resolves when completed
|
|
311
|
+
*/
|
|
312
|
+
unbanUser(userId: any, roomId: any): Promise<any>;
|
|
313
|
+
/**
|
|
314
|
+
* Gets the current user ID for this client
|
|
315
|
+
* @returns {Promise<string>} The user ID of this client
|
|
316
|
+
*/
|
|
317
|
+
getUserId(): Promise<string>;
|
|
318
|
+
/**
|
|
319
|
+
* Gets the user's information from the server directly.
|
|
320
|
+
* @returns {Promise<IWhoAmI>} The "who am I" response.
|
|
321
|
+
*/
|
|
322
|
+
getWhoAmI(): Promise<IWhoAmI>;
|
|
323
|
+
/**
|
|
324
|
+
* Stops the client from syncing.
|
|
325
|
+
*/
|
|
326
|
+
stop(): void;
|
|
327
|
+
/**
|
|
328
|
+
* Starts syncing the client with an optional filter
|
|
329
|
+
* @param {any} filter The filter to use, or null for none
|
|
330
|
+
* @returns {Promise<any>} Resolves when the client has started syncing
|
|
331
|
+
*/
|
|
332
|
+
start(filter?: any): Promise<any>;
|
|
333
|
+
protected startSyncInternal(): Promise<any>;
|
|
334
|
+
protected startSync(emitFn?: (emitEventType: string, ...payload: any[]) => Promise<any>): Promise<void>;
|
|
335
|
+
protected doSync(token: string): Promise<any>;
|
|
336
|
+
protected processSync(raw: any, emitFn?: (emitEventType: string, ...payload: any[]) => Promise<any>): Promise<any>;
|
|
337
|
+
/**
|
|
338
|
+
* Gets an event for a room. If the event is encrypted, and the client supports encryption,
|
|
339
|
+
* and the room is encrypted, then this will return a decrypted event.
|
|
340
|
+
* @param {string} roomId the room ID to get the event in
|
|
341
|
+
* @param {string} eventId the event ID to look up
|
|
342
|
+
* @returns {Promise<any>} resolves to the found event
|
|
343
|
+
*/
|
|
344
|
+
getEvent(roomId: string, eventId: string): Promise<any>;
|
|
345
|
+
/**
|
|
346
|
+
* Gets an event for a room. Returned as a raw event.
|
|
347
|
+
* @param {string} roomId the room ID to get the event in
|
|
348
|
+
* @param {string} eventId the event ID to look up
|
|
349
|
+
* @returns {Promise<any>} resolves to the found event
|
|
350
|
+
*/
|
|
351
|
+
getRawEvent(roomId: string, eventId: string): Promise<any>;
|
|
352
|
+
/**
|
|
353
|
+
* Gets the room state for the given room. Returned as raw events.
|
|
354
|
+
* @param {string} roomId the room ID to get state for
|
|
355
|
+
* @returns {Promise<any[]>} resolves to the room's state
|
|
356
|
+
*/
|
|
357
|
+
getRoomState(roomId: string): Promise<any[]>;
|
|
358
|
+
/**
|
|
359
|
+
* Gets the state events for a given room of a given type under the given state key.
|
|
360
|
+
* @param {string} roomId the room ID
|
|
361
|
+
* @param {string} type the event type
|
|
362
|
+
* @param {String} stateKey the state key, falsey if not needed
|
|
363
|
+
* @returns {Promise<any|any[]>} resolves to the state event(s)
|
|
364
|
+
* @deprecated It is not possible to get an array of events - use getRoomStateEvent instead
|
|
365
|
+
*/
|
|
366
|
+
getRoomStateEvents(roomId: any, type: any, stateKey: any): Promise<any | any[]>;
|
|
367
|
+
/**
|
|
368
|
+
* Gets a state event for a given room of a given type under the given state key.
|
|
369
|
+
* @param {string} roomId the room ID
|
|
370
|
+
* @param {string} type the event type
|
|
371
|
+
* @param {String} stateKey the state key
|
|
372
|
+
* @returns {Promise<any>} resolves to the state event
|
|
373
|
+
*/
|
|
374
|
+
getRoomStateEvent(roomId: any, type: any, stateKey: any): Promise<any>;
|
|
375
|
+
/**
|
|
376
|
+
* Gets the context surrounding an event.
|
|
377
|
+
* @param {string} roomId The room ID to get the context in.
|
|
378
|
+
* @param {string} eventId The event ID to get the context of.
|
|
379
|
+
* @param {number} limit The maximum number of events to return on either side of the event.
|
|
380
|
+
* @returns {Promise<EventContext>} The context of the event
|
|
381
|
+
*/
|
|
382
|
+
getEventContext(roomId: string, eventId: string, limit?: number): Promise<EventContext>;
|
|
383
|
+
/**
|
|
384
|
+
* Gets the profile for a given user
|
|
385
|
+
* @param {string} userId the user ID to lookup
|
|
386
|
+
* @returns {Promise<any>} the profile of the user
|
|
387
|
+
*/
|
|
388
|
+
getUserProfile(userId: string): Promise<any>;
|
|
389
|
+
/**
|
|
390
|
+
* Sets a new display name for the user.
|
|
391
|
+
* @param {string} displayName the new display name for the user, or null to clear
|
|
392
|
+
* @returns {Promise<any>} resolves when complete
|
|
393
|
+
*/
|
|
394
|
+
setDisplayName(displayName: string): Promise<any>;
|
|
395
|
+
/**
|
|
396
|
+
* Sets a new avatar url for the user.
|
|
397
|
+
* @param {string} avatarUrl the new avatar URL for the user, in the form of a Matrix Content URI
|
|
398
|
+
* @returns {Promise<any>} resolves when complete
|
|
399
|
+
*/
|
|
400
|
+
setAvatarUrl(avatarUrl: string): Promise<any>;
|
|
401
|
+
/**
|
|
402
|
+
* Joins the given room
|
|
403
|
+
* @param {string} roomIdOrAlias the room ID or alias to join
|
|
404
|
+
* @param {string[]} viaServers the server names to try and join through
|
|
405
|
+
* @returns {Promise<string>} resolves to the joined room ID
|
|
406
|
+
*/
|
|
407
|
+
joinRoom(roomIdOrAlias: string, viaServers?: string[]): Promise<string>;
|
|
408
|
+
/**
|
|
409
|
+
* Gets a list of joined room IDs
|
|
410
|
+
* @returns {Promise<string[]>} resolves to a list of room IDs the client participates in
|
|
411
|
+
*/
|
|
412
|
+
getJoinedRooms(): Promise<string[]>;
|
|
413
|
+
/**
|
|
414
|
+
* Gets the joined members in a room. The client must be in the room to make this request.
|
|
415
|
+
* @param {string} roomId The room ID to get the joined members of.
|
|
416
|
+
* @returns {Promise<string>} The joined user IDs in the room
|
|
417
|
+
*/
|
|
418
|
+
getJoinedRoomMembers(roomId: string): Promise<string[]>;
|
|
419
|
+
/**
|
|
420
|
+
* Gets the joined members in a room, as an object mapping userIds to profiles. The client must be in the room to make this request.
|
|
421
|
+
* @param {string} roomId The room ID to get the joined members of.
|
|
422
|
+
* @returns {Object} The joined user IDs in the room as an object mapped to a set of profiles.
|
|
423
|
+
*/
|
|
424
|
+
getJoinedRoomMembersWithProfiles(roomId: string): Promise<{
|
|
425
|
+
[userId: string]: {
|
|
426
|
+
display_name?: string;
|
|
427
|
+
avatar_url?: string;
|
|
428
|
+
};
|
|
429
|
+
}>;
|
|
430
|
+
/**
|
|
431
|
+
* Gets the membership events of users in the room. Defaults to all membership
|
|
432
|
+
* types, though this can be controlled with the membership and notMembership
|
|
433
|
+
* arguments. To change the point in time, use the batchToken.
|
|
434
|
+
* @param {string} roomId The room ID to get members in.
|
|
435
|
+
* @param {string} batchToken The point in time to get members at (or null for 'now')
|
|
436
|
+
* @param {string[]} membership The membership kinds to search for.
|
|
437
|
+
* @param {string[]} notMembership The membership kinds to not search for.
|
|
438
|
+
* @returns {Promise<MembershipEvent[]>} Resolves to the membership events of the users in the room.
|
|
439
|
+
* @see getRoomMembersByMembership
|
|
440
|
+
* @see getRoomMembersWithoutMembership
|
|
441
|
+
* @see getAllRoomMembers
|
|
442
|
+
*/
|
|
443
|
+
getRoomMembers(roomId: string, batchToken?: string, membership?: Membership[], notMembership?: Membership[]): Promise<MembershipEvent[]>;
|
|
444
|
+
/**
|
|
445
|
+
* Gets all room members in the room, optionally at a given point in time.
|
|
446
|
+
* @param {string} roomId The room ID to get members of.
|
|
447
|
+
* @param {string} atToken Optional batch token to get members at. Leave falsy for "now".
|
|
448
|
+
* @returns {Promise<MembershipEvent[]>} Resolves to the member events in the room.
|
|
449
|
+
*/
|
|
450
|
+
getAllRoomMembers(roomId: string, atToken?: string): Promise<MembershipEvent[]>;
|
|
451
|
+
/**
|
|
452
|
+
* Gets the membership events of users in the room which have a particular membership type. To change
|
|
453
|
+
* the point in time the server should return membership events at, use `atToken`.
|
|
454
|
+
* @param {string} roomId The room ID to get members in.
|
|
455
|
+
* @param {Membership} membership The membership to search for.
|
|
456
|
+
* @param {string?} atToken Optional batch token to use, or null for "now".
|
|
457
|
+
* @returns {Promise<MembershipEvent[]>} Resolves to the membership events of the users in the room.
|
|
458
|
+
*/
|
|
459
|
+
getRoomMembersByMembership(roomId: string, membership: Membership, atToken?: string): Promise<MembershipEvent[]>;
|
|
460
|
+
/**
|
|
461
|
+
* Gets the membership events of users in the room which lack a particular membership type. To change
|
|
462
|
+
* the point in time the server should return membership events at, use `atToken`.
|
|
463
|
+
* @param {string} roomId The room ID to get members in.
|
|
464
|
+
* @param {Membership} notMembership The membership to NOT search for.
|
|
465
|
+
* @param {string?} atToken Optional batch token to use, or null for "now".
|
|
466
|
+
* @returns {Promise<MembershipEvent[]>} Resolves to the membership events of the users in the room.
|
|
467
|
+
*/
|
|
468
|
+
getRoomMembersWithoutMembership(roomId: string, notMembership: Membership, atToken?: string): Promise<MembershipEvent[]>;
|
|
469
|
+
private getRoomMembersAt;
|
|
470
|
+
/**
|
|
471
|
+
* Leaves the given room
|
|
472
|
+
* @param {string} roomId the room ID to leave
|
|
473
|
+
* @param {string=} reason Optional reason to be included as the reason for leaving the room.
|
|
474
|
+
* @returns {Promise<any>} resolves when left
|
|
475
|
+
*/
|
|
476
|
+
leaveRoom(roomId: string, reason?: string): Promise<any>;
|
|
477
|
+
/**
|
|
478
|
+
* Forgets the given room
|
|
479
|
+
* @param {string} roomId the room ID to forget
|
|
480
|
+
* @returns {Promise<{}>} Resolves when forgotten
|
|
481
|
+
*/
|
|
482
|
+
forgetRoom(roomId: string): Promise<{}>;
|
|
483
|
+
/**
|
|
484
|
+
* Sends a read receipt for an event in a room
|
|
485
|
+
* @param {string} roomId the room ID to send the receipt to
|
|
486
|
+
* @param {string} eventId the event ID to set the receipt at
|
|
487
|
+
* @returns {Promise<any>} resolves when the receipt has been sent
|
|
488
|
+
*/
|
|
489
|
+
sendReadReceipt(roomId: string, eventId: string): Promise<any>;
|
|
490
|
+
/**
|
|
491
|
+
* Sets the typing status of the current user in a room
|
|
492
|
+
* @param {string} roomId the room ID the user is typing in
|
|
493
|
+
* @param {boolean} typing is the user currently typing
|
|
494
|
+
* @param {number} timeout how long should the server preserve the typing state, in milliseconds
|
|
495
|
+
* @returns {Promise<any>} resolves when the typing state has been set
|
|
496
|
+
*/
|
|
497
|
+
setTyping(roomId: string, typing: boolean, timeout?: number): Promise<any>;
|
|
498
|
+
/**
|
|
499
|
+
* Replies to a given event with the given text. The event is sent with a msgtype of m.text.
|
|
500
|
+
* The message will be encrypted if the client supports encryption and the room is encrypted.
|
|
501
|
+
* @param {string} roomId the room ID to reply in
|
|
502
|
+
* @param {any} event the event to reply to
|
|
503
|
+
* @param {string} text the text to reply with
|
|
504
|
+
* @param {string} html the HTML to reply with, or falsey to use the `text`
|
|
505
|
+
* @returns {Promise<string>} resolves to the event ID which was sent
|
|
506
|
+
*/
|
|
507
|
+
replyText(roomId: string, event: any, text: string, html?: string): Promise<string>;
|
|
508
|
+
/**
|
|
509
|
+
* Replies to a given event with the given HTML. The event is sent with a msgtype of m.text.
|
|
510
|
+
* The message will be encrypted if the client supports encryption and the room is encrypted.
|
|
511
|
+
* @param {string} roomId the room ID to reply in
|
|
512
|
+
* @param {any} event the event to reply to
|
|
513
|
+
* @param {string} html the HTML to reply with.
|
|
514
|
+
* @returns {Promise<string>} resolves to the event ID which was sent
|
|
515
|
+
*/
|
|
516
|
+
replyHtmlText(roomId: string, event: any, html: string): Promise<string>;
|
|
517
|
+
/**
|
|
518
|
+
* Replies to a given event with the given text. The event is sent with a msgtype of m.notice.
|
|
519
|
+
* The message will be encrypted if the client supports encryption and the room is encrypted.
|
|
520
|
+
* @param {string} roomId the room ID to reply in
|
|
521
|
+
* @param {any} event the event to reply to
|
|
522
|
+
* @param {string} text the text to reply with
|
|
523
|
+
* @param {string} html the HTML to reply with, or falsey to use the `text`
|
|
524
|
+
* @returns {Promise<string>} resolves to the event ID which was sent
|
|
525
|
+
*/
|
|
526
|
+
replyNotice(roomId: string, event: any, text: string, html?: string): Promise<string>;
|
|
527
|
+
/**
|
|
528
|
+
* Replies to a given event with the given HTML. The event is sent with a msgtype of m.notice.
|
|
529
|
+
* The message will be encrypted if the client supports encryption and the room is encrypted.
|
|
530
|
+
* @param {string} roomId the room ID to reply in
|
|
531
|
+
* @param {any} event the event to reply to
|
|
532
|
+
* @param {string} html the HTML to reply with.
|
|
533
|
+
* @returns {Promise<string>} resolves to the event ID which was sent
|
|
534
|
+
*/
|
|
535
|
+
replyHtmlNotice(roomId: string, event: any, html: string): Promise<string>;
|
|
536
|
+
/**
|
|
537
|
+
* Sends a notice to the given room. The message will be encrypted if the client supports
|
|
538
|
+
* encryption and the room is encrypted.
|
|
539
|
+
* @param {string} roomId the room ID to send the notice to
|
|
540
|
+
* @param {string} text the text to send
|
|
541
|
+
* @returns {Promise<string>} resolves to the event ID that represents the message
|
|
542
|
+
*/
|
|
543
|
+
sendNotice(roomId: string, text: string): Promise<string>;
|
|
544
|
+
/**
|
|
545
|
+
* Sends a notice to the given room with HTML content. The message will be encrypted if the client supports
|
|
546
|
+
* encryption and the room is encrypted.
|
|
547
|
+
* @param {string} roomId the room ID to send the notice to
|
|
548
|
+
* @param {string} html the HTML to send
|
|
549
|
+
* @returns {Promise<string>} resolves to the event ID that represents the message
|
|
550
|
+
*/
|
|
551
|
+
sendHtmlNotice(roomId: string, html: string): Promise<string>;
|
|
552
|
+
/**
|
|
553
|
+
* Sends a text message to the given room. The message will be encrypted if the client supports
|
|
554
|
+
* encryption and the room is encrypted.
|
|
555
|
+
* @param {string} roomId the room ID to send the text to
|
|
556
|
+
* @param {string} text the text to send
|
|
557
|
+
* @returns {Promise<string>} resolves to the event ID that represents the message
|
|
558
|
+
*/
|
|
559
|
+
sendText(roomId: string, text: string): Promise<string>;
|
|
560
|
+
/**
|
|
561
|
+
* Sends a text message to the given room with HTML content. The message will be encrypted if the client supports
|
|
562
|
+
* encryption and the room is encrypted.
|
|
563
|
+
* @param {string} roomId the room ID to send the text to
|
|
564
|
+
* @param {string} html the HTML to send
|
|
565
|
+
* @returns {Promise<string>} resolves to the event ID that represents the message
|
|
566
|
+
*/
|
|
567
|
+
sendHtmlText(roomId: string, html: string): Promise<string>;
|
|
568
|
+
/**
|
|
569
|
+
* Sends a message to the given room. The message will be encrypted if the client supports
|
|
570
|
+
* encryption and the room is encrypted.
|
|
571
|
+
* @param {string} roomId the room ID to send the message to
|
|
572
|
+
* @param {object} content the event content to send
|
|
573
|
+
* @returns {Promise<string>} resolves to the event ID that represents the message
|
|
574
|
+
*/
|
|
575
|
+
sendMessage(roomId: string, content: any): Promise<string>;
|
|
576
|
+
/**
|
|
577
|
+
* Sends an event to the given room. This will encrypt the event before sending if the room is
|
|
578
|
+
* encrypted and the client supports encryption. Use sendRawEvent() to avoid this behaviour.
|
|
579
|
+
* @param {string} roomId the room ID to send the event to
|
|
580
|
+
* @param {string} eventType the type of event to send
|
|
581
|
+
* @param {string} content the event body to send
|
|
582
|
+
* @returns {Promise<string>} resolves to the event ID that represents the event
|
|
583
|
+
*/
|
|
584
|
+
sendEvent(roomId: string, eventType: string, content: any): Promise<string>;
|
|
585
|
+
/**
|
|
586
|
+
* Sends an event to the given room.
|
|
587
|
+
* @param {string} roomId the room ID to send the event to
|
|
588
|
+
* @param {string} eventType the type of event to send
|
|
589
|
+
* @param {string} content the event body to send
|
|
590
|
+
* @returns {Promise<string>} resolves to the event ID that represents the event
|
|
591
|
+
*/
|
|
592
|
+
sendRawEvent(roomId: string, eventType: string, content: any): Promise<string>;
|
|
593
|
+
/**
|
|
594
|
+
* Sends a state event to the given room
|
|
595
|
+
* @param {string} roomId the room ID to send the event to
|
|
596
|
+
* @param {string} type the event type to send
|
|
597
|
+
* @param {string} stateKey the state key to send, should not be null
|
|
598
|
+
* @param {string} content the event body to send
|
|
599
|
+
* @returns {Promise<string>} resolves to the event ID that represents the message
|
|
600
|
+
*/
|
|
601
|
+
sendStateEvent(roomId: string, type: string, stateKey: string, content: any): Promise<string>;
|
|
602
|
+
/**
|
|
603
|
+
* Redact an event in a given room
|
|
604
|
+
* @param {string} roomId the room ID to send the redaction to
|
|
605
|
+
* @param {string} eventId the event ID to redact
|
|
606
|
+
* @param {String} reason an optional reason for redacting the event
|
|
607
|
+
* @returns {Promise<string>} resolves to the event ID that represents the redaction
|
|
608
|
+
*/
|
|
609
|
+
redactEvent(roomId: string, eventId: string, reason?: string | null): Promise<string>;
|
|
610
|
+
/**
|
|
611
|
+
* Creates a room. See the RoomCreateOptions interface
|
|
612
|
+
* for more information on what to provide for `properties`. Note that creating
|
|
613
|
+
* a room may cause the bot/appservice to raise a join event.
|
|
614
|
+
* @param {RoomCreateOptions} properties the properties of the room.
|
|
615
|
+
* @returns {Promise<string>} resolves to the room ID that represents the room
|
|
616
|
+
*/
|
|
617
|
+
createRoom(properties?: RoomCreateOptions): Promise<string>;
|
|
618
|
+
/**
|
|
619
|
+
* Checks if a given user has a required power level required to send the given event.
|
|
620
|
+
* @param {string} userId the user ID to check the power level of
|
|
621
|
+
* @param {string} roomId the room ID to check the power level in
|
|
622
|
+
* @param {string} eventType the event type to look for in the `events` property of the power levels
|
|
623
|
+
* @param {boolean} isState true to indicate the event is intended to be a state event
|
|
624
|
+
* @returns {Promise<boolean>} resolves to true if the user has the required power level, resolves to false otherwise
|
|
625
|
+
*/
|
|
626
|
+
userHasPowerLevelFor(userId: string, roomId: string, eventType: string, isState: boolean): Promise<boolean>;
|
|
627
|
+
/**
|
|
628
|
+
* Checks if a given user has a required power level to perform the given action
|
|
629
|
+
* @param {string} userId the user ID to check the power level of
|
|
630
|
+
* @param {string} roomId the room ID to check the power level in
|
|
631
|
+
* @param {PowerLevelAction} action the action to check power level for
|
|
632
|
+
* @returns {Promise<boolean>} resolves to true if the user has the required power level, resolves to false otherwise
|
|
633
|
+
*/
|
|
634
|
+
userHasPowerLevelForAction(userId: string, roomId: string, action: PowerLevelAction): Promise<boolean>;
|
|
635
|
+
/**
|
|
636
|
+
* Determines the boundary conditions for this client's ability to change another user's power level
|
|
637
|
+
* in a given room. This will identify the maximum possible level this client can change the user to,
|
|
638
|
+
* and if that change could even be possible. If the returned object indicates that the client can
|
|
639
|
+
* change the power level of the user, the client is able to set the power level to any value equal
|
|
640
|
+
* to or less than the maximum value.
|
|
641
|
+
* @param {string} targetUserId The user ID to compare against.
|
|
642
|
+
* @param {string} roomId The room ID to compare within.
|
|
643
|
+
* @returns {Promise<PowerLevelBounds>} The bounds of the client's ability to change the user's power level.
|
|
644
|
+
*/
|
|
645
|
+
calculatePowerLevelChangeBoundsOn(targetUserId: string, roomId: string): Promise<PowerLevelBounds>;
|
|
646
|
+
/**
|
|
647
|
+
* Sets the power level for a given user ID in the given room. Note that this is not safe to
|
|
648
|
+
* call multiple times concurrently as changes are not atomic. This will throw an error if
|
|
649
|
+
* the user lacks enough permission to change the power level, or if a power level event is
|
|
650
|
+
* missing from the room.
|
|
651
|
+
* @param {string} userId The user ID to change
|
|
652
|
+
* @param {string} roomId The room ID to change the power level in
|
|
653
|
+
* @param {number} newLevel The integer power level to set the user to.
|
|
654
|
+
* @returns {Promise<any>} Resolves when complete.
|
|
655
|
+
*/
|
|
656
|
+
setUserPowerLevel(userId: string, roomId: string, newLevel: number): Promise<any>;
|
|
657
|
+
/**
|
|
658
|
+
* Converts a MXC URI to an HTTP URL.
|
|
659
|
+
* @param {string} mxc The MXC URI to convert
|
|
660
|
+
* @returns {string} The HTTP URL for the content.
|
|
661
|
+
*/
|
|
662
|
+
mxcToHttp(mxc: string): string;
|
|
663
|
+
/**
|
|
664
|
+
* Converts a MXC URI to an HTTP URL for downsizing the content.
|
|
665
|
+
* @param {string} mxc The MXC URI to convert and downsize.
|
|
666
|
+
* @param {number} width The width, as an integer, for the thumbnail.
|
|
667
|
+
* @param {number} height The height, as an intenger, for the thumbnail.
|
|
668
|
+
* @param {"crop"|"scale"} method Whether to crop or scale (preserve aspect ratio) the content.
|
|
669
|
+
* @returns {string} The HTTP URL for the downsized content.
|
|
670
|
+
*/
|
|
671
|
+
mxcToHttpThumbnail(mxc: string, width: number, height: number, method: "crop" | "scale"): string;
|
|
672
|
+
/**
|
|
673
|
+
* Uploads data to the homeserver's media repository. Note that this will <b>not</b> automatically encrypt
|
|
674
|
+
* media as it cannot determine if the media should be encrypted.
|
|
675
|
+
* @param {Buffer} data the content to upload.
|
|
676
|
+
* @param {string} contentType the content type of the file. Defaults to application/octet-stream
|
|
677
|
+
* @param {string} filename the name of the file. Optional.
|
|
678
|
+
* @returns {Promise<string>} resolves to the MXC URI of the content
|
|
679
|
+
*/
|
|
680
|
+
uploadContent(data: Buffer, contentType?: string, filename?: string): Promise<string>;
|
|
681
|
+
/**
|
|
682
|
+
* Download content from the homeserver's media repository. Note that this will <b>not</b> automatically decrypt
|
|
683
|
+
* media as it cannot determine if the media is encrypted.
|
|
684
|
+
* @param {string} mxcUrl The MXC URI for the content.
|
|
685
|
+
* @param {string} allowRemote Indicates to the server that it should not attempt to fetch the
|
|
686
|
+
* media if it is deemed remote. This is to prevent routing loops where the server contacts itself.
|
|
687
|
+
* Defaults to true if not provided.
|
|
688
|
+
* @returns {Promise<{data: Buffer, contentType: string}>} Resolves to the downloaded content.
|
|
689
|
+
*/
|
|
690
|
+
downloadContent(mxcUrl: string, allowRemote?: boolean): Promise<{
|
|
691
|
+
data: Buffer;
|
|
692
|
+
contentType: string;
|
|
693
|
+
}>;
|
|
694
|
+
/**
|
|
695
|
+
* Uploads data to the homeserver's media repository after downloading it from the
|
|
696
|
+
* provided URL.
|
|
697
|
+
* @param {string} url The URL to download content from.
|
|
698
|
+
* @returns {Promise<string>} Resolves to the MXC URI of the content
|
|
699
|
+
*/
|
|
700
|
+
uploadContentFromUrl(url: string): Promise<string>;
|
|
701
|
+
/**
|
|
702
|
+
* Determines the upgrade history for a given room as a doubly-linked list styled structure. Given
|
|
703
|
+
* a room ID in the history of upgrades, the resulting `previous` array will hold any rooms which
|
|
704
|
+
* are older than the given room. The resulting `newer` array will hold any rooms which are newer
|
|
705
|
+
* versions of the room. Both arrays will be defined, but may be empty individually. Element zero
|
|
706
|
+
* of each will always be the nearest to the given room ID and the last element will be the furthest
|
|
707
|
+
* from the room. The given room will never be in either array.
|
|
708
|
+
* @param {string} roomId the room ID to get the history of
|
|
709
|
+
* @returns {Promise<{previous: RoomReference[], newer: RoomReference[]}>} Resolves to the room's
|
|
710
|
+
* upgrade history
|
|
711
|
+
*/
|
|
712
|
+
getRoomUpgradeHistory(roomId: string): Promise<{
|
|
713
|
+
previous: RoomReference[];
|
|
714
|
+
newer: RoomReference[];
|
|
715
|
+
current: RoomReference;
|
|
716
|
+
}>;
|
|
717
|
+
/**
|
|
718
|
+
* Creates a Space room.
|
|
719
|
+
* @param {SpaceCreateOptions} opts The creation options.
|
|
720
|
+
* @returns {Promise<Space>} Resolves to the created space.
|
|
721
|
+
*/
|
|
722
|
+
createSpace(opts: SpaceCreateOptions): Promise<Space>;
|
|
723
|
+
/**
|
|
724
|
+
* Gets a Space.
|
|
725
|
+
* This API does not work with unstable spaces (e.g. org.matrix.msc.1772.space)
|
|
726
|
+
*
|
|
727
|
+
* @throws If the room is not a space or there was an error
|
|
728
|
+
* @returns {Promise<Space>} Resolves to the space.
|
|
729
|
+
*/
|
|
730
|
+
getSpace(roomIdOrAlias: string): Promise<Space>;
|
|
731
|
+
/**
|
|
732
|
+
* Uploads One Time Keys for the current device.
|
|
733
|
+
* @param {OTKs} keys The keys to upload.
|
|
734
|
+
* @returns {Promise<OTKCounts>} Resolves to the current One Time Key counts when complete.
|
|
735
|
+
*/
|
|
736
|
+
uploadDeviceOneTimeKeys(keys: OTKs): Promise<OTKCounts>;
|
|
737
|
+
/**
|
|
738
|
+
* Gets the current One Time Key counts.
|
|
739
|
+
* @returns {Promise<OTKCounts>} Resolves to the One Time Key counts.
|
|
740
|
+
*/
|
|
741
|
+
checkOneTimeKeyCounts(): Promise<OTKCounts>;
|
|
742
|
+
/**
|
|
743
|
+
* Uploads a fallback One Time Key to the server for usage. This will replace the existing fallback
|
|
744
|
+
* key.
|
|
745
|
+
* @param {FallbackKey} fallbackKey The fallback key.
|
|
746
|
+
* @returns {Promise<OTKCounts>} Resolves to the One Time Key counts.
|
|
747
|
+
*/
|
|
748
|
+
uploadFallbackKey(fallbackKey: FallbackKey): Promise<OTKCounts>;
|
|
749
|
+
/**
|
|
750
|
+
* Gets <b>unverified</b> device lists for the given users. The caller is expected to validate
|
|
751
|
+
* and verify the device lists, including that the returned devices belong to the claimed users.
|
|
752
|
+
*
|
|
753
|
+
* Failures with federation are reported in the returned object. Users which did not fail a federation
|
|
754
|
+
* lookup but have no devices will not appear in either the failures or in the returned devices.
|
|
755
|
+
*
|
|
756
|
+
* See https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-query for more
|
|
757
|
+
* information.
|
|
758
|
+
* @param {string[]} userIds The user IDs to query.
|
|
759
|
+
* @param {number} federationTimeoutMs The default timeout for requesting devices over federation. Defaults to
|
|
760
|
+
* 10 seconds.
|
|
761
|
+
* @returns {Promise<MultiUserDeviceListResponse>} Resolves to the device list/errors for the requested user IDs.
|
|
762
|
+
*/
|
|
763
|
+
getUserDevices(userIds: string[], federationTimeoutMs?: number): Promise<MultiUserDeviceListResponse>;
|
|
764
|
+
/**
|
|
765
|
+
* Gets a device list for the client's own account, with metadata. The devices are not verified
|
|
766
|
+
* in this response, but should be active on the account.
|
|
767
|
+
* @returns {Promise<OwnUserDevice[]>} Resolves to the active devices on the account.
|
|
768
|
+
*/
|
|
769
|
+
getOwnDevices(): Promise<OwnUserDevice[]>;
|
|
770
|
+
/**
|
|
771
|
+
* Claims One Time Keys for a set of user devices, returning those keys. The caller is expected to verify
|
|
772
|
+
* and validate the returned keys.
|
|
773
|
+
*
|
|
774
|
+
* Failures with federation are reported in the returned object.
|
|
775
|
+
* @param {Record<string, Record<string, OTKAlgorithm>>} userDeviceMap The map of user IDs to device IDs to
|
|
776
|
+
* OTKAlgorithm to request a claim for.
|
|
777
|
+
* @param {number} federationTimeoutMs The default timeout for claiming keys over federation. Defaults to
|
|
778
|
+
* 10 seconds.
|
|
779
|
+
*/
|
|
780
|
+
claimOneTimeKeys(userDeviceMap: Record<string, Record<string, OTKAlgorithm>>, federationTimeoutMs?: number): Promise<OTKClaimResponse>;
|
|
781
|
+
/**
|
|
782
|
+
* Sends to-device messages to the respective users/devices.
|
|
783
|
+
* @param {string} type The message type being sent.
|
|
784
|
+
* @param {Record<string, Record<string, any>>} messages The messages to send, mapped as user ID to
|
|
785
|
+
* device ID (or "*" to denote all of the user's devices) to message payload (content).
|
|
786
|
+
* @returns {Promise<void>} Resolves when complete.
|
|
787
|
+
*/
|
|
788
|
+
sendToDevices(type: string, messages: Record<string, Record<string, any>>): Promise<void>;
|
|
789
|
+
/**
|
|
790
|
+
* Get relations for a given event.
|
|
791
|
+
* @param {string} roomId The room ID to for the given event.
|
|
792
|
+
* @param {string} eventId The event ID to list relations for.
|
|
793
|
+
* @param {string?} relationType The type of relations (e.g. `m.room.member`) to filter for. Optional.
|
|
794
|
+
* @param {string?} eventType The type of event to look for (e.g. `m.room.member`). Optional.
|
|
795
|
+
* @returns {Promise<{chunk: any[]}>} Resolves to an object containing the chunk of relations
|
|
796
|
+
*/
|
|
797
|
+
getRelationsForEvent(roomId: string, eventId: string, relationType?: string, eventType?: string): Promise<{
|
|
798
|
+
chunk: any[];
|
|
799
|
+
}>;
|
|
800
|
+
/**
|
|
801
|
+
* Performs a web request to the homeserver, applying appropriate authorization headers for
|
|
802
|
+
* this client.
|
|
803
|
+
* @param {"GET"|"POST"|"PUT"|"DELETE"} method The HTTP method to use in the request
|
|
804
|
+
* @param {string} endpoint The endpoint to call. For example: "/_matrix/client/v3/account/whoami"
|
|
805
|
+
* @param {any} qs The query string to send. Optional.
|
|
806
|
+
* @param {any} body The request body to send. Optional. Will be converted to JSON unless the type is a Buffer.
|
|
807
|
+
* @param {number} timeout The number of milliseconds to wait before timing out.
|
|
808
|
+
* @param {boolean} raw If true, the raw response will be returned instead of the response body.
|
|
809
|
+
* @param {string} contentType The content type to send. Only used if the `body` is a Buffer.
|
|
810
|
+
* @param {string} noEncoding Set to true to disable encoding, and return a Buffer. Defaults to false
|
|
811
|
+
* @returns {Promise<any>} Resolves to the response (body), rejected if a non-2xx status code was returned.
|
|
812
|
+
*/
|
|
813
|
+
doRequest(method: any, endpoint: any, qs?: any, body?: any, timeout?: number, raw?: boolean, contentType?: string, noEncoding?: boolean): Promise<any>;
|
|
814
|
+
}
|
|
815
|
+
export interface RoomDirectoryLookupResponse {
|
|
816
|
+
roomId: string;
|
|
817
|
+
residentServers: string[];
|
|
818
|
+
}
|
|
819
|
+
export interface RoomReference {
|
|
820
|
+
/**
|
|
821
|
+
* The room ID being referenced
|
|
822
|
+
*/
|
|
823
|
+
roomId: string;
|
|
824
|
+
/**
|
|
825
|
+
* The version of the room at the time
|
|
826
|
+
*/
|
|
827
|
+
version: string;
|
|
828
|
+
/**
|
|
829
|
+
* If going backwards, the tombstone event ID, otherwise the creation
|
|
830
|
+
* event. If the room can't be verified, this will be null. Will be
|
|
831
|
+
* null if this reference is to the current room.
|
|
832
|
+
*/
|
|
833
|
+
refEventId: string;
|
|
834
|
+
}
|