Skip to content

Commit

Permalink
feat(API): Add OTA Release Triggers API [TSI-2485] (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
jablan authored Jun 12, 2024
1 parent 8131c7b commit 8cb91dc
Show file tree
Hide file tree
Showing 10 changed files with 883 additions and 1 deletion.
507 changes: 506 additions & 1 deletion doc/compiled.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -301,6 +302,7 @@ x-tagGroups:
- Webhooks
- Distributions
- Releases
- Release Triggers
- name: Ordering
tags:
- Orders
Expand Down
12 changes: 12 additions & 0 deletions paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
91 changes: 91 additions & 0 deletions paths/release_triggers/create.yaml
Original file line number Diff line number Diff line change
@@ -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 <account_id> \
--distribution_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 <token>
x-cli-version: "2.28"
34 changes: 34 additions & 0 deletions paths/release_triggers/destroy.yaml
Original file line number Diff line number Diff line change
@@ -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 <account_id> \
--distribution_id <distribution_id> \
--id <id> \
--access_token <token>
x-cli-version: '2.28'
46 changes: 46 additions & 0 deletions paths/release_triggers/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
summary: List release triggers
description: |
List all release triggers for the given distribution.<br>
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 <account_id> \
--distribution_id <distribution_id> \
--access_token <token>
x-cli-version: '2.28'
44 changes: 44 additions & 0 deletions paths/release_triggers/show.yaml
Original file line number Diff line number Diff line change
@@ -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 <account_id> \
--distribution_id <distribution_id> \
--id <id> \
--access_token <token>
x-cli-version: '2.28'
92 changes: 92 additions & 0 deletions paths/release_triggers/update.yaml
Original file line number Diff line number Diff line change
@@ -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 <account_id> \
--distribution_id <distribution_id> \
--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 <token>
x-cli-version: "2.28"
2 changes: 2 additions & 0 deletions schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 8cb91dc

Please sign in to comment.