From aaad05fdaf78955adea560a4df0ee719f71dea06 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Tue, 27 Jun 2023 15:49:24 -0300 Subject: [PATCH] Remove Realtime < Rest inheritance in public API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I want to merge the following classes together: - RestBase and RestPromise into a class named Rest - RealtimeBase and RealtimePromise into a class named Realtime However, I need to decide what to do about the inheritence of RealtimeBase from RestBase. The obvious thing to do would be to make Realtime inherit from Rest, but this won’t work because RealtimeChannel’s type declaration does not include a `status()` function and hence Realtime.channels cannot satisfy the type of Rest.channels. So, since the IDL does not mention any inheritance relation between the REST and Realtime classes, I’m going to sever this connection in the type declarations. (We can consider the fact that _internally_ there is inheritance to be an implementation detail.) --- ably.d.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/ably.d.ts b/ably.d.ts index be583fa897..4567547545 100644 --- a/ably.d.ts +++ b/ably.d.ts @@ -1614,7 +1614,31 @@ declare namespace Types { /** * A base class used internally for Realtime APIs. */ - class RealtimeBase extends RestBase { + class RealtimeBase { + /** + * Construct a client object using an Ably {@link Types.ClientOptions} object. + * + * @param options - A {@link Types.ClientOptions} object to configure the client connection to Ably. + */ + constructor(options: Types.ClientOptions); + /** + * Constructs a client object using an Ably API key or token string. + * + * @param keyOrToken - The Ably API key or token string used to validate the client. + */ + constructor(keyOrToken: string); + /** + * The cryptographic functions available in the library. + */ + static Crypto: Types.Crypto; + /** + * Static utilities related to messages. + */ + static Message: Types.MessageStatic; + /** + * Static utilities related to presence messages. + */ + static PresenceMessage: Types.PresenceMessageStatic; /** * A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string, except it cannot contain a `*`. This option is primarily intended to be used in situations where the library is instantiated with a key. A `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. */