Skip to content

Docs/new reference section #1719

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

Merged
merged 5 commits into from
Feb 20, 2025
Merged

Docs/new reference section #1719

merged 5 commits into from
Feb 20, 2025

Conversation

samejr
Copy link
Member

@samejr samejr commented Feb 19, 2025

  • Moves API reference to a new dropdown section
  • Moves troubleshooting section further up the side menu

Summary by CodeRabbit

  • Documentation
    • Restructured the navigation for clearer organization; the API reference items are now accessible via a new dropdown grouping related sections.
    • Relocated the "Open source" section to a more prominent area.
    • Updated the icon for "Guides & examples" to enhance visual clarity.
    • Introduced new documentation files: "Advanced usage," "Authentication," "Auto-pagination," and "Errors and Retries," providing comprehensive guidance on various API features and best practices.
    • Removed the "Authentication" section from the overview document, simplifying its focus.

Copy link

changeset-bot bot commented Feb 19, 2025

⚠️ No Changeset found

Latest commit: 44f5010

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

Copy link
Contributor

coderabbitai bot commented Feb 19, 2025

Walkthrough

This pull request reorganizes the navigation structure in the docs/docs.json file. The "API reference" section is now presented as a dropdown with clearly defined groups (e.g., Tasks API, Runs API, etc.), and its previous standalone location has been removed. Additionally, the "Open source" group has been repositioned, and the icon for the "Guides & examples" dropdown has been updated from "book" to "books". New documentation files have been added for "Advanced usage," "Authentication," "Auto-pagination," and "Errors and Retries," enhancing the overall documentation without altering existing page content.

Changes

File(s) Change Summary
docs/docs.json - Moved "API reference" from its previous location into a new dropdown with grouped pages (API reference, Tasks API, Runs API, Schedules API, Env Vars API).
- Relocated the "Open source" group to a different position.
- Updated the "Guides & examples" icon from "book" to "books".
docs/management/advanced-usage.mdx - Added new documentation file "Advanced usage" detailing advanced features and providing examples for accessing raw HTTP responses.
docs/management/authentication.mdx - Added new documentation file "Authentication" outlining methods for authentication and providing code examples.
docs/management/auto-pagination.mdx - Added new documentation file "Auto-pagination" with guidance on utilizing auto-pagination in API calls, including code examples.
docs/management/errors-and-retries.mdx - Added new documentation file "Errors and Retries" explaining error handling and retry mechanisms with examples.
docs/management/overview.mdx - Removed the "Authentication" section and related content, simplifying the document's focus.

Possibly related PRs

  • Docs/community packages #1714: The changes in the main PR regarding the restructuring of the navigation in docs/docs.json are related to the modifications in the retrieved PR, which also involves changes to the same docs/docs.json file, specifically in the navigation groups and pages.

Suggested reviewers

  • ericallam

Poem

I’m a rabbit with a coding flair,
Hopping through docs with organized care.
API dropdowns lined up in a row,
Open source shifted, with a gentle glow.
“Books” now guide the curious eyes,
Hoppin’ on changes as the code flies!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7bbf665 and 44f5010.

📒 Files selected for processing (1)
  • docs/management/errors-and-retries.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/management/errors-and-retries.mdx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript-typescript)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

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: 1

🧹 Nitpick comments (3)
docs/management/auto-pagination.mdx (1)

26-41: Next-page retrieval snippet is clear and actionable.
The example demonstrates checking for additional pages using hasNextPage() and retrieving subsequent pages with getNextPage(). For improved clarity, consider adding an inline comment inside the while loop describing the purpose of iterating over subsequent pages.

docs/management/authentication.mdx (1)

77-80: Consider refining the language for the PAT description.
To strengthen the writing, you might replace “gives access to” with “grants access to” and “orgs” with “organizations” for clarity and formality. For example:

-A PAT is a token associated with a specific user, and gives access to all the orgs, projects, and environments that the user has access to.
+A PAT is a token associated with a specific user, and grants access to all the organizations, projects, and environments that the user is associated with.
🧰 Tools
🪛 LanguageTool

[style] ~80-~80: Try using a synonym here to strengthen your writing.
Context: ...en associated with a specific user, and gives access to all the orgs, projects, and e...

(GIVE_PROVIDE)

docs/docs.json (1)

104-104: Nitpick: Extra empty line in navigation.

An extra empty line appears at line 104. If this additional spacing is intentional for readability, it’s fine; otherwise, consider removing it to keep the JSON compact.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3932ad5 and 7bbf665.

