Skip to content

Commit

Permalink
feat: Add reports locales endpoint to API [TSS-2439] (#465)
Browse files Browse the repository at this point in the history
* feat: Add reports locales endpoint to API [TSS-2439]

* fix to array response, adjust to locale_codes param

* change project/reports path to project/report
  • Loading branch information
forelabs authored Nov 28, 2023
1 parent f0dd1eb commit e03aa9f
Show file tree
Hide file tree
Showing 9 changed files with 461 additions and 0 deletions.
270 changes: 270 additions & 0 deletions doc/compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
{
"name": "Documents"
},
{
"name": "Figma Attachments"
},
{
"name": "Formats"
},
Expand Down Expand Up @@ -141,6 +144,9 @@
{
"name": "Releases"
},
{
"name": "Reports"
},
{
"name": "Search"
},
Expand Down Expand Up @@ -264,6 +270,13 @@
"tags": [
"Formats"
]
},
{
"name": "Figma Attachments",
"tags": [
"Figma attachments",
"Key's Figma attachments"
]
}
],
"components": {
Expand Down Expand Up @@ -1435,6 +1448,36 @@
}
]
},
"project_report": {
"type": "object",
"title": "project report",
"properties": {
"locales_count": {
"type": "integer"
},
"keys_count": {
"type": "integer"
},
"translations_count": {
"type": "integer"
},
"untranslated_keys_count": {
"type": "integer"
},
"unverified_translations_count": {
"type": "integer"
},
"reviewed_translations_count": {
"type": "integer"
},
"managed_words_count": {
"type": "integer"
},
"project": {
"$ref": "#/components/schemas/project_short"
}
}
},
"locale_preview": {
"type": "object",
"title": "locale_preview",
Expand Down Expand Up @@ -1552,6 +1595,54 @@
},
"example": null
},
"locale_report": {
"type": "object",
"title": "locale report",
"properties": {
"keys_count": {
"type": "integer"
},
"translated_translations_percentage": {
"type": "integer"
},
"unverified_translations_percentage": {
"type": "integer"
},
"reviewed_translations_percentage": {
"type": "integer"
},
"untranslated_keys_percentage": {
"type": "integer"
},
"completed_translations_count": {
"type": "integer"
},
"untranslated_keys_count": {
"type": "integer"
},
"unverified_translations_count": {
"type": "integer"
},
"reviewed_translations_count": {
"type": "integer"
},
"source_word_count": {
"type": "integer"
},
"word_count": {
"type": "integer"
},
"word_count_unverified": {
"type": "integer"
},
"word_count_missing": {
"type": "integer"
},
"locale": {
"$ref": "#/components/schemas/locale_preview"
}
}
},
"locale_details": {
"allOf": [
{
Expand Down Expand Up @@ -4188,6 +4279,15 @@
"type": "string"
}
},
"locale_codes": {
"in": "query",
"name": "locale_codes",
"description": "Locale Code",
"required": false,
"schema": {
"type": "string"
}
},
"locale_id": {
"in": "path",
"name": "locale_id",
Expand Down Expand Up @@ -4233,6 +4333,15 @@
"type": "string"
}
},
"tag": {
"in": "query",
"name": "tag",
"description": "tag",
"required": false,
"schema": {
"type": "string"
}
},
"page": {
"in": "query",
"name": "page",
Expand Down Expand Up @@ -4746,6 +4855,167 @@
"x-cli-version": "2.5"
}
},
"/projects/{project_id}/report": {
"get": {
"summary": "Get Project Report",
"description": "Get report of a single project.",
"operationId": "report/show",
"tags": [
"Reports"
],
"parameters": [
{
"$ref": "#/components/parameters/X-PhraseApp-OTP"
},
{
"$ref": "#/components/parameters/project_id"
},
{
"description": "specify the branch to use",
"example": "my-feature-branch",
"name": "branch",
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/project_report"
}
}
},
"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"
}
}
},
"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/projects/:project_id/report?branch=my-feature-branch\" \\\n -X GET \\\n -u USERNAME_OR_ACCESS_TOKEN"
},
{
"lang": "CLI v2",
"source": "phrase report show \\\n--project_id <project_id> \\\n--branch my-feature-branch \\\n--access_token <token>"
}
],
"x-cli-version": "2.13"
}
},
"/projects/{project_id}/report/locales": {
"get": {
"summary": "List Locale Reports",
"description": "List all locale reports for the given project",
"operationId": "report/locales/list",
"tags": [
"Reports"
],
"parameters": [
{
"$ref": "#/components/parameters/X-PhraseApp-OTP"
},
{
"$ref": "#/components/parameters/project_id"
},
{
"$ref": "#/components/parameters/page"
},
{
"$ref": "#/components/parameters/per_page"
},
{
"$ref": "#/components/parameters/locale_codes"
},
{
"$ref": "#/components/parameters/tag"
},
{
"description": "specify the branch to use",
"example": "my-feature-branch",
"name": "branch",
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/locale_report"
}
}
}
},
"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"
}
}
},
"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/projects/:project_id/report/locales?locale_codes[]=de&locale_codes[]=en&branch=my-feature-branch\" \\\n -X GET \\\n -u USERNAME_OR_ACCESS_TOKEN"
},
{
"lang": "CLI v2",
"source": "phrase report locales list \\\n--project_id <project_id> \\\n--branch my-feature-branch \\\n--locale_codes de \\\n--access_token <token>"
}
],
"x-cli-version": "2.13"
}
},
"/projects/{project_id}/figma_attachments": {
"get": {
"summary": "List Figma attachments",
Expand Down
6 changes: 6 additions & 0 deletions main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ tags:
- name: Comment Replies
- name: Distributions
- name: Documents
- name: Figma Attachments
- name: Formats
- name: GitHub Sync
- name: GitLab Sync
Expand Down Expand Up @@ -193,6 +194,7 @@ tags:
- name: Projects
- name: Quality
- name: Releases
- name: Reports
- name: Search
- name: Screenshot Markers
- name: Screenshots
Expand Down Expand Up @@ -311,6 +313,10 @@ x-tagGroups:
- name: Misc
tags:
- Formats
- name: Figma Attachments
tags:
- Figma attachments
- Key's Figma attachments

components:
securitySchemes:
Expand Down
14 changes: 14 additions & 0 deletions parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ term_id:
required: true
schema:
type: string
locale_codes:
in: query
name: locale_codes
description: Locale Code
required: false
schema:
type: string
locale_id:
in: path
name: locale_id
Expand Down Expand Up @@ -171,6 +178,13 @@ name:
required: true
schema:
type: string
tag:
in: query
name: tag
description: tag
required: false
schema:
type: string
page:
in: query
name: page
Expand Down
6 changes: 6 additions & 0 deletions paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"/projects/{project_id}/documents/{id}":
delete:
"$ref": "./paths/documents/destroy.yaml"
"/projects/{project_id}/report":
get:
"$ref": "./paths/reports/show.yaml"
"/projects/{project_id}/report/locales":
get:
"$ref": "./paths/reports/locales/index.yaml"
"/projects/{project_id}/figma_attachments":
get:
"$ref": "./paths/figma_attachments/index.yaml"
Expand Down
Loading

0 comments on commit e03aa9f

Please sign in to comment.