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

Enhance getItem functionality #59

Closed
4 tasks done
edif2008 opened this issue Jul 15, 2022 · 1 comment · Fixed by #71
Closed
4 tasks done

Enhance getItem functionality #59

edif2008 opened this issue Jul 15, 2022 · 1 comment · Fixed by #71

Comments

@edif2008
Copy link
Member

edif2008 commented Jul 15, 2022

Sumary

We want users to have an easy flow when using this SDK. For items, we want them to be able to provide either the ID or the title of an item as a parameter.

Tasks to be done

  • Adjust get function in src/lib/resources.ts so that now it checks whether the input is a valid Item ID or not (i.e. it matches the following regex: "^[a-z0-9]{26}$")
  • Adjust getItem by changing the parameter name to suggest that either the name or ID is accepted (e.g. itemQuery).
  • Create a new function getItemById in src/lib/op-connect.ts
    /**
     * Get details about a specific vault with a matching ID value.
     *
     * @param {string} vaultId
     * @param {string} itemId
     * @returns {Promise<FullItem>}
     */
    public async getItemById(vaultId: string, itemId: string): Promise<FullItem> {
        return await this.items.getById(vaultId, itemId);
    }
  • Add and adjust tests for the new functions in __test__/op-connect.test.ts
@edif2008
Copy link
Member Author

This issue is blocked by #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant