def create_batch_for_job()

in src/wagtail_localize_smartling/api/client.py [0:0]


    def create_batch_for_job(self, *, job: "Job") -> str:
        # Create a Batch for uploading files to the given Job,
        # specifying the file(s) upfront.
        #
        # Returns the Batch UID, which we'll need to upload our file(s) to the batch

        body: dict[str, Any] = {
            "authorize": False,
            "translationJobUid": job.translation_job_uid,
            "fileUris": [
                # NB we just send one file per Job
                self.get_file_uri_for_job(job=job),
            ],
            # Not sending "localeWorkflows" key/value pair - doesn't look like
            # we really need them. If we do, that would need us to maintain
            # a map of language codes to workflow IDs in configuration,
            # drawing on data manually extracted from Smartling's web UI
            # "localeWorkflows": [
            #     {
            #         "targetLocaleId": "xx-YY",
            #         "workflowUid": "SET ME",
            #     },
            #     ...
            # ],
        }

        result = self._request(
            method="POST",
            path=f"/job-batches-api/v2/projects/{quote(job.project.project_id)}/batches",
            response_serializer_class=CreateBatchResponseSerializer,
            json=body,
        )

        return result["batchUid"]