You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to enhance the way users can get items when using the Connect Node SDK. In this issue, we want to enable users to get a list of items that have the given title.
Tasks to be done
Implement listItemsByTitle function in the Items class in src/lib/resources.ts. Important note: The API response returns an Item summary, not the full item, therefore once you get the list of item summaries, for each item you have to call getItemById.
/** * Search for all Items with an exact match on title. * * @param {string} title * @returns {Promise<FullItem[]>} * @private */privateasynclistItemssByTitle(vaultId: string,title: string,): Promise<Response>{// functionality}
Tip: You can move this snippet from get to listItemsByTitle and then call listItemsByTitle in get. In this way, you avoid duplicate code in the two function.
Implement listItemsByTitle function in OPConnect class in src/lib/op-connect.ts:
/** * Returns a list of Items with a matching Title value. * * @param {string} vaultId * @param {string} itemTitle * @returns {Promise<FullItem[]>} */publicasynclistItemsByTitle(vaultId: string,itemTitle: string): Promise<FullItem[]>{returnawaitthis.items.listItemsByTitle(vaultId,itemTitle);}
Add a test for the new function in __test__/op-connect.test.ts below get item test case:
test("list items by titte",async()=>{// actual test here}
The text was updated successfully, but these errors were encountered:
Summary
We want to enhance the way users can get items when using the Connect Node SDK. In this issue, we want to enable users to get a list of items that have the given title.
Tasks to be done
listItemsByTitle
function in theItems
class insrc/lib/resources.ts
. Important note: The API response returns an Item summary, not the full item, therefore once you get the list of item summaries, for each item you have to callgetItemById
.get
tolistItemsByTitle
and then calllistItemsByTitle
inget
. In this way, you avoid duplicate code in the two function.listItemsByTitle
function in OPConnect class insrc/lib/op-connect.ts
:__test__/op-connect.test.ts
belowget item
test case:The text was updated successfully, but these errors were encountered: