formatjet 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {formatjet-0.1.0 → formatjet-0.2.0}/.gitignore +2 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/PKG-INFO +1 -1
- {formatjet-0.1.0 → formatjet-0.2.0}/pyproject.toml +1 -1
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/__init__.py +7 -2
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/_client.py +120 -10
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/convert.py +27 -4
- formatjet-0.2.0/src/formatjet/openapi/api/recipes/create_recipe.py +238 -0
- formatjet-0.2.0/src/formatjet/openapi/api/recipes/delete_recipe.py +182 -0
- formatjet-0.2.0/src/formatjet/openapi/api/recipes/get_recipe.py +176 -0
- formatjet-0.2.0/src/formatjet/openapi/api/recipes/list_recipes.py +204 -0
- formatjet-0.2.0/src/formatjet/openapi/api/recipes/update_recipe.py +215 -0
- formatjet-0.2.0/src/formatjet/openapi/api/webhooks/__init__.py +1 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/__init__.py +36 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/convert_files_body.py +14 -1
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/convert_from.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/convert_to.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate.py +26 -1
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_from.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_request.py +20 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_request_steps_item_from.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_request_steps_item_to.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_to.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job.py +13 -11
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_estimate.py +30 -3
- formatjet-0.2.0/src/formatjet/openapi/models/job_estimate_unit.py +18 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_input_format_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_input_format_type_2_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_input_format_type_3_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_inputs_item_format_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_inputs_item_format_type_2_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_inputs_item_format_type_3_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request.py +33 -19
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_steps_item_from.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_steps_item_to.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item.py +64 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_from_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_from_type_2_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_from_type_3_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_to_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_to_type_2_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_to_type_3_type_1.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/list_operations_from.py +14 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/list_operations_response_200.py +3 -2
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/list_operations_to.py +14 -0
- formatjet-0.2.0/src/formatjet/openapi/models/list_recipes_response_200.py +95 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/operation.py +9 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/pricing.py +17 -13
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/pricing_plans_item_overage_type_1.py +8 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/problem_code.py +2 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe.py +126 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_request.py +92 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_request_steps_item.py +122 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_request_steps_item_from.py +109 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_request_steps_item_op.py +15 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_request_steps_item_options.py +47 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_request_steps_item_to.py +109 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_steps_item.py +113 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_steps_item_op.py +15 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_steps_item_options.py +45 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_update.py +94 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_update_steps_item.py +122 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_update_steps_item_from.py +109 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_update_steps_item_op.py +15 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_update_steps_item_options.py +47 -0
- formatjet-0.2.0/src/formatjet/openapi/models/recipe_update_steps_item_to.py +109 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/tests/test_client.py +64 -3
- {formatjet-0.1.0 → formatjet-0.2.0}/LICENSE +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/README.md +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/_errors.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/_transport.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/_webhooks.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/__init__.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/__init__.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/account/__init__.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/account/get_account.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/account/get_usage.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/catalog/__init__.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/catalog/get_pricing.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/catalog/list_formats.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/catalog/list_operations.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/__init__.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/cancel_job.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/create_job.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/create_upload.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/delete_job.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/estimate_job.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/get_job.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/list_jobs.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/jobs/stream_job_events.py +0 -0
- {formatjet-0.1.0/src/formatjet/openapi/api/webhooks → formatjet-0.2.0/src/formatjet/openapi/api/recipes}/__init__.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/webhooks/create_webhook.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/webhooks/delete_webhook.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/webhooks/get_webhook.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/webhooks/list_webhook_deliveries.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/webhooks/list_webhooks.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/webhooks/replay_webhook_event.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/webhooks/rotate_webhook_secret.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/api/webhooks/update_webhook.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/client.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/errors.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account_credits.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account_credits_monthly_type_0.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account_key.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account_key_mode.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account_key_scopes_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account_limits.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account_organization.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/account_plan.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/deletion_receipt_response.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/deletion_receipt_response_receipt.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_credit_weight.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_request_steps_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_request_steps_item_op.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/estimate_request_steps_item_options.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/format_.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_error_type_0.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_input.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_inputs_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_links.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_metadata.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_mode.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_outputs_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_input_type_0.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_input_type_1.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_input_type_2.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_inputs_item_type_0.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_inputs_item_type_1.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_metadata.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_output.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_steps_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_steps_item_op.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_request_steps_item_options.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_status.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_op.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_options.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_steps_item_status.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_summary.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_summary_mode.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/job_summary_status.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/list_formats_response_200.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/list_jobs_response_200.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/list_webhook_deliveries_response_200.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/list_webhooks_response_200.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/operation_credits.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/operation_engines_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/operation_engines_item_engines_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/operation_files.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/operation_kind.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/operation_options_schema.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/pricing_credit_packs_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/pricing_credit_weights_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/pricing_plans_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/problem.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/problem_errors_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/replay_webhook_event_body.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/upload.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/upload_headers.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/upload_method.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/upload_request.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/usage.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/usage_days_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/usage_totals.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_delivery.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_delivery_event_type.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_delivery_mode.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_disabled_reason_type_1.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_disabled_reason_type_2_type_1.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_disabled_reason_type_3_type_1.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_events_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_mode.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_request.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_request_events_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_update.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_update_events_item.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/models/webhook_endpoint_with_secret.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/openapi/types.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/src/formatjet/py.typed +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/tests/test_version.py +0 -0
- {formatjet-0.1.0 → formatjet-0.2.0}/tests/test_webhooks.py +0 -0
|
@@ -15,6 +15,8 @@ from ._client import (
|
|
|
15
15
|
JobPage,
|
|
16
16
|
Jobs,
|
|
17
17
|
OutputFile,
|
|
18
|
+
RecipePage,
|
|
19
|
+
Recipes,
|
|
18
20
|
filename_from,
|
|
19
21
|
)
|
|
20
22
|
from ._errors import FormatJetError
|
|
@@ -26,9 +28,9 @@ from ._webhooks import (
|
|
|
26
28
|
parse_webhook,
|
|
27
29
|
verify_webhook,
|
|
28
30
|
)
|
|
29
|
-
from .openapi.models import Job, JobSummary, Upload
|
|
31
|
+
from .openapi.models import Job, JobSummary, Recipe, Upload
|
|
30
32
|
|
|
31
|
-
__version__ = "0.
|
|
33
|
+
__version__ = "0.2.0"
|
|
32
34
|
|
|
33
35
|
__all__ = [
|
|
34
36
|
"DEFAULT_BASE_URL",
|
|
@@ -43,6 +45,9 @@ __all__ = [
|
|
|
43
45
|
"JobSummary",
|
|
44
46
|
"Jobs",
|
|
45
47
|
"OutputFile",
|
|
48
|
+
"Recipe",
|
|
49
|
+
"RecipePage",
|
|
50
|
+
"Recipes",
|
|
46
51
|
"Upload",
|
|
47
52
|
"WebhookSignatureError",
|
|
48
53
|
"WebhookVerification",
|
|
@@ -18,7 +18,7 @@ from ._errors import FormatJetError, error_from_response
|
|
|
18
18
|
from ._transport import RetryTransport
|
|
19
19
|
from ._webhooks import parse_webhook, verify_webhook
|
|
20
20
|
from .openapi import AuthenticatedClient
|
|
21
|
-
from .openapi.models import Job, JobOutputsItem, JobSummary, Upload
|
|
21
|
+
from .openapi.models import Job, JobOutputsItem, JobSummary, Recipe, Upload
|
|
22
22
|
|
|
23
23
|
DEFAULT_BASE_URL = "https://api.formatjet.com"
|
|
24
24
|
TERMINAL = frozenset({"completed", "failed", "canceled"})
|
|
@@ -68,6 +68,13 @@ class JobPage:
|
|
|
68
68
|
next_cursor: str | None
|
|
69
69
|
|
|
70
70
|
|
|
71
|
+
@dataclass(frozen=True)
|
|
72
|
+
class RecipePage:
|
|
73
|
+
data: list[Recipe]
|
|
74
|
+
#: Pass it back as `cursor` for the next page; `None` on the last.
|
|
75
|
+
next_cursor: str | None
|
|
76
|
+
|
|
77
|
+
|
|
71
78
|
@dataclass
|
|
72
79
|
class _Prepared:
|
|
73
80
|
filename: str | None
|
|
@@ -100,7 +107,7 @@ def _step(
|
|
|
100
107
|
options: Mapping[str, Any] | None,
|
|
101
108
|
) -> dict[str, Any]:
|
|
102
109
|
if not conversion and not to:
|
|
103
|
-
raise ValueError("Name the conversion,
|
|
110
|
+
raise ValueError("Name the conversion, the format to make (`to`) or a `recipe`.")
|
|
104
111
|
step: dict[str, Any] = {"op": "convert"}
|
|
105
112
|
if conversion:
|
|
106
113
|
step["conversion"] = conversion
|
|
@@ -113,6 +120,25 @@ def _step(
|
|
|
113
120
|
return step
|
|
114
121
|
|
|
115
122
|
|
|
123
|
+
def _run(
|
|
124
|
+
conversion: str | None,
|
|
125
|
+
to: str | None,
|
|
126
|
+
from_: str | None,
|
|
127
|
+
options: Mapping[str, Any] | None,
|
|
128
|
+
recipe: str | None,
|
|
129
|
+
steps: Sequence[Mapping[str, Any]] | None = None,
|
|
130
|
+
) -> dict[str, Any]:
|
|
131
|
+
"""What a job runs: a recipe, several steps, or the one step the arguments name."""
|
|
132
|
+
single = bool(conversion or to)
|
|
133
|
+
if sum((single, steps is not None, recipe is not None)) > 1:
|
|
134
|
+
raise ValueError("Name a conversion (or `to`), `steps` or a `recipe`: one of them.")
|
|
135
|
+
if recipe is not None:
|
|
136
|
+
return {"recipe": recipe}
|
|
137
|
+
if steps is not None:
|
|
138
|
+
return {"steps": [dict(step) for step in steps]}
|
|
139
|
+
return {"steps": [_step(conversion, to, from_, options)]}
|
|
140
|
+
|
|
141
|
+
|
|
116
142
|
def filename_from(header: str | None) -> str | None:
|
|
117
143
|
"""The name in a ``Content-Disposition`` header (``filename*`` first, as RFC 6266 says)."""
|
|
118
144
|
if not header:
|
|
@@ -208,6 +234,80 @@ class Jobs:
|
|
|
208
234
|
pause = min(pause * 1.5, 5.0)
|
|
209
235
|
|
|
210
236
|
|
|
237
|
+
class Recipes:
|
|
238
|
+
"""Recipes: saved steps and an output name to run on files (``recipe`` on a job, or the
|
|
239
|
+
``recipe`` argument of ``convert()`` and ``upload_and_convert()``). Pro and the API plans, and
|
|
240
|
+
test keys on any plan."""
|
|
241
|
+
|
|
242
|
+
def __init__(self, http: httpx.Client) -> None:
|
|
243
|
+
self._http = http
|
|
244
|
+
|
|
245
|
+
def _json(self, method: str, url: str, **kwargs: Any) -> Any:
|
|
246
|
+
response = self._http.request(method, url, **kwargs)
|
|
247
|
+
if not response.is_success:
|
|
248
|
+
raise error_from_response(response)
|
|
249
|
+
return response.json() if response.content else None
|
|
250
|
+
|
|
251
|
+
def create(
|
|
252
|
+
self,
|
|
253
|
+
name: str,
|
|
254
|
+
steps: Sequence[Mapping[str, Any]],
|
|
255
|
+
*,
|
|
256
|
+
output_name: str | None = None,
|
|
257
|
+
idempotency_key: str | None = None,
|
|
258
|
+
) -> Recipe:
|
|
259
|
+
"""Saves a recipe (``POST /v1/recipes``); its steps are checked as a job's are."""
|
|
260
|
+
body: dict[str, Any] = {"name": name, "steps": [dict(step) for step in steps]}
|
|
261
|
+
if output_name is not None:
|
|
262
|
+
body["output_name"] = output_name
|
|
263
|
+
headers = {"Idempotency-Key": idempotency_key} if idempotency_key else None
|
|
264
|
+
return Recipe.from_dict(self._json("POST", "/v1/recipes", json=body, headers=headers))
|
|
265
|
+
|
|
266
|
+
def get(self, recipe_id: str) -> Recipe:
|
|
267
|
+
return Recipe.from_dict(self._json("GET", f"/v1/recipes/{recipe_id}"))
|
|
268
|
+
|
|
269
|
+
def list(self, *, limit: int | None = None, cursor: str | None = None) -> RecipePage:
|
|
270
|
+
"""One page of recipes, newest first."""
|
|
271
|
+
params = {key: value for key, value in (("limit", limit), ("cursor", cursor)) if value is not None}
|
|
272
|
+
page = self._json("GET", "/v1/recipes", params=params)
|
|
273
|
+
return RecipePage([Recipe.from_dict(item) for item in page["data"]], page["next_cursor"])
|
|
274
|
+
|
|
275
|
+
def iterate(self, *, limit: int | None = None) -> Iterator[Recipe]:
|
|
276
|
+
"""Every recipe, newest first, a page at a time."""
|
|
277
|
+
cursor: str | None = None
|
|
278
|
+
while True:
|
|
279
|
+
page = self.list(limit=limit, cursor=cursor)
|
|
280
|
+
yield from page.data
|
|
281
|
+
if not page.next_cursor:
|
|
282
|
+
return
|
|
283
|
+
cursor = page.next_cursor
|
|
284
|
+
|
|
285
|
+
def update(
|
|
286
|
+
self,
|
|
287
|
+
recipe_id: str,
|
|
288
|
+
*,
|
|
289
|
+
name: str | None = None,
|
|
290
|
+
steps: Sequence[Mapping[str, Any]] | None = None,
|
|
291
|
+
output_name: str | None = None,
|
|
292
|
+
clear_output_name: bool = False,
|
|
293
|
+
) -> Recipe:
|
|
294
|
+
"""Changes a recipe's name, steps or output name (``clear_output_name`` goes back to the
|
|
295
|
+
input's name). Jobs already running keep their steps."""
|
|
296
|
+
body: dict[str, Any] = {}
|
|
297
|
+
if name is not None:
|
|
298
|
+
body["name"] = name
|
|
299
|
+
if steps is not None:
|
|
300
|
+
body["steps"] = [dict(step) for step in steps]
|
|
301
|
+
if clear_output_name:
|
|
302
|
+
body["output_name"] = None
|
|
303
|
+
elif output_name is not None:
|
|
304
|
+
body["output_name"] = output_name
|
|
305
|
+
return Recipe.from_dict(self._json("PATCH", f"/v1/recipes/{recipe_id}", json=body))
|
|
306
|
+
|
|
307
|
+
def delete(self, recipe_id: str) -> None:
|
|
308
|
+
self._json("DELETE", f"/v1/recipes/{recipe_id}")
|
|
309
|
+
|
|
310
|
+
|
|
211
311
|
class FormatJet:
|
|
212
312
|
"""The FormatJet API.
|
|
213
313
|
|
|
@@ -247,6 +347,7 @@ class FormatJet:
|
|
|
247
347
|
self._files = httpx.Client(transport=retrying, timeout=limits)
|
|
248
348
|
self._sleep = sleep
|
|
249
349
|
self.jobs = Jobs(self._http, sleep)
|
|
350
|
+
self.recipes = Recipes(self._http)
|
|
250
351
|
#: The generated client: pass it as ``client=`` to ``formatjet.openapi.api`` functions.
|
|
251
352
|
self.api = AuthenticatedClient(base_url=self.base_url, token=key).set_httpx_client(self._http)
|
|
252
353
|
|
|
@@ -271,6 +372,7 @@ class FormatJet:
|
|
|
271
372
|
to: str | None = None,
|
|
272
373
|
from_: str | None = None,
|
|
273
374
|
options: Mapping[str, Any] | None = None,
|
|
375
|
+
recipe: str | None = None,
|
|
274
376
|
filename: str | None = None,
|
|
275
377
|
output_filename: str | None = None,
|
|
276
378
|
ttl: int | None = None,
|
|
@@ -278,13 +380,17 @@ class FormatJet:
|
|
|
278
380
|
timeout: float = DEFAULT_WAIT_SECONDS,
|
|
279
381
|
) -> ConvertResult:
|
|
280
382
|
"""Converts one file (or the files a joining conversion takes, as a list) in one
|
|
281
|
-
request, up to 25 MB in all, and returns the converted files.
|
|
282
|
-
seconds is waited for,
|
|
383
|
+
request, up to 25 MB in all, and returns the converted files. ``recipe`` runs a saved
|
|
384
|
+
recipe's steps instead of one conversion. A job that runs past 30 seconds is waited for,
|
|
385
|
+
up to ``timeout`` seconds."""
|
|
283
386
|
files = [_prepare(item) for item in file] if isinstance(file, list) else [_prepare(file, filename)]
|
|
284
|
-
|
|
387
|
+
run = _run(conversion, to, from_, options, recipe)
|
|
388
|
+
step: dict[str, Any] = run["steps"][0] if "steps" in run else {}
|
|
285
389
|
params: dict[str, str] = {key: step[key] for key in ("conversion", "from", "to") if key in step}
|
|
286
|
-
if "
|
|
287
|
-
params["
|
|
390
|
+
if "recipe" in run:
|
|
391
|
+
params["recipe"] = run["recipe"]
|
|
392
|
+
# Options go in the body, never the URL, which can be logged: Unlock PDF's password is one.
|
|
393
|
+
data = {"options": json.dumps(step["options"], separators=(",", ":"))} if "options" in step else None
|
|
288
394
|
if output_filename:
|
|
289
395
|
params["output_filename"] = output_filename
|
|
290
396
|
if ttl is not None:
|
|
@@ -298,6 +404,7 @@ class FormatJet:
|
|
|
298
404
|
response = self._http.post(
|
|
299
405
|
"/v1/convert",
|
|
300
406
|
params=params,
|
|
407
|
+
data=data,
|
|
301
408
|
files=parts,
|
|
302
409
|
headers={"Idempotency-Key": idempotency_key or str(uuid.uuid4())},
|
|
303
410
|
)
|
|
@@ -334,6 +441,8 @@ class FormatJet:
|
|
|
334
441
|
to: str | None = None,
|
|
335
442
|
from_: str | None = None,
|
|
336
443
|
options: Mapping[str, Any] | None = None,
|
|
444
|
+
steps: Sequence[Mapping[str, Any]] | None = None,
|
|
445
|
+
recipe: str | None = None,
|
|
337
446
|
filename: str | None = None,
|
|
338
447
|
output_filename: str | None = None,
|
|
339
448
|
ttl: int | None = None,
|
|
@@ -344,11 +453,12 @@ class FormatJet:
|
|
|
344
453
|
on_progress: Callable[[Job], None] | None = None,
|
|
345
454
|
) -> ConvertResult:
|
|
346
455
|
"""Uploads the file (or the files to join, as a list), makes a job, waits for it and
|
|
347
|
-
downloads what it made. For files larger than ``convert()`` takes.
|
|
456
|
+
downloads what it made. For files larger than ``convert()`` takes. ``steps`` chains up
|
|
457
|
+
to five conversions, each on what the step before made; ``recipe`` runs a saved recipe."""
|
|
348
458
|
files = [_prepare(item) for item in file] if isinstance(file, list) else [_prepare(file, filename)]
|
|
349
|
-
|
|
459
|
+
run = _run(conversion, to, from_, options, recipe, steps)
|
|
350
460
|
refs = [{"upload_id": self._upload(prepared).id} for prepared in files]
|
|
351
|
-
request: dict[str, Any] =
|
|
461
|
+
request: dict[str, Any] = dict(run)
|
|
352
462
|
if len(refs) == 1:
|
|
353
463
|
request["input"] = refs[0]
|
|
354
464
|
else:
|
|
@@ -20,6 +20,7 @@ def _get_kwargs(
|
|
|
20
20
|
conversion: str | Unset = UNSET,
|
|
21
21
|
from_: ConvertFrom | Unset = UNSET,
|
|
22
22
|
to: ConvertTo | Unset = UNSET,
|
|
23
|
+
recipe: str | Unset = UNSET,
|
|
23
24
|
options: str | Unset = UNSET,
|
|
24
25
|
filename: str | Unset = UNSET,
|
|
25
26
|
output_filename: str | Unset = UNSET,
|
|
@@ -46,6 +47,8 @@ def _get_kwargs(
|
|
|
46
47
|
|
|
47
48
|
params["to"] = json_to
|
|
48
49
|
|
|
50
|
+
params["recipe"] = recipe
|
|
51
|
+
|
|
49
52
|
params["options"] = options
|
|
50
53
|
|
|
51
54
|
params["filename"] = filename
|
|
@@ -161,6 +164,7 @@ def sync_detailed(
|
|
|
161
164
|
conversion: str | Unset = UNSET,
|
|
162
165
|
from_: ConvertFrom | Unset = UNSET,
|
|
163
166
|
to: ConvertTo | Unset = UNSET,
|
|
167
|
+
recipe: str | Unset = UNSET,
|
|
164
168
|
options: str | Unset = UNSET,
|
|
165
169
|
filename: str | Unset = UNSET,
|
|
166
170
|
output_filename: str | Unset = UNSET,
|
|
@@ -180,7 +184,10 @@ def sync_detailed(
|
|
|
180
184
|
conversion (str | Unset): Example: word-to-pdf.
|
|
181
185
|
from_ (ConvertFrom | Unset):
|
|
182
186
|
to (ConvertTo | Unset):
|
|
183
|
-
|
|
187
|
+
recipe (str | Unset): A recipe’s ID (`rcp_…`) instead of `conversion` or `to`: its steps
|
|
188
|
+
and output name run on the file
|
|
189
|
+
options (str | Unset): The step’s options, as a JSON object. A password is refused here:
|
|
190
|
+
send it in a multipart `options` part
|
|
184
191
|
filename (str | Unset): The file’s name, for a raw body. Never logged.
|
|
185
192
|
output_filename (str | Unset):
|
|
186
193
|
ttl (int | Unset): Seconds the output is kept after completion (default 86400)
|
|
@@ -203,6 +210,7 @@ def sync_detailed(
|
|
|
203
210
|
conversion=conversion,
|
|
204
211
|
from_=from_,
|
|
205
212
|
to=to,
|
|
213
|
+
recipe=recipe,
|
|
206
214
|
options=options,
|
|
207
215
|
filename=filename,
|
|
208
216
|
output_filename=output_filename,
|
|
@@ -224,6 +232,7 @@ def sync(
|
|
|
224
232
|
conversion: str | Unset = UNSET,
|
|
225
233
|
from_: ConvertFrom | Unset = UNSET,
|
|
226
234
|
to: ConvertTo | Unset = UNSET,
|
|
235
|
+
recipe: str | Unset = UNSET,
|
|
227
236
|
options: str | Unset = UNSET,
|
|
228
237
|
filename: str | Unset = UNSET,
|
|
229
238
|
output_filename: str | Unset = UNSET,
|
|
@@ -243,7 +252,10 @@ def sync(
|
|
|
243
252
|
conversion (str | Unset): Example: word-to-pdf.
|
|
244
253
|
from_ (ConvertFrom | Unset):
|
|
245
254
|
to (ConvertTo | Unset):
|
|
246
|
-
|
|
255
|
+
recipe (str | Unset): A recipe’s ID (`rcp_…`) instead of `conversion` or `to`: its steps
|
|
256
|
+
and output name run on the file
|
|
257
|
+
options (str | Unset): The step’s options, as a JSON object. A password is refused here:
|
|
258
|
+
send it in a multipart `options` part
|
|
247
259
|
filename (str | Unset): The file’s name, for a raw body. Never logged.
|
|
248
260
|
output_filename (str | Unset):
|
|
249
261
|
ttl (int | Unset): Seconds the output is kept after completion (default 86400)
|
|
@@ -267,6 +279,7 @@ def sync(
|
|
|
267
279
|
conversion=conversion,
|
|
268
280
|
from_=from_,
|
|
269
281
|
to=to,
|
|
282
|
+
recipe=recipe,
|
|
270
283
|
options=options,
|
|
271
284
|
filename=filename,
|
|
272
285
|
output_filename=output_filename,
|
|
@@ -282,6 +295,7 @@ async def asyncio_detailed(
|
|
|
282
295
|
conversion: str | Unset = UNSET,
|
|
283
296
|
from_: ConvertFrom | Unset = UNSET,
|
|
284
297
|
to: ConvertTo | Unset = UNSET,
|
|
298
|
+
recipe: str | Unset = UNSET,
|
|
285
299
|
options: str | Unset = UNSET,
|
|
286
300
|
filename: str | Unset = UNSET,
|
|
287
301
|
output_filename: str | Unset = UNSET,
|
|
@@ -301,7 +315,10 @@ async def asyncio_detailed(
|
|
|
301
315
|
conversion (str | Unset): Example: word-to-pdf.
|
|
302
316
|
from_ (ConvertFrom | Unset):
|
|
303
317
|
to (ConvertTo | Unset):
|
|
304
|
-
|
|
318
|
+
recipe (str | Unset): A recipe’s ID (`rcp_…`) instead of `conversion` or `to`: its steps
|
|
319
|
+
and output name run on the file
|
|
320
|
+
options (str | Unset): The step’s options, as a JSON object. A password is refused here:
|
|
321
|
+
send it in a multipart `options` part
|
|
305
322
|
filename (str | Unset): The file’s name, for a raw body. Never logged.
|
|
306
323
|
output_filename (str | Unset):
|
|
307
324
|
ttl (int | Unset): Seconds the output is kept after completion (default 86400)
|
|
@@ -324,6 +341,7 @@ async def asyncio_detailed(
|
|
|
324
341
|
conversion=conversion,
|
|
325
342
|
from_=from_,
|
|
326
343
|
to=to,
|
|
344
|
+
recipe=recipe,
|
|
327
345
|
options=options,
|
|
328
346
|
filename=filename,
|
|
329
347
|
output_filename=output_filename,
|
|
@@ -343,6 +361,7 @@ async def asyncio(
|
|
|
343
361
|
conversion: str | Unset = UNSET,
|
|
344
362
|
from_: ConvertFrom | Unset = UNSET,
|
|
345
363
|
to: ConvertTo | Unset = UNSET,
|
|
364
|
+
recipe: str | Unset = UNSET,
|
|
346
365
|
options: str | Unset = UNSET,
|
|
347
366
|
filename: str | Unset = UNSET,
|
|
348
367
|
output_filename: str | Unset = UNSET,
|
|
@@ -362,7 +381,10 @@ async def asyncio(
|
|
|
362
381
|
conversion (str | Unset): Example: word-to-pdf.
|
|
363
382
|
from_ (ConvertFrom | Unset):
|
|
364
383
|
to (ConvertTo | Unset):
|
|
365
|
-
|
|
384
|
+
recipe (str | Unset): A recipe’s ID (`rcp_…`) instead of `conversion` or `to`: its steps
|
|
385
|
+
and output name run on the file
|
|
386
|
+
options (str | Unset): The step’s options, as a JSON object. A password is refused here:
|
|
387
|
+
send it in a multipart `options` part
|
|
366
388
|
filename (str | Unset): The file’s name, for a raw body. Never logged.
|
|
367
389
|
output_filename (str | Unset):
|
|
368
390
|
ttl (int | Unset): Seconds the output is kept after completion (default 86400)
|
|
@@ -387,6 +409,7 @@ async def asyncio(
|
|
|
387
409
|
conversion=conversion,
|
|
388
410
|
from_=from_,
|
|
389
411
|
to=to,
|
|
412
|
+
recipe=recipe,
|
|
390
413
|
options=options,
|
|
391
414
|
filename=filename,
|
|
392
415
|
output_filename=output_filename,
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.problem import Problem
|
|
9
|
+
from ...models.recipe import Recipe
|
|
10
|
+
from ...models.recipe_request import RecipeRequest
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: RecipeRequest,
|
|
17
|
+
idempotency_key: str | Unset = UNSET,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
if not isinstance(idempotency_key, Unset):
|
|
21
|
+
headers["idempotency-key"] = idempotency_key
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": "/v1/recipes",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_kwargs["json"] = body.to_dict()
|
|
29
|
+
|
|
30
|
+
headers["Content-Type"] = "application/json"
|
|
31
|
+
|
|
32
|
+
_kwargs["headers"] = headers
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(
|
|
37
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
38
|
+
) -> Problem | Recipe | None:
|
|
39
|
+
if response.status_code == 201:
|
|
40
|
+
response_201 = Recipe.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_201
|
|
43
|
+
|
|
44
|
+
if response.status_code == 400:
|
|
45
|
+
response_400 = Problem.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_400
|
|
48
|
+
|
|
49
|
+
if response.status_code == 401:
|
|
50
|
+
response_401 = Problem.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_401
|
|
53
|
+
|
|
54
|
+
if response.status_code == 403:
|
|
55
|
+
response_403 = Problem.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_403
|
|
58
|
+
|
|
59
|
+
if response.status_code == 409:
|
|
60
|
+
response_409 = Problem.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_409
|
|
63
|
+
|
|
64
|
+
if response.status_code == 422:
|
|
65
|
+
response_422 = Problem.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_422
|
|
68
|
+
|
|
69
|
+
if response.status_code == 429:
|
|
70
|
+
response_429 = Problem.from_dict(response.json())
|
|
71
|
+
|
|
72
|
+
return response_429
|
|
73
|
+
|
|
74
|
+
if client.raise_on_unexpected_status:
|
|
75
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
76
|
+
else:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _build_response(
|
|
81
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
82
|
+
) -> Response[Problem | Recipe]:
|
|
83
|
+
return Response(
|
|
84
|
+
status_code=HTTPStatus(response.status_code),
|
|
85
|
+
content=response.content,
|
|
86
|
+
headers=response.headers,
|
|
87
|
+
parsed=_parse_response(client=client, response=response),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def sync_detailed(
|
|
92
|
+
*,
|
|
93
|
+
client: AuthenticatedClient,
|
|
94
|
+
body: RecipeRequest,
|
|
95
|
+
idempotency_key: str | Unset = UNSET,
|
|
96
|
+
) -> Response[Problem | Recipe]:
|
|
97
|
+
"""Save a recipe: steps and an output name to run on files
|
|
98
|
+
|
|
99
|
+
Run it with `recipe` on `POST /v1/jobs`, or `?recipe=` on `POST /v1/convert`. Its steps are checked
|
|
100
|
+
now as a job's are, and again for each file. At most 100 recipes an organization. Recipes need Pro
|
|
101
|
+
or an API plan. Test keys have them on any plan.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
idempotency_key (str | Unset): Up to 255 printable ASCII characters, such as a UUID. A
|
|
105
|
+
repeat of the same request within 24 hours gets the first one’s successful answer again
|
|
106
|
+
(`Idempotent-Replayed: true`); the same key with a different request is a 409.
|
|
107
|
+
body (RecipeRequest): Example: {'name': 'Word documents to Markdown', 'steps': [{'op':
|
|
108
|
+
'convert', 'conversion': 'word-to-pdf'}, {'op': 'convert', 'conversion': 'pdf-to-
|
|
109
|
+
markdown'}], 'output_name': '{name}-text'}.
|
|
110
|
+
|
|
111
|
+
Raises:
|
|
112
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
113
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
Response[Problem | Recipe]
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
kwargs = _get_kwargs(
|
|
120
|
+
body=body,
|
|
121
|
+
idempotency_key=idempotency_key,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
response = client.get_httpx_client().request(
|
|
125
|
+
**kwargs,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
return _build_response(client=client, response=response)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def sync(
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient,
|
|
134
|
+
body: RecipeRequest,
|
|
135
|
+
idempotency_key: str | Unset = UNSET,
|
|
136
|
+
) -> Problem | Recipe | None:
|
|
137
|
+
"""Save a recipe: steps and an output name to run on files
|
|
138
|
+
|
|
139
|
+
Run it with `recipe` on `POST /v1/jobs`, or `?recipe=` on `POST /v1/convert`. Its steps are checked
|
|
140
|
+
now as a job's are, and again for each file. At most 100 recipes an organization. Recipes need Pro
|
|
141
|
+
or an API plan. Test keys have them on any plan.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
idempotency_key (str | Unset): Up to 255 printable ASCII characters, such as a UUID. A
|
|
145
|
+
repeat of the same request within 24 hours gets the first one’s successful answer again
|
|
146
|
+
(`Idempotent-Replayed: true`); the same key with a different request is a 409.
|
|
147
|
+
body (RecipeRequest): Example: {'name': 'Word documents to Markdown', 'steps': [{'op':
|
|
148
|
+
'convert', 'conversion': 'word-to-pdf'}, {'op': 'convert', 'conversion': 'pdf-to-
|
|
149
|
+
markdown'}], 'output_name': '{name}-text'}.
|
|
150
|
+
|
|
151
|
+
Raises:
|
|
152
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
153
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
Problem | Recipe
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
return sync_detailed(
|
|
160
|
+
client=client,
|
|
161
|
+
body=body,
|
|
162
|
+
idempotency_key=idempotency_key,
|
|
163
|
+
).parsed
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
async def asyncio_detailed(
|
|
167
|
+
*,
|
|
168
|
+
client: AuthenticatedClient,
|
|
169
|
+
body: RecipeRequest,
|
|
170
|
+
idempotency_key: str | Unset = UNSET,
|
|
171
|
+
) -> Response[Problem | Recipe]:
|
|
172
|
+
"""Save a recipe: steps and an output name to run on files
|
|
173
|
+
|
|
174
|
+
Run it with `recipe` on `POST /v1/jobs`, or `?recipe=` on `POST /v1/convert`. Its steps are checked
|
|
175
|
+
now as a job's are, and again for each file. At most 100 recipes an organization. Recipes need Pro
|
|
176
|
+
or an API plan. Test keys have them on any plan.
|
|
177
|
+
|
|
178
|
+
Args:
|
|
179
|
+
idempotency_key (str | Unset): Up to 255 printable ASCII characters, such as a UUID. A
|
|
180
|
+
repeat of the same request within 24 hours gets the first one’s successful answer again
|
|
181
|
+
(`Idempotent-Replayed: true`); the same key with a different request is a 409.
|
|
182
|
+
body (RecipeRequest): Example: {'name': 'Word documents to Markdown', 'steps': [{'op':
|
|
183
|
+
'convert', 'conversion': 'word-to-pdf'}, {'op': 'convert', 'conversion': 'pdf-to-
|
|
184
|
+
markdown'}], 'output_name': '{name}-text'}.
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
188
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
Response[Problem | Recipe]
|
|
192
|
+
"""
|
|
193
|
+
|
|
194
|
+
kwargs = _get_kwargs(
|
|
195
|
+
body=body,
|
|
196
|
+
idempotency_key=idempotency_key,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
200
|
+
|
|
201
|
+
return _build_response(client=client, response=response)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
async def asyncio(
|
|
205
|
+
*,
|
|
206
|
+
client: AuthenticatedClient,
|
|
207
|
+
body: RecipeRequest,
|
|
208
|
+
idempotency_key: str | Unset = UNSET,
|
|
209
|
+
) -> Problem | Recipe | None:
|
|
210
|
+
"""Save a recipe: steps and an output name to run on files
|
|
211
|
+
|
|
212
|
+
Run it with `recipe` on `POST /v1/jobs`, or `?recipe=` on `POST /v1/convert`. Its steps are checked
|
|
213
|
+
now as a job's are, and again for each file. At most 100 recipes an organization. Recipes need Pro
|
|
214
|
+
or an API plan. Test keys have them on any plan.
|
|
215
|
+
|
|
216
|
+
Args:
|
|
217
|
+
idempotency_key (str | Unset): Up to 255 printable ASCII characters, such as a UUID. A
|
|
218
|
+
repeat of the same request within 24 hours gets the first one’s successful answer again
|
|
219
|
+
(`Idempotent-Replayed: true`); the same key with a different request is a 409.
|
|
220
|
+
body (RecipeRequest): Example: {'name': 'Word documents to Markdown', 'steps': [{'op':
|
|
221
|
+
'convert', 'conversion': 'word-to-pdf'}, {'op': 'convert', 'conversion': 'pdf-to-
|
|
222
|
+
markdown'}], 'output_name': '{name}-text'}.
|
|
223
|
+
|
|
224
|
+
Raises:
|
|
225
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
226
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
Problem | Recipe
|
|
230
|
+
"""
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
await asyncio_detailed(
|
|
234
|
+
client=client,
|
|
235
|
+
body=body,
|
|
236
|
+
idempotency_key=idempotency_key,
|
|
237
|
+
)
|
|
238
|
+
).parsed
|