📒 Files selected for processing (6)
  • docs/docs.json (3 hunks)
  • docs/management/advanced-usage.mdx (1 hunks)
  • docs/management/authentication.mdx (1 hunks)
  • docs/management/auto-pagination.mdx (1 hunks)
  • docs/management/errors-and-retries.mdx (1 hunks)
  • docs/management/overview.mdx (2 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/management/auto-pagination.mdx

[grammar] ~8-~8: The verb ‘await’ seems to be in the wrong form here.
Context: ...PI support auto-pagination. You can use for await … of syntax to iterate through items a...

(FOR_VB)

docs/management/authentication.mdx

[style] ~80-~80: Try using a synonym here to strengthen your writing.
Context: ...en associated with a specific user, and gives access to all the orgs, projects, and e...

(GIVE_PROVIDE)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (21)
docs/management/advanced-usage.mdx (2)

1-5: Frontmatter is correctly defined.
The YAML frontmatter clearly sets the title, sidebar title, and description which aligns with the file’s purpose.


7-26: Code snippet for accessing raw HTTP responses is clear and useful.
The example demonstrates the use of both withResponse() and asResponse() to obtain and log HTTP response details. No issues were found.

docs/management/auto-pagination.mdx (3)

1-5: Frontmatter for auto-pagination is well-structured.
The metadata clearly defines the title, sidebar title, and description.


7-9: Introduction text introduces auto-pagination effectively.
There is a LanguageTool hint regarding the verb “await” but note that for await … of is a JavaScript language construct and is correctly used here.

🧰 Tools
🪛 LanguageTool

[grammar] ~8-~8: The verb ‘await’ seems to be in the wrong form here.
Context: ...PI support auto-pagination. You can use for await … of syntax to iterate through items a...

(FOR_VB)


10-22: For-await-of snippet is succinct and correct.
The code example properly shows asynchronous iteration over paginated results using the for await … of syntax.

docs/management/overview.mdx (2)

2-4: Overview frontmatter reflects the new documentation structure.
The title and description are concise and align with the reorganized navigation.


41-41: Usage code block ending is simple and effective.
The call to main().catch(console.error); is correctly placed; please ensure consistency in references, especially now that the Authentication details have been moved to a separate file.

docs/management/errors-and-retries.mdx (3)

1-5: Frontmatter for Errors and Retries is set appropriately.
The title, sidebar title, and description accurately introduce the content of the document.


33-47: Retry configuration snippet is clear.
The example effectively demonstrates how to customize retry options via the configure function.


51-61: Disabling retries on a specific request is well illustrated.
This snippet concisely shows how to override default retry behavior when needed.

docs/management/authentication.mdx (6)

1-5: Frontmatter for the Authentication document is clear and informative.
The metadata accurately describes the purpose of the document.


7-13: The note block for differentiating backend and frontend usage is effective.
This clearly advises users that the authentication strategies in this document are intended solely for backend usage.


15-45: Authentication examples demonstrate both methods effectively.
The examples for secret key and personal access token configurations are clear. Please verify that using the secretKey property in the configuration for personal access tokens is intentional (since it might be overloaded in your SDK).


47-71: Accordion table detailing endpoint support is comprehensive.
The table clearly differentiates which endpoints support secret key and personal access token authentication.


73-77: Secret key section is concise and provides a clear reference.
Linking to the API Keys guide enhances the usability of the documentation.


81-96: PAT usage snippet for uploading environment variables is clear.
The code example correctly shows the required arguments when using a PAT.

docs/docs.json (5)

137-146: Repositioned "Open source" Group.

The "Open source" group has been re-added at a new position within the navigation. This change aligns with the PR objectives to improve the documentation’s structure. Please verify that its placement meets the intended hierarchy.


153-208: New "API reference" Dropdown Implementation.

A new dropdown labeled "API reference" has been added with clearly defined groups—namely, "API reference," "Tasks API," "Runs API," "Schedules API," and "Env Vars API." This reorganization looks well structured and fulfills the PR’s goal of enhancing accessibility to API documentation. Ensure that all page paths and group names are correct.


212-212: Updated Icon for "Guides & examples".

The icon for the "Guides & examples" dropdown has been updated from "book" to "books." This visual change aligns with the updated design specifications.


495-497: Verified Redirect for "/frontend/react-hooks".

The redirect entry mapping "/frontend/react-hooks" to "/frontend/react-hooks/overview" appears correct. Please confirm that this mapping remains consistent with the updated navigation structure.


498-501: New Redirect for "/management/projects/runs".

A new redirect has been added to reroute "/management/projects/runs" to "/management/overview." This update should help in handling legacy or misdirected URLs. Confirm that this redirect does not conflict with other routing rules.

Comment on lines +11 to +25
```ts
import { runs, APIError } from "@trigger.dev/sdk/v3";

async function main() {
try {
const run = await runs.retrieve("run_1234");
} catch (error) {
if (error instanceof ApiError) {
console.error(`API error: ${error.status}, ${error.headers}, ${error.body}`);
} else {
console.error(`Unknown error: ${error.message}`);
}
}
}
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the identifier inconsistency for error handling.
The import uses APIError (line 12) but the instance check uses ApiError (line 18). This case mismatch will cause a runtime error. Please update the instance check to use the correct identifier.

Below is a diff that shows the necessary change:

-    if (error instanceof ApiError) {
+    if (error instanceof APIError) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```ts
import { runs, APIError } from "@trigger.dev/sdk/v3";
async function main() {
try {
const run = await runs.retrieve("run_1234");
} catch (error) {
if (error instanceof ApiError) {
console.error(`API error: ${error.status}, ${error.headers}, ${error.body}`);
} else {
console.error(`Unknown error: ${error.message}`);
}
}
}
```
import { runs, APIError } from "@trigger.dev/sdk/v3";
async function main() {
try {
const run = await runs.retrieve("run_1234");
} catch (error) {
if (error instanceof APIError) {
console.error(`API error: ${error.status}, ${error.headers}, ${error.body}`);
} else {
console.error(`Unknown error: ${error.message}`);
}
}
}

@samejr samejr merged commit 99f2caf into main Feb 20, 2025
6 checks passed
@samejr samejr deleted the docs/new-reference-section branch February 20, 2025 11:30
@coderabbitai coderabbitai bot mentioned this pull request Apr 4, 2025
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.

1 participant