From 22787ccef78a90b096ef0a77b812e4553c062759 Mon Sep 17 00:00:00 2001 From: OmAxiani0 <75031769+OmAximani0@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:03:23 +0530 Subject: [PATCH] feat: Add Strings Exporter Settings Implemented Signed-off-by: OmAxiani0 <75031769+OmAximani0@users.noreply.github.com> --- .../api_resources/projects/resource.py | 25 +++++++++++++++++++ crowdin_api/api_resources/projects/types.py | 14 ++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/crowdin_api/api_resources/projects/resource.py b/crowdin_api/api_resources/projects/resource.py index c835743..4909a74 100644 --- a/crowdin_api/api_resources/projects/resource.py +++ b/crowdin_api/api_resources/projects/resource.py @@ -20,6 +20,9 @@ OtherFileFormatSettings, SpecificFileFormatSettings, ProjectFilePatchRequest, + AndroidStringsExporterSettings, + MacOSXStringsExporterSettings, + XliffStringsExporterSettings, ) @@ -401,3 +404,25 @@ def list_project_strings_exporter( path=self.get_strings_exporter_path(projectId=projectId), params=params, ) + + def add_project_strings_exporter( + self, + projectId: int, + format: str, + settings: Union[ + AndroidStringsExporterSettings, + MacOSXStringsExporterSettings, + XliffStringsExporterSettings, + ], + ): + """ + Add Project Strings Exporter Settings. + + Link to documetation: + https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.post + """ + return self.requester.request( + method="post", + path=self.get_strings_exporter_path(projectId=projectId), + request_data={"format": format, "settings": settings}, + ) diff --git a/crowdin_api/api_resources/projects/types.py b/crowdin_api/api_resources/projects/types.py index 1335bb9..29bd788 100644 --- a/crowdin_api/api_resources/projects/types.py +++ b/crowdin_api/api_resources/projects/types.py @@ -1,4 +1,4 @@ -from typing import Any, Iterable, List, Union +from typing import Any, Iterable, List, Union, Dict from crowdin_api.api_resources.enums import PatchOperation from crowdin_api.api_resources.projects.enums import ( @@ -98,6 +98,18 @@ class OtherFileFormatSettings(TypedDict): exportPattern: str +class AndroidStringsExporterSettings(TypedDict): + convertPlaceholders: bool + + +class MacOSXStringsExporterSettings(TypedDict): + convertPlaceholders: bool + + +class XliffStringsExporterSettings(TypedDict): + languagePairMapping: Dict[str, str] + + class ProjectFilePatchRequest(TypedDict): value: Union[str, List[str]] op: PatchOperation