-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TEST CAPABILITY] Presence capability for feature-based testing examples #2581
base: main
Are you sure you want to change the base?
Conversation
This pull request contains changes to the runtime.ts file. If you, as the author of this PR, have made changes to the Runtime interface please review RUNTIME.md to determine if a new runtime version is required. Please reply to this comment stating what changes, if any, were made to the runtime object and whether a new runtime version was required. |
return callFunctionInHostAndHandleResponse( | ||
'presence.setPresence', | ||
[new SerializableSetPresenceParams(params)], | ||
new VoidResponseHandler(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You actually can use the simpler version of this since you don't expect to get anything back except an SdkError in the case that the host has an error it wants to return to the user. Check out callFunctionInHost
. You can see some examples of it being used in externalAppAuthenticationForCEA.ts
/** | ||
* Response handler for presence information | ||
*/ | ||
class UserPresenceResponseHandler extends ResponseHandler<UserPresence, UserPresence> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct (based on how everything works today). Because you are passing back an interface with multiple parameters you need to spend time thinking about
- What validation you want to do to ensure that you are receiving correctly formatted data from the host
- What (if anything) you need to do to convert what you get from the host into what you want to pass to the developer
/** | ||
* Response handler for void responses | ||
*/ | ||
class VoidResponseHandler extends ResponseHandler<void, void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably won't need this anymore once you start using callFunctionInHost
which I talk about below
/** | ||
* Serializable wrapper for GetPresenceParams | ||
*/ | ||
class SerializableGetPresenceParams implements ISerializable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed and correct because you are passing a complex interface (as opposed to a primitive or array of primitives). If you instead decided to pass the contents of GetPresenceParams as an array of primitives you wouldn't need to make a class like this. Both approaches are/can be correct
For more information about how to contribute to this repo, visit this page.
Description
Main changes in the PR:
Validation
Validation performed:
Unit Tests added:
<Yes/No>
End-to-end tests added:
<Yes/No>
Additional Requirements
Change file added:
<Yes/No>
Related PRs:
Next/remaining steps:
Screenshots: