Remove WakuClient from convo.sendMessage #26
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The sendMessage function on Conversations required developers to pass in a a DS instance. Which adds confusion, and is a potential source of issues. To maintain the cleanest API, it should be removed.
Eg:
discard await convo.sendMessage(raya.ds, content)vs
discard await convo.sendMessage(content)This requirement was left over from when the Conversations API was generic over the DeliverySerivce. There was difficulty in making the conversation abstractions work with the stored generic parameter nicely. To make progress, the DS parameter was passed in to make it function, with plans to revisit.
Solution
As Client is no longer generic over
DS, the parameter is no longer required. This PR makes the conversations api, WakuClient aware. Conversation types such as PrivateV1 are initialized with a delivery service, and it uses its stored reference whensendMessageis called.This makes the external API cleaner, and easier to use.