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

feat(entry)!: add useEntry hook and entryApi with tests #35

Merged
merged 5 commits into from
Jan 24, 2025
Merged

Conversation

ishaan000
Copy link
Collaborator

Summary

  • Introduced the entryApi layer to define and manage the main API interface.
  • Developed the useEntry hook to streamline dynamic URL building using journalId.
  • Refactored existing logic to enhance modularity by moving RequestBundle from useAccess to apiRequest.

Details

  1. New API Methods:

    • Added methods to handle entry, entryAnalysis, and entryConversation requests within the entryApi layer.
  2. Dynamic Hook:

    • Created the useEntry hook to simplify API interactions and support dynamic paths.
  3. Code Refactoring:

    • Extracted shared logic for API requests from useAccess to apiRequest.
    • Adjusted imports and dependencies to reflect the refactored structure.
  4. Testing:

    • Unit Tests:
      • Validated the functionality of entryApi and useEntry with mock data.
    • Integration Tests ( can keep it only for testing this PR ) :
      • Verified the end-to-end functionality of entryApi methods and useEntry within the full application flow.
      • Tested dynamic URL construction with varying journalId values, including edge cases for empty and special characters.

- Define the main API interface with methods in the `entryApi` layer.
- Create useEntry hook for dynamic url building using `journalId`.
- Move RequestBundle from `useAccess` to `apiRequest` and modify existing logic.
@ishaan000 ishaan000 added feature Related to new feature api Related to APIs labels Jan 20, 2025
@ishaan000 ishaan000 requested a review from hiyaryan January 20, 2025 19:45
@ishaan000 ishaan000 self-assigned this Jan 20, 2025
Copy link
Member

@hiyaryan hiyaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good @ishaan000 🙌 You've really went to the next level with TypeDoc. I have a few additional doc tips to share and just some general doc findings. Otherwise, the code this great! Please have a look.

package.json Outdated Show resolved Hide resolved
tests/hooks/api/entryApi.test.tsx Show resolved Hide resolved
tests/hooks/api/entryApi.test.tsx Outdated Show resolved Hide resolved
src/hooks/useEntry.ts Outdated Show resolved Hide resolved
src/hooks/api/entryApi.ts Outdated Show resolved Hide resolved
src/hooks/apiRequest.ts Outdated Show resolved Hide resolved
src/hooks/api/accessApi.ts Outdated Show resolved Hide resolved
src/hooks/api/entryApi.ts Outdated Show resolved Hide resolved
src/hooks/api/entryApi.ts Outdated Show resolved Hide resolved
src/hooks/api/entryApi.ts Outdated Show resolved Hide resolved
src/hooks/api/entryApi.ts Outdated Show resolved Hide resolved
src/hooks/api/entryApi.ts Outdated Show resolved Hide resolved
src/hooks/api/entryApi.ts Outdated Show resolved Hide resolved
ishaan000 and others added 3 commits January 24, 2025 13:28
Co-authored-by: Ryan James Meneses <[email protected]>
Co-authored-by: Ryan James Meneses <[email protected]>
- move `cross-fetch` to `devDependencies`.
- remove extra line on 137 in `access.Api.ts`.
- add typedocs for interface api in `entryApi.ts`.
- add eslint rule for disabled test suite for entry.
Copy link
Member

@hiyaryan hiyaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work Ishaan!! That wraps up the initial implementation of the hooks 🥳

@hiyaryan hiyaryan merged commit 80d4595 into main Jan 24, 2025
1 check passed
@hiyaryan hiyaryan deleted the entry-api branch January 24, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to APIs feature Related to new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants