Skip to content

Commit

Permalink
Remove Realtime < Rest inheritance in public API
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
lawrence-forooghian committed Jun 27, 2023
1 parent 9a0a8c5 commit aaad05f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion ably.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit aaad05f

Please sign in to comment.