Skip to content

fix(crowdin): improve Screenshot and Distribution model parity#1142

Merged
cungminh2710 merged 2 commits into
mainfrom
fix-crowdin-screenshot-distribution-parity-3784772611125568900
Jun 28, 2026
Merged

fix(crowdin): improve Screenshot and Distribution model parity#1142
cungminh2710 merged 2 commits into
mainfrom
fix-crowdin-screenshot-distribution-parity-3784772611125568900

Conversation

@cungminh2710

Copy link
Copy Markdown
Contributor

This PR improves the parity of the Crowdin Go client models with the official API v2 for Screenshots and Distributions.

What:

  • Added projectId (int) to the Screenshot model.
  • Added branchIds ([]int) and directoryIds ([]int) to both Distribution and DistributionAddRequest models.
  • Updated relevant contract tests in screenshots_test.go, labels_test.go, and distributions_test.go.

Why:
These fields are part of the Crowdin API v2 contract but were missing from the Go SDK, preventing users from accessing or specifying these granular identifiers.

Docs:

Tests:

  • Executed GOWORK=off go test ./crowdin/... within the third_party/crowdin-api-client-go directory.
  • Ran go test ./... in the repository root.

Confidence:
The changes are additive to response models and use omitempty for request models, ensuring backward compatibility while enabling access to documented API fields. Verified with updated contract tests.


PR created automatically by Jules for task 3784772611125568900 started by @cungminh2710

- Add ProjectID to Screenshot model
- Add BranchIDs and DirectoryIDs to Distribution and DistributionAddRequest models
- Update contract tests for screenshots, labels, and distributions to verify the new fields
- Document learnings in .jules/crowdin-steward.md

Co-authored-by: cungminh2710 <8063319+cungminh2710@users.noreply.github.com>
@cungminh2710
cungminh2710 requested a review from MuenYu as a code owner June 28, 2026 23:02
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hyperlocalise Ignored Ignored Jun 28, 2026 11:24pm

Request Review

@greptile-apps

greptile-apps Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds missing Crowdin API v2 fields to two Go SDK models: ProjectID to Screenshot, and BranchIDs/DirectoryIDs to both Distribution (response) and DistributionAddRequest. All changes are purely additive and backward-compatible.

  • model/screenshot.go: ProjectID int \json:"projectId"`inserted betweenIDandUserID`, matching the API's documented response shape.
  • model/distributions.go: BranchIDs and DirectoryIDs added to the response struct (no omitempty, consistent with BundleIDs/FileIDs) and to DistributionAddRequest (with omitempty, correct for optional request fields). Field ordering in the response struct is also tidied to group the four slice fields together before the timestamp fields.
  • Tests: Contract tests in distributions_test.go, screenshots_test.go, and labels_test.go updated with matching JSON fixtures and expected Go struct values for every new field.

Confidence Score: 5/5

Safe to merge — all changes are additive field additions to existing structs with no logic changes.

The diff is limited to adding new JSON-tagged fields to two response models and one request model. Response model fields carry no omitempty (consistent with existing peers), request model fields carry omitempty (correct for optional inputs). The previous thread's concern about asymmetric omitempty on Distribution has been resolved. Contract tests cover all four Distribution service operations and all affected Screenshot tests, and the serialization order in DistributionAddRequest matches the test body expectation.

No files require special attention.

Important Files Changed

Filename Overview
third_party/crowdin-api-client-go/crowdin/model/distributions.go Added BranchIDs and DirectoryIDs to Distribution (response, no omitempty) and DistributionAddRequest (request, with omitempty); field order updated to group the new slice fields before CreatedAt/UpdatedAt; consistent with existing patterns.
third_party/crowdin-api-client-go/crowdin/model/screenshot.go Added ProjectID int field with json:"projectId" to Screenshot response struct; straightforward additive change with no omitempty needed for a response model.
third_party/crowdin-api-client-go/crowdin/distributions_test.go All four test cases (List, Get, Add, Edit) updated with branchIds/directoryIds in both JSON fixtures and expected structs; Add test also verifies correct request body serialization including the new fields.
third_party/crowdin-api-client-go/crowdin/screenshots_test.go GetScreenshot test updated with projectId: 2 in both fixture and expected struct; minimal, correct change.
third_party/crowdin-api-client-go/crowdin/labels_test.go AssignToScreenshots and UnassignFromScreenshots tests updated with projectId: 1 in both JSON fixtures and expected Screenshot structs.
.jules/crowdin-steward.md Stewardship log entry added documenting the new fields and updated tests; informational only.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    class Screenshot {
        +int ID
        +int ProjectID
        +int UserID
        +string URL
        +string WebURL
        +string Name
        +struct Size
        +int TagsCount
        +[]Tag Tags
        +[]int LabelIDs
        +string CreatedAt
        +string UpdatedAt
    }

    class Distribution {
        +string Hash
        +string Name
        +[]int BundleIDs
        +[]int BranchIDs
        +[]int DirectoryIDs
        +[]int FileIDs
        +string CreatedAt
        +string UpdatedAt
        +string ExportMode
        +string ManifestURL
    }

    class DistributionAddRequest {
        +string Name
        +ExportMode ExportMode
        +[]int FileIDs
        +[]int BundleIDs
        +[]int BranchIDs
        +[]int DirectoryIDs
        +Validate() error
    }
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
classDiagram
    class Screenshot {
        +int ID
        +int ProjectID
        +int UserID
        +string URL
        +string WebURL
        +string Name
        +struct Size
        +int TagsCount
        +[]Tag Tags
        +[]int LabelIDs
        +string CreatedAt
        +string UpdatedAt
    }

    class Distribution {
        +string Hash
        +string Name
        +[]int BundleIDs
        +[]int BranchIDs
        +[]int DirectoryIDs
        +[]int FileIDs
        +string CreatedAt
        +string UpdatedAt
        +string ExportMode
        +string ManifestURL
    }

    class DistributionAddRequest {
        +string Name
        +ExportMode ExportMode
        +[]int FileIDs
        +[]int BundleIDs
        +[]int BranchIDs
        +[]int DirectoryIDs
        +Validate() error
    }
Loading

Reviews (2): Last reviewed commit: "fix(crowdin): improve Screenshot and Dis..." | Re-trigger Greptile

Comment thread third_party/crowdin-api-client-go/crowdin/model/distributions.go Outdated
- Add ProjectID to Screenshot model
- Add BranchIDs and DirectoryIDs to Distribution and DistributionAddRequest models
- Fix field order and visibility for Distribution fields to match API v2 parity
- Update contract tests for screenshots, labels, and distributions
- Document learnings in .jules/crowdin-steward.md

Co-authored-by: cungminh2710 <8063319+cungminh2710@users.noreply.github.com>
@cungminh2710
cungminh2710 merged commit e75d754 into main Jun 28, 2026
11 checks passed
@cungminh2710
cungminh2710 deleted the fix-crowdin-screenshot-distribution-parity-3784772611125568900 branch June 28, 2026 23:54
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