crowdin / crowdin/crowdin-api-client-ruby

Add support for TM Segment Batch Operations

Open
#125 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
59
Forks
22
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.