Skip to content
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

Improve casting interface for Entities #115

Open
MichaelHirn opened this issue Sep 13, 2019 · 1 comment
Open

Improve casting interface for Entities #115

MichaelHirn opened this issue Sep 13, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request refactor rlay-client-lib issues pertaining to @rlay/rlay-client-lib
Milestone

Comments

@MichaelHirn
Copy link
Contributor

Especially Individuals and standardize a bit better so that implementing higher-level entity factories becomes easier and requires less overhead.

@MichaelHirn MichaelHirn added enhancement New feature or request rlay-client-lib issues pertaining to @rlay/rlay-client-lib refactor labels Sep 13, 2019
@MichaelHirn MichaelHirn added this to the v0.3.0 milestone Sep 13, 2019
@MichaelHirn MichaelHirn self-assigned this Sep 13, 2019
@MichaelHirn
Copy link
Contributor Author

Just one example

  • .find requires extra casting into correct higher-level entity factory
const entity = await rlayClient.HighLevelCustomEntity.find(cid)
// right now: entity.constructor.name === 'Rlay_Individual'
// should be: entity.constructor.name === 'HighLevelCustomEntity'
// to get it to `HighLevelCustomEntity` you have to do rn:
const castedEntity = new rlayClient.HighLevelCustomEntity(rlayClient, entity.payload);
castedEntity.remoteCid = entity.remoteCid;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor rlay-client-lib issues pertaining to @rlay/rlay-client-lib
Projects
None yet
Development

No branches or pull requests

1 participant