Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

feat(documents): allow to retrieve a document by its ID #116

Open
wants to merge 5 commits into
base: v0.22-dev
Choose a base branch
from
Open

feat(documents): allow to retrieve a document by its ID #116

wants to merge 5 commits into from

Conversation

dashameter
Copy link
Contributor

Issue being fixed or feature implemented

Add shorthand method to retrieve documents by their $id

Example:

    const document = await client.platform.documents.getById(
      'PaymentRequest.PaymentIntent',
      'DD9yD2G63GPdwcQi987tmiCeL3YybGDmXLkQr1jBLPhm'
    );

closes #102
supersedes #103

@antouhou
Copy link
Contributor

antouhou commented Aug 1, 2020

Looks good to me! What do you think @shumkov @Alex-Werner ?

@dashameter
Copy link
Contributor Author

dashameter commented Aug 1, 2020

#103 had a brief discussion if it's worthwhile to rename the methods to e.g. fetch and fetchById to clearly communicate the data is retrieved remotely rather than locally ..

there is also a brief convo on discord on it https://discord.com/channels/670271785974890526/670540408593448980/732938013356851251

of course it can always be changed later

@shumkov
Copy link
Member

shumkov commented Aug 3, 2020

@dashameter Yeah, I guess we can do that later. Regarding getByID, I would accept an array of IDs. Any thoughts?

@dashameter
Copy link
Contributor Author

accepting a string for one ID and array for multiple IDs feels intuitive, or a wrapper function getById wrapping getByIds

@shumkov shumkov changed the title feat(documents): Allow to retrieve a document by its ID feat(documents): фllow to retrieve a document by its ID Aug 4, 2020
@shumkov shumkov changed the title feat(documents): фllow to retrieve a document by its ID feat(documents): allow to retrieve a document by its ID Aug 4, 2020
@shumkov
Copy link
Member

shumkov commented Aug 4, 2020

I would keep just one method.

@dashameter
Copy link
Contributor Author

What if we merge this as is, since I'm already using the method in the dapps, and later we extend it with an array of ids which will be a non breaking change, since the function will continue to also accept just a single ID as a string.

@shumkov
Copy link
Member

shumkov commented Aug 21, 2020

Polymorphic params in defo, not a best practice. I meant to make the method accept only array of IDs and call it getByIds.

@shumkov shumkov changed the base branch from v0.15-dev to v0.16-dev September 4, 2020 17:12
@shumkov shumkov changed the base branch from v0.16-dev to master October 29, 2020 19:37
@antouhou antouhou changed the base branch from master to v0.22-dev October 25, 2021 15:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Feat: Allow retrieving documents from dpp by ID
3 participants