From 71351ac285f4f49976092e176c77b09f3485eb65 Mon Sep 17 00:00:00 2001 From: Mikko Karkee Date: Thu, 24 Aug 2023 13:04:08 +0300 Subject: [PATCH] feat(API): Introduce comment replies endpoints (#383) * Adjusted comment schema and #create endpoint * Added comment replies documentation * Adjusted #create endpoint documentation for comment/reaction * Fix lint * Adjust to x-cli-version: '2.10' --- doc/compiled.json | 510 +++++++++++++++++++++- main.yaml | 2 + paths.yaml | 16 + paths/comment_reactions/create.yaml | 10 +- paths/comment_replies/create.yaml | 62 +++ paths/comment_replies/destroy.yaml | 47 ++ paths/comment_replies/index.yaml | 62 +++ paths/comment_replies/mark_as_read.yaml | 47 ++ paths/comment_replies/mark_as_unread.yaml | 47 ++ paths/comment_replies/show.yaml | 58 +++ paths/comments/create.yaml | 18 +- schemas/comment.yaml | 11 + 12 files changed, 881 insertions(+), 9 deletions(-) create mode 100644 paths/comment_replies/create.yaml create mode 100644 paths/comment_replies/destroy.yaml create mode 100644 paths/comment_replies/index.yaml create mode 100644 paths/comment_replies/mark_as_read.yaml create mode 100644 paths/comment_replies/mark_as_unread.yaml create mode 100644 paths/comment_replies/show.yaml diff --git a/doc/compiled.json b/doc/compiled.json index 391ee6da..d4f793f4 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -57,6 +57,9 @@ { "name": "Comment Reactions" }, + { + "name": "Comment Replies" + }, { "name": "Distributions" }, @@ -209,6 +212,7 @@ "Organization Job Template Locales", "Comments", "Comment Reactions", + "Comment Replies", "Branches" ] }, @@ -588,6 +592,9 @@ "message": { "type": "string" }, + "has_replies": { + "type": "boolean" + }, "user": { "$ref": "#/components/schemas/user_preview" }, @@ -604,18 +611,32 @@ "items": { "$ref": "#/components/schemas/user_preview" } + }, + "locales": { + "type": "array", + "items": { + "$ref": "#/components/schemas/locale_preview" + } } }, "example": { "id": "abcd1234cdef1234abcd1234cdef1234", "message": "Some message...", + "has_replies": true, "user": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "created_at": "2015-01-28T09:52:53Z", - "updated_at": "2015-01-28T09:52:53Z" + "updated_at": "2015-01-28T09:52:53Z", + "locales": [ + { + "id": "abcd1234cdef1234abcd1234cdef1234", + "name": "English", + "code": "en-GB" + } + ] } }, "comment_reaction": { @@ -10425,6 +10446,27 @@ }, { "$ref": "#/components/parameters/key_id" + }, + { + "description": "specify the message for the comment", + "example": "some message...", + "name": "message", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "specify the locales for the comment", + "example": "someId", + "name": "locale_ids", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } } ], "responses": { @@ -10462,11 +10504,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"branch\":\"my-feature-branch\",\"message\":\"Some message...\"}' \\\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"branch\":\"my-feature-branch\", \"message\":\"Some message...\", \"locale_ids\": [\"someId\"]}' \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", - "source": "phrase comments create \\\n--project_id \\\n--key_id \\\n--data '{\"branch\":\"my-feature-branch\", \"message\": \"Some message...\"}' \\\n--access_token " + "source": "phrase comments create \\\n--project_id \\\n--key_id \\\n--data '{\"branch\":\"my-feature-branch\", \"message\": \"Some message...\", \"locale_ids\": [\"someId\"]}' \\\n--access_token " } ], "requestBody": { @@ -11012,6 +11054,15 @@ "schema": { "type": "string" } + }, + { + "description": "specify the emoji for the reaction", + "example": "👍", + "name": "emoji", + "in": "query", + "schema": { + "type": "string" + } } ], "responses": { @@ -11052,11 +11103,11 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/reactions/\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X DELETE \\\n -d '{\"branch\":\"my-feature-branch\"}' \\\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/reactions/\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X DELETE \\\n -d '{\"branch\":\"my-feature-branch\", \"emoji\": \"👍\"}' \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", - "source": "phrase reactions create \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--branch my-feature-branch \\\n--access_token " + "source": "phrase reactions create \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--data '{\"branch\":\"my-feature-branch\", \"emoji\": \"👍\"]}' \\\n--access_token " } ], "x-cli-version": "2.9" @@ -11206,6 +11257,455 @@ "x-cli-version": "2.9" } }, + "/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies": { + "get": { + "summary": "List replies", + "description": "List all replies for a comment.", + "operationId": "replies/list", + "tags": [ + "Comment Replies" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/project_id" + }, + { + "$ref": "#/components/parameters/key_id" + }, + { + "$ref": "#/components/parameters/comment_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": { + "$ref": "#/components/schemas/comment" + } + } + } + }, + "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" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X GET \\\n -d '{\"branch\":\"my-feature-branch\"}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase replies list \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--data '{\"branch\":\"my-feature-branch\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.10" + }, + "post": { + "summary": "Create a reply", + "description": "Create a new reply for a comment.", + "operationId": "reply/create", + "tags": [ + "Comment Replies" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/project_id" + }, + { + "$ref": "#/components/parameters/key_id" + }, + { + "$ref": "#/components/parameters/comment_id" + }, + { + "description": "specify the branch to use", + "example": "my-feature-branch", + "name": "branch", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "specify the message for the comment", + "example": "some message...", + "name": "message", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "201": { + "description": "Created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/comment" + } + } + }, + "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" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -d '{\"branch\":\"my-feature-branch\", \"message\":\"Some message...\"}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase replies create \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--data '{\"branch\":\"my-feature-branch\", \"message\": \"Some message...\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.10" + } + }, + "/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}": { + "get": { + "summary": "Get a single reply", + "description": "Get details on a single reply.", + "operationId": "reply/show", + "tags": [ + "Comment Replies" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/project_id" + }, + { + "$ref": "#/components/parameters/key_id" + }, + { + "$ref": "#/components/parameters/comment_id" + }, + { + "$ref": "#/components/parameters/id" + }, + { + "description": "specify the branch to use", + "example": "my-feature-branch", + "name": "branch", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/comment" + } + } + }, + "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" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X GET \\\n -d '{\"branch\":\"my-feature-branch\"}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase replies show \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--id \\\n--data '{\"branch\":\"my-feature-branch\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.10" + }, + "delete": { + "summary": "Delete a reply", + "description": "Delete an existing reply.", + "operationId": "reply/delete", + "tags": [ + "Comment Replies" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/project_id" + }, + { + "$ref": "#/components/parameters/key_id" + }, + { + "$ref": "#/components/parameters/comment_id" + }, + { + "$ref": "#/components/parameters/id" + }, + { + "description": "specify the branch to use", + "example": "my-feature-branch", + "name": "branch", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/:id\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X DELETE \\\n -d '{\"branch\":\"my-feature-branch\"}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase replies delete \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--id \\\n--data '{\"branch\":\"my-feature-branch\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.10" + } + }, + "/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}/mark_as_read": { + "patch": { + "summary": "Mark a reply as read", + "description": "Mark a reply as read.", + "operationId": "reply/mark_as_read", + "tags": [ + "Comment Replies" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/project_id" + }, + { + "$ref": "#/components/parameters/key_id" + }, + { + "$ref": "#/components/parameters/comment_id" + }, + { + "$ref": "#/components/parameters/id" + }, + { + "description": "specify the branch to use", + "example": "my-feature-branch", + "name": "branch", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/:id/mark_as_read\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"branch\":\"my-feature-branch\"}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase replies mark_as_read \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--id \\\n--data '{\"branch\":\"my-feature-branch\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.10" + } + }, + "/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}/mark_as_unread": { + "patch": { + "summary": "Mark a reply as unread", + "description": "Mark a reply as unread.", + "operationId": "reply/mark_as_unread", + "tags": [ + "Comment Replies" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-PhraseApp-OTP" + }, + { + "$ref": "#/components/parameters/project_id" + }, + { + "$ref": "#/components/parameters/key_id" + }, + { + "$ref": "#/components/parameters/comment_id" + }, + { + "$ref": "#/components/parameters/id" + }, + { + "description": "specify the branch to use", + "example": "my-feature-branch", + "name": "branch", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "429": { + "$ref": "#/components/responses/429" + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/:id/mark_as_unread\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"branch\":\"my-feature-branch\"}' \\\n -H 'Content-Type: application/json'" + }, + { + "lang": "CLI v2", + "source": "phrase replies mark_as_unread \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--id \\\n--data '{\"branch\":\"my-feature-branch\"]}' \\\n--access_token " + } + ], + "x-cli-version": "2.10" + } + }, "/projects/{project_id}/webhooks": { "get": { "summary": "List webhooks", diff --git a/main.yaml b/main.yaml index 9f52e7fb..f2e2d412 100644 --- a/main.yaml +++ b/main.yaml @@ -113,6 +113,7 @@ tags: - name: Comments - name: Comment Reactions + - name: Comment Replies - name: Distributions - name: Documents - name: Formats @@ -277,6 +278,7 @@ x-tagGroups: - Organization Job Template Locales - Comments - Comment Reactions + - Comment Replies - Branches - name: Quality tags: diff --git a/paths.yaml b/paths.yaml index 7aff3aae..2ee34e9f 100644 --- a/paths.yaml +++ b/paths.yaml @@ -209,6 +209,22 @@ "$ref": "./paths/comment_reactions/show.yaml" delete: "$ref": "./paths/comment_reactions/destroy.yaml" +"/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies": + get: + "$ref": "./paths/comment_replies/index.yaml" + post: + "$ref": "./paths/comment_replies/create.yaml" +"/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}": + get: + "$ref": "./paths/comment_replies/show.yaml" + delete: + "$ref": "./paths/comment_replies/destroy.yaml" +"/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}/mark_as_read": + patch: + "$ref": "./paths/comment_replies/mark_as_read.yaml" +"/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}/mark_as_unread": + patch: + "$ref": "./paths/comment_replies/mark_as_unread.yaml" "/projects/{project_id}/webhooks": get: "$ref": "./paths/webhooks/index.yaml" diff --git a/paths/comment_reactions/create.yaml b/paths/comment_reactions/create.yaml index fc347ce5..8589d711 100644 --- a/paths/comment_reactions/create.yaml +++ b/paths/comment_reactions/create.yaml @@ -15,6 +15,12 @@ parameters: in: query schema: type: string +- description: specify the emoji for the reaction + example: 👍 + name: emoji + in: query + schema: + type: string responses: '201': description: Created @@ -43,7 +49,7 @@ x-code-samples: curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/reactions/" \ -u USERNAME_OR_ACCESS_TOKEN \ -X DELETE \ - -d '{"branch":"my-feature-branch"}' \ + -d '{"branch":"my-feature-branch", "emoji": "👍"}' \ -H 'Content-Type: application/json' - lang: CLI v2 source: |- @@ -51,6 +57,6 @@ x-code-samples: --project_id \ --key_id \ --comment_id \ - --branch my-feature-branch \ + --data '{"branch":"my-feature-branch", "emoji": "👍"]}' \ --access_token x-cli-version: '2.9' diff --git a/paths/comment_replies/create.yaml b/paths/comment_replies/create.yaml new file mode 100644 index 00000000..70ed0627 --- /dev/null +++ b/paths/comment_replies/create.yaml @@ -0,0 +1,62 @@ +--- +summary: Create a reply +description: Create a new reply for a comment. +operationId: reply/create +tags: +- Comment Replies +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/project_id" +- "$ref": "../../parameters.yaml#/key_id" +- "$ref": "../../parameters.yaml#/comment_id" +- description: specify the branch to use + example: my-feature-branch + name: branch + in: query + schema: + type: string +- description: specify the message for the comment + example: some message... + name: message + in: query + schema: + type: string +responses: + '201': + description: Created + content: + application/json: + schema: + "$ref": "../../schemas/comment.yaml#/comment" + 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" + '403': + "$ref": "../../responses.yaml#/403" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X POST \ + -d '{"branch":"my-feature-branch", "message":"Some message..."}' \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase replies create \ + --project_id \ + --key_id \ + --comment_id \ + --data '{"branch":"my-feature-branch", "message": "Some message..."]}' \ + --access_token +x-cli-version: '2.10' diff --git a/paths/comment_replies/destroy.yaml b/paths/comment_replies/destroy.yaml new file mode 100644 index 00000000..764e0264 --- /dev/null +++ b/paths/comment_replies/destroy.yaml @@ -0,0 +1,47 @@ +--- +summary: Delete a reply +description: Delete an existing reply. +operationId: reply/delete +tags: +- Comment Replies +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/project_id" +- "$ref": "../../parameters.yaml#/key_id" +- "$ref": "../../parameters.yaml#/comment_id" +- "$ref": "../../parameters.yaml#/id" +- description: specify the branch to use + example: my-feature-branch + name: branch + in: query + schema: + type: string +responses: + '204': + "$ref": "../../responses.yaml#/204" + '400': + "$ref": "../../responses.yaml#/400" + '403': + "$ref": "../../responses.yaml#/403" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/:id" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X DELETE \ + -d '{"branch":"my-feature-branch"}' \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase replies delete \ + --project_id \ + --key_id \ + --comment_id \ + --id \ + --data '{"branch":"my-feature-branch"]}' \ + --access_token +x-cli-version: '2.10' diff --git a/paths/comment_replies/index.yaml b/paths/comment_replies/index.yaml new file mode 100644 index 00000000..eecc133a --- /dev/null +++ b/paths/comment_replies/index.yaml @@ -0,0 +1,62 @@ +--- +summary: List replies +description: List all replies for a comment. +operationId: replies/list +tags: +- Comment Replies +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/project_id" +- "$ref": "../../parameters.yaml#/key_id" +- "$ref": "../../parameters.yaml#/comment_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/comment.yaml#/comment" + 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" + '403': + "$ref": "../../responses.yaml#/403" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X GET \ + -d '{"branch":"my-feature-branch"}' \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase replies list \ + --project_id \ + --key_id \ + --comment_id \ + --data '{"branch":"my-feature-branch"]}' \ + --access_token +x-cli-version: '2.10' diff --git a/paths/comment_replies/mark_as_read.yaml b/paths/comment_replies/mark_as_read.yaml new file mode 100644 index 00000000..8ace77bc --- /dev/null +++ b/paths/comment_replies/mark_as_read.yaml @@ -0,0 +1,47 @@ +--- +summary: Mark a reply as read +description: Mark a reply as read. +operationId: reply/mark_as_read +tags: +- Comment Replies +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/project_id" +- "$ref": "../../parameters.yaml#/key_id" +- "$ref": "../../parameters.yaml#/comment_id" +- "$ref": "../../parameters.yaml#/id" +- description: specify the branch to use + example: my-feature-branch + name: branch + in: query + schema: + type: string +responses: + '204': + "$ref": "../../responses.yaml#/204" + '400': + "$ref": "../../responses.yaml#/400" + '403': + "$ref": "../../responses.yaml#/403" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/:id/mark_as_read" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X PATCH \ + -d '{"branch":"my-feature-branch"}' \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase replies mark_as_read \ + --project_id \ + --key_id \ + --comment_id \ + --id \ + --data '{"branch":"my-feature-branch"]}' \ + --access_token +x-cli-version: '2.10' diff --git a/paths/comment_replies/mark_as_unread.yaml b/paths/comment_replies/mark_as_unread.yaml new file mode 100644 index 00000000..f27a73fb --- /dev/null +++ b/paths/comment_replies/mark_as_unread.yaml @@ -0,0 +1,47 @@ +--- +summary: Mark a reply as unread +description: Mark a reply as unread. +operationId: reply/mark_as_unread +tags: +- Comment Replies +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/project_id" +- "$ref": "../../parameters.yaml#/key_id" +- "$ref": "../../parameters.yaml#/comment_id" +- "$ref": "../../parameters.yaml#/id" +- description: specify the branch to use + example: my-feature-branch + name: branch + in: query + schema: + type: string +responses: + '204': + "$ref": "../../responses.yaml#/204" + '400': + "$ref": "../../responses.yaml#/400" + '403': + "$ref": "../../responses.yaml#/403" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/:id/mark_as_unread" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X PATCH \ + -d '{"branch":"my-feature-branch"}' \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase replies mark_as_unread \ + --project_id \ + --key_id \ + --comment_id \ + --id \ + --data '{"branch":"my-feature-branch"]}' \ + --access_token +x-cli-version: '2.10' diff --git a/paths/comment_replies/show.yaml b/paths/comment_replies/show.yaml new file mode 100644 index 00000000..7383a5b2 --- /dev/null +++ b/paths/comment_replies/show.yaml @@ -0,0 +1,58 @@ +--- +summary: Get a single reply +description: Get details on a single reply. +operationId: reply/show +tags: +- Comment Replies +parameters: +- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" +- "$ref": "../../parameters.yaml#/project_id" +- "$ref": "../../parameters.yaml#/key_id" +- "$ref": "../../parameters.yaml#/comment_id" +- "$ref": "../../parameters.yaml#/id" +- description: specify the branch to use + example: my-feature-branch + name: branch + in: query + schema: + type: string +responses: + '200': + description: OK + content: + application/json: + schema: + "$ref": "../../schemas/comment.yaml#/comment" + 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" + '403': + "$ref": "../../responses.yaml#/403" + '404': + "$ref": "../../responses.yaml#/404" + '429': + "$ref": "../../responses.yaml#/429" +x-code-samples: +- lang: Curl + source: |- + curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies/:id" \ + -u USERNAME_OR_ACCESS_TOKEN \ + -X GET \ + -d '{"branch":"my-feature-branch"}' \ + -H 'Content-Type: application/json' +- lang: CLI v2 + source: |- + phrase replies show \ + --project_id \ + --key_id \ + --comment_id \ + --id \ + --data '{"branch":"my-feature-branch"]}' \ + --access_token +x-cli-version: '2.10' diff --git a/paths/comments/create.yaml b/paths/comments/create.yaml index 3edee2ad..ddb6a988 100644 --- a/paths/comments/create.yaml +++ b/paths/comments/create.yaml @@ -8,6 +8,20 @@ parameters: - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP" - "$ref": "../../parameters.yaml#/project_id" - "$ref": "../../parameters.yaml#/key_id" +- description: specify the message for the comment + example: some message... + name: message + in: query + schema: + type: string +- description: specify the locales for the comment + example: someId + name: locale_ids + in: query + schema: + type: array + items: + type: string responses: '201': description: Created @@ -34,14 +48,14 @@ x-code-samples: curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments" \ -u USERNAME_OR_ACCESS_TOKEN \ -X POST \ - -d '{"branch":"my-feature-branch","message":"Some message..."}' \ + -d '{"branch":"my-feature-branch", "message":"Some message...", "locale_ids": ["someId"]}' \ -H 'Content-Type: application/json' - lang: CLI v2 source: |- phrase comments create \ --project_id \ --key_id \ - --data '{"branch":"my-feature-branch", "message": "Some message..."}' \ + --data '{"branch":"my-feature-branch", "message": "Some message...", "locale_ids": ["someId"]}' \ --access_token requestBody: required: true diff --git a/schemas/comment.yaml b/schemas/comment.yaml index 0da06cd1..97541848 100644 --- a/schemas/comment.yaml +++ b/schemas/comment.yaml @@ -7,6 +7,8 @@ comment: type: string message: type: string + has_replies: + type: boolean user: "$ref": "./user_preview.yaml#/user_preview" created_at: @@ -19,12 +21,21 @@ comment: type: array items: "$ref": "./user_preview.yaml#/user_preview" + locales: + type: array + items: + "$ref": "./locale_preview.yaml#/locale_preview" example: id: abcd1234cdef1234abcd1234cdef1234 message: Some message... + has_replies: true user: id: abcd1234cdef1234abcd1234cdef1234 username: joe.doe name: Joe Doe created_at: '2015-01-28T09:52:53Z' updated_at: '2015-01-28T09:52:53Z' + locales: + - id: abcd1234cdef1234abcd1234cdef1234 + name: English + code: en-GB