From 8cb91dcce2c19ca700cf9d0713fa74f28ad59434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Jablanovi=C4=87?= Date: Wed, 12 Jun 2024 10:38:04 +0200 Subject: [PATCH] feat(API): Add OTA Release Triggers API [TSI-2485] (#622) --- doc/compiled.json | 507 +++++++++++++++++++++++++++- main.yaml | 2 + paths.yaml | 12 + paths/release_triggers/create.yaml | 91 +++++ paths/release_triggers/destroy.yaml | 34 ++ paths/release_triggers/index.yaml | 46 +++ paths/release_triggers/show.yaml | 44 +++ paths/release_triggers/update.yaml | 92 +++++ schemas.yaml | 2 + schemas/release_trigger.yaml | 54 +++ 10 files changed, 883 insertions(+), 1 deletion(-) create mode 100644 paths/release_triggers/create.yaml create mode 100644 paths/release_triggers/destroy.yaml create mode 100644 paths/release_triggers/index.yaml create mode 100644 paths/release_triggers/show.yaml create mode 100644 paths/release_triggers/update.yaml create mode 100644 schemas/release_trigger.yaml diff --git a/doc/compiled.json b/doc/compiled.json index 8391ebc7..da20156a 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -147,6 +147,9 @@ { "name": "Releases" }, + { + "name": "Release Triggers" + }, { "name": "Repo Syncs", "description": "The Repo Syncs API allows you to synchronize your Phrase projects with your code repositories.\nYou can import translations from your repository to Phrase and export translations from Phrase to your repository.\n" @@ -246,7 +249,8 @@ "GitLab Sync", "Webhooks", "Distributions", - "Releases" + "Releases", + "Release Triggers" ] }, { @@ -3824,6 +3828,79 @@ "updated_at": "2015-01-28T09:52:53Z" } }, + "release_trigger": { + "type": "object", + "title": "release_trigger", + "properties": { + "id": { + "type": "string" + }, + "branch": { + "type": "string" + }, + "cron_schedule": { + "type": "string", + "description": "Cron schedule for the scheduler. Read more about the format of this field at https://en.wikipedia.org/wiki/Cron" + }, + "time_zone": { + "type": "string", + "description": "Time zone for the scheduler" + }, + "next_run_at": { + "type": "string", + "format": "date-time", + "description": "The next time a release will be created for this trigger" + }, + "app_min_version": { + "type": "string" + }, + "app_max_version": { + "type": "string" + }, + "locales": { + "type": "array", + "items": { + "$ref": "#/components/schemas/locale_preview" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + }, + "example": { + "id": "abcd1234cdef1234abcd1234cdef1234", + "locales": [ + { + "id": "abcd1234cdef1234abcd1234cdef1234", + "name": "English", + "code": "en-GB" + } + ], + "branch": "my-feature-branch", + "tags": [ + "android", + "feature1" + ], + "cron_schedule": "15 18 * * 1,3", + "time_zone": "Europe/Berlin", + "next_run_at": "2015-01-28T09:52:53Z", + "app_min_version": "1.0.0", + "app_max_version": "2.0.0", + "created_at": "2015-01-28T09:52:53Z", + "updated_at": "2015-01-28T09:52:53Z" + } + }, "screenshot": { "type": "object", "title": "screenshot", @@ -9586,6 +9663,434 @@ "x-cli-version": "2.5" } }, + "/accounts/{account_id}/distributions/{distribution_id}/release_triggers": { + "get": { + "summary": "List release triggers", + "description": "List all release triggers for the given distribution.
\nNote: Currently only one release trigger can exist per distribution.\n", + "operationId": "release_triggers/list", + "tags": [ + "Release Triggers" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/distribution_id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/release_trigger" + } + } + } + }, + "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" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase release_triggers list \\\n--account_id \\\n--distribution_id \\\n--access_token " + } + ], + "x-cli-version": "2.28" + }, + "post": { + "summary": "Create a release trigger", + "description": "Create a new recurring release. New releases will be published automatically, based on the cron schedule provided. Currently, only one release trigger can exist per distribution.", + "operationId": "release_triggers/create", + "tags": [ + "Release Triggers" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/distribution_id" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "title": "release/create/parameters", + "properties": { + "cron_schedule": { + "description": "Cron schedule for the scheduler. Read more about the format of this field at https://en.wikipedia.org/wiki/Cron", + "type": "string", + "example": "15 18 * * 1,3" + }, + "time_zone": { + "description": "Time zone for the scheduler", + "type": "string", + "example": "Europe/Berlin" + }, + "locale_ids": { + "description": "List of locale ids that will be included in the release.", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "abcd1234cdef1234abcd1234cdef1234", + "fff565db236400772368235db2c6117e" + ] + }, + "tags": { + "description": "Only include tagged keys in the release. For a key to be included it must be tagged with all tags provided", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "android", + "feature1" + ] + }, + "branch": { + "description": "Branch used for release", + "type": "string", + "example": "my-feature-branch" + }, + "app_min_version": { + "description": "The created releases will be available only for apps with version greater or equal to this value", + "type": "string", + "example": "1.0.0" + }, + "app_max_version": { + "description": "The created releases will be available only for apps with version less or equal to this value", + "type": "string", + "example": "2.0.0" + } + } + } + } + } + }, + "responses": { + "201": { + "description": "Created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/release_trigger" + } + } + }, + "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" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"cron_schedule\":\"15 18 * * 1,3\",\"time_zone\":\"Europe/Berlin\",\"locale_ids\":[\"abcd1234cdef1234abcd1234cdef1234\",\"fff565db236400772368235db2c6117e\"],\"tags\":[\"android\",\"feature1\"],\"branch\":\"my-feature-branch\",\"app_min_version\":\"1.0.0\",\"app_max_version\":\"2.0.0\"}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase release_triggers create \\\n--account_id \\\n--distribution_id \\\n--data '{\"cron_schedule\":\"15 18 * * 1,3\",\"time_zone\":\"Europe/Berlin\",\"locale_ids\":[\"abcd1234cdef1234abcd1234cdef1234\",\"fff565db236400772368235db2c6117e\"],\"tags\":[\"android\",\"feature1\"],\"branch\":\"my-feature-branch\",\"app_min_version\":\"1.0.0\",\"app_max_version\":\"2.0.0\"}' \\\n--access_token " + } + ], + "x-cli-version": "2.28" + } + }, + "/accounts/{account_id}/distributions/{distribution_id}/release_triggers/{id}": { + "get": { + "summary": "Get a single release trigger", + "description": "Get details of a single release trigger.", + "operationId": "release_triggers/show", + "tags": [ + "Release Triggers" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/distribution_id" + }, + { + "$ref": "#/components/parameters/id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/release_trigger" + } + } + }, + "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" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase release_triggers show \\\n--account_id \\\n--distribution_id \\\n--id \\\n--access_token " + } + ], + "x-cli-version": "2.28" + }, + "patch": { + "summary": "Update a release trigger", + "description": "Update a recurring release.", + "operationId": "release_triggers/update", + "tags": [ + "Release Triggers" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/distribution_id" + }, + { + "$ref": "#/components/parameters/id" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "title": "release/update/parameters", + "properties": { + "cron_schedule": { + "description": "Cron schedule for the scheduler. Read more about the format of this field at https://en.wikipedia.org/wiki/Cron", + "type": "string", + "example": "15 18 * * 1,3" + }, + "time_zone": { + "description": "Time zone for the scheduler", + "type": "string", + "example": "Europe/Berlin" + }, + "locale_ids": { + "description": "List of locale ids that will be included in the release.", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "abcd1234cdef1234abcd1234cdef1234", + "fff565db236400772368235db2c6117e" + ] + }, + "tags": { + "description": "Only include tagged keys in the release. For a key to be included it must be tagged with all tags provided", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "android", + "feature1" + ] + }, + "branch": { + "description": "Branch used for release", + "type": "string", + "example": "my-feature-branch" + }, + "app_min_version": { + "description": "The created releases will be available only for apps with version greater or equal to this value", + "type": "string", + "example": "1.0.0" + }, + "app_max_version": { + "description": "The created releases will be available only for apps with version less or equal to this value", + "type": "string", + "example": "2.0.0" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/release_trigger" + } + } + }, + "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" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"cron_schedule\":\"15 18 * * 1,3\",\"time_zone\":\"Europe/Berlin\",\"locale_ids\":[\"abcd1234cdef1234abcd1234cdef1234\",\"fff565db236400772368235db2c6117e\"],\"tags\":[\"android\",\"feature1\"],\"branch\":\"my-feature-branch\",\"app_min_version\":\"1.0.0\",\"app_max_version\":\"2.0.0\"}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase release_triggers update \\\n--account_id \\\n--distribution_id \\\n--id \\\n--data '{\"cron_schedule\":\"15 18 * * 1,3\",\"time_zone\":\"Europe/Berlin\",\"locale_ids\":[\"abcd1234cdef1234abcd1234cdef1234\",\"fff565db236400772368235db2c6117e\"],\"tags\":[\"android\",\"feature1\"],\"branch\":\"my-feature-branch\",\"app_min_version\":\"1.0.0\",\"app_max_version\":\"2.0.0\"}' \\\n--access_token " + } + ], + "x-cli-version": "2.28" + }, + "delete": { + "summary": "Delete a single release trigger", + "description": "Delete a single release trigger.", + "operationId": "release_triggers/destroy", + "tags": [ + "Release Triggers" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/distribution_id" + }, + { + "$ref": "#/components/parameters/id" + } + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X DELETE" + }, + { + "lang": "CLI v2", + "source": "phrase release_triggers delete \\\n--account_id \\\n--distribution_id \\\n--id \\\n--access_token " + } + ], + "x-cli-version": "2.28" + } + }, "/projects/{project_id}/jobs": { "get": { "summary": "List jobs", diff --git a/main.yaml b/main.yaml index b1a7f966..4bdf243e 100644 --- a/main.yaml +++ b/main.yaml @@ -195,6 +195,7 @@ tags: - name: Projects - name: Quality - name: Releases + - name: Release Triggers - name: Repo Syncs description: | The Repo Syncs API allows you to synchronize your Phrase projects with your code repositories. @@ -301,6 +302,7 @@ x-tagGroups: - Webhooks - Distributions - Releases + - Release Triggers - name: Ordering tags: - Orders diff --git a/paths.yaml b/paths.yaml index 26949984..b943eb48 100644 --- a/paths.yaml +++ b/paths.yaml @@ -135,6 +135,18 @@ "/accounts/{account_id}/distributions/{distribution_id}/releases/{id}/publish": post: "$ref": "./paths/releases/publish.yaml" +"/accounts/{account_id}/distributions/{distribution_id}/release_triggers": + get: + "$ref": "./paths/release_triggers/index.yaml" + post: + "$ref": "./paths/release_triggers/create.yaml" +"/accounts/{account_id}/distributions/{distribution_id}/release_triggers/{id}": + get: + "$ref": "./paths/release_triggers/show.yaml" + patch: + "$ref": "./paths/release_triggers/update.yaml" + delete: + "$ref": "./paths/release_triggers/destroy.yaml" "/projects/{project_id}/jobs": get: "$ref": "./paths/jobs/index.yaml" diff --git a/paths/release_triggers/create.yaml b/paths/release_triggers/create.yaml new file mode 100644 index 00000000..53c91ff7 --- /dev/null +++ b/paths/release_triggers/create.yaml @@ -0,0 +1,91 @@ +--- +summary: Create a release trigger +description: Create a new recurring release. New releases will be published automatically, based on the cron schedule provided. + Currently, only one release trigger can exist per distribution. +operationId: release_triggers/create +tags: + - Release Triggers +parameters: + - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" + - "$ref": "../../parameters.yaml#/account_id" + - "$ref": "../../parameters.yaml#/distribution_id" +requestBody: + required: true + content: + application/json: + schema: + type: object + title: release/create/parameters + properties: + cron_schedule: + description: Cron schedule for the scheduler. Read more about the format of this field at https://en.wikipedia.org/wiki/Cron + type: string + example: "15 18 * * 1,3" + time_zone: + description: Time zone for the scheduler + type: string + example: "Europe/Berlin" + locale_ids: + description: List of locale ids that will be included in the release. + type: array + items: + type: string + example: + - abcd1234cdef1234abcd1234cdef1234 + - fff565db236400772368235db2c6117e + tags: + description: Only include tagged keys in the release. For a key to be included it must be tagged with all tags provided + type: array + items: + type: string + example: + - android + - feature1 + branch: + description: Branch used for release + type: string + example: my-feature-branch + app_min_version: + description: The created releases will be available only for apps with version greater or equal to this value + type: string + example: "1.0.0" + app_max_version: + description: The created releases will be available only for apps with version less or equal to this value + type: string + example: "2.0.0" +responses: + "201": + description: Created + content: + application/json: + schema: + "$ref": "../../schemas/release_trigger.yaml#/release_trigger" + 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" + "404": + "$ref": "../../responses.yaml#/404" + "429": + "$ref": "../../responses.yaml#/429" +x-code-samples: + - lang: Curl + source: |- + curl "https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X POST \ + -d '{"cron_schedule":"15 18 * * 1,3","time_zone":"Europe/Berlin","locale_ids":["abcd1234cdef1234abcd1234cdef1234","fff565db236400772368235db2c6117e"],"tags":["android","feature1"],"branch":"my-feature-branch","app_min_version":"1.0.0","app_max_version":"2.0.0"}' \ + -H 'Content-Type: application/json' + - lang: CLI v2 + source: |- + phrase release_triggers create \ + --account_id \ + --distribution_id \ + --data '{"cron_schedule":"15 18 * * 1,3","time_zone":"Europe/Berlin","locale_ids":["abcd1234cdef1234abcd1234cdef1234","fff565db236400772368235db2c6117e"],"tags":["android","feature1"],"branch":"my-feature-branch","app_min_version":"1.0.0","app_max_version":"2.0.0"}' \ + --access_token +x-cli-version: "2.28" diff --git a/paths/release_triggers/destroy.yaml b/paths/release_triggers/destroy.yaml new file mode 100644 index 00000000..c737329a --- /dev/null +++ b/paths/release_triggers/destroy.yaml @@ -0,0 +1,34 @@ +--- +summary: Delete a single release trigger +description: Delete a single release trigger. +operationId: release_triggers/destroy +tags: +- Release Triggers +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/distribution_id" +- "$ref": "../../parameters.yaml#/id" +responses: + '204': + "$ref": "../../responses.yaml#/204" + '400': + "$ref": "../../responses.yaml#/400" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers/:id" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X DELETE +- lang: CLI v2 + source: |- + phrase release_triggers delete \ + --account_id \ + --distribution_id \ + --id \ + --access_token +x-cli-version: '2.28' diff --git a/paths/release_triggers/index.yaml b/paths/release_triggers/index.yaml new file mode 100644 index 00000000..31fa74f0 --- /dev/null +++ b/paths/release_triggers/index.yaml @@ -0,0 +1,46 @@ +--- +summary: List release triggers +description: | + List all release triggers for the given distribution.
+ Note: Currently only one release trigger can exist per distribution. +operationId: release_triggers/list +tags: +- Release Triggers +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/distribution_id" +responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + "$ref": "../../schemas/release_trigger.yaml#/release_trigger" + 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" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers" \ + -u USERNAME_OR_ACCESS_TOKEN +- lang: CLI v2 + source: |- + phrase release_triggers list \ + --account_id \ + --distribution_id \ + --access_token +x-cli-version: '2.28' diff --git a/paths/release_triggers/show.yaml b/paths/release_triggers/show.yaml new file mode 100644 index 00000000..18ec4e6c --- /dev/null +++ b/paths/release_triggers/show.yaml @@ -0,0 +1,44 @@ +--- +summary: Get a single release trigger +description: Get details of a single release trigger. +operationId: release_triggers/show +tags: +- Release Triggers +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/distribution_id" +- "$ref": "../../parameters.yaml#/id" +responses: + '200': + description: OK + content: + application/json: + schema: + "$ref": "../../schemas/release_trigger.yaml#/release_trigger" + 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" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers/:id" \ + -u USERNAME_OR_ACCESS_TOKEN +- lang: CLI v2 + source: |- + phrase release_triggers show \ + --account_id \ + --distribution_id \ + --id \ + --access_token +x-cli-version: '2.28' diff --git a/paths/release_triggers/update.yaml b/paths/release_triggers/update.yaml new file mode 100644 index 00000000..5a31f643 --- /dev/null +++ b/paths/release_triggers/update.yaml @@ -0,0 +1,92 @@ +--- +summary: Update a release trigger +description: Update a recurring release. +operationId: release_triggers/update +tags: + - Release Triggers +parameters: + - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" + - "$ref": "../../parameters.yaml#/account_id" + - "$ref": "../../parameters.yaml#/distribution_id" + - "$ref": "../../parameters.yaml#/id" +requestBody: + required: true + content: + application/json: + schema: + type: object + title: release/update/parameters + properties: + cron_schedule: + description: Cron schedule for the scheduler. Read more about the format of this field at https://en.wikipedia.org/wiki/Cron + type: string + example: "15 18 * * 1,3" + time_zone: + description: Time zone for the scheduler + type: string + example: "Europe/Berlin" + locale_ids: + description: List of locale ids that will be included in the release. + type: array + items: + type: string + example: + - abcd1234cdef1234abcd1234cdef1234 + - fff565db236400772368235db2c6117e + tags: + description: Only include tagged keys in the release. For a key to be included it must be tagged with all tags provided + type: array + items: + type: string + example: + - android + - feature1 + branch: + description: Branch used for release + type: string + example: my-feature-branch + app_min_version: + description: The created releases will be available only for apps with version greater or equal to this value + type: string + example: "1.0.0" + app_max_version: + description: The created releases will be available only for apps with version less or equal to this value + type: string + example: "2.0.0" +responses: + "200": + description: OK + content: + application/json: + schema: + "$ref": "../../schemas/release_trigger.yaml#/release_trigger" + 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" + "404": + "$ref": "../../responses.yaml#/404" + "429": + "$ref": "../../responses.yaml#/429" +x-code-samples: + - lang: Curl + source: |- + curl "https://api.phrase.com/v2/accounts/:account_id/distributions/:distribution_id/release_triggers/:id" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X PATCH \ + -d '{"cron_schedule":"15 18 * * 1,3","time_zone":"Europe/Berlin","locale_ids":["abcd1234cdef1234abcd1234cdef1234","fff565db236400772368235db2c6117e"],"tags":["android","feature1"],"branch":"my-feature-branch","app_min_version":"1.0.0","app_max_version":"2.0.0"}' \ + -H 'Content-Type: application/json' + - lang: CLI v2 + source: |- + phrase release_triggers update \ + --account_id \ + --distribution_id \ + --id \ + --data '{"cron_schedule":"15 18 * * 1,3","time_zone":"Europe/Berlin","locale_ids":["abcd1234cdef1234abcd1234cdef1234","fff565db236400772368235db2c6117e"],"tags":["android","feature1"],"branch":"my-feature-branch","app_min_version":"1.0.0","app_max_version":"2.0.0"}' \ + --access_token +x-cli-version: "2.28" diff --git a/schemas.yaml b/schemas.yaml index beb95984..e5a519fc 100644 --- a/schemas.yaml +++ b/schemas.yaml @@ -144,6 +144,8 @@ schemas: "$ref": schemas/release_preview.yaml#/release_preview release: "$ref": schemas/release.yaml#/release + release_trigger: + "$ref": schemas/release_trigger.yaml#/release_trigger screenshot: "$ref": schemas/screenshot.yaml#/screenshot screenshot_marker: diff --git a/schemas/release_trigger.yaml b/schemas/release_trigger.yaml new file mode 100644 index 00000000..97d1c840 --- /dev/null +++ b/schemas/release_trigger.yaml @@ -0,0 +1,54 @@ +--- +release_trigger: + type: object + title: release_trigger + properties: + id: + type: string + branch: + type: string + cron_schedule: + type: string + description: Cron schedule for the scheduler. Read more about the format of this field at https://en.wikipedia.org/wiki/Cron + time_zone: + type: string + description: Time zone for the scheduler + next_run_at: + type: string + format: date-time + description: The next time a release will be created for this trigger + app_min_version: + type: string + app_max_version: + type: string + locales: + type: array + items: + "$ref": "./locale_preview.yaml#/locale_preview" + tags: + type: array + items: + type: string + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + example: + id: abcd1234cdef1234abcd1234cdef1234 + locales: + - id: abcd1234cdef1234abcd1234cdef1234 + name: English + code: en-GB + branch: my-feature-branch + tags: + - android + - feature1 + cron_schedule: "15 18 * * 1,3" + time_zone: "Europe/Berlin" + next_run_at: "2015-01-28T09:52:53Z" + app_min_version: "1.0.0" + app_max_version: "2.0.0" + created_at: "2015-01-28T09:52:53Z" + updated_at: "2015-01-28T09:52:53Z"