From 732d439130702e5239c159ed13e0ea889428e5ec Mon Sep 17 00:00:00 2001 From: Varpusparvi Date: Thu, 24 Aug 2023 13:06:17 +0200 Subject: [PATCH 1/4] feat: Document new query parameters --- doc/compiled.json | 149 ++++++++++++++++++++++++++++++- paths/comment_replies/index.yaml | 40 ++++++++- paths/comments/index.yaml | 57 +++++++++++- 3 files changed, 238 insertions(+), 8 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index d4f793f44..d5dd4e17e 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -10378,6 +10378,44 @@ "schema": { "type": "string" } + }, + { + "description": "Search query for comment messages", + "example": "Some comment content", + "name": "query", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "Search comments by their assigned locales", + "example": [ + "someId" + ], + "name": "locale_ids", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Specify the filter for the comments", + "name": "filters", + "in": "query", + "schema": { + "type": "array", + "example": [ + "read", + "unread" + ], + "items": { + "type": "string" + } + } } ], "responses": { @@ -10421,13 +10459,58 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments?branch=my-feature-branch\" \\\n -u USERNAME_OR_ACCESS_TOKEN" + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments?branch=my-feature-branch\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X GET \\\n -d '{\"branch\":\"my-feature-branch\", \"filters\": [\"unread\", \"read\"], \"query\": \"Some comment content\", \"locale_ids\": [\"someId\"] }' \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", - "source": "phrase comments list \\\n--project_id \\\n--key_id \\\n--branch my-feature-branch \\\n--access_token " + "source": "phrase comments list \\\n--project_id \\\n--key_id \\\n--data '{\"branch\":\"my-feature-branch\", \"filters\": [\"unread\", \"read\"], \"query\": \"Some comment content\", \"locale_ids\": [\"someId\"] }' \\\n--access_token " } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "title": "comments/list/parameters", + "properties": { + "branch": { + "description": "Specify the branch to use", + "type": "string", + "example": "my-feature-branch" + }, + "query": { + "description": "Search query for comment messages", + "type": "string", + "example": "Some comment content" + }, + "locale_ids": { + "description": "Search comments by their assigned locales", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "someId", + "otherId" + ] + }, + "filters": { + "description": "Specify filters to find comments by", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "read", + "unread" + ] + } + } + } + } + } + }, "x-cli-version": "2.5" }, "post": { @@ -11292,6 +11375,30 @@ "schema": { "type": "string" } + }, + { + "description": "Search query for comment messages", + "example": "Some comment content", + "name": "query", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "Specify the filter for the comments", + "name": "filters", + "in": "query", + "schema": { + "type": "array", + "example": [ + "read", + "unread" + ], + "items": { + "type": "string" + } + } } ], "responses": { @@ -11338,13 +11445,47 @@ "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'" + "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\", \"filters\": [\"unread\", \"read\"], \"query\": \"Some comment content\"}' \\\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 " + "source": "phrase replies list \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--data '{\"branch\":\"my-feature-branch\", \"filters\": [\"unread\", \"read\"], \"query\": \"Some comment content\"}' \\\n--access_token " } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "title": "replies/list/parameters", + "properties": { + "branch": { + "description": "Specify the branch to use", + "type": "string", + "example": "my-feature-branch" + }, + "query": { + "description": "Search query for comment messages", + "type": "string", + "example": "Some comment content" + }, + "filters": { + "description": "Specify filters to find comments by", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "read", + "unread" + ] + } + } + } + } + } + }, "x-cli-version": "2.10" }, "post": { diff --git a/paths/comment_replies/index.yaml b/paths/comment_replies/index.yaml index eecc133a6..03ceff013 100644 --- a/paths/comment_replies/index.yaml +++ b/paths/comment_replies/index.yaml @@ -17,6 +17,20 @@ parameters: in: query schema: type: string +- description: Search query for comment messages + example: Some comment content + name: query + in: query + schema: + type: string +- description: Specify the filter for the comments + name: filters + in: query + schema: + type: array + example: [read, unread] + items: + type: string responses: '200': description: OK @@ -49,7 +63,7 @@ x-code-samples: 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"}' \ + -d '{"branch":"my-feature-branch", "filters": ["unread", "read"], "query": "Some comment content"}' \ -H 'Content-Type: application/json' - lang: CLI v2 source: |- @@ -57,6 +71,28 @@ x-code-samples: --project_id \ --key_id \ --comment_id \ - --data '{"branch":"my-feature-branch"]}' \ + --data '{"branch":"my-feature-branch", "filters": ["unread", "read"], "query": "Some comment content"}' \ --access_token +requestBody: + required: true + content: + application/json: + schema: + type: object + title: replies/list/parameters + properties: + branch: + description: Specify the branch to use + type: string + example: my-feature-branch + query: + description: Search query for comment messages + type: string + example: Some comment content + filters: + description: Specify filters to find comments by + type: array + items: + type: string + example: [read, unread] x-cli-version: '2.10' diff --git a/paths/comments/index.yaml b/paths/comments/index.yaml index 3bccf6d87..015b59332 100644 --- a/paths/comments/index.yaml +++ b/paths/comments/index.yaml @@ -16,6 +16,28 @@ parameters: in: query schema: type: string +- description: Search query for comment messages + example: Some comment content + name: query + in: query + schema: + type: string +- description: Search comments by their assigned locales + example: [someId] + name: locale_ids + in: query + schema: + type: array + items: + type: string +- description: Specify the filter for the comments + name: filters + in: query + schema: + type: array + example: [read, unread] + items: + type: string responses: '200': description: OK @@ -44,12 +66,43 @@ x-code-samples: - lang: Curl source: |- curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments?branch=my-feature-branch" \ - -u USERNAME_OR_ACCESS_TOKEN + -u USERNAME_OR_ACCESS_TOKEN \ + -X GET \ + -d '{"branch":"my-feature-branch", "filters": ["unread", "read"], "query": "Some comment content", "locale_ids": ["someId"] }' \ + -H 'Content-Type: application/json' - lang: CLI v2 source: |- phrase comments list \ --project_id \ --key_id \ - --branch my-feature-branch \ + --data '{"branch":"my-feature-branch", "filters": ["unread", "read"], "query": "Some comment content", "locale_ids": ["someId"] }' \ --access_token +requestBody: + required: true + content: + application/json: + schema: + type: object + title: comments/list/parameters + properties: + branch: + description: Specify the branch to use + type: string + example: my-feature-branch + query: + description: Search query for comment messages + type: string + example: Some comment content + locale_ids: + description: Search comments by their assigned locales + type: array + items: + type: string + example: [someId, otherId] + filters: + description: Specify filters to find comments by + type: array + items: + type: string + example: [read, unread] x-cli-version: '2.5' From 3f72cb3b058b4acc7031ce51d9b53b4b574cd179 Mon Sep 17 00:00:00 2001 From: Varpusparvi Date: Mon, 28 Aug 2023 08:50:39 +0200 Subject: [PATCH 2/4] Adjust CLI source --- doc/compiled.json | 4 ++-- paths/comment_replies/index.yaml | 4 +++- paths/comments/index.yaml | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index d5dd4e17e..43981cd29 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -10463,7 +10463,7 @@ }, { "lang": "CLI v2", - "source": "phrase comments list \\\n--project_id \\\n--key_id \\\n--data '{\"branch\":\"my-feature-branch\", \"filters\": [\"unread\", \"read\"], \"query\": \"Some comment content\", \"locale_ids\": [\"someId\"] }' \\\n--access_token " + "source": "phrase comments list \\\n--project_id \\\n--key_id \\\n--branch \"my-feature-branch\" \\\n--filters unread \\\n--query \"Some comment content\" \\\n--locale_ids someId \\\n--access_token " } ], "requestBody": { @@ -11449,7 +11449,7 @@ }, { "lang": "CLI v2", - "source": "phrase replies list \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--data '{\"branch\":\"my-feature-branch\", \"filters\": [\"unread\", \"read\"], \"query\": \"Some comment content\"}' \\\n--access_token " + "source": "phrase replies list \\\n--project_id \\\n--key_id \\\n--comment_id \\\n--branch \"my-feature-branch\" \\\n--filters unread \\\n--query \"Some comment content\" \\\n--access_token " } ], "requestBody": { diff --git a/paths/comment_replies/index.yaml b/paths/comment_replies/index.yaml index 03ceff013..585028ff7 100644 --- a/paths/comment_replies/index.yaml +++ b/paths/comment_replies/index.yaml @@ -71,7 +71,9 @@ x-code-samples: --project_id \ --key_id \ --comment_id \ - --data '{"branch":"my-feature-branch", "filters": ["unread", "read"], "query": "Some comment content"}' \ + --branch "my-feature-branch" \ + --filters unread \ + --query "Some comment content" \ --access_token requestBody: required: true diff --git a/paths/comments/index.yaml b/paths/comments/index.yaml index 015b59332..88afd9650 100644 --- a/paths/comments/index.yaml +++ b/paths/comments/index.yaml @@ -75,7 +75,10 @@ x-code-samples: phrase comments list \ --project_id \ --key_id \ - --data '{"branch":"my-feature-branch", "filters": ["unread", "read"], "query": "Some comment content", "locale_ids": ["someId"] }' \ + --branch "my-feature-branch" \ + --filters unread \ + --query "Some comment content" \ + --locale_ids someId \ --access_token requestBody: required: true From 6371c8be9b5a0e60ef18ef1e5af56480cd7b24f8 Mon Sep 17 00:00:00 2001 From: Varpusparvi Date: Mon, 28 Aug 2023 12:00:44 +0200 Subject: [PATCH 3/4] Fix x-code-sample for curl --- paths/comment_replies/index.yaml | 3 +-- paths/comments/index.yaml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/paths/comment_replies/index.yaml b/paths/comment_replies/index.yaml index 585028ff7..ef7e6a9cd 100644 --- a/paths/comment_replies/index.yaml +++ b/paths/comment_replies/index.yaml @@ -60,10 +60,9 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies" \ + curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies?branch=my-feature-branch&filters=unread&query=something" \ -u USERNAME_OR_ACCESS_TOKEN \ -X GET \ - -d '{"branch":"my-feature-branch", "filters": ["unread", "read"], "query": "Some comment content"}' \ -H 'Content-Type: application/json' - lang: CLI v2 source: |- diff --git a/paths/comments/index.yaml b/paths/comments/index.yaml index 88afd9650..c349ac129 100644 --- a/paths/comments/index.yaml +++ b/paths/comments/index.yaml @@ -65,10 +65,9 @@ responses: x-code-samples: - lang: Curl source: |- - curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments?branch=my-feature-branch" \ + curl "https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments?branch=my-feature-branch&filters=unread&query=something&locale_ids=someId" \ -u USERNAME_OR_ACCESS_TOKEN \ -X GET \ - -d '{"branch":"my-feature-branch", "filters": ["unread", "read"], "query": "Some comment content", "locale_ids": ["someId"] }' \ -H 'Content-Type: application/json' - lang: CLI v2 source: |- From c3f129e29352718a2f034b5dc0e04434ebda7d5c Mon Sep 17 00:00:00 2001 From: Varpusparvi Date: Mon, 28 Aug 2023 12:02:25 +0200 Subject: [PATCH 4/4] Generate doc --- doc/compiled.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/compiled.json b/doc/compiled.json index 43981cd29..49e53c6cf 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -10459,7 +10459,7 @@ "x-code-samples": [ { "lang": "Curl", - "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments?branch=my-feature-branch\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X GET \\\n -d '{\"branch\":\"my-feature-branch\", \"filters\": [\"unread\", \"read\"], \"query\": \"Some comment content\", \"locale_ids\": [\"someId\"] }' \\\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments?branch=my-feature-branch&filters=unread&query=something&locale_ids=someId\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X GET \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2", @@ -11445,7 +11445,7 @@ "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\", \"filters\": [\"unread\", \"read\"], \"query\": \"Some comment content\"}' \\\n -H 'Content-Type: application/json'" + "source": "curl \"https://api.phrase.com/v2/projects/:project_id/keys/:key_id/comments/:comment_id/replies?branch=my-feature-branch&filters=unread&query=something\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X GET \\\n -H 'Content-Type: application/json'" }, { "lang": "CLI v2",