From b85b5e5a3c4f66fe6249c5e3a579ca373c5b24f1 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Mon, 10 Jul 2023 21:06:31 +0200 Subject: [PATCH 01/36] register Custom Metadata Labels to main yml --- main.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.yaml b/main.yaml index 3e06ee78..3dfaaafa 100644 --- a/main.yaml +++ b/main.yaml @@ -114,6 +114,7 @@ tags: - name: Comments - name: Comment Reactions - name: Comment Replies + - name: Custom Metadata Labels - name: Distributions - name: Documents - name: Figma Attachments @@ -266,6 +267,7 @@ x-tagGroups: - Translations - Uploads - Tags + - Custom Metadata Labels - Blacklisted Keys - Versions / History - name: Workflows From 882ef70ade036dade2a46f83fe473434bb191c89 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Tue, 11 Jul 2023 12:04:52 +0200 Subject: [PATCH 02/36] add custom metadata schema --- schemas/custom_metadata_label.yaml | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 schemas/custom_metadata_label.yaml diff --git a/schemas/custom_metadata_label.yaml b/schemas/custom_metadata_label.yaml new file mode 100644 index 00000000..3798a0e6 --- /dev/null +++ b/schemas/custom_metadata_label.yaml @@ -0,0 +1,42 @@ +--- +custom_metadata_label: + type: object + title: custom_metadata_label + properties: + id: + type: string + name: + type: string + description: + type: string + data_type: + type: string + user: + "$ref": "./user_preview.yaml#/user_preview" + account: + "$ref": "./account.yaml#/account" + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + example: + id: abcd1234cdef1234abcd1234cdef1234 + name: Character Age + description: Age of character in seconds + data_type: Text value + user: + id: abcd1234cdef1234abcd1234cdef1234 + username: joe.doe + name: Joe Doe + account: + id: abcd1234 + name: Company Account + slug: company_account + company: My Awesome Company + created_at: '2015-01-28T09:52:53Z' + updated_at: '2015-01-28T09:52:53Z' + company_logo_url: http://assets.example.com/company_logo.png + created_at: '2015-01-28T09:52:53Z' + updated_at: '2015-01-28T09:52:53Z' From 7f5fc17a98a11e9deaa9628cb0dd8f1fcb256c68 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Tue, 11 Jul 2023 12:05:20 +0200 Subject: [PATCH 03/36] add custom metadata index path --- paths.yaml | 3 ++ paths/custom_metadata_labels/index.yaml | 53 +++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 paths/custom_metadata_labels/index.yaml diff --git a/paths.yaml b/paths.yaml index e72e28b5..ae6d7871 100644 --- a/paths.yaml +++ b/paths.yaml @@ -47,6 +47,9 @@ "$ref": "./paths/styleguides/update.yaml" delete: "$ref": "./paths/styleguides/destroy.yaml" +"/accounts/{account_id}/custom_metadata_labels": + get: + "$ref": "./paths/custom_metadata_labels/index.yaml" "/accounts/{account_id}/invitations": get: "$ref": "./paths/invitations/index.yaml" diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml new file mode 100644 index 00000000..225a6cb7 --- /dev/null +++ b/paths/custom_metadata_labels/index.yaml @@ -0,0 +1,53 @@ +--- +summary: List custom_metadata_labels +description: List all custom_metadata_labels for an account. +operationId: custom_metadata_labels/list +tags: +- CustomMetadataLabels +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/id" +- "$ref": "../../parameters.yaml#/page" +- "$ref": "../../parameters.yaml#/per_page" +- 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": "../../schemas/custom_metadata_label.yaml#/custom_metadata_label" + 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" + '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/:id/custom_metadata_labels?branch=my-feature-branch" \ + -u USERNAME_OR_ACCESS_TOKEN +- lang: CLI v2 + source: |- + phrase custom_metadata_labels list \ + --id \ + --branch my-feature-branch \ + --access_token +x-cli-version: '2.5' From 6f2d259b08bb25f024d9233a86e4c664ed63d26f Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Tue, 11 Jul 2023 12:05:37 +0200 Subject: [PATCH 04/36] compile json --- doc/compiled.json | 137 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/doc/compiled.json b/doc/compiled.json index f7b9a545..42cd3681 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -60,6 +60,9 @@ { "name": "Comment Replies" }, + { + "name": "Custom Metadata Labels" + }, { "name": "Distributions" }, @@ -201,6 +204,7 @@ "Translations", "Uploads", "Tags", + "Custom Metadata Labels", "Blacklisted Keys", "Versions / History" ] @@ -5983,6 +5987,139 @@ "x-cli-version": "2.5" } }, + "/accounts/{account_id}/custom_metadata_labels": { + "get": { + "summary": "List custom_metadata_labels", + "description": "List all custom_metadata_labels for an account.", + "operationId": "custom_metadata_labels/list", + "tags": [ + "CustomMetadataLabels" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/id" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/per_page" + }, + { + "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": { + "type": "object", + "title": "custom_metadata_label", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "data_type": { + "type": "string" + }, + "user": { + "$ref": "#/components/schemas/user_preview" + }, + "account": { + "$ref": "#/components/schemas/account" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + }, + "example": { + "id": "abcd1234cdef1234abcd1234cdef1234", + "name": "Character Age", + "description": "Age of character in seconds", + "data_type": "Text value", + "user": { + "id": "abcd1234cdef1234abcd1234cdef1234", + "username": "joe.doe", + "name": "Joe Doe" + }, + "account": { + "id": "abcd1234", + "name": "Company Account", + "slug": "company_account", + "company": "My Awesome Company", + "created_at": "2015-01-28T09:52:53Z", + "updated_at": "2015-01-28T09:52:53Z", + "company_logo_url": "http://assets.example.com/company_logo.png" + }, + "created_at": "2015-01-28T09:52:53Z", + "updated_at": "2015-01-28T09:52:53Z" + } + } + } + } + }, + "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/accounts/:id/custom_metadata_labels?branch=my-feature-branch\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase custom_metadata_labels list \\\n--id \\\n--branch my-feature-branch \\\n--access_token " + } + ], + "x-cli-version": "2.5" + } + }, "/accounts/{account_id}/invitations": { "get": { "summary": "List invitations", From 43729e1c7d54b30dd033848c28cc31a67a5c22e8 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 12 Jul 2023 09:24:52 +0200 Subject: [PATCH 05/36] add enum for data_type --- doc/compiled.json | 11 ++++++++++- schemas/custom_metadata_label.yaml | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/compiled.json b/doc/compiled.json index 42cd3681..63f8d51f 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6039,7 +6039,16 @@ "type": "string" }, "data_type": { - "type": "string" + "type": "string", + "enum": [ + "boolean", + "date", + "link", + "multi_select", + "number", + "single_select", + "text" + ] }, "user": { "$ref": "#/components/schemas/user_preview" diff --git a/schemas/custom_metadata_label.yaml b/schemas/custom_metadata_label.yaml index 3798a0e6..a63839df 100644 --- a/schemas/custom_metadata_label.yaml +++ b/schemas/custom_metadata_label.yaml @@ -11,6 +11,14 @@ custom_metadata_label: type: string data_type: type: string + enum: + - boolean + - date + - link + - multi_select + - number + - single_select + - text user: "$ref": "./user_preview.yaml#/user_preview" account: From 037c904775a82b68da9303bbbe99bf8ae5d051bf Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 12 Jul 2023 10:08:58 +0200 Subject: [PATCH 06/36] specify 2.9 cli version --- doc/compiled.json | 2 +- paths/custom_metadata_labels/index.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 63f8d51f..f2a8b1e6 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6126,7 +6126,7 @@ "source": "phrase custom_metadata_labels list \\\n--id \\\n--branch my-feature-branch \\\n--access_token " } ], - "x-cli-version": "2.5" + "x-cli-version": "2.9" } }, "/accounts/{account_id}/invitations": { diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index 225a6cb7..0969fc22 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -50,4 +50,4 @@ x-code-samples: --id \ --branch my-feature-branch \ --access_token -x-cli-version: '2.5' +x-cli-version: '2.9' From 6b554f7722b49c6bdf6bebabc01f7ff67862d4aa Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 12 Jul 2023 10:14:19 +0200 Subject: [PATCH 07/36] generalize custom metadata tag --- main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.yaml b/main.yaml index 3dfaaafa..7bb6f6fd 100644 --- a/main.yaml +++ b/main.yaml @@ -114,7 +114,7 @@ tags: - name: Comments - name: Comment Reactions - name: Comment Replies - - name: Custom Metadata Labels + - name: Custom Metadata - name: Distributions - name: Documents - name: Figma Attachments From 08891f7f9cd9fd4a2e712e5bf90e88e57930a299 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 12 Jul 2023 14:09:50 +0200 Subject: [PATCH 08/36] correct path for index route --- doc/compiled.json | 8 ++++---- paths/custom_metadata_labels/index.yaml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index f2a8b1e6..cc09fba1 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -61,7 +61,7 @@ "name": "Comment Replies" }, { - "name": "Custom Metadata Labels" + "name": "Custom Metadata" }, { "name": "Distributions" @@ -6000,7 +6000,7 @@ "$ref": "#/components/parameters/X-PhraseApp-OTP" }, { - "$ref": "#/components/parameters/id" + "$ref": "#/components/parameters/account_id" }, { "$ref": "#/components/parameters/page" @@ -6119,11 +6119,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:id/custom_metadata_labels?branch=my-feature-branch\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?branch=my-feature-branch\" \\\n -u USERNAME_OR_ACCESS_TOKEN" }, { "lang": "CLI v2", - "source": "phrase custom_metadata_labels list \\\n--id \\\n--branch my-feature-branch \\\n--access_token " + "source": "phrase custom_metadata_labels list \\\n--account_id \\\n--branch my-feature-branch \\\n--access_token " } ], "x-cli-version": "2.9" diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index 0969fc22..430f6525 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -6,7 +6,7 @@ tags: - CustomMetadataLabels parameters: - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" -- "$ref": "../../parameters.yaml#/id" +- "$ref": "../../parameters.yaml#/account_id" - "$ref": "../../parameters.yaml#/page" - "$ref": "../../parameters.yaml#/per_page" - description: specify the branch to use @@ -42,12 +42,12 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:id/custom_metadata_labels?branch=my-feature-branch" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?branch=my-feature-branch" \ -u USERNAME_OR_ACCESS_TOKEN - lang: CLI v2 source: |- phrase custom_metadata_labels list \ - --id \ + --account_id \ --branch my-feature-branch \ --access_token x-cli-version: '2.9' From dc316383259cfb38acfce1ca552411775e5e656c Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 12 Jul 2023 14:13:19 +0200 Subject: [PATCH 09/36] update path --- paths.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paths.yaml b/paths.yaml index ae6d7871..2809746f 100644 --- a/paths.yaml +++ b/paths.yaml @@ -47,7 +47,7 @@ "$ref": "./paths/styleguides/update.yaml" delete: "$ref": "./paths/styleguides/destroy.yaml" -"/accounts/{account_id}/custom_metadata_labels": +"/accounts/{account_id}/custom_metadata/labels": get: "$ref": "./paths/custom_metadata_labels/index.yaml" "/accounts/{account_id}/invitations": From aedb4e60252fcf426084b51c732191253f0b3020 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 12 Jul 2023 14:19:01 +0200 Subject: [PATCH 10/36] update compiled json --- doc/compiled.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/compiled.json b/doc/compiled.json index cc09fba1..199ed758 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -5987,7 +5987,7 @@ "x-cli-version": "2.5" } }, - "/accounts/{account_id}/custom_metadata_labels": { + "/accounts/{account_id}/custom_metadata/labels": { "get": { "summary": "List custom_metadata_labels", "description": "List all custom_metadata_labels for an account.", From 63c52fd4c67eab605f40c59b933ba85f6aa9b5d0 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 12 Jul 2023 15:27:20 +0200 Subject: [PATCH 11/36] align Custom Metadata tag usage --- doc/compiled.json | 2 +- paths/custom_metadata_labels/index.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 199ed758..3a8427b9 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -5993,7 +5993,7 @@ "description": "List all custom_metadata_labels for an account.", "operationId": "custom_metadata_labels/list", "tags": [ - "CustomMetadataLabels" + "Custom Metadata" ], "parameters": [ { diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index 430f6525..9d4148ce 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -3,7 +3,7 @@ summary: List custom_metadata_labels description: List all custom_metadata_labels for an account. operationId: custom_metadata_labels/list tags: -- CustomMetadataLabels +- Custom Metadata parameters: - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" - "$ref": "../../parameters.yaml#/account_id" From 8bb7161e13b653dc2ff127eb96307b2d46a0aaf4 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 13 Jul 2023 10:58:29 +0200 Subject: [PATCH 12/36] add project ids param to labels index --- doc/compiled.json | 14 ++++++++++++++ paths/custom_metadata_labels/index.yaml | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/doc/compiled.json b/doc/compiled.json index 3a8427b9..52059ef1 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6016,6 +6016,20 @@ "schema": { "type": "string" } + }, + { + "description": "ids of projects that the labels belong to", + "example": [ + "abcd1234cdef1234abcd1234cdef1234" + ], + "name": "project_ids", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } } ], "responses": { diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index 9d4148ce..bf3feedf 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -15,6 +15,15 @@ parameters: in: query schema: type: string +- description: ids of projects that the labels belong to + example: + - abcd1234cdef1234abcd1234cdef1234 + name: project_ids + in: query + schema: + type: array + items: + type: string responses: '200': description: OK From 3685a03381e2abb92f396ddc53345418d24e5d84 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 13 Jul 2023 11:19:58 +0200 Subject: [PATCH 13/36] add sort and order to metadata label index --- doc/compiled.json | 18 ++++++++++++++++++ paths/custom_metadata_labels/index.yaml | 12 ++++++++++++ 2 files changed, 30 insertions(+) diff --git a/doc/compiled.json b/doc/compiled.json index 52059ef1..895d7199 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6030,6 +6030,24 @@ "type": "string" } } + }, + { + "description": "Sort criteria. Can be one of: key_name, created_at, updated_at.", + "example": "updated_at", + "name": "sort", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "Order direction. Can be one of: asc, desc.", + "example": "desc", + "name": "order", + "in": "query", + "schema": { + "type": "string" + } } ], "responses": { diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index bf3feedf..4b0832d6 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -24,6 +24,18 @@ parameters: type: array items: type: string +- description: 'Sort criteria. Can be one of: key_name, created_at, updated_at.' + example: updated_at + name: sort + in: query + schema: + type: string +- description: 'Order direction. Can be one of: asc, desc.' + example: desc + name: order + in: query + schema: + type: string responses: '200': description: OK From d4a742f46e479d4c3ca5e2d5a5ec2c6cfc7ca52d Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 13 Jul 2023 12:00:31 +0200 Subject: [PATCH 14/36] update url params example --- doc/compiled.json | 4 ++-- paths/custom_metadata_labels/index.yaml | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 895d7199..206557eb 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6151,11 +6151,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?branch=my-feature-branch\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?branch=my-feature-branch&page=1&per_page=10&project_ids=%5B1,2,3%5D&sort=created_at&order=desc\" \\\n -u USERNAME_OR_ACCESS_TOKEN" }, { "lang": "CLI v2", - "source": "phrase custom_metadata_labels list \\\n--account_id \\\n--branch my-feature-branch \\\n--access_token " + "source": "phrase custom_metadata_labels list \\\n--account_id \\\n--branch my-feature-branch \\\n--page 1 \\\n--per_page 10 \\\n--project_ids [1,2,3] \\\n--sort created_at \\\n--order desc \\\n--access_token " } ], "x-cli-version": "2.9" diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index 4b0832d6..1162c46c 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -63,12 +63,17 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?branch=my-feature-branch" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?branch=my-feature-branch&page=1&per_page=10&project_ids=%5B1,2,3%5D&sort=created_at&order=desc" \ -u USERNAME_OR_ACCESS_TOKEN - lang: CLI v2 source: |- phrase custom_metadata_labels list \ --account_id \ --branch my-feature-branch \ + --page 1 \ + --per_page 10 \ + --project_ids [1,2,3] \ + --sort created_at \ + --order desc \ --access_token x-cli-version: '2.9' From e84fe7194524aed3463e9b21da42540b2eaa6d7b Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 13 Jul 2023 12:55:50 +0200 Subject: [PATCH 15/36] make summary and description more clear and concise --- doc/compiled.json | 4 ++-- paths/custom_metadata_labels/index.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 206557eb..c663e35d 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -5989,8 +5989,8 @@ }, "/accounts/{account_id}/custom_metadata/labels": { "get": { - "summary": "List custom_metadata_labels", - "description": "List all custom_metadata_labels for an account.", + "summary": "List labels", + "description": "List all custom metadata labels for an account.", "operationId": "custom_metadata_labels/list", "tags": [ "Custom Metadata" diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index 1162c46c..2b48c7f3 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -1,6 +1,6 @@ --- -summary: List custom_metadata_labels -description: List all custom_metadata_labels for an account. +summary: List labels +description: List all custom metadata labels for an account. operationId: custom_metadata_labels/list tags: - Custom Metadata From 218eeb66ba390037e840799a7e66715a84a81a72 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 13 Jul 2023 13:00:57 +0200 Subject: [PATCH 16/36] add endpoint availability notice --- doc/compiled.json | 2 +- paths/custom_metadata_labels/index.yaml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index c663e35d..1a228361 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -5990,7 +5990,7 @@ "/accounts/{account_id}/custom_metadata/labels": { "get": { "summary": "List labels", - "description": "List all custom metadata labels for an account.", + "description": "List all custom metadata labels for an account.\n\nThis endpoint is only available to accounts with advanced plans or above.\n", "operationId": "custom_metadata_labels/list", "tags": [ "Custom Metadata" diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index 2b48c7f3..068f3ff1 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -1,6 +1,9 @@ --- summary: List labels -description: List all custom metadata labels for an account. +description: | + List all custom metadata labels for an account. + + This endpoint is only available to accounts with advanced plans or above. operationId: custom_metadata_labels/list tags: - Custom Metadata From 033db1c1006b18495de2df97123fcbb39359470a Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 13 Jul 2023 14:54:11 +0200 Subject: [PATCH 17/36] remove account ref from schema --- doc/compiled.json | 3 --- schemas/custom_metadata_label.yaml | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 1a228361..505ceef8 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6085,9 +6085,6 @@ "user": { "$ref": "#/components/schemas/user_preview" }, - "account": { - "$ref": "#/components/schemas/account" - }, "created_at": { "type": "string", "format": "date-time" diff --git a/schemas/custom_metadata_label.yaml b/schemas/custom_metadata_label.yaml index a63839df..be4da940 100644 --- a/schemas/custom_metadata_label.yaml +++ b/schemas/custom_metadata_label.yaml @@ -21,8 +21,6 @@ custom_metadata_label: - text user: "$ref": "./user_preview.yaml#/user_preview" - account: - "$ref": "./account.yaml#/account" created_at: type: string format: date-time @@ -38,13 +36,5 @@ custom_metadata_label: id: abcd1234cdef1234abcd1234cdef1234 username: joe.doe name: Joe Doe - account: - id: abcd1234 - name: Company Account - slug: company_account - company: My Awesome Company - created_at: '2015-01-28T09:52:53Z' - updated_at: '2015-01-28T09:52:53Z' - company_logo_url: http://assets.example.com/company_logo.png created_at: '2015-01-28T09:52:53Z' updated_at: '2015-01-28T09:52:53Z' From da0c66cceca639d093c393898ef849338c44b58d Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 13 Jul 2023 15:47:56 +0200 Subject: [PATCH 18/36] add projects to custom metadata label schema --- doc/compiled.json | 125 ++++++++++++++++------------- schemas.yaml | 2 + schemas/custom_metadata_label.yaml | 10 +++ 3 files changed, 79 insertions(+), 58 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 505ceef8..e8d71ee5 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -698,6 +698,72 @@ } } }, + "custom_metadata_label": { + "type": "object", + "title": "custom_metadata_label", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "data_type": { + "type": "string", + "enum": [ + "boolean", + "date", + "link", + "multi_select", + "number", + "single_select", + "text" + ] + }, + "user": { + "$ref": "#/components/schemas/user_preview" + }, + "projects": { + "type": "array", + "items": { + "$ref": "#/components/schemas/project_short" + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + }, + "example": { + "id": "abcd1234cdef1234abcd1234cdef1234", + "name": "Character Age", + "description": "Age of character in seconds", + "data_type": "Text value", + "user": { + "id": "abcd1234cdef1234abcd1234cdef1234", + "username": "joe.doe", + "name": "Joe Doe" + }, + "created_at": "2015-01-28T09:52:53Z", + "updated_at": "2015-01-28T09:52:53Z", + "projects": [ + { + "id": "abcd1234cdef1234abcd1234cdef1234", + "name": "My Android Project", + "main_format": "xml", + "created_at": "2015-01-28T09:52:53Z", + "updated_at": "2015-01-28T09:52:53Z" + } + ] + } + }, "key_preview": { "type": "object", "title": "key_preview", @@ -6058,64 +6124,7 @@ "schema": { "type": "array", "items": { - "type": "object", - "title": "custom_metadata_label", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "data_type": { - "type": "string", - "enum": [ - "boolean", - "date", - "link", - "multi_select", - "number", - "single_select", - "text" - ] - }, - "user": { - "$ref": "#/components/schemas/user_preview" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - }, - "example": { - "id": "abcd1234cdef1234abcd1234cdef1234", - "name": "Character Age", - "description": "Age of character in seconds", - "data_type": "Text value", - "user": { - "id": "abcd1234cdef1234abcd1234cdef1234", - "username": "joe.doe", - "name": "Joe Doe" - }, - "account": { - "id": "abcd1234", - "name": "Company Account", - "slug": "company_account", - "company": "My Awesome Company", - "created_at": "2015-01-28T09:52:53Z", - "updated_at": "2015-01-28T09:52:53Z", - "company_logo_url": "http://assets.example.com/company_logo.png" - }, - "created_at": "2015-01-28T09:52:53Z", - "updated_at": "2015-01-28T09:52:53Z" - } + "$ref": "#/components/schemas/custom_metadata_label" } } } diff --git a/schemas.yaml b/schemas.yaml index 41665d94..67175bf8 100644 --- a/schemas.yaml +++ b/schemas.yaml @@ -20,6 +20,8 @@ schemas: "$ref": schemas/comment.yaml#/comment comment_reaction: "$ref": schemas/comment_reaction.yaml#/comment_reaction + custom_metadata_label: + "$ref": schemas/custom_metadata_label.yaml#/custom_metadata_label key_preview: "$ref": schemas/key_preview.yaml#/key_preview affected_count: diff --git a/schemas/custom_metadata_label.yaml b/schemas/custom_metadata_label.yaml index be4da940..406a4dd6 100644 --- a/schemas/custom_metadata_label.yaml +++ b/schemas/custom_metadata_label.yaml @@ -21,6 +21,10 @@ custom_metadata_label: - text user: "$ref": "./user_preview.yaml#/user_preview" + projects: + type: array + items: + "$ref": "./project_short.yaml#/project_short" created_at: type: string format: date-time @@ -38,3 +42,9 @@ custom_metadata_label: name: Joe Doe created_at: '2015-01-28T09:52:53Z' updated_at: '2015-01-28T09:52:53Z' + projects: + - id: abcd1234cdef1234abcd1234cdef1234 + name: My Android Project + main_format: xml + created_at: '2015-01-28T09:52:53Z' + updated_at: '2015-01-28T09:52:53Z' From e22dae673420a4105562fab9fa011e86d9ed8543 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 30 Nov 2023 10:30:57 +0100 Subject: [PATCH 19/36] update label -> property --- doc/compiled.json | 18 +++++++++--------- main.yaml | 2 +- paths.yaml | 4 ++-- paths/custom_metadata_labels/index.yaml | 12 ++++++------ schemas.yaml | 4 ++-- ...abel.yaml => custom_metadata_property.yaml} | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) rename schemas/{custom_metadata_label.yaml => custom_metadata_property.yaml} (94%) diff --git a/doc/compiled.json b/doc/compiled.json index e8d71ee5..c4939186 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -204,7 +204,7 @@ "Translations", "Uploads", "Tags", - "Custom Metadata Labels", + "Custom Metadata Properties", "Blacklisted Keys", "Versions / History" ] @@ -698,9 +698,9 @@ } } }, - "custom_metadata_label": { + "custom_metadata_property": { "type": "object", - "title": "custom_metadata_label", + "title": "custom_metadata_property", "properties": { "id": { "type": "string" @@ -6055,9 +6055,9 @@ }, "/accounts/{account_id}/custom_metadata/labels": { "get": { - "summary": "List labels", - "description": "List all custom metadata labels for an account.\n\nThis endpoint is only available to accounts with advanced plans or above.\n", - "operationId": "custom_metadata_labels/list", + "summary": "List custom metadata properties", + "description": "List all custom metadata properties for an account.\n\nThis endpoint is only available to accounts with advanced plans or above.\n", + "operationId": "custom_metadata_properties/list", "tags": [ "Custom Metadata" ], @@ -6084,7 +6084,7 @@ } }, { - "description": "ids of projects that the labels belong to", + "description": "ids of projects that the properties belong to", "example": [ "abcd1234cdef1234abcd1234cdef1234" ], @@ -6124,7 +6124,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/custom_metadata_label" + "$ref": "#/components/schemas/custom_metadata_properties" } } } @@ -6161,7 +6161,7 @@ }, { "lang": "CLI v2", - "source": "phrase custom_metadata_labels list \\\n--account_id \\\n--branch my-feature-branch \\\n--page 1 \\\n--per_page 10 \\\n--project_ids [1,2,3] \\\n--sort created_at \\\n--order desc \\\n--access_token " + "source": "phrase custom_metadata_properties list \\\n--account_id \\\n--branch my-feature-branch \\\n--page 1 \\\n--per_page 10 \\\n--project_ids [1,2,3] \\\n--sort created_at \\\n--order desc \\\n--access_token " } ], "x-cli-version": "2.9" diff --git a/main.yaml b/main.yaml index 7bb6f6fd..622f314e 100644 --- a/main.yaml +++ b/main.yaml @@ -267,7 +267,7 @@ x-tagGroups: - Translations - Uploads - Tags - - Custom Metadata Labels + - Custom Metadata Properties - Blacklisted Keys - Versions / History - name: Workflows diff --git a/paths.yaml b/paths.yaml index 2809746f..de07f457 100644 --- a/paths.yaml +++ b/paths.yaml @@ -47,9 +47,9 @@ "$ref": "./paths/styleguides/update.yaml" delete: "$ref": "./paths/styleguides/destroy.yaml" -"/accounts/{account_id}/custom_metadata/labels": +"/accounts/{account_id}/custom_metadata/properties": get: - "$ref": "./paths/custom_metadata_labels/index.yaml" + "$ref": "./paths/custom_metadata_properties/index.yaml" "/accounts/{account_id}/invitations": get: "$ref": "./paths/invitations/index.yaml" diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_labels/index.yaml index 068f3ff1..25be7c96 100644 --- a/paths/custom_metadata_labels/index.yaml +++ b/paths/custom_metadata_labels/index.yaml @@ -1,10 +1,10 @@ --- -summary: List labels +summary: List properties description: | - List all custom metadata labels for an account. + List all custom metadata properties for an account. This endpoint is only available to accounts with advanced plans or above. -operationId: custom_metadata_labels/list +operationId: custom_metadata_properties/list tags: - Custom Metadata parameters: @@ -18,7 +18,7 @@ parameters: in: query schema: type: string -- description: ids of projects that the labels belong to +- description: ids of projects that the properties belong to example: - abcd1234cdef1234abcd1234cdef1234 name: project_ids @@ -47,7 +47,7 @@ responses: schema: type: array items: - "$ref": "../../schemas/custom_metadata_label.yaml#/custom_metadata_label" + "$ref": "../../schemas/custom_metadata_property.yaml#/custom_metadata_property" headers: X-Rate-Limit-Limit: "$ref": "../../headers.yaml#/X-Rate-Limit-Limit" @@ -70,7 +70,7 @@ x-code-samples: -u USERNAME_OR_ACCESS_TOKEN - lang: CLI v2 source: |- - phrase custom_metadata_labels list \ + phrase custom_metadata_properties list \ --account_id \ --branch my-feature-branch \ --page 1 \ diff --git a/schemas.yaml b/schemas.yaml index 67175bf8..6b235794 100644 --- a/schemas.yaml +++ b/schemas.yaml @@ -20,8 +20,8 @@ schemas: "$ref": schemas/comment.yaml#/comment comment_reaction: "$ref": schemas/comment_reaction.yaml#/comment_reaction - custom_metadata_label: - "$ref": schemas/custom_metadata_label.yaml#/custom_metadata_label + custom_metadata_property: + "$ref": schemas/custom_metadata_property.yaml#/custom_metadata_property key_preview: "$ref": schemas/key_preview.yaml#/key_preview affected_count: diff --git a/schemas/custom_metadata_label.yaml b/schemas/custom_metadata_property.yaml similarity index 94% rename from schemas/custom_metadata_label.yaml rename to schemas/custom_metadata_property.yaml index 406a4dd6..7e4ece4f 100644 --- a/schemas/custom_metadata_label.yaml +++ b/schemas/custom_metadata_property.yaml @@ -1,7 +1,7 @@ --- -custom_metadata_label: +custom_metadata_property: type: object - title: custom_metadata_label + title: custom_metadata_property properties: id: type: string From 9c0a1213c914c223284196d9a920a7d0ec1d34ed Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 30 Nov 2023 10:34:43 +0100 Subject: [PATCH 20/36] rename CM paths folder --- .../index.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename paths/{custom_metadata_labels => custom_metadata_properties}/index.yaml (100%) diff --git a/paths/custom_metadata_labels/index.yaml b/paths/custom_metadata_properties/index.yaml similarity index 100% rename from paths/custom_metadata_labels/index.yaml rename to paths/custom_metadata_properties/index.yaml From a56a2580acabcdf602762056dd99c149cc2b26da Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 30 Nov 2023 11:30:16 +0100 Subject: [PATCH 21/36] lint --- doc/compiled.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index c4939186..e3f20dd4 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6053,9 +6053,9 @@ "x-cli-version": "2.5" } }, - "/accounts/{account_id}/custom_metadata/labels": { + "/accounts/{account_id}/custom_metadata/properties": { "get": { - "summary": "List custom metadata properties", + "summary": "List properties", "description": "List all custom metadata properties for an account.\n\nThis endpoint is only available to accounts with advanced plans or above.\n", "operationId": "custom_metadata_properties/list", "tags": [ @@ -6124,7 +6124,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/custom_metadata_properties" + "$ref": "#/components/schemas/custom_metadata_property" } } } From 001effcdd5012e79d8402977362d4140f27dd702 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 30 Nov 2023 15:06:46 +0100 Subject: [PATCH 22/36] fix parameter definitions --- doc/compiled.json | 51 ++++++++++----------- parameters.yaml | 8 ++++ paths.yaml | 2 +- paths/custom_metadata_properties/index.yaml | 28 ++++------- schemas/custom_metadata_property.yaml | 1 + 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index e3f20dd4..2788f64d 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -720,6 +720,7 @@ "multi_select", "number", "single_select", + "string", "text" ] }, @@ -4214,6 +4215,16 @@ "type": "string" } }, + "data_type": { + "in": "query", + "name": "data_type", + "description": "Data Type of Custom Metadata Property", + "required": false, + "schema": { + "type": "string" + }, + "example": "boolean" + }, "query_account_id": { "in": "query", "name": "account_id", @@ -6053,7 +6064,7 @@ "x-cli-version": "2.5" } }, - "/accounts/{account_id}/custom_metadata/properties": { + "/accounts/{account_id}/custom_metadata/labels": { "get": { "summary": "List properties", "description": "List all custom metadata properties for an account.\n\nThis endpoint is only available to accounts with advanced plans or above.\n", @@ -6066,39 +6077,27 @@ "$ref": "#/components/parameters/X-PhraseApp-OTP" }, { - "$ref": "#/components/parameters/account_id" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/per_page" - }, - { - "description": "specify the branch to use", - "example": "my-feature-branch", - "name": "branch", - "in": "query", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/data_type" }, { - "description": "ids of projects that the properties belong to", + "description": "id of project that the properties belong to", "example": [ "abcd1234cdef1234abcd1234cdef1234" ], - "name": "project_ids", + "name": "project_id", "in": "query", "schema": { - "type": "array", - "items": { - "type": "string" - } + "type": "string" } }, { - "description": "Sort criteria. Can be one of: key_name, created_at, updated_at.", + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/per_page" + }, + { + "description": "Sort criteria. Can be one of: name, data_type, created_at.", "example": "updated_at", "name": "sort", "in": "query", @@ -6157,11 +6156,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?branch=my-feature-branch&page=1&per_page=10&project_ids=%5B1,2,3%5D&sort=created_at&order=desc\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?data_type=boolean&project_id=1&page=1&per_page=10&sort=created_at&order=desc\" \\\n -u USERNAME_OR_ACCESS_TOKEN" }, { "lang": "CLI v2", - "source": "phrase custom_metadata_properties list \\\n--account_id \\\n--branch my-feature-branch \\\n--page 1 \\\n--per_page 10 \\\n--project_ids [1,2,3] \\\n--sort created_at \\\n--order desc \\\n--access_token " + "source": "phrase custom_metadata_properties list \\\n--account_id \\\n--data_type boolean \\\n--project_id 1 \\\n--page 1 \\\n--per_page 10 \\\n--sort created_at \\\n--order desc \\\n--access_token " } ], "x-cli-version": "2.9" diff --git a/parameters.yaml b/parameters.yaml index 875c1426..56841ce6 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -31,6 +31,14 @@ account_id: required: true schema: type: string +data_type: + in: query + name: data_type + description: Data Type of Custom Metadata Property + required: false + schema: + type: string + example: boolean query_account_id: in: query name: account_id diff --git a/paths.yaml b/paths.yaml index de07f457..82b59fa2 100644 --- a/paths.yaml +++ b/paths.yaml @@ -47,7 +47,7 @@ "$ref": "./paths/styleguides/update.yaml" delete: "$ref": "./paths/styleguides/destroy.yaml" -"/accounts/{account_id}/custom_metadata/properties": +"/accounts/{account_id}/custom_metadata/labels": get: "$ref": "./paths/custom_metadata_properties/index.yaml" "/accounts/{account_id}/invitations": diff --git a/paths/custom_metadata_properties/index.yaml b/paths/custom_metadata_properties/index.yaml index 25be7c96..1041151e 100644 --- a/paths/custom_metadata_properties/index.yaml +++ b/paths/custom_metadata_properties/index.yaml @@ -9,25 +9,17 @@ tags: - Custom Metadata parameters: - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" -- "$ref": "../../parameters.yaml#/account_id" -- "$ref": "../../parameters.yaml#/page" -- "$ref": "../../parameters.yaml#/per_page" -- description: specify the branch to use - example: my-feature-branch - name: branch - in: query - schema: - type: string -- description: ids of projects that the properties belong to +- "$ref": "../../parameters.yaml#/data_type" +- description: id of project that the properties belong to example: - abcd1234cdef1234abcd1234cdef1234 - name: project_ids + name: project_id in: query schema: - type: array - items: - type: string -- description: 'Sort criteria. Can be one of: key_name, created_at, updated_at.' + type: string +- "$ref": "../../parameters.yaml#/page" +- "$ref": "../../parameters.yaml#/per_page" +- description: 'Sort criteria. Can be one of: name, data_type, created_at.' example: updated_at name: sort in: query @@ -66,16 +58,16 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?branch=my-feature-branch&page=1&per_page=10&project_ids=%5B1,2,3%5D&sort=created_at&order=desc" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?data_type=boolean&project_id=1&page=1&per_page=10&sort=created_at&order=desc" \ -u USERNAME_OR_ACCESS_TOKEN - lang: CLI v2 source: |- phrase custom_metadata_properties list \ --account_id \ - --branch my-feature-branch \ + --data_type boolean \ + --project_id 1 \ --page 1 \ --per_page 10 \ - --project_ids [1,2,3] \ --sort created_at \ --order desc \ --access_token diff --git a/schemas/custom_metadata_property.yaml b/schemas/custom_metadata_property.yaml index 7e4ece4f..43fba90c 100644 --- a/schemas/custom_metadata_property.yaml +++ b/schemas/custom_metadata_property.yaml @@ -18,6 +18,7 @@ custom_metadata_property: - multi_select - number - single_select + - string - text user: "$ref": "./user_preview.yaml#/user_preview" From b56d3289eb3e1b254f1039a3620a0ef9397a74c5 Mon Sep 17 00:00:00 2001 From: anthonyshchang <108525179+anthonyshchang@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:45:23 +0100 Subject: [PATCH 23/36] feat(api): Add show API endpoint for custom_metadata_labels (#359) * add paths for custom metadata show * align tag * make summary and description more clear and concise * fix path with namespace * specify version 2.9 * update compiled json * change from label to property for consistency * fix merge conflicts * remove unused branch param * compile docs --------- Co-authored-by: Matias Alvarez --- doc/compiled.json | 64 ++++++++++++++++++++++ paths.yaml | 3 + paths/custom_metadata_properties/show.yaml | 42 ++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 paths/custom_metadata_properties/show.yaml diff --git a/doc/compiled.json b/doc/compiled.json index 2788f64d..6016dcee 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6166,6 +6166,70 @@ "x-cli-version": "2.9" } }, + "/accounts/{account_id}/custom_metadata/labels/{id}": { + "get": { + "summary": "Get a single property", + "description": "Get details of a single custom property.", + "operationId": "custom_metadata_property/show", + "tags": [ + "Custom Metadata" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/custom_metadata_property" + } + } + }, + "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/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase custom_metadata_labels show \\\n--account_id \\\n--id \\\n--access_token " + } + ], + "x-cli-version": "2.9" + } + }, "/accounts/{account_id}/invitations": { "get": { "summary": "List invitations", diff --git a/paths.yaml b/paths.yaml index 82b59fa2..b5457407 100644 --- a/paths.yaml +++ b/paths.yaml @@ -50,6 +50,9 @@ "/accounts/{account_id}/custom_metadata/labels": get: "$ref": "./paths/custom_metadata_properties/index.yaml" +"/accounts/{account_id}/custom_metadata/labels/{id}": + get: + "$ref": "./paths/custom_metadata_properties/show.yaml" "/accounts/{account_id}/invitations": get: "$ref": "./paths/invitations/index.yaml" diff --git a/paths/custom_metadata_properties/show.yaml b/paths/custom_metadata_properties/show.yaml new file mode 100644 index 00000000..5bbdc2b8 --- /dev/null +++ b/paths/custom_metadata_properties/show.yaml @@ -0,0 +1,42 @@ +--- +summary: Get a single property +description: Get details of a single custom property. +operationId: custom_metadata_property/show +tags: +- Custom Metadata +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/id" +responses: + '200': + description: OK + content: + application/json: + schema: + "$ref": "../../schemas/custom_metadata_property.yaml#/custom_metadata_property" + 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/custom_metadata/labels/:id" \ + -u USERNAME_OR_ACCESS_TOKEN +- lang: CLI v2 + source: |- + phrase custom_metadata_labels show \ + --account_id \ + --id \ + --access_token +x-cli-version: '2.9' From d4b469d3318dd89cf6bcbe74ba0f826a41a13a33 Mon Sep 17 00:00:00 2001 From: anthonyshchang <108525179+anthonyshchang@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:56:31 +0100 Subject: [PATCH 24/36] feat: add CM api update (#475) * wip * add name and description * correct cli commands * add create api doc for CM properties (#476) * compile docs --- doc/compiled.json | 251 ++++++++++++++++++- paths.yaml | 4 + paths/custom_metadata_properties/create.yaml | 83 ++++++ paths/custom_metadata_properties/update.yaml | 80 ++++++ schemas/custom_metadata_property.yaml | 15 +- 5 files changed, 427 insertions(+), 6 deletions(-) create mode 100644 paths/custom_metadata_properties/create.yaml create mode 100644 paths/custom_metadata_properties/update.yaml diff --git a/doc/compiled.json b/doc/compiled.json index 6016dcee..5ba57aaa 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -733,6 +733,12 @@ "$ref": "#/components/schemas/project_short" } }, + "value_options": { + "type": "array", + "items": { + "type": "string" + } + }, "created_at": { "type": "string", "format": "date-time" @@ -744,9 +750,9 @@ }, "example": { "id": "abcd1234cdef1234abcd1234cdef1234", - "name": "Character Age", - "description": "Age of character in seconds", - "data_type": "Text value", + "name": "Nuts", + "description": "A healthy snack for all ages", + "data_type": "multi_select", "user": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", @@ -762,6 +768,11 @@ "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z" } + ], + "value_options": [ + "apple", + "banana", + "coconut" ] } }, @@ -6228,6 +6239,240 @@ } ], "x-cli-version": "2.9" + }, + "post": { + "summary": "Create a property", + "description": "Create a new custom metadata property.", + "operationId": "custom_metadata_property/create", + "tags": [ + "Custom Metadata" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/id" + }, + { + "description": "name of the property", + "example": [ + "Fruit" + ], + "name": "name", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "$ref": "#/components/parameters/data_type" + }, + { + "description": "description of property", + "example": [ + "A healthy snack for all ages" + ], + "name": "description", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "ids of projects that the property belongs to", + "example": [ + "abcd1234cdef1234abcd1234cdef1234" + ], + "name": "project_ids", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "value options of property (only applies to single or multi select properties)", + "example": [ + "Apple", + "Banana", + "Coconut" + ], + "name": "value_options", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/custom_metadata_property" + } + } + }, + "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" + }, + "422": { + "$ref": "#/components/responses/422" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase custom_metadata_properties create \\\n--account_id \\\n--id \\\n--data '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.9" + }, + "patch": { + "summary": "Update a property", + "description": "Update an existing custom metadata property.", + "operationId": "custom_metadata_property/update", + "tags": [ + "Custom Metadata" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/id" + }, + { + "description": "name of the property", + "example": [ + "Fruit" + ], + "name": "name", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "description of property", + "example": [ + "A healthy snack for all ages" + ], + "name": "description", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "ids of projects that the property belongs to", + "example": [ + "abcd1234cdef1234abcd1234cdef1234" + ], + "name": "project_ids", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "value options of property (only applies to single or multi select properties)", + "example": [ + "Apple", + "Banana", + "Coconut" + ], + "name": "value_options", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/custom_metadata_property" + } + } + }, + "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/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase custom_metadata_properties update \\\n--account_id \\\n--id \\\n--data '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.9" } }, "/accounts/{account_id}/invitations": { diff --git a/paths.yaml b/paths.yaml index b5457407..90391184 100644 --- a/paths.yaml +++ b/paths.yaml @@ -53,6 +53,10 @@ "/accounts/{account_id}/custom_metadata/labels/{id}": get: "$ref": "./paths/custom_metadata_properties/show.yaml" + post: + "$ref": "./paths/custom_metadata_properties/create.yaml" + patch: + "$ref": "./paths/custom_metadata_properties/update.yaml" "/accounts/{account_id}/invitations": get: "$ref": "./paths/invitations/index.yaml" diff --git a/paths/custom_metadata_properties/create.yaml b/paths/custom_metadata_properties/create.yaml new file mode 100644 index 00000000..ececb1ca --- /dev/null +++ b/paths/custom_metadata_properties/create.yaml @@ -0,0 +1,83 @@ +--- +summary: Create a property +description: Create a new custom metadata property. +operationId: custom_metadata_property/create +tags: +- Custom Metadata +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/id" +- description: name of the property + example: + - Fruit + name: name + in: query + schema: + type: string +- "$ref": "../../parameters.yaml#/data_type" +- description: description of property + example: + - A healthy snack for all ages + name: description + in: query + schema: + type: string +- description: ids of projects that the property belongs to + example: + - abcd1234cdef1234abcd1234cdef1234 + name: project_ids + in: query + schema: + type: array + items: + type: string +- description: value options of property (only applies to single or multi select properties) + example: + - Apple + - Banana + - Coconut + name: value_options + in: query + schema: + type: array + items: + type: string +responses: + '200': + description: OK + content: + application/json: + schema: + "$ref": "../../schemas/custom_metadata_property.yaml#/custom_metadata_property" + 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" + '422': + "$ref": "../../responses.yaml#/422" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X POST \ + -d '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase custom_metadata_properties create \ + --account_id \ + --id \ + --data '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ + --access_token +x-cli-version: '2.9' diff --git a/paths/custom_metadata_properties/update.yaml b/paths/custom_metadata_properties/update.yaml new file mode 100644 index 00000000..b3983949 --- /dev/null +++ b/paths/custom_metadata_properties/update.yaml @@ -0,0 +1,80 @@ +--- +summary: Update a property +description: Update an existing custom metadata property. +operationId: custom_metadata_property/update +tags: +- Custom Metadata +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" +- "$ref": "../../parameters.yaml#/id" +- description: name of the property + example: + - Fruit + name: name + in: query + schema: + type: string +- description: description of property + example: + - A healthy snack for all ages + name: description + in: query + schema: + type: string +- description: ids of projects that the property belongs to + example: + - abcd1234cdef1234abcd1234cdef1234 + name: project_ids + in: query + schema: + type: array + items: + type: string +- description: value options of property (only applies to single or multi select properties) + example: + - Apple + - Banana + - Coconut + name: value_options + in: query + schema: + type: array + items: + type: string +responses: + '200': + description: OK + content: + application/json: + schema: + "$ref": "../../schemas/custom_metadata_property.yaml#/custom_metadata_property" + 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/custom_metadata/labels/:id" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X PATCH \ + -d '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase custom_metadata_properties update \ + --account_id \ + --id \ + --data '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ + --access_token +x-cli-version: '2.9' diff --git a/schemas/custom_metadata_property.yaml b/schemas/custom_metadata_property.yaml index 43fba90c..89f52e9b 100644 --- a/schemas/custom_metadata_property.yaml +++ b/schemas/custom_metadata_property.yaml @@ -26,6 +26,10 @@ custom_metadata_property: type: array items: "$ref": "./project_short.yaml#/project_short" + value_options: + type: array + items: + type: string created_at: type: string format: date-time @@ -34,9 +38,9 @@ custom_metadata_property: format: date-time example: id: abcd1234cdef1234abcd1234cdef1234 - name: Character Age - description: Age of character in seconds - data_type: Text value + name: Nuts + description: A healthy snack for all ages + data_type: multi_select user: id: abcd1234cdef1234abcd1234cdef1234 username: joe.doe @@ -49,3 +53,8 @@ custom_metadata_property: main_format: xml created_at: '2015-01-28T09:52:53Z' updated_at: '2015-01-28T09:52:53Z' + value_options: + - apple + - banana + - coconut + From fcd8cbeb6135d9975bd29897be49166cca5c14dc Mon Sep 17 00:00:00 2001 From: anthonyshchang <108525179+anthonyshchang@users.noreply.github.com> Date: Wed, 6 Dec 2023 09:04:28 +0100 Subject: [PATCH 25/36] feat: add delete CM property doc (#477) * add delete api doc for CM properties * build docs --- doc/compiled.json | 47 +++++++++++++++++++ paths.yaml | 2 + paths/custom_metadata_properties/destroy.yaml | 36 ++++++++++++++ paths/custom_metadata_properties/index.yaml | 1 + 4 files changed, 86 insertions(+) create mode 100644 paths/custom_metadata_properties/destroy.yaml diff --git a/doc/compiled.json b/doc/compiled.json index 5ba57aaa..7cd4e343 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6087,6 +6087,9 @@ { "$ref": "#/components/parameters/X-PhraseApp-OTP" }, + { + "$ref": "#/components/parameters/account_id" + }, { "$ref": "#/components/parameters/data_type" }, @@ -6473,6 +6476,50 @@ } ], "x-cli-version": "2.9" + }, + "delete": { + "summary": "Destroy property", + "description": "Destroy a custom metadata property of an account.\n\nThis endpoint is only available to accounts with advanced plans or above.\n", + "operationId": "custom_metadata_properties/delete", + "tags": [ + "Custom Metadata" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_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/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n -X DELETE\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase custom_metadata_properties delete \\\n--account_id \\\n--id \\\n--access_token " + } + ], + "x-cli-version": "2.9" } }, "/accounts/{account_id}/invitations": { diff --git a/paths.yaml b/paths.yaml index 90391184..b83f60ef 100644 --- a/paths.yaml +++ b/paths.yaml @@ -57,6 +57,8 @@ "$ref": "./paths/custom_metadata_properties/create.yaml" patch: "$ref": "./paths/custom_metadata_properties/update.yaml" + delete: + "$ref": "./paths/custom_metadata_properties/destroy.yaml" "/accounts/{account_id}/invitations": get: "$ref": "./paths/invitations/index.yaml" diff --git a/paths/custom_metadata_properties/destroy.yaml b/paths/custom_metadata_properties/destroy.yaml new file mode 100644 index 00000000..f7f16fb4 --- /dev/null +++ b/paths/custom_metadata_properties/destroy.yaml @@ -0,0 +1,36 @@ +--- +summary: Destroy property +description: | + Destroy a custom metadata property of an account. + + This endpoint is only available to accounts with advanced plans or above. +operationId: custom_metadata_properties/delete +tags: +- Custom Metadata +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_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/custom_metadata/labels/:id" \ + -u USERNAME_OR_ACCESS_TOKEN + -X DELETE + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase custom_metadata_properties delete \ + --account_id \ + --id \ + --access_token +x-cli-version: '2.9' diff --git a/paths/custom_metadata_properties/index.yaml b/paths/custom_metadata_properties/index.yaml index 1041151e..7e3d0712 100644 --- a/paths/custom_metadata_properties/index.yaml +++ b/paths/custom_metadata_properties/index.yaml @@ -9,6 +9,7 @@ tags: - Custom Metadata parameters: - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/account_id" - "$ref": "../../parameters.yaml#/data_type" - description: id of project that the properties belong to example: From 09780918e68d10516c8fcc02039d0ac5f97f6cd9 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 6 Dec 2023 10:41:05 +0100 Subject: [PATCH 26/36] rename data type to custom metadata data type --- doc/compiled.json | 6 +++--- parameters.yaml | 2 +- paths/custom_metadata_properties/create.yaml | 2 +- paths/custom_metadata_properties/index.yaml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 7cd4e343..63f7f645 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -4226,7 +4226,7 @@ "type": "string" } }, - "data_type": { + "custom_metadata_data_type": { "in": "query", "name": "data_type", "description": "Data Type of Custom Metadata Property", @@ -6091,7 +6091,7 @@ "$ref": "#/components/parameters/account_id" }, { - "$ref": "#/components/parameters/data_type" + "$ref": "#/components/parameters/custom_metadata_data_type" }, { "description": "id of project that the properties belong to", @@ -6272,7 +6272,7 @@ } }, { - "$ref": "#/components/parameters/data_type" + "$ref": "#/components/parameters/custom_metadata_data_type" }, { "description": "description of property", diff --git a/parameters.yaml b/parameters.yaml index 56841ce6..a612d613 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -31,7 +31,7 @@ account_id: required: true schema: type: string -data_type: +custom_metadata_data_type: in: query name: data_type description: Data Type of Custom Metadata Property diff --git a/paths/custom_metadata_properties/create.yaml b/paths/custom_metadata_properties/create.yaml index ececb1ca..15b878c8 100644 --- a/paths/custom_metadata_properties/create.yaml +++ b/paths/custom_metadata_properties/create.yaml @@ -15,7 +15,7 @@ parameters: in: query schema: type: string -- "$ref": "../../parameters.yaml#/data_type" +- "$ref": "../../parameters.yaml#/custom_metadata_data_type" - description: description of property example: - A healthy snack for all ages diff --git a/paths/custom_metadata_properties/index.yaml b/paths/custom_metadata_properties/index.yaml index 7e3d0712..14139ea4 100644 --- a/paths/custom_metadata_properties/index.yaml +++ b/paths/custom_metadata_properties/index.yaml @@ -10,7 +10,7 @@ tags: parameters: - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" - "$ref": "../../parameters.yaml#/account_id" -- "$ref": "../../parameters.yaml#/data_type" +- "$ref": "../../parameters.yaml#/custom_metadata_data_type" - description: id of project that the properties belong to example: - abcd1234cdef1234abcd1234cdef1234 From 7ca6c3db2678e4e25571d1a1124aab436e609f62 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 6 Dec 2023 10:44:11 +0100 Subject: [PATCH 27/36] nest create under collection --- doc/compiled.json | 135 +++++++++---------- paths.yaml | 4 +- paths/custom_metadata_properties/create.yaml | 4 +- 3 files changed, 69 insertions(+), 74 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 63f7f645..6743f89d 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6178,70 +6178,6 @@ } ], "x-cli-version": "2.9" - } - }, - "/accounts/{account_id}/custom_metadata/labels/{id}": { - "get": { - "summary": "Get a single property", - "description": "Get details of a single custom property.", - "operationId": "custom_metadata_property/show", - "tags": [ - "Custom Metadata" - ], - "parameters": [ - { - "$ref": "#/components/parameters/X-PhraseApp-OTP" - }, - { - "$ref": "#/components/parameters/account_id" - }, - { - "$ref": "#/components/parameters/id" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/custom_metadata_property" - } - } - }, - "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/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN" - }, - { - "lang": "CLI v2", - "source": "phrase custom_metadata_labels show \\\n--account_id \\\n--id \\\n--access_token " - } - ], - "x-cli-version": "2.9" }, "post": { "summary": "Create a property", @@ -6257,9 +6193,6 @@ { "$ref": "#/components/parameters/account_id" }, - { - "$ref": "#/components/parameters/id" - }, { "description": "name of the property", "example": [ @@ -6354,11 +6287,75 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", - "source": "phrase custom_metadata_properties create \\\n--account_id \\\n--id \\\n--data '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n--access_token " + "source": "phrase custom_metadata_properties create \\\n--account_id \\\n--data '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.9" + } + }, + "/accounts/{account_id}/custom_metadata/labels/{id}": { + "get": { + "summary": "Get a single property", + "description": "Get details of a single custom property.", + "operationId": "custom_metadata_property/show", + "tags": [ + "Custom Metadata" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/id" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/custom_metadata_property" + } + } + }, + "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/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + }, + { + "lang": "CLI v2", + "source": "phrase custom_metadata_labels show \\\n--account_id \\\n--id \\\n--access_token " } ], "x-cli-version": "2.9" diff --git a/paths.yaml b/paths.yaml index b83f60ef..5d7c9dbc 100644 --- a/paths.yaml +++ b/paths.yaml @@ -50,11 +50,11 @@ "/accounts/{account_id}/custom_metadata/labels": get: "$ref": "./paths/custom_metadata_properties/index.yaml" + post: + "$ref": "./paths/custom_metadata_properties/create.yaml" "/accounts/{account_id}/custom_metadata/labels/{id}": get: "$ref": "./paths/custom_metadata_properties/show.yaml" - post: - "$ref": "./paths/custom_metadata_properties/create.yaml" patch: "$ref": "./paths/custom_metadata_properties/update.yaml" delete: diff --git a/paths/custom_metadata_properties/create.yaml b/paths/custom_metadata_properties/create.yaml index 15b878c8..a4856e8a 100644 --- a/paths/custom_metadata_properties/create.yaml +++ b/paths/custom_metadata_properties/create.yaml @@ -7,7 +7,6 @@ tags: parameters: - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" - "$ref": "../../parameters.yaml#/account_id" -- "$ref": "../../parameters.yaml#/id" - description: name of the property example: - Fruit @@ -68,7 +67,7 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels" \ -u USERNAME_OR_ACCESS_TOKEN \ -X POST \ -d '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ @@ -77,7 +76,6 @@ x-code-samples: source: |- phrase custom_metadata_properties create \ --account_id \ - --id \ --data '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ --access_token x-cli-version: '2.9' From 08771e7c744f314ab7cb03fe657ce227278edfd5 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 6 Dec 2023 11:21:07 +0100 Subject: [PATCH 28/36] update routes to use properties instead of labels --- paths/custom_metadata_properties/create.yaml | 2 +- paths/custom_metadata_properties/destroy.yaml | 2 +- paths/custom_metadata_properties/index.yaml | 2 +- paths/custom_metadata_properties/show.yaml | 4 ++-- paths/custom_metadata_properties/update.yaml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paths/custom_metadata_properties/create.yaml b/paths/custom_metadata_properties/create.yaml index a4856e8a..c98dbf4a 100644 --- a/paths/custom_metadata_properties/create.yaml +++ b/paths/custom_metadata_properties/create.yaml @@ -67,7 +67,7 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties" \ -u USERNAME_OR_ACCESS_TOKEN \ -X POST \ -d '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ diff --git a/paths/custom_metadata_properties/destroy.yaml b/paths/custom_metadata_properties/destroy.yaml index f7f16fb4..844b7800 100644 --- a/paths/custom_metadata_properties/destroy.yaml +++ b/paths/custom_metadata_properties/destroy.yaml @@ -23,7 +23,7 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties/:id" \ -u USERNAME_OR_ACCESS_TOKEN -X DELETE -H 'Content-Type: application/json' diff --git a/paths/custom_metadata_properties/index.yaml b/paths/custom_metadata_properties/index.yaml index 14139ea4..34c84720 100644 --- a/paths/custom_metadata_properties/index.yaml +++ b/paths/custom_metadata_properties/index.yaml @@ -59,7 +59,7 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?data_type=boolean&project_id=1&page=1&per_page=10&sort=created_at&order=desc" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties?data_type=boolean&project_id=1&page=1&per_page=10&sort=created_at&order=desc" \ -u USERNAME_OR_ACCESS_TOKEN - lang: CLI v2 source: |- diff --git a/paths/custom_metadata_properties/show.yaml b/paths/custom_metadata_properties/show.yaml index 5bbdc2b8..d899d8d0 100644 --- a/paths/custom_metadata_properties/show.yaml +++ b/paths/custom_metadata_properties/show.yaml @@ -31,11 +31,11 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties/:id" \ -u USERNAME_OR_ACCESS_TOKEN - lang: CLI v2 source: |- - phrase custom_metadata_labels show \ + phrase custom_metadata_properties show \ --account_id \ --id \ --access_token diff --git a/paths/custom_metadata_properties/update.yaml b/paths/custom_metadata_properties/update.yaml index b3983949..840ef82d 100644 --- a/paths/custom_metadata_properties/update.yaml +++ b/paths/custom_metadata_properties/update.yaml @@ -65,7 +65,7 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id" \ + curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties/:id" \ -u USERNAME_OR_ACCESS_TOKEN \ -X PATCH \ -d '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ From dcd320ebd0673dab3df5658fe95593ae360ee487 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 6 Dec 2023 11:21:29 +0100 Subject: [PATCH 29/36] regen docs --- doc/compiled.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 6743f89d..9a65310a 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6170,7 +6170,7 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels?data_type=boolean&project_id=1&page=1&per_page=10&sort=created_at&order=desc\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties?data_type=boolean&project_id=1&page=1&per_page=10&sort=created_at&order=desc\" \\\n -u USERNAME_OR_ACCESS_TOKEN" }, { "lang": "CLI v2", @@ -6287,7 +6287,7 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", @@ -6351,11 +6351,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN" }, { "lang": "CLI v2", - "source": "phrase custom_metadata_labels show \\\n--account_id \\\n--id \\\n--access_token " + "source": "phrase custom_metadata_properties show \\\n--account_id \\\n--id \\\n--access_token " } ], "x-cli-version": "2.9" @@ -6465,7 +6465,7 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", @@ -6509,7 +6509,7 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/labels/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n -X DELETE\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n -X DELETE\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", From b400e827b09d1f68445365dd05b5354a7e356f78 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Wed, 6 Dec 2023 13:57:03 +0100 Subject: [PATCH 30/36] fix project_id example --- doc/compiled.json | 4 +--- paths/custom_metadata_properties/index.yaml | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 9a65310a..4ece23fd 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6095,9 +6095,7 @@ }, { "description": "id of project that the properties belong to", - "example": [ - "abcd1234cdef1234abcd1234cdef1234" - ], + "example": "abcd1234cdef1234abcd1234cdef1234", "name": "project_id", "in": "query", "schema": { diff --git a/paths/custom_metadata_properties/index.yaml b/paths/custom_metadata_properties/index.yaml index 34c84720..eaffd586 100644 --- a/paths/custom_metadata_properties/index.yaml +++ b/paths/custom_metadata_properties/index.yaml @@ -12,8 +12,7 @@ parameters: - "$ref": "../../parameters.yaml#/account_id" - "$ref": "../../parameters.yaml#/custom_metadata_data_type" - description: id of project that the properties belong to - example: - - abcd1234cdef1234abcd1234cdef1234 + example: abcd1234cdef1234abcd1234cdef1234 name: project_id in: query schema: From 7b636a642bbe0662d32dee57f77833d0285ec79e Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 7 Dec 2023 09:22:38 +0100 Subject: [PATCH 31/36] update path CM route naming --- doc/compiled.json | 4 ++-- paths.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 4ece23fd..f5573259 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -6075,7 +6075,7 @@ "x-cli-version": "2.5" } }, - "/accounts/{account_id}/custom_metadata/labels": { + "/accounts/{account_id}/custom_metadata/properties": { "get": { "summary": "List properties", "description": "List all custom metadata properties for an account.\n\nThis endpoint is only available to accounts with advanced plans or above.\n", @@ -6295,7 +6295,7 @@ "x-cli-version": "2.9" } }, - "/accounts/{account_id}/custom_metadata/labels/{id}": { + "/accounts/{account_id}/custom_metadata/properties/{id}": { "get": { "summary": "Get a single property", "description": "Get details of a single custom property.", diff --git a/paths.yaml b/paths.yaml index 5d7c9dbc..0dfde583 100644 --- a/paths.yaml +++ b/paths.yaml @@ -47,12 +47,12 @@ "$ref": "./paths/styleguides/update.yaml" delete: "$ref": "./paths/styleguides/destroy.yaml" -"/accounts/{account_id}/custom_metadata/labels": +"/accounts/{account_id}/custom_metadata/properties": get: "$ref": "./paths/custom_metadata_properties/index.yaml" post: "$ref": "./paths/custom_metadata_properties/create.yaml" -"/accounts/{account_id}/custom_metadata/labels/{id}": +"/accounts/{account_id}/custom_metadata/properties/{id}": get: "$ref": "./paths/custom_metadata_properties/show.yaml" patch: From c42fbeac3e844e8ab21a4e8ca4df37cc87d940e4 Mon Sep 17 00:00:00 2001 From: anthonyshchang <108525179+anthonyshchang@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:37:42 +0100 Subject: [PATCH 32/36] feat: update translation key create/update with custom metadata. Add CM schema in translation key response (#480) * add CM to create/update keys * Add custom metadata object on CM get key * Add more description for update --------- Co-authored-by: Ildar Safin --- doc/compiled.json | 35 ++++++++++++++++++++++++---- paths/keys/create.yaml | 10 +++++++- paths/keys/update.yaml | 9 ++++++- schemas/translation_key_details.yaml | 8 +++++++ 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index f5573259..7230aaa2 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -2389,6 +2389,13 @@ }, "creator": { "$ref": "#/components/schemas/user_preview" + }, + "custom_metadata": { + "type": "object", + "title": "custom_metadata", + "additionalProperties": { + "type": "string" + } } }, "example": { @@ -2405,6 +2412,10 @@ "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" + }, + "custom_metadata": { + "fruit": "Apple", + "vegetable": "Tomato" } } } @@ -19897,11 +19908,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -F branch=my-feature-branch \\\n -F name=home.index.headline \\\n -F description=Some%20description%20worth%20knowing... \\\n -F name_plural=home.index.headlines \\\n -F data_type=number \\\n -F tags=awesome-feature,needs-proofreading \\\n -F max_characters_allowed=140 \\\n -F screenshot=@/path/to/my/screenshot.png" + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -F branch=my-feature-branch \\\n -F name=home.index.headline \\\n -F description=Some%20description%20worth%20knowing... \\\n -F name_plural=home.index.headlines \\\n -F data_type=number \\\n -F tags=awesome-feature,needs-proofreading \\\n -F max_characters_allowed=140 \\\n -F screenshot=@/path/to/my/screenshot.png\n -F custom_metadata[property]=value" }, { "lang": "CLI v2", - "source": "phrase keys create \\\n--project_id \\\n--data '{\"branch\":\"my-feature-branch\", \"name\":\"home.index.headline\", \"description\": \"Some description worth knowing...\", \"name_plural\":\"home.index.headlines\", \"data_type\":\"number\", \"tags\":\"awesome-feature,needs-proofreading\", \"max_characters_allowed\":\"140\", \"screenshot\":\"/path/to/my/screenshot.png\"}' \\\n--access_token " + "source": "phrase keys create \\\n--project_id \\\n--data '{\"branch\":\"my-feature-branch\", \"name\":\"home.index.headline\", \"description\": \"Some description worth knowing...\", \"name_plural\":\"home.index.headlines\", \"data_type\":\"number\", \"tags\":\"awesome-feature,needs-proofreading\", \"max_characters_allowed\":\"140\", \"screenshot\":\"/path/to/my/screenshot.png\", \"custom_metadata\": {\"property\" => \"value\"}}' \\\n--access_token " } ], "requestBody": { @@ -19994,6 +20005,14 @@ "description": "NSStringLocalizedFormatKey attribute. Used in .stringsdict format.", "type": "string", "example": null + }, + "custom_metadata": { + "description": "Custom metadata property name and value pairs to be associated with key.", + "type": "object", + "example": { + "fruit": "Apple", + "vegetable": "Tomato" + } } } } @@ -20322,11 +20341,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -F branch=my-feature-branch \\\n -F name=home.index.headline \\\n -F description=Some%20description%20worth%20knowing... \\\n -F name_plural=home.index.headlines \\\n -F data_type=number \\\n -F tags=awesome-feature,needs-proofreading \\\n -F max_characters_allowed=140 \\\n -F screenshot=@/path/to/my/screenshot.png" + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -F branch=my-feature-branch \\\n -F name=home.index.headline \\\n -F description=Some%20description%20worth%20knowing... \\\n -F name_plural=home.index.headlines \\\n -F data_type=number \\\n -F tags=awesome-feature,needs-proofreading \\\n -F max_characters_allowed=140 \\\n -F screenshot=@/path/to/my/screenshot.png\n -F custom_metadata[property]=value" }, { "lang": "CLI v2", - "source": "phrase keys update \\\n--project_id \\\n--id \\\n--data '{\"branch\":\"my-feature-branch\", \"name\":\"home.index.headline\", \"description\": \"Some description worth knowing...\", \"name_plural\":\"home.index.headlines\", \"data_type\":\"number\", \"tags\":\"awesome-feature,needs-proofreading\", \"max_characters_allowed\":\"140\", \"screenshot\":\"/path/to/my/screenshot.png\"}' \\\n--access_token " + "source": "phrase keys update \\\n--project_id \\\n--id \\\n--data '{\"branch\":\"my-feature-branch\", \"name\":\"home.index.headline\", \"description\": \"Some description worth knowing...\", \"name_plural\":\"home.index.headlines\", \"data_type\":\"number\", \"tags\":\"awesome-feature,needs-proofreading\", \"max_characters_allowed\":\"140\", \"screenshot\":\"/path/to/my/screenshot.png\", \"custom_metadata\": {\"property\" => \"value\"}}' \\\n--access_token " } ], "requestBody": { @@ -20414,6 +20433,14 @@ "description": "NSStringLocalizedFormatKey attribute. Used in .stringsdict format.", "type": "string", "example": null + }, + "custom_metadata": { + "description": "Updates/Creates custom metadata property name and value pairs to be associated with key. If you want to delete a custom metadata property, you can set its value to null. If you want to update a custom metadata property, you can set its value to the new value.", + "type": "object", + "example": { + "fruit": "Apple", + "vegetable": "Tomato" + } } } } diff --git a/paths/keys/create.yaml b/paths/keys/create.yaml index 4bec002e..f34057b1 100644 --- a/paths/keys/create.yaml +++ b/paths/keys/create.yaml @@ -41,11 +41,12 @@ x-code-samples: -F tags=awesome-feature,needs-proofreading \ -F max_characters_allowed=140 \ -F screenshot=@/path/to/my/screenshot.png + -F custom_metadata[property]=value - lang: CLI v2 source: |- phrase keys create \ --project_id \ - --data '{"branch":"my-feature-branch", "name":"home.index.headline", "description": "Some description worth knowing...", "name_plural":"home.index.headlines", "data_type":"number", "tags":"awesome-feature,needs-proofreading", "max_characters_allowed":"140", "screenshot":"/path/to/my/screenshot.png"}' \ + --data '{"branch":"my-feature-branch", "name":"home.index.headline", "description": "Some description worth knowing...", "name_plural":"home.index.headlines", "data_type":"number", "tags":"awesome-feature,needs-proofreading", "max_characters_allowed":"140", "screenshot":"/path/to/my/screenshot.png", "custom_metadata": {"property" => "value"}}' \ --access_token requestBody: required: true @@ -122,4 +123,11 @@ requestBody: description: NSStringLocalizedFormatKey attribute. Used in .stringsdict format. type: string example: + custom_metadata: + description: Custom metadata property name and value pairs to be associated with key. + type: object + example: + fruit: Apple + vegetable: Tomato + x-cli-version: '2.5' diff --git a/paths/keys/update.yaml b/paths/keys/update.yaml index 7ac2bf57..a201d1bb 100644 --- a/paths/keys/update.yaml +++ b/paths/keys/update.yaml @@ -42,12 +42,13 @@ x-code-samples: -F tags=awesome-feature,needs-proofreading \ -F max_characters_allowed=140 \ -F screenshot=@/path/to/my/screenshot.png + -F custom_metadata[property]=value - lang: CLI v2 source: |- phrase keys update \ --project_id \ --id \ - --data '{"branch":"my-feature-branch", "name":"home.index.headline", "description": "Some description worth knowing...", "name_plural":"home.index.headlines", "data_type":"number", "tags":"awesome-feature,needs-proofreading", "max_characters_allowed":"140", "screenshot":"/path/to/my/screenshot.png"}' \ + --data '{"branch":"my-feature-branch", "name":"home.index.headline", "description": "Some description worth knowing...", "name_plural":"home.index.headlines", "data_type":"number", "tags":"awesome-feature,needs-proofreading", "max_characters_allowed":"140", "screenshot":"/path/to/my/screenshot.png", "custom_metadata": {"property" => "value"}}' \ --access_token requestBody: required: true @@ -120,4 +121,10 @@ requestBody: description: NSStringLocalizedFormatKey attribute. Used in .stringsdict format. type: string example: + custom_metadata: + description: Updates/Creates custom metadata property name and value pairs to be associated with key. If you want to delete a custom metadata property, you can set its value to null. If you want to update a custom metadata property, you can set its value to the new value. + type: object + example: + fruit: Apple + vegetable: Tomato x-cli-version: '2.5' diff --git a/schemas/translation_key_details.yaml b/schemas/translation_key_details.yaml index 6dc7127d..4f20b718 100644 --- a/schemas/translation_key_details.yaml +++ b/schemas/translation_key_details.yaml @@ -23,6 +23,11 @@ translation_key_details: type: string creator: "$ref": "./user_preview.yaml#/user_preview" + custom_metadata: + type: object + title: custom_metadata + additionalProperties: + type: string example: name_plural: home.index.headlines comments_count: 2 @@ -37,3 +42,6 @@ translation_key_details: id: abcd1234cdef1234abcd1234cdef1234 username: joe.doe name: Joe Doe + custom_metadata: + fruit: Apple + vegetable: Tomato \ No newline at end of file From 42e7a82cec6b7d9d16153c9e5873ed095e742f16 Mon Sep 17 00:00:00 2001 From: Ildar Safin Date: Wed, 13 Dec 2023 11:20:34 +0100 Subject: [PATCH 33/36] Make create CM example to be working with CURL --- doc/compiled.json | 18 ++++++++++++++---- parameters.yaml | 11 ++++++++++- paths/custom_metadata_properties/create.yaml | 4 ++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 7230aaa2..b7ecea63 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -4241,9 +4241,19 @@ "in": "query", "name": "data_type", "description": "Data Type of Custom Metadata Property", - "required": false, + "required": true, "schema": { - "type": "string" + "type": "string", + "enum": [ + "boolean", + "date", + "link", + "multi_select", + "number", + "single_select", + "string", + "text" + ] }, "example": "boolean" }, @@ -6296,11 +6306,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"name\":\"Fruit\",\"data_type\":\"multi_select\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", - "source": "phrase custom_metadata_properties create \\\n--account_id \\\n--data '{\"name\":\"Fruit\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n--access_token " + "source": "phrase custom_metadata_properties create \\\n--account_id \\\n--data '{\"name\":\"Fruit\",\"data_type\":\"multi_select\",\"description\":\"A healthy snack for all ages\",\"project_ids\":[\"1\",\"2\",\"3\"],\"value_options\":[\"apple\",\"banana\",\"coconut\"]}' \\\n--access_token " } ], "x-cli-version": "2.9" diff --git a/parameters.yaml b/parameters.yaml index a612d613..cba10cf3 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -35,9 +35,18 @@ custom_metadata_data_type: in: query name: data_type description: Data Type of Custom Metadata Property - required: false + required: true schema: type: string + enum: + - boolean + - date + - link + - multi_select + - number + - single_select + - string + - text example: boolean query_account_id: in: query diff --git a/paths/custom_metadata_properties/create.yaml b/paths/custom_metadata_properties/create.yaml index c98dbf4a..da0087ee 100644 --- a/paths/custom_metadata_properties/create.yaml +++ b/paths/custom_metadata_properties/create.yaml @@ -70,12 +70,12 @@ x-code-samples: curl "https://api.phrase.com/v2/accounts/:account_id/custom_metadata/properties" \ -u USERNAME_OR_ACCESS_TOKEN \ -X POST \ - -d '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ + -d '{"name":"Fruit","data_type":"multi_select","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ -H 'Content-Type: application/json' - lang: CLI v2 source: |- phrase custom_metadata_properties create \ --account_id \ - --data '{"name":"Fruit","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ + --data '{"name":"Fruit","data_type":"multi_select","description":"A healthy snack for all ages","project_ids":["1","2","3"],"value_options":["apple","banana","coconut"]}' \ --access_token x-cli-version: '2.9' From 74275dff23d83fb6250d1e0cdab0a6736e857066 Mon Sep 17 00:00:00 2001 From: Ildar Safin Date: Wed, 13 Dec 2023 11:34:34 +0100 Subject: [PATCH 34/36] Make the data_type field to be not required --- doc/compiled.json | 2 +- parameters.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index b7ecea63..e5b78451 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -4241,7 +4241,7 @@ "in": "query", "name": "data_type", "description": "Data Type of Custom Metadata Property", - "required": true, + "required": false, "schema": { "type": "string", "enum": [ diff --git a/parameters.yaml b/parameters.yaml index cba10cf3..d9c7dfc3 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -35,7 +35,7 @@ custom_metadata_data_type: in: query name: data_type description: Data Type of Custom Metadata Property - required: true + required: false schema: type: string enum: From 4fdbef079f69374c0a0b1a25f6345c32bcb40c3c Mon Sep 17 00:00:00 2001 From: Mladen Jablanovic Date: Wed, 13 Dec 2023 11:57:29 +0100 Subject: [PATCH 35/36] extract custom metadata data type schema --- doc/compiled.json | 22 +++++++++----------- parameters.yaml | 11 +--------- paths/custom_metadata_properties/create.yaml | 9 +++++++- schemas/custom_metadata_data_type.yaml | 11 ++++++++++ schemas/custom_metadata_property.yaml | 11 +--------- 5 files changed, 31 insertions(+), 33 deletions(-) create mode 100644 schemas/custom_metadata_data_type.yaml diff --git a/doc/compiled.json b/doc/compiled.json index e5b78451..188b9ab6 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -712,17 +712,7 @@ "type": "string" }, "data_type": { - "type": "string", - "enum": [ - "boolean", - "date", - "link", - "multi_select", - "number", - "single_select", - "string", - "text" - ] + "$ref": "#/components/parameters/custom_metadata_data_type/schema" }, "user": { "$ref": "#/components/schemas/user_preview" @@ -6219,12 +6209,20 @@ ], "name": "name", "in": "query", + "required": true, "schema": { "type": "string" } }, { - "$ref": "#/components/parameters/custom_metadata_data_type" + "name": "data_type", + "in": "query", + "description": "Data Type of Custom Metadata Property", + "required": true, + "schema": { + "$ref": "#/components/parameters/custom_metadata_data_type/schema" + }, + "example": "boolean" }, { "description": "description of property", diff --git a/parameters.yaml b/parameters.yaml index d9c7dfc3..be99fa5a 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -37,16 +37,7 @@ custom_metadata_data_type: description: Data Type of Custom Metadata Property required: false schema: - type: string - enum: - - boolean - - date - - link - - multi_select - - number - - single_select - - string - - text + "$ref": "./schemas/custom_metadata_data_type.yaml#/data_type" example: boolean query_account_id: in: query diff --git a/paths/custom_metadata_properties/create.yaml b/paths/custom_metadata_properties/create.yaml index da0087ee..e2bdc60e 100644 --- a/paths/custom_metadata_properties/create.yaml +++ b/paths/custom_metadata_properties/create.yaml @@ -12,9 +12,16 @@ parameters: - Fruit name: name in: query + required: true schema: type: string -- "$ref": "../../parameters.yaml#/custom_metadata_data_type" +- name: data_type + in: query + description: Data Type of Custom Metadata Property + required: true + schema: + "$ref": "../../schemas/custom_metadata_data_type.yaml#/data_type" + example: boolean - description: description of property example: - A healthy snack for all ages diff --git a/schemas/custom_metadata_data_type.yaml b/schemas/custom_metadata_data_type.yaml new file mode 100644 index 00000000..0b0ee655 --- /dev/null +++ b/schemas/custom_metadata_data_type.yaml @@ -0,0 +1,11 @@ +data_type: + type: string + enum: + - boolean + - date + - link + - multi_select + - number + - single_select + - string + - text diff --git a/schemas/custom_metadata_property.yaml b/schemas/custom_metadata_property.yaml index 89f52e9b..b8209793 100644 --- a/schemas/custom_metadata_property.yaml +++ b/schemas/custom_metadata_property.yaml @@ -10,16 +10,7 @@ custom_metadata_property: description: type: string data_type: - type: string - enum: - - boolean - - date - - link - - multi_select - - number - - single_select - - string - - text + "$ref": "./custom_metadata_data_type.yaml#/data_type" user: "$ref": "./user_preview.yaml#/user_preview" projects: From 504fb405d37b71323dd4504d90e15b2ef98f68db Mon Sep 17 00:00:00 2001 From: Mladen Jablanovic Date: Wed, 13 Dec 2023 12:02:09 +0100 Subject: [PATCH 36/36] fix --- doc/compiled.json | 29 ++++++++++++++------------ schemas.yaml | 2 ++ schemas/custom_metadata_data_type.yaml | 1 + 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 188b9ab6..f5405267 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -712,7 +712,7 @@ "type": "string" }, "data_type": { - "$ref": "#/components/parameters/custom_metadata_data_type/schema" + "$ref": "#/components/schemas/custom_metadata_data_type" }, "user": { "$ref": "#/components/schemas/user_preview" @@ -766,6 +766,19 @@ ] } }, + "custom_metadata_data_type": { + "type": "string", + "enum": [ + "boolean", + "date", + "link", + "multi_select", + "number", + "single_select", + "string", + "text" + ] + }, "key_preview": { "type": "object", "title": "key_preview", @@ -4233,17 +4246,7 @@ "description": "Data Type of Custom Metadata Property", "required": false, "schema": { - "type": "string", - "enum": [ - "boolean", - "date", - "link", - "multi_select", - "number", - "single_select", - "string", - "text" - ] + "$ref": "#/components/schemas/custom_metadata_data_type" }, "example": "boolean" }, @@ -6220,7 +6223,7 @@ "description": "Data Type of Custom Metadata Property", "required": true, "schema": { - "$ref": "#/components/parameters/custom_metadata_data_type/schema" + "$ref": "#/components/schemas/custom_metadata_data_type" }, "example": "boolean" }, diff --git a/schemas.yaml b/schemas.yaml index 6b235794..c360b6bf 100644 --- a/schemas.yaml +++ b/schemas.yaml @@ -22,6 +22,8 @@ schemas: "$ref": schemas/comment_reaction.yaml#/comment_reaction custom_metadata_property: "$ref": schemas/custom_metadata_property.yaml#/custom_metadata_property + custom_metadata_data_type: + "$ref": schemas/custom_metadata_data_type.yaml#/data_type key_preview: "$ref": schemas/key_preview.yaml#/key_preview affected_count: diff --git a/schemas/custom_metadata_data_type.yaml b/schemas/custom_metadata_data_type.yaml index 0b0ee655..39a96e0a 100644 --- a/schemas/custom_metadata_data_type.yaml +++ b/schemas/custom_metadata_data_type.yaml @@ -1,3 +1,4 @@ +--- data_type: type: string enum: