From e1d9cfb23e079fea2d9e5475dff9a4137f1f0154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Behrendt?= Date: Tue, 2 Jul 2024 14:12:34 +0200 Subject: [PATCH] feat: add repo sync events show endpoint (#641) * feat: add repo sync events show endpoint * Add id to repo sync event --- doc/compiled.json | 97 ++++++++++++++++--- parameters.yaml | 7 ++ paths.yaml | 5 +- .../index.yaml} | 0 paths/repo_sync_events/show.yaml | 44 +++++++++ paths/repo_syncs/export.yaml | 7 +- paths/repo_syncs/import.yaml | 7 +- schemas/repo_sync_event.yaml | 2 + 8 files changed, 140 insertions(+), 29 deletions(-) rename paths/{repo_syncs/events.yaml => repo_sync_events/index.yaml} (100%) create mode 100644 paths/repo_sync_events/show.yaml diff --git a/doc/compiled.json b/doc/compiled.json index 2e83a65a..39b9fa84 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -4523,6 +4523,9 @@ "type": "object", "title": "repo_sync_event", "properties": { + "id": { + "type": "string" + }, "event_type": { "type": "string", "enum": [ @@ -4638,6 +4641,15 @@ "type": "string" } }, + "repo_sync_id": { + "in": "path", + "name": "repo_sync_id", + "description": "Repo Sync ID", + "required": true, + "schema": { + "type": "string" + } + }, "space_id": { "in": "path", "name": "space_id", @@ -22931,14 +22943,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "title": "repo_sync/export", - "properties": { - "message": { - "type": "string", - "example": "Export started" - } - } + "$ref": "#/components/schemas/repo_sync_event" } } }, @@ -23002,14 +23007,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "title": "repo_sync/import", - "properties": { - "message": { - "type": "string", - "example": "Import started" - } - } + "$ref": "#/components/schemas/repo_sync_event" } } }, @@ -23121,6 +23119,73 @@ "x-cli-version": "2.24" } }, + "/accounts/{account_id}/repo_syncs/{repo_sync_id}/events/{id}": { + "get": { + "summary": "Get a single Repo Sync Event", + "description": "Shows a single Repo Sync event.", + "operationId": "repo_sync_event/show", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/repo_sync_id" + }, + { + "$ref": "#/components/parameters/id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/repo_sync_event" + } + } + }, + "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/ab12cd34/repo_syncs/56ef78/events/78dfgj\"\\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase repo_sync_event show \\\n--id \\\n--repo_sync_id \\\n--account_id abcd1234 \\\n--access_token " + } + ], + "x-cli-version": "2.24" + } + }, "/accounts/{account_id}/repo_syncs/{id}/deactivate": { "post": { "summary": "Deactivate a Repo Sync", diff --git a/parameters.yaml b/parameters.yaml index 2bfd555e..a997b081 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -46,6 +46,13 @@ query_account_id: required: false schema: type: string +repo_sync_id: + in: path + name: repo_sync_id + description: Repo Sync ID + required: true + schema: + type: string space_id: in: path name: space_id diff --git a/paths.yaml b/paths.yaml index 7e3b3ca8..d6dd7dbf 100644 --- a/paths.yaml +++ b/paths.yaml @@ -542,7 +542,10 @@ "$ref": "./paths/repo_syncs/import.yaml" "/accounts/{account_id}/repo_syncs/{id}/events": get: - "$ref": "./paths/repo_syncs/events.yaml" + "$ref": "./paths/repo_sync_events/index.yaml" +"/accounts/{account_id}/repo_syncs/{repo_sync_id}/events/{id}": + get: + "$ref": "./paths/repo_sync_events/show.yaml" "/accounts/{account_id}/repo_syncs/{id}/deactivate": post: "$ref": "./paths/repo_syncs/deactivate.yaml" diff --git a/paths/repo_syncs/events.yaml b/paths/repo_sync_events/index.yaml similarity index 100% rename from paths/repo_syncs/events.yaml rename to paths/repo_sync_events/index.yaml diff --git a/paths/repo_sync_events/show.yaml b/paths/repo_sync_events/show.yaml new file mode 100644 index 00000000..7f7d6af6 --- /dev/null +++ b/paths/repo_sync_events/show.yaml @@ -0,0 +1,44 @@ +--- +summary: Get a single Repo Sync Event +description: Shows a single Repo Sync event. +operationId: repo_sync_event/show +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/repo_sync_id" +- "$ref": "../../parameters.yaml#/id" +responses: + '200': + description: OK + content: + application/json: + schema: + "$ref": "../../schemas/repo_sync_event.yaml#/repo_sync_event" + 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/ab12cd34/repo_syncs/56ef78/events/78dfgj"\ + -u USERNAME_OR_ACCESS_TOKEN +- lang: CLI v2 + source: |- + phrase repo_sync_event show \ + --id \ + --repo_sync_id \ + --account_id abcd1234 \ + --access_token +x-cli-version: '2.24' diff --git a/paths/repo_syncs/export.yaml b/paths/repo_syncs/export.yaml index cdd488ea..b13bb215 100644 --- a/paths/repo_syncs/export.yaml +++ b/paths/repo_syncs/export.yaml @@ -20,12 +20,7 @@ responses: content: application/json: schema: - type: object - title: repo_sync/export - properties: - message: - type: string - example: Export started + "$ref": "../../schemas/repo_sync_event.yaml#/repo_sync_event" headers: X-Rate-Limit-Limit: "$ref": "../../headers.yaml#/X-Rate-Limit-Limit" diff --git a/paths/repo_syncs/import.yaml b/paths/repo_syncs/import.yaml index cff137fc..77fbcfbd 100644 --- a/paths/repo_syncs/import.yaml +++ b/paths/repo_syncs/import.yaml @@ -20,12 +20,7 @@ responses: content: application/json: schema: - type: object - title: repo_sync/import - properties: - message: - type: string - example: Import started + "$ref": "../../schemas/repo_sync_event.yaml#/repo_sync_event" headers: X-Rate-Limit-Limit: "$ref": "../../headers.yaml#/X-Rate-Limit-Limit" diff --git a/schemas/repo_sync_event.yaml b/schemas/repo_sync_event.yaml index c8f48f76..ed96c955 100644 --- a/schemas/repo_sync_event.yaml +++ b/schemas/repo_sync_event.yaml @@ -3,6 +3,8 @@ repo_sync_event: type: object title: repo_sync_event properties: + id: + type: string event_type: type: string enum: [import, export]