Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(API): Add custom_metadata_filters param to locale download endpoint [TSI-2174] #478

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ public void localeDownloadTest() throws ApiException, IOException, InterruptedEx

mockBackend.enqueue(mockResponse);


Map<String, String> nestedFormatOptionsMap = new HashMap<>();
nestedFormatOptionsMap.put("nested_option", "sub_option");

Map<String, Object> formatOptionsMap = new HashMap<>();
formatOptionsMap.put("omit_separator_space", "true");
formatOptionsMap.put("fallback_language", "en");
Expand All @@ -167,7 +167,8 @@ public void localeDownloadTest() throws ApiException, IOException, InterruptedEx
Boolean useLastReviewedVersion = null;
String fallbackLocaleId = null;
String sourceLocaleId = null;
File response = api.localeDownload(projectId, id, xPhraseAppOTP, ifModifiedSince, ifNoneMatch, branch, fileFormat, tags, tag, includeEmptyTranslations, excludeEmptyZeroForms, includeTranslatedKeys, keepNotranslateTags, convertEmoji, formatOptions, encoding, skipUnverifiedTranslations, includeUnverifiedTranslations, useLastReviewedVersion, fallbackLocaleId, sourceLocaleId);
Object customMetadataFilters = null;
File response = api.localeDownload(projectId, id, xPhraseAppOTP, ifModifiedSince, ifNoneMatch, branch, fileFormat, tags, tag, includeEmptyTranslations, excludeEmptyZeroForms, includeTranslatedKeys, keepNotranslateTags, convertEmoji, formatOptions, encoding, skipUnverifiedTranslations, includeUnverifiedTranslations, useLastReviewedVersion, fallbackLocaleId, sourceLocaleId, customMetadataFilters);

String fileContents = new String(java.nio.file.Files.readAllBytes(response.toPath()));
Assert.assertEquals("Correct file contents", fileContents, body);
Expand Down
13 changes: 12 additions & 1 deletion doc/compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -7778,6 +7778,17 @@
"schema": {
"type": "string"
}
},
{
"name": "custom_metadata_filters",
"in": "query",
"description": "Custom metadata filters. Provide the name of the metadata field and the value to filter by. Only keys with matching metadata will be included in the download.\n",
"schema": {
"type": "object",
"properties": {}
},
"style": "deepObject",
"explode": true
}
],
"responses": {
Expand Down Expand Up @@ -7816,7 +7827,7 @@
"x-code-samples": [
{
"lang": "Curl",
"source": "curl \"https://api.phrase.com/v2/projects/:project_id/locales/:id/download?branch=my-feature-branch&file_format=yml&tags=feature1,feature2&tag=feature\" \\\n -u USERNAME_OR_ACCESS_TOKEN"
"source": "curl \"https://api.phrase.com/v2/projects/:project_id/locales/:id/download?branch=my-feature-branch&file_format=yml&tags=feature1,feature2&tag=feature&custom_metadata_filters[tone]=friendly\" \\\n -u USERNAME_OR_ACCESS_TOKEN"
},
{
"lang": "CLI v2",
Expand Down
11 changes: 10 additions & 1 deletion paths/locales/download.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ parameters:
in: query
schema:
type: string
- name: custom_metadata_filters
in: query
description: |
Custom metadata filters. Provide the name of the metadata field and the value to filter by. Only keys with matching metadata will be included in the download.
schema:
type: object
properties: {}
style: deepObject
explode: true
responses:
"200":
description: OK
Expand All @@ -136,7 +145,7 @@ responses:
x-code-samples:
- lang: Curl
source: |-
curl "https://api.phrase.com/v2/projects/:project_id/locales/:id/download?branch=my-feature-branch&file_format=yml&tags=feature1,feature2&tag=feature" \
curl "https://api.phrase.com/v2/projects/:project_id/locales/:id/download?branch=my-feature-branch&file_format=yml&tags=feature1,feature2&tag=feature&custom_metadata_filters[tone]=friendly" \
-u USERNAME_OR_ACCESS_TOKEN
- lang: CLI v2
source: |-
Expand Down
Loading