crowdin / crowdin/crowdin-api-client-go
Add support for TM Segment Batch Operations
- Dominant language
- Go
- Stars
- 10
- Forks
- 18
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 1
Description
The Crowdin API adds a **TM Segment Batch Operations** method:
- `PATCH /tms/{tmId}/segments` (`api.tms.segments.patchBatch`)
The request body is an array of JSON Patch operations:
- `add` with path `/-` and a segment create form as `value` — create a TM segment
- `add` with path `/{segmentId}/records/-` and `value` `{ languageId, text }` — append a record to a segment
- `remove` with path `/{segmentId}` — delete a segment
- `remove` with path `/{segmentId}/records/{recordId}` — delete a segment record
- `replace` with path `/{segmentId}/records/{recordId}/text` and a string `value` — update record text
The `200` response returns the collection of updated TM segments.
Note: the single-segment **Edit TM Segment** method (`api.tms.segments.patch`) request body is now formally defined as a discriminated union of add/replace/remove operations with `op` and `path` required — the wire format is unchanged, but generated types may need regeneration.
Client libraries should add the batch method. Available in both Crowdin and Crowdin Enterprise.
**References:**
- [TM Segment Batch Operations](https://support.crowdin.com/developer/api/v2/#operation/api.tms.segments.patchBatch)
- [Edit TM Segment](https://support.crowdin.com/developer/api/v2/#operation/api.tms.segments.patch)
- Crowdin Enterprise: [TM Segment Batch Operations](https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.tms.segments.patchBatch)
Contributor guide
Research direction
Start at the existing api.tms.segments.patch client entry point and compare its request types with the Crowdin TM Segment Batch Operations documentation. Add the api.tms.segments.patchBatch method for the listed JSON Patch operations, and check whether generated types reflect the updated single-segment request union. Done means the batch response returns updated TM segments and both Crowdin variants are supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100