diff --git a/doc/compiled.json b/doc/compiled.json index f2fe2987..5f52847c 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -147,6 +147,10 @@ { "name": "Releases" }, + { + "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" + }, { "name": "Reports" }, @@ -4287,6 +4291,116 @@ "parent", "children" ] + }, + "repo_sync": { + "type": "object", + "title": "repo_sync", + "properties": { + "id": { + "type": "string" + }, + "project": { + "$ref": "#/components/schemas/project_short" + }, + "provider": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "auto_import": { + "type": "boolean" + }, + "repo_name": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "last_import_at": { + "type": "string", + "format": "date-time" + }, + "last_export_at": { + "type": "string", + "format": "date-time" + } + }, + "example": { + "id": "abcd1234cdef1234abcd1234cdef1234", + "project": { + "id": "abcd1234cdef1234abcd1234cdef1234", + "name": "My Android Project", + "main_format": "xml", + "created_at": "2015-01-28T09:52:53Z", + "updated_at": "2015-01-28T09:52:53Z" + }, + "provider": "github", + "enabled": true, + "auto_import": true, + "repo_name": "organization/repo", + "created_at": "2015-01-28T09:52:53Z", + "last_import_at": "2015-01-28T09:52:53Z", + "last_export_at": "2015-01-28T09:52:53Z" + } + }, + "repo_sync_event": { + "type": "object", + "title": "repo_sync_event", + "properties": { + "event_type": { + "type": "string", + "enum": [ + "import", + "export" + ] + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "status": { + "type": "string", + "enum": [ + "running", + "success", + "failure" + ] + }, + "pull_request_url": { + "type": "string", + "description": "URL of the pull request created on export" + }, + "auto_import": { + "type": "boolean", + "description": "Whether the import was triggered by the repo push event" + }, + "errors": { + "description": "List of error messages, in case of failure", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + } + }, + "example": { + "event_type": "import", + "created_at": "2015-01-28T09:52:53Z", + "status": "failure", + "auto_import": true, + "errors": [ + "Error message", + "Error message" + ] + } } }, "parameters": { @@ -4350,6 +4464,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", @@ -21734,6 +21857,483 @@ "x-cli-version": "2.20" } }, + "/accounts/{account_id}/repo_syncs": { + "get": { + "summary": "Get Repo Syncs", + "description": "Lists all Repo Syncs from an account", + "operationId": "repo_sync/list", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$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" + }, + "Link": { + "$ref": "#/components/headers/Link" + }, + "Pagination": { + "$ref": "#/components/headers/Pagination" + } + } + }, + "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\"\\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase repo_sync list \\\n--account_id abcd1234 \\\n--access_token " + } + ], + "x-cli-version": "2.24" + } + }, + "/accounts/{account_id}/repo_syncs/{repo_sync_id}": { + "get": { + "summary": "Get a single Repo Sync", + "description": "Shows a single Repo Sync setting.", + "operationId": "repo_sync/show", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/repo_sync_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" + }, + "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\"\\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase repo_sync show \\\n--id \\\n--account_id abcd1234 \\\n--access_token " + } + ], + "x-cli-version": "2.24" + } + }, + "/accounts/{account_id}/repo_syncs/{repo_sync_id}/export": { + "post": { + "summary": "Export to code repository", + "description": "> Beta: this feature will change in the future.\n\nExport translations from Phrase Strings to repository provider according to the\n.phrase.yml file within the code repository.\n\n*Export is done asynchronously and may take several seconds depending on the project size.*", + "operationId": "repo_sync/export", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/repo_sync_id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "title": "repo_sync/export", + "properties": { + "message": { + "type": "string", + "example": "Export started" + } + } + } + } + }, + "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/45ef6789/export\"\\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase repo_sync export \\\n--repo_sync_id \\\n--access_token " + } + ], + "x-cli-version": "2.24" + } + }, + "/accounts/{account_id}/repo_syncs/{repo_sync_id}/import": { + "post": { + "summary": "Import from code repository", + "description": "> Beta: this feature will change in the future.\n\nImport translations from repository provider to Phrase Strings according to the .phrase.yml file\nwithin the code repository.\n\n_Import is done asynchronously and may take several seconds depending on the project size._", + "operationId": "repo_sync/import", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/repo_sync_id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "title": "repo_sync/import", + "properties": { + "message": { + "type": "string", + "example": "Import started" + } + } + } + } + }, + "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/45ef6789/import\"\\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase repo_sync import \\\n--repo_sync_id \\\n--access_token " + } + ], + "x-cli-version": "2.24" + } + }, + "/accounts/{account_id}/repo_syncs/{repo_sync_id}/events": { + "get": { + "summary": "Repository Syncs History", + "description": "Get the history of a single Repo Sync. The history includes all imports and exports\nperformed by the Repo Sync.", + "operationId": "repo_sync/events", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/repo_sync_id" + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$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" + }, + "Link": { + "$ref": "#/components/headers/Link" + }, + "Pagination": { + "$ref": "#/components/headers/Pagination" + } + } + }, + "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\"\\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase repo_sync events \\\n--id \\\n--account_id abcd1234 \\\n--access_token " + } + ], + "x-cli-version": "2.24" + } + }, + "/accounts/{account_id}/repo_syncs/{repo_sync_id}/deactivate": { + "post": { + "summary": "Deactivate a Repo Sync", + "description": "Deactivate an active Repo Sync. Import and export can't be performed on deactivated syncs\nand the pushes to the repository won't trigger the import to Phrase.", + "operationId": "repo_sync/deactivate", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/repo_sync_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" + }, + "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/45ef6789/deactivate\"\\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase repo_sync deactivate \\\n--repo_sync_id \\\n--access_token " + } + ], + "x-cli-version": "2.24" + } + }, + "/accounts/{account_id}/repo_syncs/{repo_sync_id}/activate": { + "post": { + "summary": "Activate a Repo Sync", + "description": "Activate a deactivated Repo Sync. Active syncs can be used to import and export translations,\nand imports to Phrase are automatically triggered by pushes to the repository, if configured.", + "operationId": "repo_sync/activate", + "tags": [ + "Repo Syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/repo_sync_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" + }, + "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/45ef6789/activate\"\\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase repo_sync activate \\\n--repo_sync_id \\\n--access_token " + } + ], + "x-cli-version": "2.24" + } + }, "/accounts/{account_id}/spaces": { "get": { "summary": "List Spaces", diff --git a/lint.sh b/lint.sh index 9e4f0e70..1a0e5fe5 100755 --- a/lint.sh +++ b/lint.sh @@ -1,6 +1,6 @@ #!/bin/bash -output=$(npx openapi-generator-cli validate -i tmp/compiled.yaml | grep -v "inheritance without use of 'discriminator.propertyName'" | grep -v "No validation issues detected.") +output=$(npx openapi-generator-cli validate -i tmp/compiled.yaml | grep -v "No validation issues detected.") if echo "$output" | grep -q -E "WARN|ERROR"; then echo "$output" echo "Validation errors" diff --git a/main.yaml b/main.yaml index 622f314e..b1a7f966 100644 --- a/main.yaml +++ b/main.yaml @@ -195,6 +195,10 @@ tags: - name: Projects - name: Quality - name: Releases + - name: Repo Syncs + description: | + The Repo Syncs API allows you to synchronize your Phrase projects with your code repositories. + You can import translations from your repository to Phrase and export translations from Phrase to your repository. - name: Reports - name: Search - name: Screenshot Markers 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 aa6e3e37..7fa4c220 100644 --- a/paths.yaml +++ b/paths.yaml @@ -510,6 +510,27 @@ "/projects/{project_id}/quality_performance_score": post: "$ref": "./paths/quality_performance_score/index.yaml" +"/accounts/{account_id}/repo_syncs": + get: + "$ref": "./paths/repo_syncs/index.yaml" +"/accounts/{account_id}/repo_syncs/{repo_sync_id}": + get: + "$ref": "./paths/repo_syncs/show.yaml" +"/accounts/{account_id}/repo_syncs/{repo_sync_id}/export": + post: + "$ref": "./paths/repo_syncs/export.yaml" +"/accounts/{account_id}/repo_syncs/{repo_sync_id}/import": + post: + "$ref": "./paths/repo_syncs/import.yaml" +"/accounts/{account_id}/repo_syncs/{repo_sync_id}/events": + get: + "$ref": "./paths/repo_syncs/events.yaml" +"/accounts/{account_id}/repo_syncs/{repo_sync_id}/deactivate": + post: + "$ref": "./paths/repo_syncs/deactivate.yaml" +"/accounts/{account_id}/repo_syncs/{repo_sync_id}/activate": + post: + "$ref": "./paths/repo_syncs/activate.yaml" "/accounts/{account_id}/spaces": get: "$ref": "./paths/spaces/index.yaml" diff --git a/paths/repo_syncs/activate.yaml b/paths/repo_syncs/activate.yaml new file mode 100644 index 00000000..99628603 --- /dev/null +++ b/paths/repo_syncs/activate.yaml @@ -0,0 +1,45 @@ +--- +summary: Activate a Repo Sync +description: |- + Activate a deactivated Repo Sync. Active syncs can be used to import and export translations, + and imports to Phrase are automatically triggered by pushes to the repository, if configured. +operationId: repo_sync/activate +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/repo_sync_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" + '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/45ef6789/activate"\ + -u USERNAME_OR_ACCESS_TOKEN \ + -X POST \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase repo_sync activate \ + --repo_sync_id \ + --access_token +x-cli-version: '2.24' diff --git a/paths/repo_syncs/deactivate.yaml b/paths/repo_syncs/deactivate.yaml new file mode 100644 index 00000000..02c7f3d9 --- /dev/null +++ b/paths/repo_syncs/deactivate.yaml @@ -0,0 +1,45 @@ +--- +summary: Deactivate a Repo Sync +description: |- + Deactivate an active Repo Sync. Import and export can't be performed on deactivated syncs + and the pushes to the repository won't trigger the import to Phrase. +operationId: repo_sync/deactivate +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/repo_sync_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" + '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/45ef6789/deactivate"\ + -u USERNAME_OR_ACCESS_TOKEN \ + -X POST \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase repo_sync deactivate \ + --repo_sync_id \ + --access_token +x-cli-version: '2.24' diff --git a/paths/repo_syncs/events.yaml b/paths/repo_syncs/events.yaml new file mode 100644 index 00000000..08b33fd5 --- /dev/null +++ b/paths/repo_syncs/events.yaml @@ -0,0 +1,49 @@ +summary: "Repository Syncs History" +description: |- + Get the history of a single Repo Sync. The history includes all imports and exports + performed by the Repo Sync. +operationId: repo_sync/events +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/repo_sync_id" +responses: + '200': + description: Successful response + content: + application/json: + schema: + type: array + items: + "$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" + Link: + "$ref": "../../headers.yaml#/Link" + Pagination: + "$ref": "../../headers.yaml#/Pagination" + '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"\ + -u USERNAME_OR_ACCESS_TOKEN +- lang: CLI v2 + source: |- + phrase repo_sync events \ + --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 new file mode 100644 index 00000000..cb0ef3a5 --- /dev/null +++ b/paths/repo_syncs/export.yaml @@ -0,0 +1,54 @@ +--- +summary: Export to code repository +description: |- + > Beta: this feature will change in the future. + + Export translations from Phrase Strings to repository provider according to the + .phrase.yml file within the code repository. + + *Export is done asynchronously and may take several seconds depending on the project size.* +operationId: repo_sync/export +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/repo_sync_id" +responses: + '200': + description: OK + content: + application/json: + schema: + type: object + title: repo_sync/export + properties: + message: + type: string + example: Export started + 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/45ef6789/export"\ + -u USERNAME_OR_ACCESS_TOKEN \ + -X POST \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase repo_sync export \ + --repo_sync_id \ + --access_token +x-cli-version: '2.24' diff --git a/paths/repo_syncs/import.yaml b/paths/repo_syncs/import.yaml new file mode 100644 index 00000000..7c74c1b0 --- /dev/null +++ b/paths/repo_syncs/import.yaml @@ -0,0 +1,54 @@ +--- +summary: Import from code repository +description: |- + > Beta: this feature will change in the future. + + Import translations from repository provider to Phrase Strings according to the .phrase.yml file + within the code repository. + + _Import is done asynchronously and may take several seconds depending on the project size._ +operationId: repo_sync/import +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/repo_sync_id" +responses: + '200': + description: OK + content: + application/json: + schema: + type: object + title: repo_sync/import + properties: + message: + type: string + example: Import started + 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/45ef6789/import"\ + -u USERNAME_OR_ACCESS_TOKEN \ + -X POST \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase repo_sync import \ + --repo_sync_id \ + --access_token +x-cli-version: '2.24' diff --git a/paths/repo_syncs/index.yaml b/paths/repo_syncs/index.yaml new file mode 100644 index 00000000..63d2f413 --- /dev/null +++ b/paths/repo_syncs/index.yaml @@ -0,0 +1,46 @@ +--- +summary: Get Repo Syncs +description: Lists all Repo Syncs from an account +operationId: repo_sync/list +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + "$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" + Link: + "$ref": "../../headers.yaml#/Link" + Pagination: + "$ref": "../../headers.yaml#/Pagination" + '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"\ + -u USERNAME_OR_ACCESS_TOKEN +- lang: CLI v2 + source: |- + phrase repo_sync list \ + --account_id abcd1234 \ + --access_token +x-cli-version: '2.24' diff --git a/paths/repo_syncs/show.yaml b/paths/repo_syncs/show.yaml new file mode 100644 index 00000000..7027808a --- /dev/null +++ b/paths/repo_syncs/show.yaml @@ -0,0 +1,42 @@ +--- +summary: Get a single Repo Sync +description: Shows a single Repo Sync setting. +operationId: repo_sync/show +tags: +- Repo Syncs +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/repo_sync_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" + '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"\ + -u USERNAME_OR_ACCESS_TOKEN +- lang: CLI v2 + source: |- + phrase repo_sync show \ + --id \ + --account_id abcd1234 \ + --access_token +x-cli-version: '2.24' diff --git a/schemas.yaml b/schemas.yaml index 875723f4..beb95984 100644 --- a/schemas.yaml +++ b/schemas.yaml @@ -164,3 +164,7 @@ schemas: "$ref": schemas/organization_job_template_details.yaml#/organization_job_template_details key_link: "$ref": schemas/key_link.yaml#/key_link + repo_sync: + "$ref": schemas/repo_sync.yaml#/repo_sync + repo_sync_event: + "$ref": schemas/repo_sync_event.yaml#/repo_sync_event diff --git a/schemas/repo_sync.yaml b/schemas/repo_sync.yaml new file mode 100644 index 00000000..738e03bd --- /dev/null +++ b/schemas/repo_sync.yaml @@ -0,0 +1,41 @@ +--- +repo_sync: + type: object + title: repo_sync + properties: + id: + type: string + project: + "$ref": "./project_short.yaml#/project_short" + provider: + type: string + enabled: + type: boolean + auto_import: + type: boolean + repo_name: + type: string + created_at: + type: string + format: date-time + last_import_at: + type: string + format: date-time + last_export_at: + type: string + format: date-time + example: + id: abcd1234cdef1234abcd1234cdef1234 + project: + id: abcd1234cdef1234abcd1234cdef1234 + name: My Android Project + main_format: xml + created_at: '2015-01-28T09:52:53Z' + updated_at: '2015-01-28T09:52:53Z' + provider: github + enabled: true + auto_import: true + repo_name: organization/repo + created_at: '2015-01-28T09:52:53Z' + last_import_at: '2015-01-28T09:52:53Z' + last_export_at: '2015-01-28T09:52:53Z' diff --git a/schemas/repo_sync_event.yaml b/schemas/repo_sync_event.yaml new file mode 100644 index 00000000..c8f48f76 --- /dev/null +++ b/schemas/repo_sync_event.yaml @@ -0,0 +1,35 @@ +--- +repo_sync_event: + type: object + title: repo_sync_event + properties: + event_type: + type: string + enum: [import, export] + created_at: + type: string + format: date-time + status: + type: string + enum: [running, success, failure] + pull_request_url: + type: string + description: URL of the pull request created on export + auto_import: + type: boolean + description: Whether the import was triggered by the repo push event + errors: + description: List of error messages, in case of failure + type: array + items: + anyOf: + - type: string + - type: object + example: + event_type: import + created_at: '2015-01-28T09:52:53Z' + status: failure + auto_import: true + errors: + - "Error message" + - "Error message"