From 2263b9d3747f6199c3cefb83dae97de71a6e2a45 Mon Sep 17 00:00:00 2001 From: Anthony Chang Date: Tue, 5 Dec 2023 16:58:30 +0100 Subject: [PATCH] add delete api doc for CM properties --- doc/compiled.json | 290 +----------------- paths.yaml | 3 + paths/custom_metadata_properties/destroy.yaml | 36 +++ paths/custom_metadata_properties/index.yaml | 1 + 4 files changed, 55 insertions(+), 275 deletions(-) create mode 100644 paths/custom_metadata_properties/destroy.yaml diff --git a/doc/compiled.json b/doc/compiled.json index 5ba57aaa..899d2594 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -733,12 +733,6 @@ "$ref": "#/components/schemas/project_short" } }, - "value_options": { - "type": "array", - "items": { - "type": "string" - } - }, "created_at": { "type": "string", "format": "date-time" @@ -750,9 +744,9 @@ }, "example": { "id": "abcd1234cdef1234abcd1234cdef1234", - "name": "Nuts", - "description": "A healthy snack for all ages", - "data_type": "multi_select", + "name": "Character Age", + "description": "Age of character in seconds", + "data_type": "Text value", "user": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", @@ -768,11 +762,6 @@ "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z" } - ], - "value_options": [ - "apple", - "banana", - "coconut" ] } }, @@ -6087,6 +6076,9 @@ { "$ref": "#/components/parameters/X-PhraseApp-OTP" }, + { + "$ref": "#/components/parameters/account_id" + }, { "$ref": "#/components/parameters/data_type" }, @@ -6177,193 +6169,11 @@ "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", - "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", + "/accounts/{account_id}/custom_metadata/labels/{:id}": { + "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" ], @@ -6376,81 +6186,11 @@ }, { "$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" - } - } + "204": { + "$ref": "#/components/responses/204" }, "400": { "$ref": "#/components/responses/400" @@ -6465,11 +6205,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 \\\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/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 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 " + "source": "phrase custom_metadata_properties delete \\\n--account_id \\\n--id \\\n--access_token " } ], "x-cli-version": "2.9" diff --git a/paths.yaml b/paths.yaml index 90391184..22d5b385 100644 --- a/paths.yaml +++ b/paths.yaml @@ -50,6 +50,7 @@ "/accounts/{account_id}/custom_metadata/labels": get: "$ref": "./paths/custom_metadata_properties/index.yaml" +<<<<<<< HEAD "/accounts/{account_id}/custom_metadata/labels/{id}": get: "$ref": "./paths/custom_metadata_properties/show.yaml" @@ -57,6 +58,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: