Skip to content

feat: added README.md in /packages/api#2153

Merged
chronark merged 2 commits intounkeyed:mainfrom
Abhi-Bohora:README.md
Oct 3, 2024
Merged

feat: added README.md in /packages/api#2153
chronark merged 2 commits intounkeyed:mainfrom
Abhi-Bohora:README.md

Conversation

@Abhi-Bohora
Copy link
Contributor

@Abhi-Bohora Abhi-Bohora commented Oct 2, 2024

What does this PR do?

This PR adds a README.md to /packages/api

Fixes (#2149)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

Summary by CodeRabbit

  • New Features
    • Introduced a comprehensive README for the @unkey/api TypeScript client, detailing installation, usage, and configuration options.
    • Included usage examples and error handling guidance to enhance user experience.
    • Provided a link to full documentation for further reference.
  • Chores
    • Reformatted the keywords array in package.json for improved readability.
    • Expanded the files array in package.json to include the new README file.

@changeset-bot
Copy link

changeset-bot bot commented Oct 2, 2024

⚠️ No Changeset found

Latest commit: 30798fd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Oct 2, 2024

@Abhi-Bohora is attempting to deploy a commit to the Unkey Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2024

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 2, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduce a new README file for the @unkey/api TypeScript client, which provides detailed documentation for users. It includes installation instructions, a quickstart guide, usage examples, and configuration options. The document emphasizes the importance of security regarding the root key and outlines the expected response formats for API methods. Additionally, it provides code snippets for various configurations and includes a link to the full documentation.

Changes

File Change Summary
packages/api/README.md Added comprehensive documentation for the @unkey/api TypeScript client, including installation, usage examples, configuration options, and security warnings.
packages/api/package.json Reformatted keywords for readability and added "README.md" to the files array.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API_Client as API Client
    participant API_Server as API Server

    User->>API_Client: Initialize with root key
    API_Client->>API_Server: Send request (e.g., verifyKey)
    API_Server-->>API_Client: Return response (error/result)
    API_Client-->>User: Provide response details
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between cda8833 and 30798fd.

📒 Files selected for processing (1)
  • packages/api/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/api/package.json

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2024

Thank you for following the naming conventions for pull request titles! 🙏

@chronark chronark self-assigned this Oct 2, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
packages/api/README.md (5)

11-15: Consider adding installation instructions for other package managers

While the npm installation instructions are clear, consider adding instructions for other popular package managers like yarn or pnpm. This would make the README more inclusive for users with different preferences or project setups.

For example, you could add:

## Installation

npm:
```bash
npm install @unkey/api

yarn:

yarn add @unkey/api

pnpm:

pnpm add @unkey/api

---

`17-28`: **Add more context about the root key and settings**

The quickstart guide is informative, but it could benefit from additional context. Consider adding:
1. A brief explanation of what a root key is and its importance.
2. More specific instructions on where to find the settings to create a new root key.

This additional information would help new users get started more easily.

Here's a suggested addition:

```markdown
## Quickstart

1. Create a new Unkey Root Key in the settings.
   - Log in to your Unkey account and navigate to the "Settings" section.
   - Look for the "API Keys" or "Root Keys" subsection.
   - Generate a new root key. This key has full access to your Unkey account, so handle it with care.

2. Use the root key to initialize the client:

...

30-53: Enhance code example with more inline comments

The usage example for verifying a key is clear and includes error handling. To make it even more user-friendly, consider adding more inline comments explaining each step of the process. This would help users understand the purpose of each part of the code.

Here's a suggested enhancement:

import { verifyKey } from "@unkey/api";

// Attempt to verify the key
const { result, error } = await verifyKey("key_123");

// Check if there was an error during the verification process
if (error) {
  console.error(error.message);
  // Handle potential network or bad request error
  // A link to our docs will be in the `error.docs` field
  return;
}

// Check if the key is valid
if (!result.valid) {
  // Key is not valid, do not grant access
  return;
}

// Key is valid, proceed with the request
console.log(result);
// You can access additional information about the key in the result object
// For example: result.ownerId, result.meta, etc.

78-114: Add information about telemetry data collection

The configuration options section is comprehensive and well-documented. However, to enhance transparency and user trust, consider adding a brief explanation of what telemetry data is collected when it's not disabled. This information would help users make an informed decision about whether to disable telemetry or not.

Here's a suggested addition:

### Disable Telemetry

By default, we collect anonymous telemetry data to help improve our SDK. This data includes:
- SDK version
- General usage statistics (e.g., which methods are called)
- Error occurrences (without any sensitive information)

To opt out of anonymous telemetry data collection:

```ts
const unkey = new Unkey({
  rootKey: "<UNKEY_ROOT_KEY>",
  disableTelemetry: true,
});

We respect your privacy and never collect any sensitive information or API keys.


---

`116-118`: **Enhance the documentation section**

While providing a link to the full documentation is good, this section could be more comprehensive and prominent. Consider expanding it to include:

1. A more descriptive title for the section (e.g., "Additional Resources")
2. Links to other relevant resources such as API reference, tutorials, or community forums
3. A brief description of what users can find in the full documentation


Here's a suggested enhancement:

```markdown
## Additional Resources

- [Full SDK Documentation](https://www.unkey.com/docs/libraries/ts/sdk/overview): Comprehensive guide to all features and advanced usage
- [API Reference](https://www.unkey.com/docs/api-reference): Detailed information about all available endpoints
- [Tutorials](https://www.unkey.com/docs/tutorials): Step-by-step guides for common use cases
- [Community Forum](https://community.unkey.com): Get help from the Unkey community and share your experiences

For any questions or issues, please [open a GitHub issue](https://github.com/unkeyed/unkey/issues/new) or contact our support team.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b7f9828 and cda8833.

📒 Files selected for processing (1)
  • packages/api/README.md (1 hunks)
🔇 Additional comments (3)
packages/api/README.md (3)

1-10: LGTM: Well-structured and informative header

The header section provides a clear introduction to the @unkey/api TypeScript client, its purpose, and a link to the documentation. This helps users quickly understand what the SDK is for and where to find more information.


55-76: LGTM: Clear and comprehensive response format documentation

The response format section effectively communicates the structure of both success and error responses. The examples provided are clear and help users understand what to expect when using the SDK. This information is crucial for proper error handling and data processing.


1-118: Overall, a well-structured and informative README with room for minor improvements

This README provides a comprehensive introduction to the @unkey/api TypeScript client. It covers essential topics such as installation, quickstart, usage examples, response formats, and configuration options. The document is well-organized and easy to follow.

To further enhance its quality, consider implementing the following suggestions:

  1. Add installation instructions for other package managers (yarn, pnpm)
  2. Provide more context about the root key and where to find settings in the quickstart section
  3. Enhance the usage example with more inline comments
  4. Add information about telemetry data collection
  5. Expand the documentation section with additional resources

These improvements will make the README even more user-friendly and informative, especially for new users of the SDK.

@chronark
Copy link
Collaborator

chronark commented Oct 2, 2024

I believe this doesn't include the README in the final bundle pushed to npm, can you add it to the files config in the package.json?

the rest looks great!

Copy link
Collaborator

@chronark chronark left a comment

Choose a reason for hiding this comment

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

See comment

@Abhi-Bohora
Copy link
Contributor Author

Added README.md in files config in the package.json

@Abhi-Bohora Abhi-Bohora requested a review from chronark October 3, 2024 02:01
@chronark
Copy link
Collaborator

chronark commented Oct 3, 2024

Thanks @Abhi-Bohora

@chronark chronark merged commit cedb5e9 into unkeyed:main Oct 3, 2024
@oss-gg
Copy link

oss-gg bot commented Oct 3, 2024

Awarding Abhi-Bohora: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/Abhi-Bohora

@Abhi-Bohora Abhi-Bohora deleted the README.md branch October 3, 2024 10:50
harshsbhat pushed a commit to harshsbhat/unkey that referenced this pull request Oct 3, 2024
* added README.md in /packages/api

* added README.md in the files config in package.json
@coderabbitai coderabbitai bot mentioned this pull request Oct 3, 2024
18 tasks
mcstepp pushed a commit that referenced this pull request Oct 8, 2024
* added README.md in /packages/api

* added README.md in the files config in package.json
@coderabbitai coderabbitai bot mentioned this pull request Jul 31, 2025
18 tasks
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 this pull request may close these issues.

3 participants