From d1729acd736887b71528ab943684987f7ede1e0e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Nov 2026 13:44:45 +0000 Subject: [PATCH 1/2] feat(API): add owner, export_triggers, and export_schedule to repo sync responses and request bodies #STRINGS-4401 --- doc/compiled.json | 259 ++++++++++++++++++++++++++++++++++- paths.yaml | 2 + paths/repo_syncs/create.yaml | 58 +++++++- paths/repo_syncs/update.yaml | 108 +++++++++++++++ schemas.yaml | 2 + schemas/repo_sync.yaml | 51 +++++++ schemas/user_short.yaml | 18 +++ 7 files changed, 496 insertions(+), 2 deletions(-) create mode 100644 paths/repo_syncs/update.yaml create mode 100644 schemas/user_short.yaml diff --git a/doc/compiled.json b/doc/compiled.json index 680ca6476..edfc032a9 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -3282,6 +3282,30 @@ "gravatar_uid": "205e460b479e2e5b48aec07710c08d50" } }, + "user_short": { + "type": "object", + "title": "user_short", + "properties": { + "id": { + "type": "string" + }, + "username": { + "type": "string" + }, + "name": { + "type": "string" + }, + "gravatar_uid": { + "type": "string" + } + }, + "example": { + "id": "abcd1234cdef1234abcd1234cdef1234", + "username": "johndoe", + "name": "John Doe", + "gravatar_uid": "205e460b479e2e5b48aec07710c08d50" + } + }, "user": { "type": "object", "title": "user", @@ -5233,6 +5257,55 @@ "type": "string", "format": "date-time", "nullable": true + }, + "owner": { + "$ref": "#/components/schemas/user_short" + }, + "export_triggers": { + "type": "array", + "description": "Events that trigger an automatic export. Only present when the automatic export feature is enabled for the account. Possible values: `schedule` (runs on the configured schedule), `branch_merged` (runs when a branch is merged in the connected repository), `job_completed` (runs when a translation job completes in the project).\n", + "items": { + "type": "string", + "enum": [ + "schedule", + "branch_merged", + "job_completed" + ] + } + }, + "export_schedule": { + "type": "object", + "nullable": true, + "description": "Schedule configuration for automatic exports. Only present when the automatic export feature is enabled for the account. `null` when the `schedule` trigger is not active.\n", + "properties": { + "frequency": { + "type": "string", + "description": "How often the export runs. `cron` means a fully custom cron expression is used (`cron_schedule` holds the raw expression).\n", + "enum": [ + "hour", + "day", + "week", + "month", + "cron" + ] + }, + "cron_schedule": { + "type": "string", + "description": "The underlying cron expression. Derived automatically from `frequency`, `time`, and day fields when using a named frequency; provided verbatim when `frequency` is `cron`.\n", + "example": "0 9 * * 1" + }, + "time_zone": { + "type": "string", + "description": "IANA time zone name used to interpret the schedule.", + "example": "Europe/Berlin" + }, + "next_run_at": { + "type": "string", + "format": "date-time", + "nullable": true, + "description": "When the next scheduled export will run, in UTC." + } + } } }, "example": { @@ -26453,7 +26526,7 @@ "$ref": "#/components/responses/404" }, "422": { - "$ref": "#/components/responses/422" + "description": "Unprocessable. Returned when model validation fails (e.g. duplicate project + repo + branch combination, invalid `export_triggers` values) or when `export_triggers`/`export_schedule` are provided but the automatic export feature is not enabled for the account.\n" }, "429": { "$ref": "#/components/responses/429" @@ -26543,6 +26616,62 @@ "description": "Custom API endpoint URL for self-hosted Git instances. Required when `connection_type` is `self_hosted`.", "type": "string", "example": "https://git.example.com/api/v4" + }, + "owner_id": { + "type": "string", + "description": "Code of the user who will own this repo sync. Automated actions run as this user. Defaults to the account owner when not set.\n" + }, + "export_triggers": { + "type": "array", + "description": "Events that should trigger an automatic export. Requires the automatic export feature to be enabled for the account; returns `422` otherwise. Accepted values: `schedule`, `branch_merged`, `job_completed`.\n", + "items": { + "type": "string", + "enum": [ + "schedule", + "branch_merged", + "job_completed" + ] + } + }, + "export_schedule": { + "type": "object", + "description": "Schedule settings for automatic exports. Required when `export_triggers` includes `schedule`. Requires the automatic export feature to be enabled.\n", + "properties": { + "frequency": { + "type": "string", + "enum": [ + "hour", + "day", + "week", + "month", + "cron" + ] + }, + "time": { + "type": "string", + "description": "Time of day for the export (HH:MM format). Used with `day`, `week`, and `month` frequencies.", + "example": "09:00" + }, + "time_zone": { + "type": "string", + "description": "IANA time zone name.", + "example": "Europe/Berlin" + }, + "days_of_week": { + "type": "string", + "description": "Comma-separated day numbers (0=Sunday … 6=Saturday). Used with `week` frequency.", + "example": "1,3" + }, + "day_of_month": { + "type": "integer", + "description": "Day of the month (1–31). Used with `month` frequency." + }, + "cron_schedule": { + "type": "string", + "description": "Raw cron expression. Used when `frequency` is `cron`.", + "example": "0 9 * * 1" + } + } } } } @@ -26621,6 +26750,134 @@ } ], "x-cli-version": "2.24" + }, + "patch": { + "summary": "Update a repo sync", + "description": "Update settings for an existing Repo Sync. Sending `owner_id`, `export_triggers`, or `export_schedule` requires the caller to have `manage_github_sync?` permission on the project (returns `403` otherwise). Sending `export_triggers` or `export_schedule` when the automatic export feature is not enabled for the account returns `422`.\n", + "operationId": "repo_sync/update", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/repo_sync" + } + } + }, + "headers": { + "X-Rate-Limit-Limit": { + "$ref": "#/components/headers/X-Rate-Limit-Limit" + }, + "X-Rate-Limit-Remaining": { + "$ref": "#/components/headers/X-Rate-Limit-Remaining" + }, + "X-Rate-Limit-Reset": { + "$ref": "#/components/headers/X-Rate-Limit-Reset" + } + } + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401" + }, + "403": { + "description": "Forbidden. Possible causes: insufficient OAuth scope (requires `write`); caller does not have `manage_git_syncs?` permission on the account; or `owner_id`, `export_triggers`, or `export_schedule` was provided but the caller does not have `manage_github_sync?` permission on the project.\n" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "422": { + "description": "Unprocessable. Returned when model validation fails or when `export_triggers`/`export_schedule` are provided but the automatic export feature is not enabled for the account.\n" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "title": "repo_sync/update/parameters", + "properties": { + "name": { + "type": "string", + "description": "Display name for the repo sync." + }, + "owner_id": { + "type": "string", + "description": "Code of the user to assign as owner. Requires `manage_github_sync?` permission on the project; returns `403` if not satisfied.\n" + }, + "export_triggers": { + "type": "array", + "description": "Replaces the current set of automatic export triggers. Requires `manage_github_sync?` permission on the project and the automatic export feature to be enabled for the account. Accepted values: `schedule`, `branch_merged`, `job_completed`.\n", + "items": { + "type": "string", + "enum": [ + "schedule", + "branch_merged", + "job_completed" + ] + } + }, + "export_schedule": { + "type": "object", + "description": "Updates the schedule for automatic exports. Only applied when `export_triggers` includes `schedule`. Requires `manage_github_sync?` permission and the automatic export feature to be enabled.\n", + "properties": { + "frequency": { + "type": "string", + "enum": [ + "hour", + "day", + "week", + "month", + "cron" + ] + }, + "time": { + "type": "string", + "example": "09:00" + }, + "time_zone": { + "type": "string", + "example": "Europe/Berlin" + }, + "days_of_week": { + "type": "string", + "example": "1,3" + }, + "day_of_month": { + "type": "integer" + }, + "cron_schedule": { + "type": "string", + "example": "0 9 * * 1" + } + } + } + } + } + } + } + } } }, "/accounts/{account_id}/repo_syncs/{id}/export": { diff --git a/paths.yaml b/paths.yaml index 182077746..26c48c393 100644 --- a/paths.yaml +++ b/paths.yaml @@ -545,6 +545,8 @@ "/accounts/{account_id}/repo_syncs/{id}": get: "$ref": "./paths/repo_syncs/show.yaml" + patch: + "$ref": "./paths/repo_syncs/update.yaml" "/accounts/{account_id}/repo_syncs/{id}/export": post: "$ref": "./paths/repo_syncs/export.yaml" diff --git a/paths/repo_syncs/create.yaml b/paths/repo_syncs/create.yaml index 61d99b289..a9fa5a9ca 100644 --- a/paths/repo_syncs/create.yaml +++ b/paths/repo_syncs/create.yaml @@ -32,7 +32,11 @@ responses: '404': "$ref": "../../responses.yaml#/404" '422': - "$ref": "../../responses.yaml#/422" + description: > + Unprocessable. Returned when model validation fails (e.g. duplicate + project + repo + branch combination, invalid `export_triggers` values) + or when `export_triggers`/`export_schedule` are provided but the + automatic export feature is not enabled for the account. '429': "$ref": "../../responses.yaml#/429" x-code-samples: @@ -126,4 +130,56 @@ requestBody: description: Custom API endpoint URL for self-hosted Git instances. Required when `connection_type` is `self_hosted`. type: string example: https://git.example.com/api/v4 + owner_id: + type: string + description: > + Code of the user who will own this repo sync. Automated actions + run as this user. Defaults to the account owner when not set. + export_triggers: + type: array + description: > + Events that should trigger an automatic export. Requires the + automatic export feature to be enabled for the account; returns + `422` otherwise. Accepted values: `schedule`, `branch_merged`, + `job_completed`. + items: + type: string + enum: + - schedule + - branch_merged + - job_completed + export_schedule: + type: object + description: > + Schedule settings for automatic exports. Required when + `export_triggers` includes `schedule`. Requires the automatic + export feature to be enabled. + properties: + frequency: + type: string + enum: + - hour + - day + - week + - month + - cron + time: + type: string + description: Time of day for the export (HH:MM format). Used with `day`, `week`, and `month` frequencies. + example: "09:00" + time_zone: + type: string + description: IANA time zone name. + example: "Europe/Berlin" + days_of_week: + type: string + description: Comma-separated day numbers (0=Sunday … 6=Saturday). Used with `week` frequency. + example: "1,3" + day_of_month: + type: integer + description: Day of the month (1–31). Used with `month` frequency. + cron_schedule: + type: string + description: Raw cron expression. Used when `frequency` is `cron`. + example: "0 9 * * 1" x-cli-version: '2.60' diff --git a/paths/repo_syncs/update.yaml b/paths/repo_syncs/update.yaml new file mode 100644 index 000000000..99822ba21 --- /dev/null +++ b/paths/repo_syncs/update.yaml @@ -0,0 +1,108 @@ +--- +summary: Update a repo sync +description: > + Update settings for an existing Repo Sync. Sending `owner_id`, + `export_triggers`, or `export_schedule` requires the caller to have + `manage_github_sync?` permission on the project (returns `403` otherwise). + Sending `export_triggers` or `export_schedule` when the automatic export + feature is not enabled for the account returns `422`. +operationId: repo_sync/update +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/id" +responses: + '200': + description: OK + content: + application/json: + schema: + "$ref": "../../schemas/repo_sync.yaml#/repo_sync" + headers: + X-Rate-Limit-Limit: + "$ref": "../../headers.yaml#/X-Rate-Limit-Limit" + X-Rate-Limit-Remaining: + "$ref": "../../headers.yaml#/X-Rate-Limit-Remaining" + X-Rate-Limit-Reset: + "$ref": "../../headers.yaml#/X-Rate-Limit-Reset" + '400': + "$ref": "../../responses.yaml#/400" + '401': + "$ref": "../../responses.yaml#/401" + '403': + description: > + Forbidden. Possible causes: insufficient OAuth scope (requires `write`); + caller does not have `manage_git_syncs?` permission on the account; or + `owner_id`, `export_triggers`, or `export_schedule` was provided but + the caller does not have `manage_github_sync?` permission on the project. + '404': + "$ref": "../../responses.yaml#/404" + '422': + description: > + Unprocessable. Returned when model validation fails or when + `export_triggers`/`export_schedule` are provided but the automatic + export feature is not enabled for the account. + '429': + "$ref": "../../responses.yaml#/429" +requestBody: + required: true + content: + application/json: + schema: + type: object + title: repo_sync/update/parameters + properties: + name: + type: string + description: Display name for the repo sync. + owner_id: + type: string + description: > + Code of the user to assign as owner. Requires + `manage_github_sync?` permission on the project; returns `403` + if not satisfied. + export_triggers: + type: array + description: > + Replaces the current set of automatic export triggers. Requires + `manage_github_sync?` permission on the project and the + automatic export feature to be enabled for the account. + Accepted values: `schedule`, `branch_merged`, `job_completed`. + items: + type: string + enum: + - schedule + - branch_merged + - job_completed + export_schedule: + type: object + description: > + Updates the schedule for automatic exports. Only applied when + `export_triggers` includes `schedule`. Requires + `manage_github_sync?` permission and the automatic export + feature to be enabled. + properties: + frequency: + type: string + enum: + - hour + - day + - week + - month + - cron + time: + type: string + example: "09:00" + time_zone: + type: string + example: "Europe/Berlin" + days_of_week: + type: string + example: "1,3" + day_of_month: + type: integer + cron_schedule: + type: string + example: "0 9 * * 1" diff --git a/schemas.yaml b/schemas.yaml index 88b4dec09..cc6dac4ba 100644 --- a/schemas.yaml +++ b/schemas.yaml @@ -114,6 +114,8 @@ schemas: "$ref": schemas/translation_version_with_user.yaml#/translation_version_with_user user_preview: "$ref": schemas/user_preview.yaml#/user_preview + user_short: + "$ref": schemas/user_short.yaml#/user_short user: "$ref": schemas/user.yaml#/user current_user: diff --git a/schemas/repo_sync.yaml b/schemas/repo_sync.yaml index 1ae7ea949..ddbcbfab5 100644 --- a/schemas/repo_sync.yaml +++ b/schemas/repo_sync.yaml @@ -38,6 +38,57 @@ repo_sync: type: string format: date-time nullable: true + owner: + "$ref": "./user_short.yaml#/user_short" + export_triggers: + type: array + description: > + Events that trigger an automatic export. Only present when the automatic + export feature is enabled for the account. Possible values: `schedule` + (runs on the configured schedule), `branch_merged` (runs when a branch + is merged in the connected repository), `job_completed` (runs when a + translation job completes in the project). + items: + type: string + enum: + - schedule + - branch_merged + - job_completed + export_schedule: + type: object + nullable: true + description: > + Schedule configuration for automatic exports. Only present when the + automatic export feature is enabled for the account. `null` when the + `schedule` trigger is not active. + properties: + frequency: + type: string + description: > + How often the export runs. `cron` means a fully custom cron + expression is used (`cron_schedule` holds the raw expression). + enum: + - hour + - day + - week + - month + - cron + cron_schedule: + type: string + description: > + The underlying cron expression. Derived automatically from + `frequency`, `time`, and day fields when using a named frequency; + provided verbatim when `frequency` is `cron`. + example: "0 9 * * 1" + time_zone: + type: string + description: IANA time zone name used to interpret the schedule. + example: "Europe/Berlin" + next_run_at: + type: string + format: date-time + nullable: true + description: When the next scheduled export will run, in UTC. example: id: abcd1234cdef1234abcd1234cdef1234 project: diff --git a/schemas/user_short.yaml b/schemas/user_short.yaml new file mode 100644 index 000000000..126f25ee9 --- /dev/null +++ b/schemas/user_short.yaml @@ -0,0 +1,18 @@ +--- +user_short: + type: object + title: user_short + properties: + id: + type: string + username: + type: string + name: + type: string + gravatar_uid: + type: string + example: + id: abcd1234cdef1234abcd1234cdef1234 + username: johndoe + name: John Doe + gravatar_uid: 205e460b479e2e5b48aec07710c08d50 From 928d2e292950bc6ea6c18ca5ba14ee39cca8d705 Mon Sep 17 00:00:00 2001 From: Sven Dunemann Date: Mon, 16 Nov 2026 14:54:40 +0100 Subject: [PATCH 2/2] fix(API): keep shared 422 response for repo sync create/update #STRINGS-4401 Co-Authored-By: Claude Sonnet 5.5 --- doc/compiled.json | 4 ++-- paths/repo_syncs/create.yaml | 6 +----- paths/repo_syncs/update.yaml | 5 +---- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index edfc032a9..963c97834 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -26526,7 +26526,7 @@ "$ref": "#/components/responses/404" }, "422": { - "description": "Unprocessable. Returned when model validation fails (e.g. duplicate project + repo + branch combination, invalid `export_triggers` values) or when `export_triggers`/`export_schedule` are provided but the automatic export feature is not enabled for the account.\n" + "$ref": "#/components/responses/422" }, "429": { "$ref": "#/components/responses/429" @@ -26804,7 +26804,7 @@ "$ref": "#/components/responses/404" }, "422": { - "description": "Unprocessable. Returned when model validation fails or when `export_triggers`/`export_schedule` are provided but the automatic export feature is not enabled for the account.\n" + "$ref": "#/components/responses/422" }, "429": { "$ref": "#/components/responses/429" diff --git a/paths/repo_syncs/create.yaml b/paths/repo_syncs/create.yaml index a9fa5a9ca..f35cc1008 100644 --- a/paths/repo_syncs/create.yaml +++ b/paths/repo_syncs/create.yaml @@ -32,11 +32,7 @@ responses: '404': "$ref": "../../responses.yaml#/404" '422': - description: > - Unprocessable. Returned when model validation fails (e.g. duplicate - project + repo + branch combination, invalid `export_triggers` values) - or when `export_triggers`/`export_schedule` are provided but the - automatic export feature is not enabled for the account. + "$ref": "../../responses.yaml#/422" '429': "$ref": "../../responses.yaml#/429" x-code-samples: diff --git a/paths/repo_syncs/update.yaml b/paths/repo_syncs/update.yaml index 99822ba21..a9bfd739a 100644 --- a/paths/repo_syncs/update.yaml +++ b/paths/repo_syncs/update.yaml @@ -40,10 +40,7 @@ responses: '404': "$ref": "../../responses.yaml#/404" '422': - description: > - Unprocessable. Returned when model validation fails or when - `export_triggers`/`export_schedule` are provided but the automatic - export feature is not enabled for the account. + "$ref": "../../responses.yaml#/422" '429': "$ref": "../../responses.yaml#/429" requestBody: