Skip to content

Commit

Permalink
feat(API): Introduce comment replies endpoints (#383)
Browse files Browse the repository at this point in the history
* 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'
  • Loading branch information
Varpuspaavi authored Aug 24, 2023
1 parent 82ced72 commit 71351ac
Show file tree
Hide file tree
Showing 12 changed files with 881 additions and 9 deletions.
510 changes: 505 additions & 5 deletions doc/compiled.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ tags:
</div>
- name: Comments
- name: Comment Reactions
- name: Comment Replies
- name: Distributions
- name: Documents
- name: Formats
Expand Down Expand Up @@ -277,6 +278,7 @@ x-tagGroups:
- Organization Job Template Locales
- Comments
- Comment Reactions
- Comment Replies
- Branches
- name: Quality
tags:
Expand Down
16 changes: 16 additions & 0 deletions paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 8 additions & 2 deletions paths/comment_reactions/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -43,14 +49,14 @@ 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: |-
phrase reactions create \
--project_id <project_id> \
--key_id <key_id> \
--comment_id <comment_id> \
--branch my-feature-branch \
--data '{"branch":"my-feature-branch", "emoji": "👍"]}' \
--access_token <token>
x-cli-version: '2.9'
62 changes: 62 additions & 0 deletions paths/comment_replies/create.yaml
Original file line number Diff line number Diff line change
@@ -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 <project_id> \
--key_id <key_id> \
--comment_id <comment_id> \
--data '{"branch":"my-feature-branch", "message": "Some message..."]}' \
--access_token <token>
x-cli-version: '2.10'
47 changes: 47 additions & 0 deletions paths/comment_replies/destroy.yaml
Original file line number Diff line number Diff line change
@@ -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 <project_id> \
--key_id <key_id> \
--comment_id <comment_id> \
--id <id> \
--data '{"branch":"my-feature-branch"]}' \
--access_token <token>
x-cli-version: '2.10'
62 changes: 62 additions & 0 deletions paths/comment_replies/index.yaml
Original file line number Diff line number Diff line change
@@ -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 <project_id> \
--key_id <key_id> \
--comment_id <comment_id> \
--data '{"branch":"my-feature-branch"]}' \
--access_token <token>
x-cli-version: '2.10'
47 changes: 47 additions & 0 deletions paths/comment_replies/mark_as_read.yaml
Original file line number Diff line number Diff line change
@@ -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 <project_id> \
--key_id <key_id> \
--comment_id <comment_id> \
--id <id> \
--data '{"branch":"my-feature-branch"]}' \
--access_token <token>
x-cli-version: '2.10'
47 changes: 47 additions & 0 deletions paths/comment_replies/mark_as_unread.yaml
Original file line number Diff line number Diff line change
@@ -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 <project_id> \
--key_id <key_id> \
--comment_id <comment_id> \
--id <id> \
--data '{"branch":"my-feature-branch"]}' \
--access_token <token>
x-cli-version: '2.10'
58 changes: 58 additions & 0 deletions paths/comment_replies/show.yaml
Original file line number Diff line number Diff line change
@@ -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 <project_id> \
--key_id <key_id> \
--comment_id <comment_id> \
--id <id> \
--data '{"branch":"my-feature-branch"]}' \
--access_token <token>
x-cli-version: '2.10'
Loading

0 comments on commit 71351ac

Please sign in to comment.