From 52b1844873ef9d325269cb9eea6bdc9b8d22493f Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 7 Dec 2023 09:20:51 +0100 Subject: [PATCH 1/4] wip --- paths/keys/create.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/paths/keys/create.yaml b/paths/keys/create.yaml index 4bec002e..6bd35f38 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,8 @@ 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 + x-cli-version: '2.5' From 1969c3389bfd42577774cdb1d75b2776e7b36461 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Thu, 7 Dec 2023 09:54:31 +0100 Subject: [PATCH 2/4] add CM to create/update keys --- doc/compiled.json | 24 ++++++++++++++++++++---- paths/keys/create.yaml | 3 +++ paths/keys/update.yaml | 9 ++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index f5573259..12d9bdce 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -19897,11 +19897,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 +19994,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 +20330,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 +20422,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" + } } } } diff --git a/paths/keys/create.yaml b/paths/keys/create.yaml index 6bd35f38..f34057b1 100644 --- a/paths/keys/create.yaml +++ b/paths/keys/create.yaml @@ -126,5 +126,8 @@ requestBody: 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..87a7e331 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: Custom metadata property name and value pairs to be associated with key. + type: object + example: + fruit: Apple + vegetable: Tomato x-cli-version: '2.5' From 1062cc9f794fced783bb1e90acc9579bb5e5f51f Mon Sep 17 00:00:00 2001 From: Ildar Safin Date: Tue, 12 Dec 2023 14:22:47 +0100 Subject: [PATCH 3/4] Add custom metadata object on CM get key --- doc/compiled.json | 11 +++++++++++ schemas/translation_key_details.yaml | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/doc/compiled.json b/doc/compiled.json index 12d9bdce..71cd6c03 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" } } } 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 0e74573d987b7b19b52179eaca6e22d6a5837aea Mon Sep 17 00:00:00 2001 From: Ildar Safin Date: Tue, 12 Dec 2023 14:41:42 +0100 Subject: [PATCH 4/4] Add more description for update --- doc/compiled.json | 2 +- paths/keys/update.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 71cd6c03..7230aaa2 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -20435,7 +20435,7 @@ "example": null }, "custom_metadata": { - "description": "Custom metadata property name and value pairs to be associated with key.", + "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", diff --git a/paths/keys/update.yaml b/paths/keys/update.yaml index 87a7e331..a201d1bb 100644 --- a/paths/keys/update.yaml +++ b/paths/keys/update.yaml @@ -122,7 +122,7 @@ requestBody: type: string example: custom_metadata: - description: Custom metadata property name and value pairs to be associated with key. + 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