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

12147 update toggl track to latest version of api v9 #12741

Merged

Conversation

luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Jul 5, 2024

Resolves #12147

Summary by CodeRabbit

  • New Features

    • Updated Toggl integration with incremental version updates for various actions and sources.
    • Enhanced API interaction for better performance and reliability.
  • Refactor

    • Refined internal methods for webhook management, workspace retrieval, and time entry operations.

@luancazarine luancazarine linked an issue Jul 5, 2024 that may be closed by this pull request
Copy link

vercel bot commented Jul 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2024 2:57pm
pipedream-docs ⬜️ Ignored (Inspect) Jul 5, 2024 2:57pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jul 5, 2024 2:57pm

Copy link
Contributor

coderabbitai bot commented Jul 5, 2024

Walkthrough

This update primarily addresses the use of deprecated Toggl API (V8) and shifts to the latest API version (V9). Additionally, it includes incremental version updates across various components and actions, refines method signatures by removing unnecessary async declarations, and optimizes response handling in the Toggl components.

Changes

File Path / Grouped Paths Change Summary
components/toggl/actions/get-time-entry/get-time-entry.mjs Updated version; modified response handling logic.
components/toggl/package.json Updated package version and upgraded dependency on @pipedream/platform from ^0.10.0 to ^3.0.0.
components/toggl/sources/... (new-start-time-entry, new-time-entry, new-update-time-entry, new-webhook-event) Updated versions of these source files to signify incremental changes.
components/toggl/toggl.app.mjs Refactored _makeRequest method; removed async from several method signatures; updated API version.
components/toggl/actions/get-current-time-entry/get-current-time-entry.mjs Updated version.
components/toggl/actions/get-time-entries/get-time-entries.mjs Updated version.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Update Toggl Track to latest version of API (V9) (#12147)

Poem

To safeguard time with utmost glee,
Toggl updates, now V9 shall be.
With codes refined and bugs adrift,
We celebrate this timely shift.
🎉🐇📚


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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: 3

Outside diff range and nitpick comments (2)
components/toggl/toggl.app.mjs (2)

[!TIP]
Codebase Verification

Verify the impact of changing _makeRequest from async to sync.

The _makeRequest method was changed from asynchronous to synchronous. Ensure that all the caller functions handle this change correctly. The following locations contain asynchronous calls to _makeRequest and need to be updated:

  • components/uservoice/uservoice.app.js
    • Line: 47
  • components/procore/procore.app.js
    • Lines: 47, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109
Analysis chain

Line range hint 50-57:
Verify the impact of changing _makeRequest from async to sync.

The _makeRequest method was changed from asynchronous to synchronous. Ensure that all the caller functions handle this change correctly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all caller functions handle the synchronous `_makeRequest` correctly.

# Test: Search for the usage of `_makeRequest`. Expect: All usages are synchronous.
rg --type python $'_makeRequest'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify that all caller functions handle the synchronous `_makeRequest` correctly.

# Test: Search for the usage of `_makeRequest`. Expect: All usages are synchronous.
rg --type js '_makeRequest'

Length of output: 1406


[!TIP]
Codebase Verification

The getTimeEntries method should remain asynchronous.

The getTimeEntries method is used internally with await in the components/toggl/toggl.app.mjs file. Changing this method from asynchronous to synchronous will break the existing code.

  • components/toggl/toggl.app.mjs: Instances of await this.getTimeEntries.
Analysis chain

Line range hint 85-93:
Verify the impact of changing getTimeEntries from async to sync.

The getTimeEntries method was changed from asynchronous to synchronous. Ensure that all the caller functions handle this change correctly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all caller functions handle the synchronous `getTimeEntries` correctly.

# Test: Search for the usage of `getTimeEntries`. Expect: All usages are synchronous.
rg --type python $'getTimeEntries'

Length of output: 64


Script:

#!/bin/bash
# Description: Verify that all caller functions handle the synchronous `getTimeEntries` correctly.

# Test: Search for the usage of `getTimeEntries`. Expect: All usages are synchronous.
rg --type js 'getTimeEntries'

Length of output: 29


Script:

#!/bin/bash
# Description: Verify that all caller functions handle the synchronous `getTimeEntries` correctly.

# Step 1: Search for the usage of `getTimeEntries` in all JavaScript and TypeScript files.
rg --type js,ts 'getTimeEntries'

# Step 2: Verify if `getTimeEntries` is being exported.
rg --type js,ts 'export.*getTimeEntries'

# Step 3: Verify if `getTimeEntries` is being imported.
rg --type js,ts 'import.*getTimeEntries'

Length of output: 208


Script:

#!/bin/bash
# Description: Verify that all caller functions handle the synchronous `getTimeEntries` correctly.

# Step 1: Search for the usage of `getTimeEntries` in JavaScript files.
rg --type js 'getTimeEntries'

# Step 2: Search for the usage of `getTimeEntries` in TypeScript files.
rg --type ts 'getTimeEntries'

# Step 3: Verify if `getTimeEntries` is being exported in JavaScript files.
rg --type js 'export.*getTimeEntries'

# Step 4: Verify if `getTimeEntries` is being exported in TypeScript files.
rg --type ts 'export.*getTimeEntries'

# Step 5: Verify if `getTimeEntries` is being imported in JavaScript files.
rg --type js 'import.*getTimeEntries'

# Step 6: Verify if `getTimeEntries` is being imported in TypeScript files.
rg --type ts 'import.*getTimeEntries'

Length of output: 219


Script:

#!/bin/bash
# Description: Verify the definition and internal usage of `getTimeEntries` within the `components/toggl/toggl.app.mjs` file.

# Step 1: Verify the definition of `getTimeEntries` within the file.
rg 'getTimeEntries' components/toggl/toggl.app.mjs

# Step 2: Check for any internal usage of `getTimeEntries` within the file.
rg 'getTimeEntries' components/toggl/toggl.app.mjs

Length of output: 255

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b2d18e5 and 9ca95bd.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (7)
  • components/toggl/actions/get-time-entry/get-time-entry.mjs (2 hunks)
  • components/toggl/package.json (2 hunks)
  • components/toggl/sources/new-start-time-entry/new-start-time-entry.mjs (1 hunks)
  • components/toggl/sources/new-time-entry/new-time-entry.mjs (1 hunks)
  • components/toggl/sources/new-update-time-entry/new-update-time-entry.mjs (1 hunks)
  • components/toggl/sources/new-webhook-event/new-webhook-event.mjs (1 hunks)
  • components/toggl/toggl.app.mjs (4 hunks)
Files skipped from review due to trivial changes (6)
  • components/toggl/actions/get-time-entry/get-time-entry.mjs
  • components/toggl/package.json
  • components/toggl/sources/new-start-time-entry/new-start-time-entry.mjs
  • components/toggl/sources/new-time-entry/new-time-entry.mjs
  • components/toggl/sources/new-update-time-entry/new-update-time-entry.mjs
  • components/toggl/sources/new-webhook-event/new-webhook-event.mjs
Additional comments not posted (2)
components/toggl/toggl.app.mjs (2)

79-81: Verify the impact of changing getWorkspaces from async to sync.

The getWorkspaces method was changed from asynchronous to synchronous. Ensure that all the caller functions handle this change correctly.


Line range hint 60-70:
Verify the impact of changing createWebhook from async to sync.

The createWebhook method was changed from asynchronous to synchronous. Ensure that all the caller functions handle this change correctly.

components/toggl/toggl.app.mjs Show resolved Hide resolved
components/toggl/toggl.app.mjs Show resolved Hide resolved
components/toggl/toggl.app.mjs Show resolved Hide resolved
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9ca95bd and 6726bcf.

Files selected for processing (2)
  • components/toggl/actions/get-current-time-entry/get-current-time-entry.mjs (1 hunks)
  • components/toggl/actions/get-time-entries/get-time-entries.mjs (1 hunks)
Files skipped from review due to trivial changes (2)
  • components/toggl/actions/get-current-time-entry/get-current-time-entry.mjs
  • components/toggl/actions/get-time-entries/get-time-entries.mjs

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

@luancazarine luancazarine merged commit d650a66 into master Jul 8, 2024
11 checks passed
@luancazarine luancazarine deleted the 12147-update-toggl-track-to-latest-version-of-api-v9 branch July 8, 2024 14:28
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.

Update Toggl Track to latest version of API (V9)
2 participants