From 98de0c52a83600866200368834bd99dc0f2e79cb Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Tue, 16 Jun 2026 09:20:13 +0200 Subject: [PATCH] chore: use alias_generator on generated models instead of per-field aliases Drive the codegen postprocess to put alias_generator=to_camel on each model and emit explicit Field aliases only for irregular conversions, shrinking the generated _models.py. The wire format is unchanged. --- scripts/postprocess_generated_models.py | 175 +- src/apify_client/_models.py | 2361 ++++++----------- .../unit/test_postprocess_generated_models.py | 129 + 3 files changed, 1090 insertions(+), 1575 deletions(-) diff --git a/scripts/postprocess_generated_models.py b/scripts/postprocess_generated_models.py index 3a3bf2d3..c927b972 100644 --- a/scripts/postprocess_generated_models.py +++ b/scripts/postprocess_generated_models.py @@ -3,6 +3,10 @@ Applied to `_models.py`: - Fix discriminator field names that use camelCase instead of snake_case (known issue with discriminators on schemas referenced from array items). +- Add `alias_generator=to_camel` to every model's `ConfigDict` and drop the per-field `Field(alias=...)` whenever the + alias is just the camelCase of the snake_case field name. Only irregular conversions (all-caps usage keys, + `gitHubGistUrl`, `schema`, ...) keep an explicit alias. The wire format is unchanged: an explicit `Field(alias=...)` + still wins over the generator in Pydantic, and `populate_by_name=True` keeps snake_case input working. - Rewrite every `class X(StrEnum)` as `X = Literal[...]` so downstream code can pass plain strings (and reuse the named alias in resource-client signatures) instead of enum members. - Move the resulting `X = Literal[...]` definitions into `_literals.py`, leaving `_models.py` importing them — so @@ -28,6 +32,8 @@ from pathlib import Path from typing import TYPE_CHECKING +from pydantic.alias_generators import to_camel + if TYPE_CHECKING: from apify_client._docs import GroupName @@ -98,6 +104,154 @@ def fix_discriminators(content: str) -> str: return content +def _ensure_to_camel_import(content: str) -> str: + """Add `from pydantic.alias_generators import to_camel` after the `from pydantic import ...` line.""" + if 'from pydantic.alias_generators import to_camel' in content: + return content + return re.sub( + r'(from pydantic import [^\n]+\n)', + r'\1from pydantic.alias_generators import to_camel\n', + content, + count=1, + ) + + +def _add_alias_generator_to_configs(content: str) -> str: + """Add `alias_generator=to_camel` to every model's `ConfigDict(extra='allow', populate_by_name=True)`. + + Collapses the multi-line config datamodel-codegen emits into a single line (it fits the line length), which keeps + the generated output smaller now that per-field aliases are gone. Idempotent: a config that already carries + `alias_generator` has it between `populate_by_name=True,` and the closing paren, so the pattern no longer matches. + """ + return re.sub( + r"model_config = ConfigDict\(\s*extra='allow',\s*populate_by_name=True,\s*\)", + "model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel)", + content, + ) + + +def _class_uses_camel_generator(class_node: ast.ClassDef) -> bool: + """Return True if `class_node` declares `model_config = ConfigDict(..., alias_generator=to_camel)`.""" + for stmt in class_node.body: + if isinstance(stmt, ast.Assign): + targets = stmt.targets + elif isinstance(stmt, ast.AnnAssign): + targets = [stmt.target] + else: + continue + if not any(isinstance(t, ast.Name) and t.id == 'model_config' for t in targets): + continue + value = stmt.value + if isinstance(value, ast.Call) and isinstance(value.func, ast.Name) and value.func.id == 'ConfigDict': + return any( + kw.arg == 'alias_generator' and isinstance(kw.value, ast.Name) and kw.value.id == 'to_camel' + for kw in value.keywords + ) + return False + + +def _annotation_without_regular_alias(annotation: ast.expr, field_name: str) -> str | None: + """Return the unparsed annotation with a regular `Field(alias=...)` removed, or None to leave it untouched. + + An alias is "regular" when `to_camel(field_name)` reproduces it, so the model's `alias_generator` already covers + it. Irregular aliases (e.g. `gitHubGistUrl`, all-caps usage keys, `schema`) are kept. When the alias was the + `Field` call's only content, the now-empty `Field` is dropped and `Annotated[T, Field()]` collapses to `T`. + """ + if not ( + isinstance(annotation, ast.Subscript) + and isinstance(annotation.value, ast.Name) + and annotation.value.id == 'Annotated' + and isinstance(annotation.slice, ast.Tuple) + ): + return None + + elts = annotation.slice.elts + field_idx = next( + ( + i + for i, elt in enumerate(elts) + if i > 0 + and isinstance(elt, ast.Call) + and isinstance(elt.func, ast.Name) + and elt.func.id == 'Field' + and _extract_alias_from_field_call(elt) is not None + ), + None, + ) + if field_idx is None: + return None + + field_call = elts[field_idx] + assert isinstance(field_call, ast.Call) # noqa: S101 + if to_camel(field_name) != _extract_alias_from_field_call(field_call): + return None + + remaining_keywords = [kw for kw in field_call.keywords if kw.arg != 'alias'] + new_elts = list(elts) + if remaining_keywords or field_call.args: + new_elts[field_idx] = ast.Call(func=field_call.func, args=list(field_call.args), keywords=remaining_keywords) + else: + del new_elts[field_idx] + + if len(new_elts) == 1: + result_node: ast.expr = new_elts[0] + else: + result_node = ast.Subscript( + value=annotation.value, + slice=ast.Tuple(elts=new_elts, ctx=ast.Load()), + ctx=ast.Load(), + ) + return ast.unparse(result_node) + + +def _strip_regular_field_aliases(content: str) -> str: + """Drop every per-field `Field(alias=...)` whose alias is just the camelCase of the field name. + + Operates on UTF-8 byte offsets (matching `ast` `col_offset` semantics) so multi-line annotations and any + non-ASCII content splice correctly. Only fields on models that carry `alias_generator=to_camel` are touched. + """ + tree = ast.parse(content) + data = bytearray(content.encode()) + line_byte_starts = [0, *[i + 1 for i, byte in enumerate(data) if byte == ord('\n')]] + + edits: list[tuple[int, int, bytes]] = [] + for node in tree.body: + if not isinstance(node, ast.ClassDef) or not _class_uses_camel_generator(node): + continue + for stmt in node.body: + if not isinstance(stmt, ast.AnnAssign) or not isinstance(stmt.target, ast.Name): + continue + if stmt.target.id == 'model_config': + continue + replacement = _annotation_without_regular_alias(stmt.annotation, stmt.target.id) + if replacement is None: + continue + ann = stmt.annotation + assert ann.end_lineno is not None # noqa: S101 + assert ann.end_col_offset is not None # noqa: S101 + start = line_byte_starts[ann.lineno - 1] + ann.col_offset + end = line_byte_starts[ann.end_lineno - 1] + ann.end_col_offset + edits.append((start, end, replacement.encode())) + + # Splice in reverse byte order so earlier offsets stay valid after each edit. + for start, end, replacement_bytes in sorted(edits, key=lambda e: e[0], reverse=True): + data[start:end] = replacement_bytes + + return data.decode() + + +def apply_camel_alias_generator(content: str) -> str: + """Move per-field camelCase aliasing onto a shared `alias_generator=to_camel`, keeping only irregular aliases. + + Adds the `to_camel` import, injects `alias_generator=to_camel` into every model `ConfigDict`, then strips the + now-redundant `Field(alias=...)` entries. The wire format is unchanged (verified by tests): Pydantic lets an + explicit alias override the generator, and `populate_by_name=True` keeps snake_case input working. + """ + content = _ensure_to_camel_import(content) + content = _add_alias_generator_to_configs(content) + return _strip_regular_field_aliases(content) + + def convert_enums_to_literals(content: str) -> str: """Rewrite every `class X(StrEnum): ...` into an `X = Literal[...]` alias. @@ -404,9 +558,11 @@ def _extract_alias_from_field_call(field_call: ast.Call) -> str | None: def _extract_class_field_aliases(class_node: ast.ClassDef) -> dict[str, str]: """Return `{snake_field: api_field}` for every annotated field declared on `class_node`. - Fields without a `Field(alias=...)` map to themselves (their declared Python name matches the API name — typical - for single-word fields like `url`, `id`). + The API spelling is resolved in priority order: an explicit `Field(alias=...)` wins; otherwise, on a model that + carries `alias_generator=to_camel`, the name is run through `to_camel` (matching Pydantic at runtime); otherwise + the field maps to itself (single-word fields like `url`, `id`, or models without the generator). """ + uses_camel = _class_uses_camel_generator(class_node) aliases: dict[str, str] = {} for stmt in class_node.body: if not isinstance(stmt, ast.AnnAssign) or not isinstance(stmt.target, ast.Name): @@ -414,15 +570,19 @@ def _extract_class_field_aliases(class_node: ast.ClassDef) -> dict[str, str]: field_name = stmt.target.id if field_name == 'model_config': continue - # Default: no alias means snake name == API name. - api_name = field_name # Walk the annotation to find a nested `Field(alias='...')` call inside `Annotated[...]`. + explicit_alias: str | None = None for sub in ast.walk(stmt.annotation): if isinstance(sub, ast.Call) and isinstance(sub.func, ast.Name) and sub.func.id == 'Field': - found = _extract_alias_from_field_call(sub) - if found is not None: - api_name = found + explicit_alias = _extract_alias_from_field_call(sub) + if explicit_alias is not None: break + if explicit_alias is not None: + api_name = explicit_alias + elif uses_camel: + api_name = to_camel(field_name) + else: + api_name = field_name aliases[field_name] = api_name return aliases @@ -588,6 +748,7 @@ def postprocess_models(models_path: Path, literals_path: Path) -> list[Path]: """ original = models_path.read_text() fixed = fix_discriminators(original) + fixed = apply_camel_alias_generator(fixed) fixed = convert_enums_to_literals(fixed) fixed = add_docs_group_decorators(fixed, 'Models') models_content, literals_content = split_literals_to_file(fixed) diff --git a/src/apify_client/_models.py b/src/apify_client/_models.py index 4ee81741..cdc2972a 100644 --- a/src/apify_client/_models.py +++ b/src/apify_client/_models.py @@ -5,6 +5,7 @@ from typing import Annotated, Any, Literal from pydantic import AnyUrl, AwareDatetime, BaseModel, ConfigDict, EmailStr, Field, RootModel +from pydantic.alias_generators import to_camel from apify_client._docs import docs_group from apify_client._literals import ( @@ -23,11 +24,8 @@ @docs_group('Models') class AccountLimits(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - monthly_usage_cycle: Annotated[UsageCycle, Field(alias='monthlyUsageCycle')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + monthly_usage_cycle: UsageCycle limits: Limits current: Current @@ -36,23 +34,19 @@ class AccountLimits(BaseModel): class ActVersion(BaseModel): """Snapshot of the Actor version that this build was created from.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - source_type: Annotated[VersionSourceType | None, Field(alias='sourceType')] = None - build_tag: Annotated[str | None, Field(alias='buildTag', examples=['experimental'])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + source_type: VersionSourceType | None = None + build_tag: Annotated[str | None, Field(examples=['experimental'])] = None version_number: Annotated[ - str | None, Field(alias='versionNumber', examples=['0.0'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$') + str | None, Field(examples=['0.0'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$') ] = None git_repo_url: Annotated[ - str | None, - Field(alias='gitRepoUrl', examples=['https://github.com/apifytech/actor-crawler.git#experimental:web-scraper']), + str | None, Field(examples=['https://github.com/apifytech/actor-crawler.git#experimental:web-scraper']) ] = None """ URL of the git repository, present when sourceType is GIT_REPO. """ - source_files: Annotated[list[SourceCodeFile] | None, Field(alias='sourceFiles')] = None + source_files: list[SourceCodeFile] | None = None """ Inline source files, present when sourceType is SOURCE_FILES. """ @@ -60,23 +54,20 @@ class ActVersion(BaseModel): @docs_group('Models') class Actor(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] name: Annotated[str, Field(examples=['MyActor'])] username: Annotated[str, Field(examples=['jane35'])] description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None - is_public: Annotated[bool, Field(alias='isPublic', examples=[False])] - actor_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='actorPermissionLevel')] = None - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-07-08T11:27:57.401Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-07-08T14:01:05.546Z'])] + restart_on_error: Annotated[bool | None, Field(deprecated=True, examples=[False])] = None + is_public: Annotated[bool, Field(examples=[False])] + actor_permission_level: ActorPermissionLevel | None = None + created_at: Annotated[AwareDatetime, Field(examples=['2019-07-08T11:27:57.401Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-07-08T14:01:05.546Z'])] stats: ActorStats versions: list[Version] - pricing_infos: Annotated[ + pricing_infos: ( list[ Annotated[ PayPerEventActorPricingInfo @@ -86,39 +77,33 @@ class Actor(BaseModel): Field(discriminator='pricing_model'), ] ] - | None, - Field(alias='pricingInfos'), - ] = None - default_run_options: Annotated[DefaultRunOptions, Field(alias='defaultRunOptions')] - example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None - is_deprecated: Annotated[bool | None, Field(alias='isDeprecated', examples=[False])] = None - deployment_key: Annotated[str | None, Field(alias='deploymentKey', examples=['ssh-rsa AAAA ...'])] = None + | None + ) = None + default_run_options: DefaultRunOptions + example_run_input: ExampleRunInput | None = None + is_deprecated: Annotated[bool | None, Field(examples=[False])] = None + deployment_key: Annotated[str | None, Field(examples=['ssh-rsa AAAA ...'])] = None title: Annotated[str | None, Field(examples=['My Actor'])] = None - tagged_builds: Annotated[dict[str, TaggedBuildInfo | None] | None, Field(alias='taggedBuilds')] = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None - readme_summary: Annotated[str | None, Field(alias='readmeSummary')] = None + tagged_builds: dict[str, TaggedBuildInfo | None] | None = None + actor_standby: ActorStandby | None = None + readme_summary: str | None = None """ A brief, LLM-generated readme summary """ - seo_title: Annotated[str | None, Field(alias='seoTitle', examples=['Web Scraper'])] = None + seo_title: Annotated[str | None, Field(examples=['Web Scraper'])] = None seo_description: Annotated[ - str | None, - Field( - alias='seoDescription', - examples=['Crawls websites using Chrome and extracts data from pages using JavaScript.'], - ), + str | None, Field(examples=['Crawls websites using Chrome and extracts data from pages using JavaScript.']) ] = None picture_url: Annotated[ - str | None, - Field(alias='pictureUrl', examples=['https://apify-image-uploads-prod.s3.amazonaws.com/.../actor-picture.png']), + str | None, Field(examples=['https://apify-image-uploads-prod.s3.amazonaws.com/.../actor-picture.png']) ] = None - standby_url: Annotated[str | None, Field(alias='standbyUrl', examples=['https://my-actor.apify.actor'])] = None + standby_url: Annotated[str | None, Field(examples=['https://my-actor.apify.actor'])] = None notice: Annotated[str | None, Field(examples=['NONE'])] = None categories: Annotated[list[str] | None, Field(examples=[['DEVELOPER_TOOLS', 'OPEN_SOURCE']])] = None - is_critical: Annotated[bool | None, Field(alias='isCritical', examples=[False])] = None - is_generic: Annotated[bool | None, Field(alias='isGeneric', examples=[False])] = None - is_source_code_hidden: Annotated[bool | None, Field(alias='isSourceCodeHidden', examples=[False])] = None - has_no_dataset: Annotated[bool | None, Field(alias='hasNoDataset', examples=[False])] = None + is_critical: Annotated[bool | None, Field(examples=[False])] = None + is_generic: Annotated[bool | None, Field(examples=[False])] = None + is_source_code_hidden: Annotated[bool | None, Field(examples=[False])] = None + has_no_dataset: Annotated[bool | None, Field(examples=[False])] = None @docs_group('Models') @@ -128,31 +113,26 @@ class ActorChargeEvent(BaseModel): """ - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - event_title: Annotated[str, Field(alias='eventTitle')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + event_title: str """ Human-readable title shown to users in the billing UI. """ - event_description: Annotated[str, Field(alias='eventDescription')] + event_description: str """ Human-readable description of what triggers this event. """ - event_price_usd: Annotated[float | None, Field(alias='eventPriceUsd')] = None + event_price_usd: float | None = None """ Flat price per event in USD. Present only for non-tiered events. Mutually exclusive with `eventTieredPricingUsd`. """ - event_tiered_pricing_usd: Annotated[ - dict[str, TieredPricingPerEventEntry] | None, Field(alias='eventTieredPricingUsd') - ] = None - is_primary_event: Annotated[bool | None, Field(alias='isPrimaryEvent')] = None + event_tiered_pricing_usd: dict[str, TieredPricingPerEventEntry] | None = None + is_primary_event: bool | None = None """ Whether this event is the Actor's primary chargeable event. """ - is_one_time_event: Annotated[bool | None, Field(alias='isOneTimeEvent')] = None + is_one_time_event: bool | None = None """ Whether this event can only be charged once per Actor run. """ @@ -162,11 +142,8 @@ class ActorChargeEvent(BaseModel): class ActorDefinition(BaseModel): """The definition of the Actor, the full specification of this field can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/actor-json).""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - actor_specification: Annotated[Literal[1], Field(alias='actorSpecification')] = 1 + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + actor_specification: Literal[1] = 1 """ The Actor specification version that this Actor follows. This property must be set to 1. """ @@ -178,11 +155,11 @@ class ActorDefinition(BaseModel): """ The version of the Actor, typically a dot-separated sequence of numbers (e.g., `0.1`, `1.0`, or `0.0.1`). """ - build_tag: Annotated[str | None, Field(alias='buildTag')] = None + build_tag: str | None = None """ The tag name to be applied to a successful build of the Actor. Defaults to 'latest' if not specified. """ - environment_variables: Annotated[dict[str, str] | None, Field(alias='environmentVariables')] = None + environment_variables: dict[str, str] | None = None """ A map of environment variables to be used during local development and deployment. """ @@ -190,7 +167,7 @@ class ActorDefinition(BaseModel): """ The path to the Dockerfile used for building the Actor on the platform. """ - docker_context_dir: Annotated[str | None, Field(alias='dockerContextDir')] = None + docker_context_dir: str | None = None """ The path to the directory used as the Docker context when building the Actor. """ @@ -207,19 +184,19 @@ class ActorDefinition(BaseModel): The path to the CHANGELOG file displayed in the Actor's information tab. """ storages: Storages | None = None - default_memory_mbytes: Annotated[str | int | None, Field(alias='defaultMemoryMbytes')] = None + default_memory_mbytes: str | int | None = None """ Specifies the default amount of memory in megabytes to be used when the Actor is started. Can be an integer or a [dynamic memory expression](/platform/actors/development/actor-definition/dynamic-actor-memory). """ - min_memory_mbytes: Annotated[int | None, Field(alias='minMemoryMbytes', ge=128)] = None + min_memory_mbytes: Annotated[int | None, Field(ge=128)] = None """ Specifies the minimum amount of memory in megabytes required by the Actor. """ - max_memory_mbytes: Annotated[int | None, Field(alias='maxMemoryMbytes', ge=128)] = None + max_memory_mbytes: Annotated[int | None, Field(ge=128)] = None """ Specifies the maximum amount of memory in megabytes required by the Actor. """ - uses_standby_mode: Annotated[bool | None, Field(alias='usesStandbyMode')] = None + uses_standby_mode: bool | None = None """ Specifies whether Standby mode is enabled for the Actor. """ @@ -229,40 +206,28 @@ class ActorDefinition(BaseModel): class ActorResponse(BaseModel): """Response containing Actor data.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Actor @docs_group('Models') class ActorRunFailedError(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) error: RunFailedErrorDetail | None = None @docs_group('Models') class ActorRunTimeoutExceededError(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) error: RunTimeoutExceededErrorDetail | None = None @docs_group('Models') class ActorShort(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['br9CKmk457'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-10-29T07:34:24.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-10-30T07:34:24.202Z'])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-10-29T07:34:24.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-10-30T07:34:24.202Z'])] name: Annotated[str, Field(examples=['MyAct'])] username: Annotated[str, Field(examples=['janedoe'])] title: Annotated[str | None, Field(examples=['Hello World Example'])] = None @@ -271,42 +236,32 @@ class ActorShort(BaseModel): @docs_group('Models') class ActorStandby(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - is_enabled: Annotated[bool | None, Field(alias='isEnabled')] = None - desired_requests_per_actor_run: Annotated[int | None, Field(alias='desiredRequestsPerActorRun')] = None - max_requests_per_actor_run: Annotated[int | None, Field(alias='maxRequestsPerActorRun')] = None - idle_timeout_secs: Annotated[int | None, Field(alias='idleTimeoutSecs')] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + is_enabled: bool | None = None + desired_requests_per_actor_run: int | None = None + max_requests_per_actor_run: int | None = None + idle_timeout_secs: int | None = None build: str | None = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes')] = None - disable_standby_fields_override: Annotated[bool | None, Field(alias='disableStandbyFieldsOverride')] = None - should_pass_actor_input: Annotated[bool | None, Field(alias='shouldPassActorInput')] = None + memory_mbytes: int | None = None + disable_standby_fields_override: bool | None = None + should_pass_actor_input: bool | None = None @docs_group('Models') class ActorStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - total_builds: Annotated[int | None, Field(alias='totalBuilds', examples=[9])] = None - total_runs: Annotated[int | None, Field(alias='totalRuns', examples=[16])] = None - total_users: Annotated[int | None, Field(alias='totalUsers', examples=[6])] = None - total_users7_days: Annotated[int | None, Field(alias='totalUsers7Days', examples=[2])] = None - total_users30_days: Annotated[int | None, Field(alias='totalUsers30Days', examples=[6])] = None - total_users90_days: Annotated[int | None, Field(alias='totalUsers90Days', examples=[6])] = None - total_metamorphs: Annotated[int | None, Field(alias='totalMetamorphs', examples=[2])] = None - last_run_started_at: Annotated[ - AwareDatetime | None, Field(alias='lastRunStartedAt', examples=['2019-07-08T14:01:05.546Z']) - ] = None - actor_review_count: Annotated[int | None, Field(alias='actorReviewCount', examples=[69])] = None - actor_review_rating: Annotated[float | None, Field(alias='actorReviewRating', examples=[4.7])] = None - bookmark_count: Annotated[int | None, Field(alias='bookmarkCount', examples=[1269])] = None - public_actor_run_stats30_days: Annotated[ - PublicActorRunStats30Days | None, Field(alias='publicActorRunStats30Days') - ] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + total_builds: Annotated[int | None, Field(examples=[9])] = None + total_runs: Annotated[int | None, Field(examples=[16])] = None + total_users: Annotated[int | None, Field(examples=[6])] = None + total_users7_days: Annotated[int | None, Field(examples=[2])] = None + total_users30_days: Annotated[int | None, Field(examples=[6])] = None + total_users90_days: Annotated[int | None, Field(examples=[6])] = None + total_metamorphs: Annotated[int | None, Field(examples=[2])] = None + last_run_started_at: Annotated[AwareDatetime | None, Field(examples=['2019-07-08T14:01:05.546Z'])] = None + actor_review_count: Annotated[int | None, Field(examples=[69])] = None + actor_review_rating: Annotated[float | None, Field(examples=[4.7])] = None + bookmark_count: Annotated[int | None, Field(examples=[1269])] = None + public_actor_run_stats30_days: PublicActorRunStats30Days | None = None """ Run status counts over the past 30 days. """ @@ -316,10 +271,7 @@ class ActorStats(BaseModel): class AddRequestResponse(BaseModel): """Response containing the result of adding a request to the request queue.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: RequestRegistration @@ -327,23 +279,20 @@ class AddRequestResponse(BaseModel): class AddedRequest(BaseModel): """Information about a request that was successfully added to a request queue.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - request_id: Annotated[str, Field(alias='requestId', examples=['sbJ7klsdf7ujN9l'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + request_id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] """ A unique identifier assigned to the request. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + unique_key: Annotated[str, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ - was_already_present: Annotated[bool, Field(alias='wasAlreadyPresent', examples=[False])] + was_already_present: Annotated[bool, Field(examples=[False])] """ Indicates whether a request with the same unique key already existed in the request queue. If true, no new request was created. """ - was_already_handled: Annotated[bool, Field(alias='wasAlreadyHandled', examples=[False])] + was_already_handled: Annotated[bool, Field(examples=[False])] """ Indicates whether a request with the same unique key has already been processed by the request queue. """ @@ -353,10 +302,7 @@ class AddedRequest(BaseModel): class BatchAddResponse(BaseModel): """Response containing the result of a batch add operation.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: BatchAddResult @@ -364,15 +310,12 @@ class BatchAddResponse(BaseModel): class BatchAddResult(BaseModel): """Result of a batch add operation containing successfully processed and failed requests.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - processed_requests: Annotated[list[AddedRequest], Field(alias='processedRequests')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + processed_requests: list[AddedRequest] """ Requests that were successfully added to the request queue. """ - unprocessed_requests: Annotated[list[RequestDraft], Field(alias='unprocessedRequests')] + unprocessed_requests: list[RequestDraft] """ Requests that failed to be added and can be retried. """ @@ -382,10 +325,7 @@ class BatchAddResult(BaseModel): class BatchDeleteResponse(BaseModel): """Response containing the result of a batch delete operation.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: BatchDeleteResult @@ -393,17 +333,12 @@ class BatchDeleteResponse(BaseModel): class BatchDeleteResult(BaseModel): """Result of a batch delete operation containing successfully deleted and failed requests.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - processed_requests: Annotated[ - list[DeletedRequestById | DeletedRequestByUniqueKey], Field(alias='processedRequests') - ] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + processed_requests: list[DeletedRequestById | DeletedRequestByUniqueKey] """ Requests that were successfully deleted from the request queue. """ - unprocessed_requests: Annotated[list[RequestDraft], Field(alias='unprocessedRequests')] + unprocessed_requests: list[RequestDraft] """ Requests that failed to be deleted and can be retried. """ @@ -411,23 +346,20 @@ class BatchDeleteResult(BaseModel): @docs_group('Models') class BrowserInfoResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) method: Annotated[str, Field(examples=['GET'])] """ HTTP method of the request. """ - client_ip: Annotated[str | None, Field(alias='clientIp', examples=['1.2.3.4'])] + client_ip: Annotated[str | None, Field(examples=['1.2.3.4'])] """ IP address of the client. """ - country_code: Annotated[str | None, Field(alias='countryCode', examples=['US'])] + country_code: Annotated[str | None, Field(examples=['US'])] """ Two-letter country code resolved from the client IP address. """ - body_length: Annotated[int, Field(alias='bodyLength', examples=[0])] + body_length: Annotated[int, Field(examples=[0])] """ Length of the request body in bytes. """ @@ -436,7 +368,7 @@ class BrowserInfoResponse(BaseModel): Request headers. Omitted when `skipHeaders=true`. """ - raw_headers: Annotated[list[str] | None, Field(alias='rawHeaders')] = None + raw_headers: list[str] | None = None """ Raw request headers as a flat list of alternating name/value strings. Included only when `rawHeaders=true`. @@ -446,141 +378,101 @@ class BrowserInfoResponse(BaseModel): @docs_group('Models') class Build(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] - act_id: Annotated[str, Field(alias='actId', examples=['janedoe~my-actor'])] - user_id: Annotated[str, Field(alias='userId', examples=['klmdEpoiojmdEMlk3'])] - started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( - None - ) + act_id: Annotated[str, Field(examples=['janedoe~my-actor'])] + user_id: Annotated[str, Field(examples=['klmdEpoiojmdEMlk3'])] + started_at: Annotated[AwareDatetime, Field(examples=['2019-11-30T07:34:24.202Z'])] + finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T09:30:12.202Z'])] = None status: ActorJobStatus meta: BuildsMeta stats: BuildStats | None = None options: BuildOptions | None = None usage: BuildUsage | None = None - usage_total_usd: Annotated[float | None, Field(alias='usageTotalUsd', examples=[0.02])] = None + usage_total_usd: Annotated[float | None, Field(examples=[0.02])] = None """ Total cost in USD for this build. Requires authentication token to access. """ - usage_usd: Annotated[BuildUsage | None, Field(alias='usageUsd')] = None + usage_usd: BuildUsage | None = None """ Platform usage costs breakdown in USD for this build. Requires authentication token to access. """ - input_schema: Annotated[ - str | None, Field(alias='inputSchema', deprecated=True, examples=['{\\n "title": "Schema for ... }']) - ] = None + input_schema: Annotated[str | None, Field(deprecated=True, examples=['{\\n "title": "Schema for ... }'])] = None readme: Annotated[str | None, Field(deprecated=True, examples=['# Magic Actor\\nThis Actor is magic.'])] = None build_number: Annotated[ - str, - Field( - alias='buildNumber', - examples=['0.1.1'], - pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$', - ), + str, Field(examples=['0.1.1'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$') ] - act_version: Annotated[ActVersion | None, Field(alias='actVersion', title='BuildActVersion')] = None + act_version: Annotated[ActVersion | None, Field(title='BuildActVersion')] = None """ Snapshot of the Actor version that this build was created from. """ - actor_definition: Annotated[ActorDefinition | None, Field(alias='actorDefinition')] = None + actor_definition: ActorDefinition | None = None @docs_group('Models') class BuildOptions(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - use_cache: Annotated[bool | None, Field(alias='useCache', examples=[False])] = None - beta_packages: Annotated[bool | None, Field(alias='betaPackages', examples=[False])] = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[1024])] = None - disk_mbytes: Annotated[int | None, Field(alias='diskMbytes', examples=[2048])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + use_cache: Annotated[bool | None, Field(examples=[False])] = None + beta_packages: Annotated[bool | None, Field(examples=[False])] = None + memory_mbytes: Annotated[int | None, Field(examples=[1024])] = None + disk_mbytes: Annotated[int | None, Field(examples=[2048])] = None @docs_group('Models') class BuildResponse(BaseModel): """Response containing Actor build data.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Build @docs_group('Models') class BuildShort(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] - act_id: Annotated[str | None, Field(alias='actId', examples=['janedoe~my-actor'])] = None - user_id: Annotated[str | None, Field(alias='userId', examples=['klmdEpoiojmdEMlk3'])] = None + act_id: Annotated[str | None, Field(examples=['janedoe~my-actor'])] = None + user_id: Annotated[str | None, Field(examples=['klmdEpoiojmdEMlk3'])] = None status: ActorJobStatus - started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( - None - ) - usage_total_usd: Annotated[float, Field(alias='usageTotalUsd', examples=[0.02])] + started_at: Annotated[AwareDatetime, Field(examples=['2019-11-30T07:34:24.202Z'])] + finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T09:30:12.202Z'])] = None + usage_total_usd: Annotated[float, Field(examples=[0.02])] build_number: Annotated[ - str, - Field( - alias='buildNumber', - examples=['0.1.1'], - pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$', - ), + str, Field(examples=['0.1.1'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$') ] - build_number_int: Annotated[int | None, Field(alias='buildNumberInt', examples=[10000])] = None + build_number_int: Annotated[int | None, Field(examples=[10000])] = None meta: BuildsMeta | None = None @docs_group('Models') class BuildStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - duration_millis: Annotated[int | None, Field(alias='durationMillis', examples=[1000])] = None - run_time_secs: Annotated[float | None, Field(alias='runTimeSecs', examples=[45.718])] = None - compute_units: Annotated[float, Field(alias='computeUnits', examples=[0.0126994444444444])] - image_size_bytes: Annotated[int | None, Field(alias='imageSizeBytes', examples=[975770223])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + duration_millis: Annotated[int | None, Field(examples=[1000])] = None + run_time_secs: Annotated[float | None, Field(examples=[45.718])] = None + compute_units: Annotated[float, Field(examples=[0.0126994444444444])] + image_size_bytes: Annotated[int | None, Field(examples=[975770223])] = None @docs_group('Models') class BuildTag(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - build_id: Annotated[str, Field(alias='buildId')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + build_id: str @docs_group('Models') class BuildUsage(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[0.08])] = None @docs_group('Models') class BuildsMeta(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) origin: RunOrigin - client_ip: Annotated[str | None, Field(alias='clientIp', examples=['172.234.12.34'])] = None + client_ip: Annotated[str | None, Field(examples=['172.234.12.34'])] = None """ IP address of the client that started the build. """ - user_agent: Annotated[str | None, Field(alias='userAgent', examples=['Mozilla/5.0 (iPad)'])] = None + user_agent: Annotated[str | None, Field(examples=['Mozilla/5.0 (iPad)'])] = None """ User agent of the client that started the build. """ @@ -588,73 +480,55 @@ class BuildsMeta(BaseModel): @docs_group('Models') class Call(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - started_at: Annotated[AwareDatetime | None, Field(alias='startedAt', examples=['2019-12-12T07:34:14.202Z'])] = None - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T07:34:14.202Z'])] = ( - None - ) - error_message: Annotated[str | None, Field(alias='errorMessage', examples=['Cannot send request'])] = None - response_status: Annotated[int | None, Field(alias='responseStatus', examples=[200])] = None - response_body: Annotated[str | None, Field(alias='responseBody', examples=['{"foo": "bar"}'])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + started_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T07:34:14.202Z'])] = None + finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T07:34:14.202Z'])] = None + error_message: Annotated[str | None, Field(examples=['Cannot send request'])] = None + response_status: Annotated[int | None, Field(examples=[200])] = None + response_body: Annotated[str | None, Field(examples=['{"foo": "bar"}'])] = None @docs_group('Models') class ChargeRunRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - event_name: Annotated[str, Field(alias='eventName', examples=['ANALYZE_PAGE'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + event_name: Annotated[str, Field(examples=['ANALYZE_PAGE'])] count: Annotated[int, Field(examples=[1])] @docs_group('Models') class CommonActorPricingInfo(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - apify_margin_percentage: Annotated[float, Field(alias='apifyMarginPercentage')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + apify_margin_percentage: float """ In [0, 1], fraction of pricePerUnitUsd that goes to Apify """ - created_at: Annotated[AwareDatetime, Field(alias='createdAt')] + created_at: AwareDatetime """ When this pricing info record has been created """ - started_at: Annotated[AwareDatetime, Field(alias='startedAt')] + started_at: AwareDatetime """ Since when is this pricing info record effective for a given Actor """ - notified_about_future_change_at: Annotated[AwareDatetime | None, Field(alias='notifiedAboutFutureChangeAt')] = None - notified_about_change_at: Annotated[AwareDatetime | None, Field(alias='notifiedAboutChangeAt')] = None - reason_for_change: Annotated[str | None, Field(alias='reasonForChange')] = None - is_price_change_notification_suppressed: Annotated[ - bool | None, Field(alias='isPriceChangeNotificationSuppressed') - ] = None - force_contains_significant_price_change: Annotated[ - bool | None, Field(alias='forceContainsSignificantPriceChange') - ] = None + notified_about_future_change_at: AwareDatetime | None = None + notified_about_change_at: AwareDatetime | None = None + reason_for_change: str | None = None + is_price_change_notification_suppressed: bool | None = None + force_contains_significant_price_change: bool | None = None @docs_group('Models') class CreateActorRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: Annotated[str | None, Field(examples=['MyActor'])] = None description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None title: Annotated[str | None, Field(examples=['My actor'])] = None - is_public: Annotated[bool | None, Field(alias='isPublic', examples=[False])] = None - seo_title: Annotated[str | None, Field(alias='seoTitle', examples=['My actor'])] = None - seo_description: Annotated[str | None, Field(alias='seoDescription', examples=['My actor is the best'])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None + is_public: Annotated[bool | None, Field(examples=[False])] = None + seo_title: Annotated[str | None, Field(examples=['My actor'])] = None + seo_description: Annotated[str | None, Field(examples=['My actor is the best'])] = None + restart_on_error: Annotated[bool | None, Field(deprecated=True, examples=[False])] = None versions: list[Version] | None = None - pricing_infos: Annotated[ + pricing_infos: ( list[ Annotated[ PayPerEventActorPricingInfo @@ -664,37 +538,31 @@ class CreateActorRequest(BaseModel): Field(discriminator='pricing_model'), ] ] - | None, - Field(alias='pricingInfos'), - ] = None + | None + ) = None categories: list[str] | None = None - default_run_options: Annotated[DefaultRunOptions | None, Field(alias='defaultRunOptions')] = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None - example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None - is_deprecated: Annotated[bool | None, Field(alias='isDeprecated')] = None + default_run_options: DefaultRunOptions | None = None + actor_standby: ActorStandby | None = None + example_run_input: ExampleRunInput | None = None + is_deprecated: bool | None = None @docs_group('Models') class CreateOrUpdateVersionRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) version_number: Annotated[ - str | None, Field(alias='versionNumber', examples=['0.0'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$') - ] = None - source_type: Annotated[VersionSourceType | None, Field(alias='sourceType')] = None - env_vars: Annotated[list[EnvVarRequest] | None, Field(alias='envVars')] = None - apply_env_vars_to_build: Annotated[bool | None, Field(alias='applyEnvVarsToBuild', examples=[False])] = None - build_tag: Annotated[str | None, Field(alias='buildTag', examples=['latest'])] = None - source_files: Annotated[ - list[SourceCodeFile | SourceCodeFolder] | None, Field(alias='sourceFiles', title='VersionSourceFiles') + str | None, Field(examples=['0.0'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$') ] = None - git_repo_url: Annotated[str | None, Field(alias='gitRepoUrl')] = None + source_type: VersionSourceType | None = None + env_vars: list[EnvVarRequest] | None = None + apply_env_vars_to_build: Annotated[bool | None, Field(examples=[False])] = None + build_tag: Annotated[str | None, Field(examples=['latest'])] = None + source_files: Annotated[list[SourceCodeFile | SourceCodeFolder] | None, Field(title='VersionSourceFiles')] = None + git_repo_url: str | None = None """ URL of the Git repository when sourceType is GIT_REPO. """ - tarball_url: Annotated[str | None, Field(alias='tarballUrl')] = None + tarball_url: str | None = None """ URL of the tarball when sourceType is TARBALL. """ @@ -706,72 +574,51 @@ class CreateOrUpdateVersionRequest(BaseModel): @docs_group('Models') class CreateTaskRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + act_id: Annotated[str, Field(examples=['asADASadYvn4mBZmm'])] name: Annotated[str | None, Field(examples=['my-task'])] = None options: TaskOptions | None = None input: TaskInput | None = None title: str | None = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None + actor_standby: ActorStandby | None = None @docs_group('Models') class Current(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - monthly_usage_usd: Annotated[float, Field(alias='monthlyUsageUsd', examples=[43])] - monthly_actor_compute_units: Annotated[float, Field(alias='monthlyActorComputeUnits', examples=[500.784475])] - monthly_external_data_transfer_gbytes: Annotated[ - float, Field(alias='monthlyExternalDataTransferGbytes', examples=[3.00861903931946]) - ] - monthly_proxy_serps: Annotated[int, Field(alias='monthlyProxySerps', examples=[34])] - monthly_residential_proxy_gbytes: Annotated[float, Field(alias='monthlyResidentialProxyGbytes', examples=[0.4])] - actor_memory_gbytes: Annotated[float, Field(alias='actorMemoryGbytes', examples=[8])] - actor_count: Annotated[int, Field(alias='actorCount', examples=[31])] - actor_task_count: Annotated[int, Field(alias='actorTaskCount', examples=[130])] - active_actor_job_count: Annotated[int, Field(alias='activeActorJobCount', examples=[0])] - team_account_seat_count: Annotated[int, Field(alias='teamAccountSeatCount', examples=[5])] - schedule_count: Annotated[int | None, Field(alias='scheduleCount', examples=[77])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + monthly_usage_usd: Annotated[float, Field(examples=[43])] + monthly_actor_compute_units: Annotated[float, Field(examples=[500.784475])] + monthly_external_data_transfer_gbytes: Annotated[float, Field(examples=[3.00861903931946])] + monthly_proxy_serps: Annotated[int, Field(examples=[34])] + monthly_residential_proxy_gbytes: Annotated[float, Field(examples=[0.4])] + actor_memory_gbytes: Annotated[float, Field(examples=[8])] + actor_count: Annotated[int, Field(examples=[31])] + actor_task_count: Annotated[int, Field(examples=[130])] + active_actor_job_count: Annotated[int, Field(examples=[0])] + team_account_seat_count: Annotated[int, Field(examples=[5])] + schedule_count: Annotated[int | None, Field(examples=[77])] = None @docs_group('Models') class CurrentPricingInfo(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - pricing_model: Annotated[str, Field(alias='pricingModel', examples=['FREE'])] - apify_margin_percentage: Annotated[float | None, Field(alias='apifyMarginPercentage', examples=[0.2])] = None - created_at: Annotated[AwareDatetime | None, Field(alias='createdAt', examples=['2023-01-01T00:00:00.000Z'])] = None - started_at: Annotated[AwareDatetime | None, Field(alias='startedAt', examples=['2023-01-01T00:00:00.000Z'])] = None - notified_about_change_at: Annotated[AwareDatetime | None, Field(alias='notifiedAboutChangeAt', examples=[None])] = ( - None - ) - notified_about_future_change_at: Annotated[ - AwareDatetime | None, Field(alias='notifiedAboutFutureChangeAt', examples=[None]) - ] = None - is_price_change_notification_suppressed: Annotated[ - bool | None, Field(alias='isPriceChangeNotificationSuppressed', examples=[False]) - ] = None - force_contains_significant_price_change: Annotated[ - bool | None, Field(alias='forceContainsSignificantPriceChange', examples=[False]) - ] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + pricing_model: Annotated[str, Field(examples=['FREE'])] + apify_margin_percentage: Annotated[float | None, Field(examples=[0.2])] = None + created_at: Annotated[AwareDatetime | None, Field(examples=['2023-01-01T00:00:00.000Z'])] = None + started_at: Annotated[AwareDatetime | None, Field(examples=['2023-01-01T00:00:00.000Z'])] = None + notified_about_change_at: Annotated[AwareDatetime | None, Field(examples=[None])] = None + notified_about_future_change_at: Annotated[AwareDatetime | None, Field(examples=[None])] = None + is_price_change_notification_suppressed: Annotated[bool | None, Field(examples=[False])] = None + force_contains_significant_price_change: Annotated[bool | None, Field(examples=[False])] = None is_ppe_platform_usage_paid_by_user: Annotated[ bool | None, Field(alias='isPPEPlatformUsagePaidByUser', examples=[False]) ] = None - reason_for_change: Annotated[str | None, Field(alias='reasonForChange', examples=[None])] = None - trial_minutes: Annotated[int | None, Field(alias='trialMinutes', examples=[None])] = None - unit_name: Annotated[str | None, Field(alias='unitName', examples=[None])] = None - price_per_unit_usd: Annotated[float | None, Field(alias='pricePerUnitUsd', examples=[None])] = None - minimal_max_total_charge_usd: Annotated[float | None, Field(alias='minimalMaxTotalChargeUsd', examples=[0.5])] = ( - None - ) - pricing_per_event: Annotated[dict[str, Any] | None, Field(alias='pricingPerEvent')] = None + reason_for_change: Annotated[str | None, Field(examples=[None])] = None + trial_minutes: Annotated[int | None, Field(examples=[None])] = None + unit_name: Annotated[str | None, Field(examples=[None])] = None + price_per_unit_usd: Annotated[float | None, Field(examples=[None])] = None + minimal_max_total_charge_usd: Annotated[float | None, Field(examples=[0.5])] = None + pricing_per_event: dict[str, Any] | None = None """ Per-event pricing configuration for pay-per-event Actors. """ @@ -779,31 +626,25 @@ class CurrentPricingInfo(BaseModel): @docs_group('Models') class DailyServiceUsages(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) date: Annotated[str, Field(examples=['2022-10-02T00:00:00.000Z'])] - service_usage: Annotated[dict[str, UsageItem], Field(alias='serviceUsage')] - total_usage_credits_usd: Annotated[float, Field(alias='totalUsageCreditsUsd', examples=[0.0474385791970591])] + service_usage: dict[str, UsageItem] + total_usage_credits_usd: Annotated[float, Field(examples=[0.0474385791970591])] @docs_group('Models') class Dataset(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] name: Annotated[str | None, Field(examples=['d7b9MDYsbtX5L7XAj'])] = None - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] - item_count: Annotated[int, Field(alias='itemCount', examples=[7], ge=0)] - clean_item_count: Annotated[int, Field(alias='cleanItemCount', examples=[5], ge=0)] - act_id: Annotated[str | None, Field(alias='actId')] = None - act_run_id: Annotated[str | None, Field(alias='actRunId')] = None + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] + accessed_at: Annotated[AwareDatetime, Field(examples=['2019-12-14T08:36:13.202Z'])] + item_count: Annotated[int, Field(examples=[7], ge=0)] + clean_item_count: Annotated[int, Field(examples=[5], ge=0)] + act_id: str | None = None + act_run_id: str | None = None fields: list[str] | None = None schema_: Annotated[ dict[str, Any] | None, @@ -830,33 +671,24 @@ class Dataset(BaseModel): """ Defines the schema of items in your dataset, the full specification can be found in [Apify docs](/platform/actors/development/actor-definition/dataset-schema) """ - console_url: Annotated[ - AnyUrl, Field(alias='consoleUrl', examples=['https://console.apify.com/storage/datasets/27TmTznX9YPeAYhkC']) - ] + console_url: Annotated[AnyUrl, Field(examples=['https://console.apify.com/storage/datasets/27TmTznX9YPeAYhkC'])] items_public_url: Annotated[ - AnyUrl | None, - Field( - alias='itemsPublicUrl', - examples=['https://api.apify.com/v2/datasets/WkzbQMuFYuamGv3YF/items?signature=abc123'], - ), + AnyUrl | None, Field(examples=['https://api.apify.com/v2/datasets/WkzbQMuFYuamGv3YF/items?signature=abc123']) ] = None """ A public link to access the dataset items directly. """ - url_signing_secret_key: Annotated[str | None, Field(alias='urlSigningSecretKey')] = None + url_signing_secret_key: str | None = None """ A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the dataset. """ - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + general_access: GeneralAccess | None = None stats: DatasetStats | None = None @docs_group('Models') class DatasetFieldStatistics(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) min: float | None = None """ Minimum value of the field. For numbers, this is calculated directly. For strings, this is the length of the shortest string. For arrays, this is the length of the shortest array. For objects, this is the number of keys in the smallest object. @@ -865,11 +697,11 @@ class DatasetFieldStatistics(BaseModel): """ Maximum value of the field. For numbers, this is calculated directly. For strings, this is the length of the longest string. For arrays, this is the length of the longest array. For objects, this is the number of keys in the largest object. """ - null_count: Annotated[int | None, Field(alias='nullCount')] = None + null_count: int | None = None """ How many items in the dataset have a null value for this field. """ - empty_count: Annotated[int | None, Field(alias='emptyCount')] = None + empty_count: int | None = None """ How many items in the dataset are `undefined`, meaning that for example empty string is not considered empty. """ @@ -877,23 +709,20 @@ class DatasetFieldStatistics(BaseModel): @docs_group('Models') class DatasetListItem(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] name: Annotated[str, Field(examples=['d7b9MDYsbtX5L7XAj'])] - user_id: Annotated[str, Field(alias='userId', examples=['tbXmWu7GCxnyYtSiL'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] - item_count: Annotated[int, Field(alias='itemCount', examples=[7])] - clean_item_count: Annotated[int, Field(alias='cleanItemCount', examples=[5])] - act_id: Annotated[str | None, Field(alias='actId', examples=['zdc3Pyhyz3m8vjDeM'])] = None - act_run_id: Annotated[str | None, Field(alias='actRunId', examples=['HG7ML7M8z78YcAPEB'])] = None + user_id: Annotated[str, Field(examples=['tbXmWu7GCxnyYtSiL'])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] + accessed_at: Annotated[AwareDatetime, Field(examples=['2019-12-14T08:36:13.202Z'])] + item_count: Annotated[int, Field(examples=[7])] + clean_item_count: Annotated[int, Field(examples=[5])] + act_id: Annotated[str | None, Field(examples=['zdc3Pyhyz3m8vjDeM'])] = None + act_run_id: Annotated[str | None, Field(examples=['HG7ML7M8z78YcAPEB'])] = None title: Annotated[str | None, Field(examples=['My Dataset'])] = None username: Annotated[str | None, Field(examples=['janedoe'])] = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + general_access: GeneralAccess | None = None stats: DatasetStats | None = None @@ -901,19 +730,13 @@ class DatasetListItem(BaseModel): class DatasetResponse(BaseModel): """Response containing dataset metadata.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Dataset @docs_group('Models') class DatasetSchemaValidationError(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) type: Annotated[str | None, Field(examples=['schema-validation-error'])] = None """ The type of the error. @@ -927,11 +750,8 @@ class DatasetSchemaValidationError(BaseModel): @docs_group('Models') class DatasetStatistics(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - field_statistics: Annotated[dict[str, Any] | None, Field(alias='fieldStatistics')] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + field_statistics: dict[str, Any] | None = None """ When you configure the dataset [fields schema](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation), we measure the statistics such as `min`, `max`, `nullCount` and `emptyCount` for each field. This property provides statistics for each field from dataset fields schema.

See dataset field statistics [documentation](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation#dataset-field-statistics) for more information. """ @@ -939,26 +759,20 @@ class DatasetStatistics(BaseModel): @docs_group('Models') class DatasetStatisticsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: DatasetStatistics @docs_group('Models') class DatasetStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - read_count: Annotated[int | None, Field(alias='readCount', examples=[22])] = None - write_count: Annotated[int | None, Field(alias='writeCount', examples=[3])] = None - storage_bytes: Annotated[int | None, Field(alias='storageBytes', examples=[783])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + read_count: Annotated[int | None, Field(examples=[22])] = None + write_count: Annotated[int | None, Field(examples=[3])] = None + storage_bytes: Annotated[int | None, Field(examples=[783])] = None """ Total storage size in bytes. Only returned by the single-dataset endpoint. """ - inflated_bytes: Annotated[int | None, Field(alias='inflatedBytes', examples=[0])] = None + inflated_bytes: Annotated[int | None, Field(examples=[0])] = None """ Uncompressed size in bytes. Only returned by the dataset list endpoint. """ @@ -968,10 +782,7 @@ class DatasetStats(BaseModel): class Datasets(BaseModel): """Aliased dataset IDs for this run.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) default: Annotated[str | None, Field(examples=['wmKPijuyDnPZAPRMk'])] = None """ ID of the default dataset for this run. @@ -980,52 +791,38 @@ class Datasets(BaseModel): @docs_group('Models') class DecodeAndVerifyData(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) decoded: Any """ The original object that was encoded. """ - encoded_by_user_id: Annotated[str | None, Field(alias='encodedByUserId', examples=['wRwJZtadYvn4mBZmm'])] - is_verified_user: Annotated[bool, Field(alias='isVerifiedUser', examples=[False])] + encoded_by_user_id: Annotated[str | None, Field(examples=['wRwJZtadYvn4mBZmm'])] + is_verified_user: Annotated[bool, Field(examples=[False])] @docs_group('Models') class DecodeAndVerifyResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: DecodeAndVerifyData @docs_group('Models') class DefaultRunOptions(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) build: Annotated[str | None, Field(examples=['latest'])] = None - timeout_secs: Annotated[int | None, Field(alias='timeoutSecs', examples=[3600])] = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[2048])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', examples=[False])] = None - max_items: Annotated[int | None, Field(alias='maxItems')] = None - force_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='forcePermissionLevel')] = None + timeout_secs: Annotated[int | None, Field(examples=[3600])] = None + memory_mbytes: Annotated[int | None, Field(examples=[2048])] = None + restart_on_error: Annotated[bool | None, Field(examples=[False])] = None + max_items: int | None = None + force_permission_level: ActorPermissionLevel | None = None @docs_group('Models') class DeletedRequestById(BaseModel): """Confirmation of a request that was successfully deleted, identified by its ID.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - unique_key: Annotated[ - str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) - ] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + unique_key: Annotated[str | None, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] = None """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @@ -1039,11 +836,8 @@ class DeletedRequestById(BaseModel): class DeletedRequestByUniqueKey(BaseModel): """Confirmation of a request that was successfully deleted, identified by its unique key.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + unique_key: Annotated[str, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @@ -1055,33 +849,24 @@ class DeletedRequestByUniqueKey(BaseModel): @docs_group('Models') class EffectivePlatformFeature(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + is_enabled: Annotated[bool, Field(examples=[True])] disabled_reason: Annotated[ str | None, Field( - alias='disabledReason', examples=[ 'The "Selected public Actors for developers" feature is not enabled for your account. Please upgrade your plan or contact support@apify.com' - ], + ] ), ] - disabled_reason_type: Annotated[str | None, Field(alias='disabledReasonType', examples=['DISABLED'])] - is_trial: Annotated[bool, Field(alias='isTrial', examples=[False])] - trial_expiration_at: Annotated[ - AwareDatetime | None, Field(alias='trialExpirationAt', examples=['2025-01-01T14:00:00.000Z']) - ] + disabled_reason_type: Annotated[str | None, Field(examples=['DISABLED'])] + is_trial: Annotated[bool, Field(examples=[False])] + trial_expiration_at: Annotated[AwareDatetime | None, Field(examples=['2025-01-01T14:00:00.000Z'])] @docs_group('Models') class EffectivePlatformFeatures(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) actors: Annotated[EffectivePlatformFeature, Field(alias='ACTORS')] storage: Annotated[EffectivePlatformFeature, Field(alias='STORAGE')] scheduler: Annotated[EffectivePlatformFeature, Field(alias='SCHEDULER')] @@ -1096,10 +881,7 @@ class EffectivePlatformFeatures(BaseModel): @docs_group('Models') class EncodeAndSignData(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) encoded: Annotated[str, Field(examples=['eyJwYXlsb2FkIjoiLi4uIiwic2lnbmF0dXJlIjoiLi4uIn0='])] @@ -1110,50 +892,35 @@ class DecodeAndVerifyRequest(EncodeAndSignData): @docs_group('Models') class EncodeAndSignResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: EncodeAndSignData @docs_group('Models') class EnvVar(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: Annotated[str, Field(examples=['MY_ENV_VAR'])] value: Annotated[str | None, Field(examples=['my-value'])] = None """ The environment variable value. This field is absent in responses when `isSecret` is `true`, as secret values are never returned by the API. """ - is_secret: Annotated[bool | None, Field(alias='isSecret', examples=[False])] = None + is_secret: Annotated[bool | None, Field(examples=[False])] = None @docs_group('Models') class EnvVarRequest(EnvVar): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) @docs_group('Models') class EnvVarResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: EnvVar @docs_group('Models') class ErrorDetail(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) type: ErrorType | None = None message: str | None = None """ @@ -1163,58 +930,41 @@ class ErrorDetail(BaseModel): @docs_group('Models') class ErrorResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) error: ErrorDetail @docs_group('Models') class EventData(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - actor_id: Annotated[str, Field(alias='actorId', examples=['vvE7iMKuMc5qTHHsR'])] - actor_run_id: Annotated[str, Field(alias='actorRunId', examples=['JgwXN9BdwxGcu9MMF'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + actor_id: Annotated[str, Field(examples=['vvE7iMKuMc5qTHHsR'])] + actor_run_id: Annotated[str, Field(examples=['JgwXN9BdwxGcu9MMF'])] @docs_group('Models') class ExampleRunInput(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) body: Annotated[str | None, Field(examples=['{ "helloWorld": 123 }'])] = None - content_type: Annotated[str | None, Field(alias='contentType', examples=['application/json; charset=utf-8'])] = None + content_type: Annotated[str | None, Field(examples=['application/json; charset=utf-8'])] = None @docs_group('Models') class ExampleWebhookDispatch(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) status: WebhookDispatchStatus - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-13T08:36:13.202Z'])] = ( - None - ) - removed_at: Annotated[AwareDatetime | None, Field(alias='removedAt', examples=[None])] = None + finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-13T08:36:13.202Z'])] = None + removed_at: Annotated[AwareDatetime | None, Field(examples=[None])] = None @docs_group('Models') class FlatPricePerMonthActorPricingInfo(CommonActorPricingInfo): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - pricing_model: Annotated[Literal['FLAT_PRICE_PER_MONTH'], Field(alias='pricingModel')] - trial_minutes: Annotated[int, Field(alias='trialMinutes')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + pricing_model: Literal['FLAT_PRICE_PER_MONTH'] + trial_minutes: int """ For how long this Actor can be used for free in trial period """ - price_per_unit_usd: Annotated[float, Field(alias='pricePerUnitUsd')] + price_per_unit_usd: float """ Monthly flat price in USD """ @@ -1222,21 +972,15 @@ class FlatPricePerMonthActorPricingInfo(CommonActorPricingInfo): @docs_group('Models') class FreeActorPricingInfo(CommonActorPricingInfo): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - pricing_model: Annotated[Literal['FREE'], Field(alias='pricingModel')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + pricing_model: Literal['FREE'] @docs_group('Models') class HeadAndLockResponse(BaseModel): """Response containing locked requests from the request queue head.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: LockedRequestQueueHead @@ -1244,15 +988,12 @@ class HeadAndLockResponse(BaseModel): class HeadRequest(BaseModel): """A request from the request queue head without lock information.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] """ A unique identifier assigned to the request. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + unique_key: Annotated[str, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @@ -1261,7 +1002,7 @@ class HeadRequest(BaseModel): The URL of the request. """ method: HttpMethod | None = None - retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None + retry_count: Annotated[int | None, Field(examples=[0])] = None """ The number of times this request has been retried. """ @@ -1271,24 +1012,18 @@ class HeadRequest(BaseModel): class HeadResponse(BaseModel): """Response containing requests from the request queue head without locking.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: RequestQueueHead @docs_group('Models') class InvalidItem(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - item_position: Annotated[int | None, Field(alias='itemPosition', examples=[2])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + item_position: Annotated[int | None, Field(examples=[2])] = None """ The position of the invalid item in the array. """ - validation_errors: Annotated[list[ValidationError] | None, Field(alias='validationErrors')] = None + validation_errors: list[ValidationError] | None = None """ A complete list of AJV validation error objects for the invalid item. """ @@ -1296,38 +1031,28 @@ class InvalidItem(BaseModel): @docs_group('Models') class KeyValueStore(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] name: Annotated[str | None, Field(examples=['d7b9MDYsbtX5L7XAj'])] = None - user_id: Annotated[str | None, Field(alias='userId', examples=['BPWDBd7Z9c746JAnF'])] = None + user_id: Annotated[str | None, Field(examples=['BPWDBd7Z9c746JAnF'])] = None username: Annotated[str | None, Field(examples=['janedoe'])] = None - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] - act_id: Annotated[str | None, Field(alias='actId', examples=[None])] = None - act_run_id: Annotated[str | None, Field(alias='actRunId', examples=[None])] = None + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] + accessed_at: Annotated[AwareDatetime, Field(examples=['2019-12-14T08:36:13.202Z'])] + act_id: Annotated[str | None, Field(examples=[None])] = None + act_run_id: Annotated[str | None, Field(examples=[None])] = None console_url: Annotated[ - AnyUrl | None, - Field(alias='consoleUrl', examples=['https://console.apify.com/storage/key-value-stores/27TmTznX9YPeAYhkC']), + AnyUrl | None, Field(examples=['https://console.apify.com/storage/key-value-stores/27TmTznX9YPeAYhkC']) ] = None keys_public_url: Annotated[ AnyUrl | None, - Field( - alias='keysPublicUrl', - examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/keys?signature=abc123'], - ), + Field(examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/keys?signature=abc123']), ] = None """ A public link to access keys of the key-value store directly. """ records_public_url: Annotated[ - AnyUrl | None, - Field( - alias='recordsPublicUrl', examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/records'] - ), + AnyUrl | None, Field(examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/records']) ] = None """ A public link to access records of the key-value store directly. @@ -1336,27 +1061,23 @@ class KeyValueStore(BaseModel): """ Optional JSON schema describing the keys stored in the key-value store. """ - url_signing_secret_key: Annotated[str | None, Field(alias='urlSigningSecretKey')] = None + url_signing_secret_key: str | None = None """ A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the key-value store. """ - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + general_access: GeneralAccess | None = None stats: KeyValueStoreStats | None = None @docs_group('Models') class KeyValueStoreKey(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) key: Annotated[str, Field(examples=['second-key'])] size: Annotated[int, Field(examples=[36])] record_public_url: Annotated[ AnyUrl, Field( - alias='recordPublicUrl', - examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/records/some-key?signature=abc123'], + examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/records/some-key?signature=abc123'] ), ] """ @@ -1368,35 +1089,26 @@ class KeyValueStoreKey(BaseModel): class KeyValueStoreResponse(BaseModel): """Response containing key-value store data.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: KeyValueStore @docs_group('Models') class KeyValueStoreStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - read_count: Annotated[int, Field(alias='readCount', examples=[9])] - write_count: Annotated[int, Field(alias='writeCount', examples=[3])] - delete_count: Annotated[int, Field(alias='deleteCount', examples=[6])] - list_count: Annotated[int, Field(alias='listCount', examples=[2])] - s3_storage_bytes: Annotated[int | None, Field(alias='s3StorageBytes', examples=[18])] = None - storage_bytes: Annotated[int | None, Field(alias='storageBytes', examples=[457225])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + read_count: Annotated[int, Field(examples=[9])] + write_count: Annotated[int, Field(examples=[3])] + delete_count: Annotated[int, Field(examples=[6])] + list_count: Annotated[int, Field(examples=[2])] + s3_storage_bytes: Annotated[int | None, Field(examples=[18])] = None + storage_bytes: Annotated[int | None, Field(examples=[457225])] = None @docs_group('Models') class KeyValueStores(BaseModel): """Aliased key-value store IDs for this run.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) default: Annotated[str | None, Field(examples=['eJNzqsbPiopwJcgGQ'])] = None """ ID of the default key-value store for this run. @@ -1405,121 +1117,84 @@ class KeyValueStores(BaseModel): @docs_group('Models') class Limits(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - max_monthly_usage_usd: Annotated[float, Field(alias='maxMonthlyUsageUsd', examples=[300])] - max_monthly_actor_compute_units: Annotated[float, Field(alias='maxMonthlyActorComputeUnits', examples=[1000])] - max_monthly_external_data_transfer_gbytes: Annotated[ - float, Field(alias='maxMonthlyExternalDataTransferGbytes', examples=[7]) - ] - max_monthly_proxy_serps: Annotated[int, Field(alias='maxMonthlyProxySerps', examples=[50])] - max_monthly_residential_proxy_gbytes: Annotated[ - float, Field(alias='maxMonthlyResidentialProxyGbytes', examples=[0.5]) - ] - max_actor_memory_gbytes: Annotated[float, Field(alias='maxActorMemoryGbytes', examples=[16])] - max_actor_count: Annotated[int, Field(alias='maxActorCount', examples=[100])] - max_actor_task_count: Annotated[int, Field(alias='maxActorTaskCount', examples=[1000])] - max_concurrent_actor_jobs: Annotated[int, Field(alias='maxConcurrentActorJobs', examples=[256])] - max_team_account_seat_count: Annotated[int, Field(alias='maxTeamAccountSeatCount', examples=[9])] - data_retention_days: Annotated[int, Field(alias='dataRetentionDays', examples=[90])] - max_schedule_count: Annotated[int | None, Field(alias='maxScheduleCount', examples=[100])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + max_monthly_usage_usd: Annotated[float, Field(examples=[300])] + max_monthly_actor_compute_units: Annotated[float, Field(examples=[1000])] + max_monthly_external_data_transfer_gbytes: Annotated[float, Field(examples=[7])] + max_monthly_proxy_serps: Annotated[int, Field(examples=[50])] + max_monthly_residential_proxy_gbytes: Annotated[float, Field(examples=[0.5])] + max_actor_memory_gbytes: Annotated[float, Field(examples=[16])] + max_actor_count: Annotated[int, Field(examples=[100])] + max_actor_task_count: Annotated[int, Field(examples=[1000])] + max_concurrent_actor_jobs: Annotated[int, Field(examples=[256])] + max_team_account_seat_count: Annotated[int, Field(examples=[9])] + data_retention_days: Annotated[int, Field(examples=[90])] + max_schedule_count: Annotated[int | None, Field(examples=[100])] = None @docs_group('Models') class LimitsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: AccountLimits @docs_group('Models') class ListOfActorsInStoreResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfStoreActors @docs_group('Models') class ListOfActorsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfActors @docs_group('Models') class ListOfBuildsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfBuilds @docs_group('Models') class ListOfDatasetsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfDatasets @docs_group('Models') class ListOfEnvVars(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) total: Annotated[int, Field(examples=[5])] items: list[EnvVar] @docs_group('Models') class ListOfEnvVarsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfEnvVars @docs_group('Models') class ListOfKeyValueStoresResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfKeyValueStores @docs_group('Models') class ListOfKeys(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[KeyValueStoreKey] count: Annotated[int, Field(examples=[2])] limit: Annotated[int, Field(examples=[2])] - exclusive_start_key: Annotated[str | None, Field(alias='exclusiveStartKey', examples=['some-key'])] = None - is_truncated: Annotated[bool, Field(alias='isTruncated', examples=[True])] - next_exclusive_start_key: Annotated[str | None, Field(alias='nextExclusiveStartKey', examples=['third-key'])] = None + exclusive_start_key: Annotated[str | None, Field(examples=['some-key'])] = None + is_truncated: Annotated[bool, Field(examples=[True])] + next_exclusive_start_key: Annotated[str | None, Field(examples=['third-key'])] = None @docs_group('Models') class ListOfKeysResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfKeys @@ -1527,10 +1202,7 @@ class ListOfKeysResponse(BaseModel): class ListOfRequestQueuesResponse(BaseModel): """Response containing a list of request queues.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfRequestQueues @@ -1538,10 +1210,7 @@ class ListOfRequestQueuesResponse(BaseModel): class ListOfRequests(BaseModel): """A paginated list of requests from the request queue.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[Request] """ The array of requests. @@ -1550,9 +1219,7 @@ class ListOfRequests(BaseModel): """ The maximum number of requests returned in this response. """ - exclusive_start_id: Annotated[ - str | None, Field(alias='exclusiveStartId', deprecated=True, examples=['Ihnsp8YrvJ8102Kj']) - ] = None + exclusive_start_id: Annotated[str | None, Field(deprecated=True, examples=['Ihnsp8YrvJ8102Kj'])] = None """ The ID of the last request from the previous page, used for pagination. """ @@ -1560,9 +1227,7 @@ class ListOfRequests(BaseModel): """ A cursor string used for current page of results. """ - next_cursor: Annotated[ - str | None, Field(alias='nextCursor', examples=['eyJyZXF1ZXN0SWQiOiI5eFNNc1BrN1J6VUxTNXoifQ']) - ] = None + next_cursor: Annotated[str | None, Field(examples=['eyJyZXF1ZXN0SWQiOiI5eFNNc1BrN1J6VUxTNXoifQ'])] = None """ A cursor string to be used to continue pagination. """ @@ -1572,74 +1237,50 @@ class ListOfRequests(BaseModel): class ListOfRequestsResponse(BaseModel): """Response containing a list of requests from the request queue.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfRequests @docs_group('Models') class ListOfRunsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfRuns @docs_group('Models') class ListOfSchedulesResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfSchedules @docs_group('Models') class ListOfTasksResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfTasks @docs_group('Models') class ListOfVersions(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) total: Annotated[int, Field(examples=[5])] items: list[Version] @docs_group('Models') class ListOfVersionsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfVersions @docs_group('Models') class ListOfWebhookDispatchesResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfWebhookDispatches @docs_group('Models') class ListOfWebhooksResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: ListOfWebhooks @@ -1647,15 +1288,12 @@ class ListOfWebhooksResponse(BaseModel): class LockedHeadRequest(BaseModel): """A request from the request queue head that has been locked for processing.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] """ A unique identifier assigned to the request. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + unique_key: Annotated[str, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @@ -1664,11 +1302,11 @@ class LockedHeadRequest(BaseModel): The URL of the request. """ method: HttpMethod | None = None - retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None + retry_count: Annotated[int | None, Field(examples=[0])] = None """ The number of times this request has been retried. """ - lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-06-14T23:00:00.000Z'])] + lock_expires_at: Annotated[AwareDatetime, Field(examples=['2022-06-14T23:00:00.000Z'])] """ The timestamp when the lock on this request expires. """ @@ -1678,31 +1316,28 @@ class LockedHeadRequest(BaseModel): class LockedRequestQueueHead(BaseModel): """A batch of locked requests from the request queue head.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) limit: Annotated[int, Field(examples=[1000])] """ The maximum number of requests returned. """ - queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + queue_modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] """ The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. """ - queue_has_locked_requests: Annotated[bool | None, Field(alias='queueHasLockedRequests', examples=[True])] = None + queue_has_locked_requests: Annotated[bool | None, Field(examples=[True])] = None """ Whether the request queue contains requests locked by any client (either the one calling the endpoint or a different one). """ - client_key: Annotated[str | None, Field(alias='clientKey', examples=['client-one'])] = None + client_key: Annotated[str | None, Field(examples=['client-one'])] = None """ The client key used for locking the requests. """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + had_multiple_clients: Annotated[bool, Field(examples=[True])] """ Whether the request queue has been accessed by multiple different clients. """ - lock_secs: Annotated[int, Field(alias='lockSecs', examples=[60])] + lock_secs: Annotated[int, Field(examples=[60])] """ The number of seconds the locks will be held. """ @@ -1716,23 +1351,20 @@ class LockedRequestQueueHead(BaseModel): class Metamorph(BaseModel): """Information about a metamorph event that occurred during the run.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-11-30T07:39:24.202Z'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + created_at: Annotated[AwareDatetime, Field(examples=['2019-11-30T07:39:24.202Z'])] """ Time when the metamorph occurred. """ - actor_id: Annotated[str, Field(alias='actorId', examples=['nspoEjklmnsF2oosD'])] + actor_id: Annotated[str, Field(examples=['nspoEjklmnsF2oosD'])] """ ID of the Actor that the run was metamorphed to. """ - build_id: Annotated[str, Field(alias='buildId', examples=['ME6oKecqy5kXDS4KQ'])] + build_id: Annotated[str, Field(examples=['ME6oKecqy5kXDS4KQ'])] """ ID of the build used for the metamorphed Actor. """ - input_key: Annotated[str | None, Field(alias='inputKey', examples=['INPUT-METAMORPH-1'])] = None + input_key: Annotated[str | None, Field(examples=['INPUT-METAMORPH-1'])] = None """ Key of the input record in the key-value store. """ @@ -1740,27 +1372,17 @@ class Metamorph(BaseModel): @docs_group('Models') class MonthlyUsage(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - usage_cycle: Annotated[UsageCycle, Field(alias='usageCycle')] - monthly_service_usage: Annotated[dict[str, UsageItem], Field(alias='monthlyServiceUsage')] - daily_service_usages: Annotated[list[DailyServiceUsages], Field(alias='dailyServiceUsages')] - total_usage_credits_usd_before_volume_discount: Annotated[ - float, Field(alias='totalUsageCreditsUsdBeforeVolumeDiscount', examples=[0.786143673840067]) - ] - total_usage_credits_usd_after_volume_discount: Annotated[ - float, Field(alias='totalUsageCreditsUsdAfterVolumeDiscount', examples=[0.786143673840067]) - ] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + usage_cycle: UsageCycle + monthly_service_usage: dict[str, UsageItem] + daily_service_usages: list[DailyServiceUsages] + total_usage_credits_usd_before_volume_discount: Annotated[float, Field(examples=[0.786143673840067])] + total_usage_credits_usd_after_volume_discount: Annotated[float, Field(examples=[0.786143673840067])] @docs_group('Models') class MonthlyUsageResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: MonthlyUsage @@ -1768,10 +1390,7 @@ class MonthlyUsageResponse(BaseModel): class Notifications(BaseModel): """Notification settings for this schedule.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) email: Annotated[bool | None, Field(examples=[True])] = None @@ -1779,10 +1398,7 @@ class Notifications(BaseModel): class PaginationResponse(BaseModel): """Common pagination fields for list responses.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) total: Annotated[int, Field(examples=[1], ge=0)] """ The total number of items available across all pages. @@ -1807,28 +1423,19 @@ class PaginationResponse(BaseModel): @docs_group('Models') class ListOfActors(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[ActorShort] @docs_group('Models') class ListOfBuilds(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[BuildShort] @docs_group('Models') class ListOfDatasets(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) unnamed: Annotated[bool | None, Field(examples=[False])] = None """ Whether the listing was filtered to only unnamed datasets. @@ -1838,10 +1445,7 @@ class ListOfDatasets(PaginationResponse): @docs_group('Models') class ListOfKeyValueStores(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) unnamed: Annotated[bool | None, Field(examples=[False])] = None """ Whether the listing was filtered to only unnamed key-value stores. @@ -1853,10 +1457,7 @@ class ListOfKeyValueStores(PaginationResponse): class ListOfRequestQueues(PaginationResponse): """A paginated list of request queues.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) unnamed: Annotated[bool | None, Field(examples=[False])] = None """ Whether the listing was filtered to only unnamed request queues. @@ -1869,112 +1470,81 @@ class ListOfRequestQueues(PaginationResponse): @docs_group('Models') class ListOfRuns(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[RunShort] @docs_group('Models') class ListOfSchedules(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[ScheduleShort] @docs_group('Models') class ListOfStoreActors(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[StoreListActor] @docs_group('Models') class ListOfTasks(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[TaskShort] @docs_group('Models') class ListOfWebhookDispatches(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[WebhookDispatch] @docs_group('Models') class ListOfWebhooks(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) items: list[WebhookShort] @docs_group('Models') class PayPerEventActorPricingInfo(CommonActorPricingInfo): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - pricing_model: Annotated[Literal['PAY_PER_EVENT'], Field(alias='pricingModel')] - pricing_per_event: Annotated[PricingPerEvent, Field(alias='pricingPerEvent')] - minimal_max_total_charge_usd: Annotated[float | None, Field(alias='minimalMaxTotalChargeUsd')] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + pricing_model: Literal['PAY_PER_EVENT'] + pricing_per_event: PricingPerEvent + minimal_max_total_charge_usd: float | None = None @docs_group('Models') class Plan(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['Personal'])] description: Annotated[str, Field(examples=['Cost-effective plan for freelancers, developers and students.'])] - is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] - monthly_base_price_usd: Annotated[float, Field(alias='monthlyBasePriceUsd', examples=[49])] - monthly_usage_credits_usd: Annotated[float, Field(alias='monthlyUsageCreditsUsd', examples=[49])] - usage_discount_percent: Annotated[float | None, Field(alias='usageDiscountPercent', examples=[0])] = None + is_enabled: Annotated[bool, Field(examples=[True])] + monthly_base_price_usd: Annotated[float, Field(examples=[49])] + monthly_usage_credits_usd: Annotated[float, Field(examples=[49])] + usage_discount_percent: Annotated[float | None, Field(examples=[0])] = None enabled_platform_features: Annotated[ - list[str], - Field( - alias='enabledPlatformFeatures', examples=[['ACTORS', 'STORAGE', 'PROXY_SERPS', 'SCHEDULER', 'WEBHOOKS']] - ), - ] - max_monthly_usage_usd: Annotated[float, Field(alias='maxMonthlyUsageUsd', examples=[9999])] - max_actor_memory_gbytes: Annotated[float, Field(alias='maxActorMemoryGbytes', examples=[32])] - max_monthly_actor_compute_units: Annotated[float, Field(alias='maxMonthlyActorComputeUnits', examples=[1000])] - max_monthly_residential_proxy_gbytes: Annotated[ - float, Field(alias='maxMonthlyResidentialProxyGbytes', examples=[10]) + list[str], Field(examples=[['ACTORS', 'STORAGE', 'PROXY_SERPS', 'SCHEDULER', 'WEBHOOKS']]) ] - max_monthly_proxy_serps: Annotated[int, Field(alias='maxMonthlyProxySerps', examples=[30000])] - max_monthly_external_data_transfer_gbytes: Annotated[ - float, Field(alias='maxMonthlyExternalDataTransferGbytes', examples=[1000]) - ] - max_actor_count: Annotated[int, Field(alias='maxActorCount', examples=[100])] - max_actor_task_count: Annotated[int, Field(alias='maxActorTaskCount', examples=[1000])] - data_retention_days: Annotated[int, Field(alias='dataRetentionDays', examples=[14])] - available_proxy_groups: Annotated[dict[str, int], Field(alias='availableProxyGroups')] + max_monthly_usage_usd: Annotated[float, Field(examples=[9999])] + max_actor_memory_gbytes: Annotated[float, Field(examples=[32])] + max_monthly_actor_compute_units: Annotated[float, Field(examples=[1000])] + max_monthly_residential_proxy_gbytes: Annotated[float, Field(examples=[10])] + max_monthly_proxy_serps: Annotated[int, Field(examples=[30000])] + max_monthly_external_data_transfer_gbytes: Annotated[float, Field(examples=[1000])] + max_actor_count: Annotated[int, Field(examples=[100])] + max_actor_task_count: Annotated[int, Field(examples=[1000])] + data_retention_days: Annotated[int, Field(examples=[14])] + available_proxy_groups: dict[str, int] """ The number of available proxies in this group. """ - team_account_seat_count: Annotated[int, Field(alias='teamAccountSeatCount', examples=[1])] - support_level: Annotated[str, Field(alias='supportLevel', examples=['COMMUNITY'])] - available_add_ons: Annotated[list[str], Field(alias='availableAddOns', examples=[[]])] + team_account_seat_count: Annotated[int, Field(examples=[1])] + support_level: Annotated[str, Field(examples=['COMMUNITY'])] + available_add_ons: Annotated[list[str], Field(examples=[[]])] tier: Annotated[str | None, Field(examples=['FREE'])] = None - api_rate_limit_boosts: Annotated[int | None, Field(alias='apiRateLimitBoosts', examples=[0])] = None - max_schedule_count: Annotated[int | None, Field(alias='maxScheduleCount', examples=[100])] = None - max_concurrent_actor_runs: Annotated[int | None, Field(alias='maxConcurrentActorRuns', examples=[25])] = None - plan_pricing: Annotated[dict[str, Any] | None, Field(alias='planPricing')] = None + api_rate_limit_boosts: Annotated[int | None, Field(examples=[0])] = None + max_schedule_count: Annotated[int | None, Field(examples=[100])] = None + max_concurrent_actor_runs: Annotated[int | None, Field(examples=[25])] = None + plan_pricing: dict[str, Any] | None = None """ Pricing details for this plan. """ @@ -1982,111 +1552,82 @@ class Plan(BaseModel): @docs_group('Models') class PricePerDatasetItemActorPricingInfo(CommonActorPricingInfo): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - pricing_model: Annotated[Literal['PRICE_PER_DATASET_ITEM'], Field(alias='pricingModel')] - unit_name: Annotated[str, Field(alias='unitName')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + pricing_model: Literal['PRICE_PER_DATASET_ITEM'] + unit_name: str """ Name of the unit that is being charged """ - price_per_unit_usd: Annotated[float | None, Field(alias='pricePerUnitUsd')] = None + price_per_unit_usd: float | None = None """ Price per unit in USD. Mutually exclusive with `tieredPricing` - exactly one of the two is present on a pricing record. """ - tiered_pricing: Annotated[dict[str, TieredPricingPerDatasetItemEntry] | None, Field(alias='tieredPricing')] = None + tiered_pricing: dict[str, TieredPricingPerDatasetItemEntry] | None = None @docs_group('Models') class PriceTiers(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - quantity_above: Annotated[float, Field(alias='quantityAbove', examples=[0])] - discount_percent: Annotated[float, Field(alias='discountPercent', examples=[100])] - tier_quantity: Annotated[float, Field(alias='tierQuantity', examples=[0.39])] - unit_price_usd: Annotated[float, Field(alias='unitPriceUsd', examples=[0])] - price_usd: Annotated[float, Field(alias='priceUsd', examples=[0])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + quantity_above: Annotated[float, Field(examples=[0])] + discount_percent: Annotated[float, Field(examples=[100])] + tier_quantity: Annotated[float, Field(examples=[0.39])] + unit_price_usd: Annotated[float, Field(examples=[0])] + price_usd: Annotated[float, Field(examples=[0])] @docs_group('Models') class PricingPerEvent(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - actor_charge_events: Annotated[dict[str, ActorChargeEvent] | None, Field(alias='actorChargeEvents')] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + actor_charge_events: dict[str, ActorChargeEvent] | None = None @docs_group('Models') class PrivateUserDataResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: UserPrivateInfo @docs_group('Models') class Profile(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) bio: Annotated[str | None, Field(examples=['I started web scraping in 1985 using Altair BASIC.'])] = None name: Annotated[str | None, Field(examples=['Jane Doe'])] = None - picture_url: Annotated[ - AnyUrl | None, Field(alias='pictureUrl', examples=['https://apify.com/img/anonymous_user_picture.png']) - ] = None - github_username: Annotated[str | None, Field(alias='githubUsername', examples=['torvalds.'])] = None - website_url: Annotated[AnyUrl | None, Field(alias='websiteUrl', examples=['http://www.example.com'])] = None - twitter_username: Annotated[str | None, Field(alias='twitterUsername', examples=['@BillGates'])] = None + picture_url: Annotated[AnyUrl | None, Field(examples=['https://apify.com/img/anonymous_user_picture.png'])] = None + github_username: Annotated[str | None, Field(examples=['torvalds.'])] = None + website_url: Annotated[AnyUrl | None, Field(examples=['http://www.example.com'])] = None + twitter_username: Annotated[str | None, Field(examples=['@BillGates'])] = None @docs_group('Models') class ProlongRequestLockResponse(BaseModel): """Response containing updated lock information after prolonging a request lock.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: RequestLockInfo @docs_group('Models') class Proxy(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) password: Annotated[str, Field(examples=['ad78knd9Jkjd86'])] groups: list[ProxyGroup] @docs_group('Models') class ProxyGroup(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: Annotated[str, Field(examples=['Group1'])] description: Annotated[str | None, Field(examples=['Group1 description'])] - available_count: Annotated[int, Field(alias='availableCount', examples=[10])] + available_count: Annotated[int, Field(examples=[10])] @docs_group('Models') class PublicActorRunStats30Days(BaseModel): """Run status counts over the past 30 days.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) aborted: Annotated[int | None, Field(alias='ABORTED', examples=[2542])] = None failed: Annotated[int | None, Field(alias='FAILED', examples=[1234])] = None succeeded: Annotated[int | None, Field(alias='SUCCEEDED', examples=[732805])] = None @@ -2096,19 +1637,13 @@ class PublicActorRunStats30Days(BaseModel): @docs_group('Models') class PublicUserDataResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: UserPublicInfo @docs_group('Models') class PutItemResponseError(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) error: DatasetSchemaValidationError @@ -2119,10 +1654,7 @@ class PutItemsRequest(BaseModel): """ - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) @docs_group('Models') @@ -2132,10 +1664,7 @@ class PutRecordRequest(BaseModel): """ - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) @docs_group('Models') @@ -2145,21 +1674,13 @@ class RecordResponse(BaseModel): """ - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) @docs_group('Models') class RequestBase(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - unique_key: Annotated[ - str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) - ] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + unique_key: Annotated[str | None, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] = None """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @@ -2168,11 +1689,11 @@ class RequestBase(BaseModel): The URL of the request. """ method: HttpMethod | None = None - retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None + retry_count: Annotated[int | None, Field(examples=[0])] = None """ The number of times this request has been retried. """ - loaded_url: Annotated[str | None, Field(alias='loadedUrl', examples=['https://apify.com/jobs'])] = None + loaded_url: Annotated[str | None, Field(examples=['https://apify.com/jobs'])] = None """ The final URL that was loaded, after redirects (if any). """ @@ -2184,16 +1705,16 @@ class RequestBase(BaseModel): """ HTTP headers sent with the request. """ - user_data: Annotated[RequestUserData | None, Field(alias='userData')] = None - no_retry: Annotated[bool | None, Field(alias='noRetry', examples=[False])] = None + user_data: RequestUserData | None = None + no_retry: Annotated[bool | None, Field(examples=[False])] = None """ Indicates whether the request should not be retried if processing fails. """ - error_messages: Annotated[list[str] | None, Field(alias='errorMessages', examples=[None])] = None + error_messages: Annotated[list[str] | None, Field(examples=[None])] = None """ Error messages recorded from failed processing attempts. """ - handled_at: Annotated[AwareDatetime | None, Field(alias='handledAt', examples=['2019-06-16T10:23:31.607Z'])] = None + handled_at: Annotated[AwareDatetime | None, Field(examples=['2019-06-16T10:23:31.607Z'])] = None """ The timestamp when the request was marked as handled, if applicable. """ @@ -2203,10 +1724,7 @@ class RequestBase(BaseModel): class Request(RequestBase): """A request stored in the request queue, including its metadata and processing state.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None """ A unique identifier assigned to the request. @@ -2217,15 +1735,12 @@ class Request(RequestBase): class RequestDraft(BaseModel): """A request that failed to be processed during a request queue operation and can be retried.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None """ A unique identifier assigned to the request. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + unique_key: Annotated[str, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @@ -2240,17 +1755,12 @@ class RequestDraft(BaseModel): class RequestDraftDeleteById(BaseModel): """A request that should be deleted, identified by its ID.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] """ A unique identifier assigned to the request. """ - unique_key: Annotated[ - str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) - ] = None + unique_key: Annotated[str | None, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] = None """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @@ -2260,15 +1770,12 @@ class RequestDraftDeleteById(BaseModel): class RequestDraftDeleteByUniqueKey(BaseModel): """A request that should be deleted, identified by its unique key.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None """ A unique identifier assigned to the request. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + unique_key: Annotated[str, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])] """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @@ -2286,11 +1793,8 @@ class RequestDraftDelete(RootModel[RequestDraftDeleteById | RequestDraftDeleteBy class RequestLockInfo(BaseModel): """Information about a request lock.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-06-14T23:00:00.000Z'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + lock_expires_at: Annotated[AwareDatetime, Field(examples=['2022-06-14T23:00:00.000Z'])] """ The timestamp when the lock on this request expires. """ @@ -2300,10 +1804,7 @@ class RequestLockInfo(BaseModel): class RequestQueue(BaseModel): """A request queue object containing metadata and statistics.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] """ A unique identifier assigned to the request queue. @@ -2312,73 +1813,68 @@ class RequestQueue(BaseModel): """ The name of the request queue. """ - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] """ The ID of the user who owns the request queue. """ - act_id: Annotated[str | None, Field(alias='actId')] = None + act_id: str | None = None """ The ID of the Actor that created this request queue. """ - act_run_id: Annotated[str | None, Field(alias='actRunId')] = None + act_run_id: str | None = None """ The ID of the Actor run that created this request queue. """ - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] """ The timestamp when the request queue was created. """ - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] """ The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. """ - accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] + accessed_at: Annotated[AwareDatetime, Field(examples=['2019-12-14T08:36:13.202Z'])] """ The timestamp when the request queue was last accessed. """ - total_request_count: Annotated[int, Field(alias='totalRequestCount', examples=[870], ge=0)] + total_request_count: Annotated[int, Field(examples=[870], ge=0)] """ The total number of requests in the request queue. """ - handled_request_count: Annotated[int, Field(alias='handledRequestCount', examples=[100], ge=0)] + handled_request_count: Annotated[int, Field(examples=[100], ge=0)] """ The number of requests that have been handled. """ - pending_request_count: Annotated[int, Field(alias='pendingRequestCount', examples=[670])] + pending_request_count: Annotated[int, Field(examples=[670])] """ The number of requests that are pending and have not been handled yet. """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + had_multiple_clients: Annotated[bool, Field(examples=[True])] """ Whether the request queue has been accessed by multiple different clients. """ - console_url: Annotated[ - AnyUrl, Field(alias='consoleUrl', examples=['https://api.apify.com/v2/request-queues/27TmTznX9YPeAYhkC']) - ] + console_url: Annotated[AnyUrl, Field(examples=['https://api.apify.com/v2/request-queues/27TmTznX9YPeAYhkC'])] """ The URL to view the request queue in the Apify console. """ stats: RequestQueueStats | None = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + general_access: GeneralAccess | None = None @docs_group('Models') class RequestQueueHead(BaseModel): """A batch of requests from the request queue head without locking.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) limit: Annotated[int, Field(examples=[1000])] """ The maximum number of requests returned. """ - queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + queue_modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] """ The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + had_multiple_clients: Annotated[bool, Field(examples=[True])] """ Whether the request queue has been accessed by multiple different clients. """ @@ -2392,10 +1888,7 @@ class RequestQueueHead(BaseModel): class RequestQueueResponse(BaseModel): """Response containing request queue data.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: RequestQueue @@ -2403,10 +1896,7 @@ class RequestQueueResponse(BaseModel): class RequestQueueShort(BaseModel): """A shortened request queue object for list responses.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] """ A unique identifier assigned to the request queue. @@ -2415,7 +1905,7 @@ class RequestQueueShort(BaseModel): """ The name of the request queue. """ - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] """ The ID of the user who owns the request queue. """ @@ -2423,47 +1913,47 @@ class RequestQueueShort(BaseModel): """ The username of the user who owns the request queue. """ - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] """ The timestamp when the request queue was created. """ - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] """ The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. """ - accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] + accessed_at: Annotated[AwareDatetime, Field(examples=['2019-12-14T08:36:13.202Z'])] """ The timestamp when the request queue was last accessed. """ - expire_at: Annotated[AwareDatetime | None, Field(alias='expireAt', examples=['2019-06-02T17:15:06.751Z'])] = None + expire_at: Annotated[AwareDatetime | None, Field(examples=['2019-06-02T17:15:06.751Z'])] = None """ The timestamp when the request queue will expire and be deleted. """ - total_request_count: Annotated[int, Field(alias='totalRequestCount', examples=[870], ge=0)] + total_request_count: Annotated[int, Field(examples=[870], ge=0)] """ The total number of requests in the request queue. """ - handled_request_count: Annotated[int, Field(alias='handledRequestCount', examples=[100], ge=0)] + handled_request_count: Annotated[int, Field(examples=[100], ge=0)] """ The number of requests that have been handled. """ - pending_request_count: Annotated[int, Field(alias='pendingRequestCount', examples=[670])] + pending_request_count: Annotated[int, Field(examples=[670])] """ The number of requests that are pending and have not been handled yet. """ - act_id: Annotated[str | None, Field(alias='actId')] = None + act_id: str | None = None """ The ID of the Actor that created this request queue. """ - act_run_id: Annotated[str | None, Field(alias='actRunId')] = None + act_run_id: str | None = None """ The ID of the Actor run that created this request queue. """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + had_multiple_clients: Annotated[bool, Field(examples=[True])] """ Whether the request queue has been accessed by multiple different clients. """ - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + general_access: GeneralAccess | None = None stats: RequestQueueStats | None = None @@ -2471,27 +1961,24 @@ class RequestQueueShort(BaseModel): class RequestQueueStats(BaseModel): """Statistics about request queue operations and storage.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - delete_count: Annotated[int | None, Field(alias='deleteCount', examples=[0])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + delete_count: Annotated[int | None, Field(examples=[0])] = None """ The number of delete operations performed on the request queue. """ - head_item_read_count: Annotated[int | None, Field(alias='headItemReadCount', examples=[5])] = None + head_item_read_count: Annotated[int | None, Field(examples=[5])] = None """ The number of times requests from the head were read. """ - read_count: Annotated[int | None, Field(alias='readCount', examples=[100])] = None + read_count: Annotated[int | None, Field(examples=[100])] = None """ The total number of read operations performed on the request queue. """ - storage_bytes: Annotated[int | None, Field(alias='storageBytes', examples=[1024])] = None + storage_bytes: Annotated[int | None, Field(examples=[1024])] = None """ The total storage size in bytes used by the request queue. """ - write_count: Annotated[int | None, Field(alias='writeCount', examples=[10])] = None + write_count: Annotated[int | None, Field(examples=[10])] = None """ The total number of write operations performed on the request queue. """ @@ -2501,10 +1988,7 @@ class RequestQueueStats(BaseModel): class RequestQueues(BaseModel): """Aliased request queue IDs for this run.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) default: Annotated[str | None, Field(examples=['FL35cSF7jrxr3BY39'])] = None """ ID of the default request queue for this run. @@ -2515,19 +1999,16 @@ class RequestQueues(BaseModel): class RequestRegistration(BaseModel): """Result of registering a request in the request queue, either by adding a new request or updating an existing one.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - request_id: Annotated[str, Field(alias='requestId', examples=['sbJ7klsdf7ujN9l'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + request_id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] """ A unique identifier assigned to the request. """ - was_already_present: Annotated[bool, Field(alias='wasAlreadyPresent', examples=[False])] + was_already_present: Annotated[bool, Field(examples=[False])] """ Indicates whether a request with the same unique key already existed in the request queue. If true, no new request was created. """ - was_already_handled: Annotated[bool, Field(alias='wasAlreadyHandled', examples=[False])] + was_already_handled: Annotated[bool, Field(examples=[False])] """ Indicates whether a request with the same unique key has already been processed by the request queue. """ @@ -2537,10 +2018,7 @@ class RequestRegistration(BaseModel): class RequestResponse(BaseModel): """Response containing a single request from the request queue.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Request @@ -2548,43 +2026,35 @@ class RequestResponse(BaseModel): class RequestUserData(BaseModel): """Custom user data attached to the request. Can contain arbitrary fields.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) @docs_group('Models') class Run(BaseModel): """Represents an Actor run and its associated data.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] """ Unique identifier of the Actor run. """ - act_id: Annotated[str, Field(alias='actId', examples=['HDSasDasz78YcAPEB'])] + act_id: Annotated[str, Field(examples=['HDSasDasz78YcAPEB'])] """ ID of the Actor that was run. """ - user_id: Annotated[str, Field(alias='userId', examples=['7sT5jcggjjA9fNcxF'])] + user_id: Annotated[str, Field(examples=['7sT5jcggjjA9fNcxF'])] """ ID of the user who started the run. """ - actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['KJHSKHausidyaJKHs'])] = None + actor_task_id: Annotated[str | None, Field(examples=['KJHSKHausidyaJKHs'])] = None """ ID of the Actor task, if the run was started from a task. """ - started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] + started_at: Annotated[AwareDatetime, Field(examples=['2019-11-30T07:34:24.202Z'])] """ Time when the Actor run started. """ - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( - None - ) + finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T09:30:12.202Z'])] = None """ Time when the Actor run finished. """ @@ -2592,11 +2062,11 @@ class Run(BaseModel): """ Current status of the Actor run. """ - status_message: Annotated[str | None, Field(alias='statusMessage', examples=['Actor is running'])] = None + status_message: Annotated[str | None, Field(examples=['Actor is running'])] = None """ Detailed message about the run status. """ - is_status_message_terminal: Annotated[bool | None, Field(alias='isStatusMessageTerminal', examples=[False])] = None + is_status_message_terminal: Annotated[bool | None, Field(examples=[False])] = None """ Whether the status message is terminal (final). """ @@ -2610,7 +2080,7 @@ class Run(BaseModel): | FlatPricePerMonthActorPricingInfo | FreeActorPricingInfo | None, - Field(alias='pricingInfo', discriminator='pricing_model', title='ActorRunPricingInfo'), + Field(discriminator='pricing_model', title='ActorRunPricingInfo'), ] = None """ Pricing information for the Actor. @@ -2620,8 +2090,7 @@ class Run(BaseModel): Statistics of the Actor run. """ charged_event_counts: Annotated[ - dict[str, int] | None, - Field(alias='chargedEventCounts', examples=[{'actor-start': 1, 'page-crawled': 150, 'data-extracted': 75}]), + dict[str, int] | None, Field(examples=[{'actor-start': 1, 'page-crawled': 150, 'data-extracted': 75}]) ] = None """ A map of charged event types to their counts. The keys are event type identifiers defined by the Actor's pricing model (pay-per-event), and the values are the number of times each event was charged during this run. @@ -2630,56 +2099,49 @@ class Run(BaseModel): """ Configuration options for the Actor run. """ - build_id: Annotated[str, Field(alias='buildId', examples=['7sT5jcggjjA9fNcxF'])] + build_id: Annotated[str, Field(examples=['7sT5jcggjjA9fNcxF'])] """ ID of the Actor build used for this run. """ - exit_code: Annotated[int | None, Field(alias='exitCode', examples=[0])] = None + exit_code: Annotated[int | None, Field(examples=[0])] = None """ Exit code of the Actor run process. """ - general_access: Annotated[GeneralAccess, Field(alias='generalAccess')] + general_access: GeneralAccess """ General access level for the Actor run. """ - default_key_value_store_id: Annotated[str, Field(alias='defaultKeyValueStoreId', examples=['eJNzqsbPiopwJcgGQ'])] + default_key_value_store_id: Annotated[str, Field(examples=['eJNzqsbPiopwJcgGQ'])] """ ID of the default key-value store for this run. """ - default_dataset_id: Annotated[str, Field(alias='defaultDatasetId', examples=['wmKPijuyDnPZAPRMk'])] + default_dataset_id: Annotated[str, Field(examples=['wmKPijuyDnPZAPRMk'])] """ ID of the default dataset for this run. """ - default_request_queue_id: Annotated[str, Field(alias='defaultRequestQueueId', examples=['FL35cSF7jrxr3BY39'])] + default_request_queue_id: Annotated[str, Field(examples=['FL35cSF7jrxr3BY39'])] """ ID of the default request queue for this run. """ - storage_ids: Annotated[StorageIds | None, Field(alias='storageIds')] = None + storage_ids: StorageIds | None = None """ A map of aliased storage IDs associated with this run, grouped by storage type. """ build_number: Annotated[ - str | None, - Field( - alias='buildNumber', - examples=['0.0.36'], - pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$', - ), + str | None, Field(examples=['0.0.36'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$') ] = None """ Build number of the Actor build used for this run. """ - container_url: Annotated[ - AnyUrl | None, Field(alias='containerUrl', examples=['https://g8kd8kbc5ge8.runs.apify.net']) - ] = None + container_url: Annotated[AnyUrl | None, Field(examples=['https://g8kd8kbc5ge8.runs.apify.net'])] = None """ URL of the container running the Actor. """ - is_container_server_ready: Annotated[bool | None, Field(alias='isContainerServerReady', examples=[True])] = None + is_container_server_ready: Annotated[bool | None, Field(examples=[True])] = None """ Whether the container's HTTP server is ready to accept requests. """ - git_branch_name: Annotated[str | None, Field(alias='gitBranchName', examples=['master'])] = None + git_branch_name: Annotated[str | None, Field(examples=['master'])] = None """ Name of the git branch used for the Actor build. """ @@ -2687,11 +2149,11 @@ class Run(BaseModel): """ Resource usage statistics for the run. """ - usage_total_usd: Annotated[float | None, Field(alias='usageTotalUsd', examples=[0.2654])] = None + usage_total_usd: Annotated[float | None, Field(examples=[0.2654])] = None """ Total cost in USD for this run. Represents what you actually pay. For run owners: includes platform usage (compute units) and/or event costs depending on the Actor's pricing model. For run non-owners: only available for Pay-Per-Event Actors (event costs only). Requires authentication token to access. """ - usage_usd: Annotated[RunUsageUsd | None, Field(alias='usageUsd')] = None + usage_usd: RunUsageUsd | None = None """ Platform usage costs breakdown in USD. Only present if you own the run AND are paying for platform usage (Pay-Per-Usage, Rental, or Pay-Per-Event with usage costs like standby Actors). Not available for standard Pay-Per-Event Actors. Requires authentication token to access. """ @@ -2699,9 +2161,7 @@ class Run(BaseModel): """ List of metamorph events that occurred during the run. """ - platform_usage_billing_model: Annotated[str | None, Field(alias='platformUsageBillingModel', examples=['USER'])] = ( - None - ) + platform_usage_billing_model: Annotated[str | None, Field(examples=['USER'])] = None """ Indicates which party covers platform usage costs for this run. """ @@ -2709,10 +2169,7 @@ class Run(BaseModel): @docs_group('Models') class RunFailedErrorDetail(ErrorDetail): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) type: Annotated[Literal['run-failed'], Field(title='ErrorType')] = 'run-failed' """ Machine-processable error type identifier. @@ -2721,24 +2178,21 @@ class RunFailedErrorDetail(ErrorDetail): @docs_group('Models') class RunMeta(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) origin: RunOrigin - client_ip: Annotated[str | None, Field(alias='clientIp')] = None + client_ip: str | None = None """ IP address of the client that started the run. """ - user_agent: Annotated[str | None, Field(alias='userAgent')] = None + user_agent: str | None = None """ User agent of the client that started the run. """ - schedule_id: Annotated[str | None, Field(alias='scheduleId')] = None + schedule_id: str | None = None """ ID of the schedule that triggered the run. """ - scheduled_at: Annotated[AwareDatetime | None, Field(alias='scheduledAt')] = None + scheduled_at: AwareDatetime | None = None """ Time when the run was scheduled. """ @@ -2746,90 +2200,68 @@ class RunMeta(BaseModel): @docs_group('Models') class RunOptions(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) build: Annotated[str, Field(examples=['latest'])] - timeout_secs: Annotated[int, Field(alias='timeoutSecs', examples=[300], ge=0)] - memory_mbytes: Annotated[int, Field(alias='memoryMbytes', examples=[1024], ge=128, le=32768)] - disk_mbytes: Annotated[int, Field(alias='diskMbytes', examples=[2048], ge=0)] - max_items: Annotated[int | None, Field(alias='maxItems', examples=[1000], ge=1)] = None - max_total_charge_usd: Annotated[float | None, Field(alias='maxTotalChargeUsd', examples=[5], ge=0.0)] = None + timeout_secs: Annotated[int, Field(examples=[300], ge=0)] + memory_mbytes: Annotated[int, Field(examples=[1024], ge=128, le=32768)] + disk_mbytes: Annotated[int, Field(examples=[2048], ge=0)] + max_items: Annotated[int | None, Field(examples=[1000], ge=1)] = None + max_total_charge_usd: Annotated[float | None, Field(examples=[5], ge=0.0)] = None @docs_group('Models') class RunResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Run @docs_group('Models') class RunShort(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] - act_id: Annotated[str, Field(alias='actId', examples=['HDSasDasz78YcAPEB'])] - user_id: Annotated[str | None, Field(alias='userId', examples=['7sT5jcggjjA9fNcxF'])] = None - actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['KJHSKHausidyaJKHs'])] = None + act_id: Annotated[str, Field(examples=['HDSasDasz78YcAPEB'])] + user_id: Annotated[str | None, Field(examples=['7sT5jcggjjA9fNcxF'])] = None + actor_task_id: Annotated[str | None, Field(examples=['KJHSKHausidyaJKHs'])] = None status: ActorJobStatus - started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( - None - ) - build_id: Annotated[str, Field(alias='buildId', examples=['HG7ML7M8z78YcAPEB'])] + started_at: Annotated[AwareDatetime, Field(examples=['2019-11-30T07:34:24.202Z'])] + finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T09:30:12.202Z'])] = None + build_id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] build_number: Annotated[ - str | None, - Field( - alias='buildNumber', - examples=['0.0.2'], - pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$', - ), + str | None, Field(examples=['0.0.2'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$') ] = None - build_number_int: Annotated[int | None, Field(alias='buildNumberInt', examples=[10000])] = None + build_number_int: Annotated[int | None, Field(examples=[10000])] = None meta: RunMeta - usage_total_usd: Annotated[float, Field(alias='usageTotalUsd', examples=[0.2])] - default_key_value_store_id: Annotated[str, Field(alias='defaultKeyValueStoreId', examples=['sfAjeR4QmeJCQzTfe'])] - default_dataset_id: Annotated[str, Field(alias='defaultDatasetId', examples=['3ZojQDdFTsyE7Moy4'])] - default_request_queue_id: Annotated[str, Field(alias='defaultRequestQueueId', examples=['so93g2shcDzK3pA85'])] + usage_total_usd: Annotated[float, Field(examples=[0.2])] + default_key_value_store_id: Annotated[str, Field(examples=['sfAjeR4QmeJCQzTfe'])] + default_dataset_id: Annotated[str, Field(examples=['3ZojQDdFTsyE7Moy4'])] + default_request_queue_id: Annotated[str, Field(examples=['so93g2shcDzK3pA85'])] @docs_group('Models') class RunStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - input_body_len: Annotated[int | None, Field(alias='inputBodyLen', examples=[240], ge=0)] = None - migration_count: Annotated[int | None, Field(alias='migrationCount', examples=[0], ge=0)] = None - reboot_count: Annotated[int | None, Field(alias='rebootCount', examples=[0], ge=0)] = None - restart_count: Annotated[int, Field(alias='restartCount', examples=[0], ge=0)] - resurrect_count: Annotated[int, Field(alias='resurrectCount', examples=[2], ge=0)] - mem_avg_bytes: Annotated[float | None, Field(alias='memAvgBytes', examples=[267874071.9])] = None - mem_max_bytes: Annotated[int | None, Field(alias='memMaxBytes', examples=[404713472], ge=0)] = None - mem_current_bytes: Annotated[int | None, Field(alias='memCurrentBytes', examples=[0], ge=0)] = None - cpu_avg_usage: Annotated[float | None, Field(alias='cpuAvgUsage', examples=[33.7532101107538])] = None - cpu_max_usage: Annotated[float | None, Field(alias='cpuMaxUsage', examples=[169.650735534941])] = None - cpu_current_usage: Annotated[float | None, Field(alias='cpuCurrentUsage', examples=[0])] = None - net_rx_bytes: Annotated[int | None, Field(alias='netRxBytes', examples=[103508042], ge=0)] = None - net_tx_bytes: Annotated[int | None, Field(alias='netTxBytes', examples=[4854600], ge=0)] = None - duration_millis: Annotated[int | None, Field(alias='durationMillis', examples=[248472], ge=0)] = None - run_time_secs: Annotated[float | None, Field(alias='runTimeSecs', examples=[248.472], ge=0.0)] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + input_body_len: Annotated[int | None, Field(examples=[240], ge=0)] = None + migration_count: Annotated[int | None, Field(examples=[0], ge=0)] = None + reboot_count: Annotated[int | None, Field(examples=[0], ge=0)] = None + restart_count: Annotated[int, Field(examples=[0], ge=0)] + resurrect_count: Annotated[int, Field(examples=[2], ge=0)] + mem_avg_bytes: Annotated[float | None, Field(examples=[267874071.9])] = None + mem_max_bytes: Annotated[int | None, Field(examples=[404713472], ge=0)] = None + mem_current_bytes: Annotated[int | None, Field(examples=[0], ge=0)] = None + cpu_avg_usage: Annotated[float | None, Field(examples=[33.7532101107538])] = None + cpu_max_usage: Annotated[float | None, Field(examples=[169.650735534941])] = None + cpu_current_usage: Annotated[float | None, Field(examples=[0])] = None + net_rx_bytes: Annotated[int | None, Field(examples=[103508042], ge=0)] = None + net_tx_bytes: Annotated[int | None, Field(examples=[4854600], ge=0)] = None + duration_millis: Annotated[int | None, Field(examples=[248472], ge=0)] = None + run_time_secs: Annotated[float | None, Field(examples=[248.472], ge=0.0)] = None metamorph: Annotated[int | None, Field(examples=[0], ge=0)] = None - compute_units: Annotated[float, Field(alias='computeUnits', examples=[0.13804], ge=0.0)] + compute_units: Annotated[float, Field(examples=[0.13804], ge=0.0)] @docs_group('Models') class RunTimeoutExceededErrorDetail(ErrorDetail): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) type: Annotated[Literal['run-timeout-exceeded'], Field(title='ErrorType')] = 'run-timeout-exceeded' """ Machine-processable error type identifier. @@ -2838,10 +2270,7 @@ class RunTimeoutExceededErrorDetail(ErrorDetail): @docs_group('Models') class RunUsage(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[3])] = None dataset_reads: Annotated[int | None, Field(alias='DATASET_READS', examples=[4])] = None dataset_writes: Annotated[int | None, Field(alias='DATASET_WRITES', examples=[4])] = None @@ -2866,10 +2295,7 @@ class RunUsage(BaseModel): class RunUsageUsd(BaseModel): """Resource usage costs in USD. All values are monetary amounts in US dollars.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[0.0003])] = None dataset_reads: Annotated[float | None, Field(alias='DATASET_READS', examples=[0.0001])] = None dataset_writes: Annotated[float | None, Field(alias='DATASET_WRITES', examples=[0.0001])] = None @@ -2892,86 +2318,65 @@ class RunUsageUsd(BaseModel): @docs_group('Models') class ScheduleActionRunActor(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['c6KfSgoQzFhMk3etc'])] type: Literal['RUN_ACTOR'] - actor_id: Annotated[str, Field(alias='actorId', examples=['jF8GGEvbEg4Au3NLA'])] - run_input: Annotated[ScheduleActionRunInput | None, Field(alias='runInput')] = None - run_options: Annotated[TaskOptions | None, Field(alias='runOptions')] = None + actor_id: Annotated[str, Field(examples=['jF8GGEvbEg4Au3NLA'])] + run_input: ScheduleActionRunInput | None = None + run_options: TaskOptions | None = None @docs_group('Models') class ScheduleActionRunActorTask(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['c6KfSgoQzFhMk3etc'])] type: Literal['RUN_ACTOR_TASK'] - actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['jF8GGEvbEg4Au3NLA'])] + actor_task_id: Annotated[str, Field(examples=['jF8GGEvbEg4Au3NLA'])] input: dict[str, Any] | None = None @docs_group('Models') class ScheduleActionRunInput(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) body: Annotated[str | None, Field(examples=['{\\n "foo": "actor"\\n}'])] = None - content_type: Annotated[str | None, Field(alias='contentType', examples=['application/json; charset=utf-8'])] = None + content_type: Annotated[str | None, Field(examples=['application/json; charset=utf-8'])] = None @docs_group('Models') class ScheduleActionShortRunActor(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['ZReCs7hkdieq8ZUki'])] type: Literal['RUN_ACTOR'] - actor_id: Annotated[str, Field(alias='actorId', examples=['HKhKmiCMrDgu9eXeE'])] + actor_id: Annotated[str, Field(examples=['HKhKmiCMrDgu9eXeE'])] @docs_group('Models') class ScheduleActionShortRunActorTask(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['ZReCs7hkdieq8ZUki'])] type: Literal['RUN_ACTOR_TASK'] - actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['HKhKmiCMrDgu9eXeE'])] + actor_task_id: Annotated[str, Field(examples=['HKhKmiCMrDgu9eXeE'])] @docs_group('Models') class ScheduleBase(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] name: Annotated[str, Field(examples=['my-schedule'])] - cron_expression: Annotated[str, Field(alias='cronExpression', examples=['* * * * *'])] + cron_expression: Annotated[str, Field(examples=['* * * * *'])] timezone: Annotated[str, Field(examples=['UTC'])] - is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] - is_exclusive: Annotated[bool, Field(alias='isExclusive', examples=[True])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-20T06:33:11.202Z'])] - next_run_at: Annotated[AwareDatetime | None, Field(alias='nextRunAt', examples=['2019-04-12T07:34:10.202Z'])] = None - last_run_at: Annotated[AwareDatetime | None, Field(alias='lastRunAt', examples=['2019-04-12T07:33:10.202Z'])] = None + is_enabled: Annotated[bool, Field(examples=[True])] + is_exclusive: Annotated[bool, Field(examples=[True])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-20T06:33:11.202Z'])] + next_run_at: Annotated[AwareDatetime | None, Field(examples=['2019-04-12T07:34:10.202Z'])] = None + last_run_at: Annotated[AwareDatetime | None, Field(examples=['2019-04-12T07:33:10.202Z'])] = None @docs_group('Models') class Schedule(ScheduleBase): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None title: str | None = None notifications: Annotated[Notifications | None, Field(title='ScheduleNotifications')] = None @@ -2983,14 +2388,11 @@ class Schedule(ScheduleBase): @docs_group('Models') class ScheduleCreate(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: Annotated[str | None, Field(examples=['my-schedule'])] = None - is_enabled: Annotated[bool | None, Field(alias='isEnabled', examples=[True])] = None - is_exclusive: Annotated[bool | None, Field(alias='isExclusive', examples=[True])] = None - cron_expression: Annotated[str | None, Field(alias='cronExpression', examples=['* * * * *'])] = None + is_enabled: Annotated[bool | None, Field(examples=[True])] = None + is_exclusive: Annotated[bool | None, Field(examples=[True])] = None + cron_expression: Annotated[str | None, Field(examples=['* * * * *'])] = None timezone: Annotated[str | None, Field(examples=['UTC'])] = None description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None title: str | None = None @@ -3002,72 +2404,51 @@ class ScheduleCreate(BaseModel): @docs_group('Models') class ScheduleCreateActionRunActor(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) type: Literal['RUN_ACTOR'] - actor_id: Annotated[str, Field(alias='actorId', examples=['jF8GGEvbEg4Au3NLA'])] - run_input: Annotated[ScheduleActionRunInput | None, Field(alias='runInput')] = None - run_options: Annotated[TaskOptions | None, Field(alias='runOptions')] = None + actor_id: Annotated[str, Field(examples=['jF8GGEvbEg4Au3NLA'])] + run_input: ScheduleActionRunInput | None = None + run_options: TaskOptions | None = None @docs_group('Models') class ScheduleCreateActionRunActorTask(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) type: Literal['RUN_ACTOR_TASK'] - actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['jF8GGEvbEg4Au3NLA'])] + actor_task_id: Annotated[str, Field(examples=['jF8GGEvbEg4Au3NLA'])] input: dict[str, Any] | None = None @docs_group('Models') class ScheduleInvoked(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) message: Annotated[str, Field(examples=['Schedule invoked'])] level: Annotated[str, Field(examples=['INFO'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-03-26T12:28:00.370Z'])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-03-26T12:28:00.370Z'])] @docs_group('Models') class ScheduleLogResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: list[ScheduleInvoked] @docs_group('Models') class ScheduleResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Schedule @docs_group('Models') class ScheduleShort(ScheduleBase): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) actions: list[Annotated[ScheduleActionShortRunActor | ScheduleActionShortRunActorTask, Field(discriminator='type')]] @docs_group('Models') class SchemaValidationErrorData(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - invalid_items: Annotated[list[InvalidItem], Field(alias='invalidItems')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + invalid_items: list[InvalidItem] """ A list of invalid items in the received array of items. """ @@ -3075,10 +2456,7 @@ class SchemaValidationErrorData(BaseModel): @docs_group('Models') class SourceCodeFile(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) format: SourceCodeFileFormat | None = None content: Annotated[str | None, Field(examples=["console.log('This is the main.js file');"])] = None name: Annotated[str, Field(examples=['src/main.js'])] @@ -3091,10 +2469,7 @@ class SourceCodeFolder(BaseModel): """ - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: Annotated[str, Field(examples=['src/utils'])] """ The folder path relative to the Actor's root directory. @@ -3109,19 +2484,16 @@ class SourceCodeFolder(BaseModel): class StorageIds(BaseModel): """A map of aliased storage IDs associated with this run, grouped by storage type.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) datasets: Datasets | None = None """ Aliased dataset IDs for this run. """ - key_value_stores: Annotated[KeyValueStores | None, Field(alias='keyValueStores')] = None + key_value_stores: KeyValueStores | None = None """ Aliased key-value store IDs for this run. """ - request_queues: Annotated[RequestQueues | None, Field(alias='requestQueues')] = None + request_queues: RequestQueues | None = None """ Aliased request queue IDs for this run. """ @@ -3129,10 +2501,7 @@ class StorageIds(BaseModel): @docs_group('Models') class Storages(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) dataset: dict[str, Any] | None = None """ Defines the schema of items in your dataset, the full specification can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema) @@ -3141,32 +2510,29 @@ class Storages(BaseModel): @docs_group('Models') class StoreListActor(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] title: Annotated[str, Field(examples=['My Public Actor'])] name: Annotated[str, Field(examples=['my-public-actor'])] username: Annotated[str, Field(examples=['jane35'])] - user_full_name: Annotated[str, Field(alias='userFullName', examples=['Jane H. Doe'])] + user_full_name: Annotated[str, Field(examples=['Jane H. Doe'])] description: Annotated[str, Field(examples=['My public actor!'])] categories: Annotated[list[str] | None, Field(examples=[['MARKETING', 'LEAD_GENERATION']])] = None notice: str | None = None - picture_url: Annotated[AnyUrl | None, Field(alias='pictureUrl', examples=['https://...'])] = None - user_picture_url: Annotated[AnyUrl | None, Field(alias='userPictureUrl', examples=['https://...'])] = None + picture_url: Annotated[AnyUrl | None, Field(examples=['https://...'])] = None + user_picture_url: Annotated[AnyUrl | None, Field(examples=['https://...'])] = None url: Annotated[AnyUrl | None, Field(examples=['https://...'])] = None stats: ActorStats - current_pricing_info: Annotated[CurrentPricingInfo, Field(alias='currentPricingInfo')] - is_white_listed_for_agentic_payments: Annotated[bool | None, Field(alias='isWhiteListedForAgenticPayments')] = None + current_pricing_info: CurrentPricingInfo + is_white_listed_for_agentic_payments: bool | None = None """ Whether the Actor is whitelisted for agentic payment processing. """ - actor_review_count: Annotated[int | None, Field(alias='actorReviewCount', examples=[69])] = None - actor_review_rating: Annotated[float | None, Field(alias='actorReviewRating', examples=[4.7])] = None - bookmark_count: Annotated[int | None, Field(alias='bookmarkCount', examples=[1269])] = None + actor_review_count: Annotated[int | None, Field(examples=[69])] = None + actor_review_rating: Annotated[float | None, Field(examples=[4.7])] = None + bookmark_count: Annotated[int | None, Field(examples=[1269])] = None badge: Annotated[str | None, Field(examples=[None])] = None - readme_summary: Annotated[str | None, Field(alias='readmeSummary')] = None + readme_summary: str | None = None """ A brief, LLM-generated readme summary """ @@ -3176,32 +2542,22 @@ class StoreListActor(BaseModel): class TaggedBuildInfo(BaseModel): """Information about a tagged build.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - build_id: Annotated[str | None, Field(alias='buildId', examples=['z2EryhbfhgSyqj6Hn'])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + build_id: Annotated[str | None, Field(examples=['z2EryhbfhgSyqj6Hn'])] = None """ The ID of the build associated with this tag. """ build_number: Annotated[ - str | None, - Field( - alias='buildNumber', - examples=['0.0.2'], - pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$', - ), + str | None, Field(examples=['0.0.2'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$') ] = None """ The build number/version string. """ - build_number_int: Annotated[int | None, Field(alias='buildNumberInt', examples=[42])] = None + build_number_int: Annotated[int | None, Field(examples=[42])] = None """ The build number encoded as a single integer. """ - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-06-10T11:15:49.286Z'])] = ( - None - ) + finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-06-10T11:15:49.286Z'])] = None """ The timestamp when the build finished. """ @@ -3209,24 +2565,21 @@ class TaggedBuildInfo(BaseModel): @docs_group('Models') class Task(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] + act_id: Annotated[str, Field(examples=['asADASadYvn4mBZmm'])] name: Annotated[str, Field(examples=['my-task'])] username: Annotated[str | None, Field(examples=['janedoe'])] = None - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2018-10-26T07:23:14.855Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2018-10-26T13:30:49.578Z'])] - removed_at: Annotated[AwareDatetime | None, Field(alias='removedAt')] = None + created_at: Annotated[AwareDatetime, Field(examples=['2018-10-26T07:23:14.855Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2018-10-26T13:30:49.578Z'])] + removed_at: AwareDatetime | None = None stats: TaskStats | None = None options: TaskOptions | None = None input: TaskInput | None = None title: str | None = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None - standby_url: Annotated[AnyUrl | None, Field(alias='standbyUrl')] = None + actor_standby: ActorStandby | None = None + standby_url: AnyUrl | None = None @docs_group('Models') @@ -3236,70 +2589,52 @@ class TaskInput(BaseModel): """ - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) @docs_group('Models') class TaskOptions(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) build: Annotated[str | None, Field(examples=['latest'])] = None - timeout_secs: Annotated[int | None, Field(alias='timeoutSecs', examples=[300])] = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[1024])] = None - max_items: Annotated[int | None, Field(alias='maxItems', examples=[1000])] = None - max_total_charge_usd: Annotated[float | None, Field(alias='maxTotalChargeUsd', examples=[5])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', examples=[False])] = None + timeout_secs: Annotated[int | None, Field(examples=[300])] = None + memory_mbytes: Annotated[int | None, Field(examples=[1024])] = None + max_items: Annotated[int | None, Field(examples=[1000])] = None + max_total_charge_usd: Annotated[float | None, Field(examples=[5])] = None + restart_on_error: Annotated[bool | None, Field(examples=[False])] = None @docs_group('Models') class TaskResponse(BaseModel): """Response containing Actor task data.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Task @docs_group('Models') class TaskShort(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] - act_name: Annotated[str | None, Field(alias='actName', examples=['my-actor'])] = None + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] + act_id: Annotated[str, Field(examples=['asADASadYvn4mBZmm'])] + act_name: Annotated[str | None, Field(examples=['my-actor'])] = None name: Annotated[str, Field(examples=['my-task'])] username: Annotated[str | None, Field(examples=['janedoe'])] = None - act_username: Annotated[str | None, Field(alias='actUsername', examples=['janedoe'])] = None - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2018-10-26T07:23:14.855Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2018-10-26T13:30:49.578Z'])] + act_username: Annotated[str | None, Field(examples=['janedoe'])] = None + created_at: Annotated[AwareDatetime, Field(examples=['2018-10-26T07:23:14.855Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2018-10-26T13:30:49.578Z'])] stats: TaskStats | None = None @docs_group('Models') class TaskStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - total_runs: Annotated[int | None, Field(alias='totalRuns', examples=[15])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + total_runs: Annotated[int | None, Field(examples=[15])] = None @docs_group('Models') class TestWebhookResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: WebhookDispatch @@ -3307,11 +2642,8 @@ class TestWebhookResponse(BaseModel): class TieredPricingPerDatasetItemEntry(BaseModel): """A single tier's price-per-dataset-item entry.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - tiered_price_per_unit_usd: Annotated[float, Field(alias='tieredPricePerUnitUsd')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + tiered_price_per_unit_usd: float """ Price per unit in USD for this tier. """ @@ -3321,11 +2653,8 @@ class TieredPricingPerDatasetItemEntry(BaseModel): class TieredPricingPerEventEntry(BaseModel): """A single tier's price-per-event entry.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - tiered_event_price_usd: Annotated[float, Field(alias='tieredEventPriceUsd')] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + tiered_event_price_usd: float """ Price per event in USD for this tier. """ @@ -3335,10 +2664,7 @@ class TieredPricingPerEventEntry(BaseModel): class UnlockRequestsResponse(BaseModel): """Response containing the result of unlocking requests.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: UnlockRequestsResult @@ -3346,11 +2672,8 @@ class UnlockRequestsResponse(BaseModel): class UnlockRequestsResult(BaseModel): """Result of unlocking requests in the request queue.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - unlocked_count: Annotated[int, Field(alias='unlockedCount', examples=[10])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + unlocked_count: Annotated[int, Field(examples=[10])] """ Number of requests that were successfully unlocked. """ @@ -3358,20 +2681,17 @@ class UnlockRequestsResult(BaseModel): @docs_group('Models') class UpdateActorRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: Annotated[str | None, Field(examples=['MyActor'])] = None description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None - is_public: Annotated[bool | None, Field(alias='isPublic', examples=[False])] = None - actor_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='actorPermissionLevel')] = None - seo_title: Annotated[str | None, Field(alias='seoTitle', examples=['My actor'])] = None - seo_description: Annotated[str | None, Field(alias='seoDescription', examples=['My actor is the best'])] = None + is_public: Annotated[bool | None, Field(examples=[False])] = None + actor_permission_level: ActorPermissionLevel | None = None + seo_title: Annotated[str | None, Field(examples=['My actor'])] = None + seo_description: Annotated[str | None, Field(examples=['My actor is the best'])] = None title: Annotated[str | None, Field(examples=['My Actor'])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None + restart_on_error: Annotated[bool | None, Field(deprecated=True, examples=[False])] = None versions: list[CreateOrUpdateVersionRequest] | None = None - pricing_infos: Annotated[ + pricing_infos: ( list[ Annotated[ PayPerEventActorPricingInfo @@ -3381,14 +2701,12 @@ class UpdateActorRequest(BaseModel): Field(discriminator='pricing_model'), ] ] - | None, - Field(alias='pricingInfos'), - ] = None + | None + ) = None categories: list[str] | None = None - default_run_options: Annotated[DefaultRunOptions | None, Field(alias='defaultRunOptions')] = None + default_run_options: DefaultRunOptions | None = None tagged_builds: Annotated[ - dict[str, Any] | None, - Field(alias='taggedBuilds', examples=[{'latest': {'buildId': 'z2EryhbfhgSyqj6Hn'}, 'beta': None}]), + dict[str, Any] | None, Field(examples=[{'latest': {'buildId': 'z2EryhbfhgSyqj6Hn'}, 'beta': None}]) ] = None """ An object to modify tags on the Actor's builds. The key is the tag name (e.g., _latest_), and the value is either an object with a `buildId` or `null`. @@ -3431,33 +2749,27 @@ class UpdateActorRequest(BaseModel): ``` """ - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None - example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None - is_deprecated: Annotated[bool | None, Field(alias='isDeprecated')] = None + actor_standby: ActorStandby | None = None + example_run_input: ExampleRunInput | None = None + is_deprecated: bool | None = None @docs_group('Models') class UpdateDatasetRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: str | None = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + general_access: GeneralAccess | None = None @docs_group('Models') class UpdateLimitsRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - max_monthly_usage_usd: Annotated[float | None, Field(alias='maxMonthlyUsageUsd', examples=[300])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + max_monthly_usage_usd: Annotated[float | None, Field(examples=[300])] = None """ If your platform usage in the billing period exceeds the prepaid usage, you will be charged extra. Setting this property you can update your hard limit on monthly platform usage to prevent accidental overage or to limit the extra charges. """ - data_retention_days: Annotated[int | None, Field(alias='dataRetentionDays', examples=[90])] = None + data_retention_days: Annotated[int | None, Field(examples=[90])] = None """ Apify securely stores your ten most recent Actor runs indefinitely, ensuring they are always accessible. Unnamed storages and other Actor runs are automatically deleted after the retention period. If you're subscribed, you can change it to keep data for longer or to limit your usage. [Lear more](https://docs.apify.com/platform/storage/usage#data-retention). @@ -3468,38 +2780,29 @@ class UpdateLimitsRequest(BaseModel): class UpdateRequestQueueRequest(BaseModel): """Request object for updating a request queue.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: str | None = None """ The new name for the request queue. """ - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + general_access: GeneralAccess | None = None @docs_group('Models') class UpdateRequestResponse(BaseModel): """Response containing the result of updating a request in the request queue.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: RequestRegistration @docs_group('Models') class UpdateRunRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - run_id: Annotated[str | None, Field(alias='runId', examples=['3KH8gEpp4d8uQSe8T'])] = None - status_message: Annotated[str | None, Field(alias='statusMessage', examples=['Actor has finished'])] = None - is_status_message_terminal: Annotated[bool | None, Field(alias='isStatusMessageTerminal', examples=[True])] = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + run_id: Annotated[str | None, Field(examples=['3KH8gEpp4d8uQSe8T'])] = None + status_message: Annotated[str | None, Field(examples=['Actor has finished'])] = None + is_status_message_terminal: Annotated[bool | None, Field(examples=[True])] = None + general_access: GeneralAccess | None = None @docs_group('Models') @@ -3509,80 +2812,60 @@ class UpdateStoreRequest(UpdateDatasetRequest): @docs_group('Models') class UpdateTaskRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) name: Annotated[str | None, Field(examples=['my-task'])] = None options: TaskOptions | None = None input: TaskInput | None = None title: str | None = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None + actor_standby: ActorStandby | None = None @docs_group('Models') class UsageCycle(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - start_at: Annotated[AwareDatetime, Field(alias='startAt', examples=['2022-10-02T00:00:00.000Z'])] - end_at: Annotated[AwareDatetime, Field(alias='endAt', examples=['2022-11-01T23:59:59.999Z'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + start_at: Annotated[AwareDatetime, Field(examples=['2022-10-02T00:00:00.000Z'])] + end_at: Annotated[AwareDatetime, Field(examples=['2022-11-01T23:59:59.999Z'])] @docs_group('Models') class UsageItem(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) quantity: Annotated[float, Field(examples=[2.784475])] - base_amount_usd: Annotated[float, Field(alias='baseAmountUsd', examples=[0.69611875])] - base_unit_price_usd: Annotated[float | None, Field(alias='baseUnitPriceUsd', examples=[0.25])] = None - amount_after_volume_discount_usd: Annotated[ - float | None, Field(alias='amountAfterVolumeDiscountUsd', examples=[0.69611875]) - ] = None - price_tiers: Annotated[list[PriceTiers] | None, Field(alias='priceTiers')] = None + base_amount_usd: Annotated[float, Field(examples=[0.69611875])] + base_unit_price_usd: Annotated[float | None, Field(examples=[0.25])] = None + amount_after_volume_discount_usd: Annotated[float | None, Field(examples=[0.69611875])] = None + price_tiers: list[PriceTiers] | None = None @docs_group('Models') class UserPrivateInfo(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['YiKoxjkaS9gjGTqhF'])] username: Annotated[str, Field(examples=['myusername'])] profile: Profile email: Annotated[EmailStr, Field(examples=['bob@example.com'])] proxy: Proxy plan: Plan - effective_platform_features: Annotated[EffectivePlatformFeatures, Field(alias='effectivePlatformFeatures')] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2022-11-29T14:48:29.381Z'])] - is_paying: Annotated[bool, Field(alias='isPaying', examples=[True])] + effective_platform_features: EffectivePlatformFeatures + created_at: Annotated[AwareDatetime, Field(examples=['2022-11-29T14:48:29.381Z'])] + is_paying: Annotated[bool, Field(examples=[True])] @docs_group('Models') class UserPublicInfo(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) username: Annotated[str, Field(examples=['d7b9MDYsbtX5L7XAj'])] profile: Profile | None = None @docs_group('Models') class ValidationError(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - instance_path: Annotated[str | None, Field(alias='instancePath')] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + instance_path: str | None = None """ The path to the instance being validated. """ - schema_path: Annotated[str | None, Field(alias='schemaPath')] = None + schema_path: str | None = None """ The path to the schema that failed the validation. """ @@ -3602,25 +2885,18 @@ class ValidationError(BaseModel): @docs_group('Models') class Version(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - version_number: Annotated[ - str, Field(alias='versionNumber', examples=['0.0'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$') - ] - source_type: Annotated[VersionSourceType | None, Field(alias='sourceType')] - env_vars: Annotated[list[EnvVar] | None, Field(alias='envVars')] = None - apply_env_vars_to_build: Annotated[bool | None, Field(alias='applyEnvVarsToBuild', examples=[False])] = None - build_tag: Annotated[str | None, Field(alias='buildTag', examples=['latest'])] = None - source_files: Annotated[ - list[SourceCodeFile | SourceCodeFolder] | None, Field(alias='sourceFiles', title='VersionSourceFiles') - ] = None - git_repo_url: Annotated[str | None, Field(alias='gitRepoUrl')] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + version_number: Annotated[str, Field(examples=['0.0'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$')] + source_type: VersionSourceType | None + env_vars: list[EnvVar] | None = None + apply_env_vars_to_build: Annotated[bool | None, Field(examples=[False])] = None + build_tag: Annotated[str | None, Field(examples=['latest'])] = None + source_files: Annotated[list[SourceCodeFile | SourceCodeFolder] | None, Field(title='VersionSourceFiles')] = None + git_repo_url: str | None = None """ URL of the Git repository when sourceType is GIT_REPO. """ - tarball_url: Annotated[str | None, Field(alias='tarballUrl')] = None + tarball_url: str | None = None """ URL of the tarball when sourceType is TARBALL. """ @@ -3632,88 +2908,65 @@ class Version(BaseModel): @docs_group('Models') class VersionResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Version @docs_group('Models') class Webhook(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['YiKoxjkaS9gjGTqhF'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None - event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] + is_ad_hoc: Annotated[bool | None, Field(examples=[False])] = None + should_interpolate_strings: Annotated[bool | None, Field(examples=[False])] = None + event_types: Annotated[list[WebhookEventType], Field(examples=[['ACTOR.RUN.SUCCEEDED']])] condition: WebhookCondition - ignore_ssl_errors: Annotated[bool, Field(alias='ignoreSslErrors', examples=[False])] - do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None - request_url: Annotated[AnyUrl, Field(alias='requestUrl', examples=['http://example.com/'])] - payload_template: Annotated[ - str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) - ] = None - headers_template: Annotated[ - str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) - ] = None + ignore_ssl_errors: Annotated[bool, Field(examples=[False])] + do_not_retry: Annotated[bool | None, Field(examples=[False])] = None + request_url: Annotated[AnyUrl, Field(examples=['http://example.com/'])] + payload_template: Annotated[str | None, Field(examples=['{\\n "userId": {{userId}}...'])] = None + headers_template: Annotated[str | None, Field(examples=['{\\n "Authorization": "Bearer ..."}'])] = None description: Annotated[str | None, Field(examples=['this is webhook description'])] = None - last_dispatch: Annotated[ExampleWebhookDispatch | None, Field(alias='lastDispatch')] = None + last_dispatch: ExampleWebhookDispatch | None = None stats: WebhookStats | None = None @docs_group('Models') class WebhookCondition(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - actor_id: Annotated[str | None, Field(alias='actorId', examples=['hksJZtadYvn4mBuin'])] = None - actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['asdLZtadYvn4mBZmm'])] = None - actor_run_id: Annotated[str | None, Field(alias='actorRunId', examples=['hgdKZtadYvn4mBpoi'])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + actor_id: Annotated[str | None, Field(examples=['hksJZtadYvn4mBuin'])] = None + actor_task_id: Annotated[str | None, Field(examples=['asdLZtadYvn4mBZmm'])] = None + actor_run_id: Annotated[str | None, Field(examples=['hgdKZtadYvn4mBpoi'])] = None @docs_group('Models') class WebhookCreate(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None - event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + is_ad_hoc: Annotated[bool | None, Field(examples=[False])] = None + event_types: Annotated[list[WebhookEventType], Field(examples=[['ACTOR.RUN.SUCCEEDED']])] condition: WebhookCondition - idempotency_key: Annotated[str | None, Field(alias='idempotencyKey', examples=['fdSJmdP3nfs7sfk3y'])] = None - ignore_ssl_errors: Annotated[bool | None, Field(alias='ignoreSslErrors', examples=[False])] = None - do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None - request_url: Annotated[str, Field(alias='requestUrl', examples=['http://example.com/'])] - payload_template: Annotated[ - str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) - ] = None - headers_template: Annotated[ - str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) - ] = None + idempotency_key: Annotated[str | None, Field(examples=['fdSJmdP3nfs7sfk3y'])] = None + ignore_ssl_errors: Annotated[bool | None, Field(examples=[False])] = None + do_not_retry: Annotated[bool | None, Field(examples=[False])] = None + request_url: Annotated[str, Field(examples=['http://example.com/'])] + payload_template: Annotated[str | None, Field(examples=['{\\n "userId": {{userId}}...'])] = None + headers_template: Annotated[str | None, Field(examples=['{\\n "Authorization": "Bearer ..."}'])] = None description: Annotated[str | None, Field(examples=['this is webhook description'])] = None - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None + should_interpolate_strings: Annotated[bool | None, Field(examples=[False])] = None @docs_group('Models') class WebhookDispatch(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - webhook_id: Annotated[str, Field(alias='webhookId', examples=['asdLZtadYvn4mBZmm'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] + webhook_id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] status: WebhookDispatchStatus - event_type: Annotated[WebhookEventType, Field(alias='eventType')] - event_data: Annotated[EventData | None, Field(alias='eventData', title='eventData')] = None + event_type: WebhookEventType + event_data: Annotated[EventData | None, Field(title='eventData')] = None webhook: WebhookDispatchWebhookSummary | None = None calls: Annotated[list[Call] | None, Field(title='calls')] = None @@ -3727,14 +2980,11 @@ class WebhookDispatchResponse(TestWebhookResponse): class WebhookDispatchWebhookSummary(BaseModel): """A summary of the webhook that triggered this dispatch.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - action_type: Annotated[str | None, Field(alias='actionType', examples=['HTTP_REQUEST'])] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + action_type: Annotated[str | None, Field(examples=['HTTP_REQUEST'])] = None condition: WebhookCondition | None = None - request_url: Annotated[AnyUrl | None, Field(alias='requestUrl', examples=['https://example.com/webhook'])] = None - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None + request_url: Annotated[AnyUrl | None, Field(examples=['https://example.com/webhook'])] = None + is_ad_hoc: Annotated[bool | None, Field(examples=[False])] = None @docs_group('Models') @@ -3745,40 +2995,33 @@ class WebhookRepresentation(BaseModel): """ - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] - request_url: Annotated[str, Field(alias='requestUrl', examples=['http://example.com/'])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + event_types: Annotated[list[WebhookEventType], Field(examples=[['ACTOR.RUN.SUCCEEDED']])] + request_url: Annotated[str, Field(examples=['http://example.com/'])] """ The URL to which the webhook sends its payload. """ - payload_template: Annotated[ - str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) - ] = None + payload_template: Annotated[str | None, Field(examples=['{\\n "userId": {{userId}}...'])] = None """ Optional template for the JSON payload sent by the webhook. """ - headers_template: Annotated[ - str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) - ] = None + headers_template: Annotated[str | None, Field(examples=['{\\n "Authorization": "Bearer ..."}'])] = None """ Optional template for the HTTP headers sent by the webhook. """ - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None + should_interpolate_strings: Annotated[bool | None, Field(examples=[False])] = None """ Flag to also interpolate `{{...}}` variables inside string values of the payload and headers templates. """ - idempotency_key: Annotated[str | None, Field(alias='idempotencyKey', examples=['fdSJmdP3nfs7sfk3y'])] = None + idempotency_key: Annotated[str | None, Field(examples=['fdSJmdP3nfs7sfk3y'])] = None """ Key that prevents creating duplicate webhooks, e.g. when the run-starting request is retried. """ - ignore_ssl_errors: Annotated[bool | None, Field(alias='ignoreSslErrors', examples=[False])] = None + ignore_ssl_errors: Annotated[bool | None, Field(examples=[False])] = None """ Flag to ignore SSL errors when the webhook sends the request. """ - do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None + do_not_retry: Annotated[bool | None, Field(examples=[False])] = None """ Flag to skip retrying the webhook request on failure. """ @@ -3788,65 +3031,47 @@ class WebhookRepresentation(BaseModel): class WebhookResponse(BaseModel): """Response containing webhook data.""" - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) data: Webhook @docs_group('Models') class WebhookShort(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) id: Annotated[str, Field(examples=['YiKoxjkaS9gjGTqhF'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None - is_apify_integration: Annotated[bool | None, Field(alias='isApifyIntegration', examples=[False])] = None - is_enabled: Annotated[bool | None, Field(alias='isEnabled', examples=[True])] = None - action_type: Annotated[str | None, Field(alias='actionType', examples=['HTTP_REQUEST'])] = None - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None - event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] + created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])] + user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])] + is_ad_hoc: Annotated[bool | None, Field(examples=[False])] = None + is_apify_integration: Annotated[bool | None, Field(examples=[False])] = None + is_enabled: Annotated[bool | None, Field(examples=[True])] = None + action_type: Annotated[str | None, Field(examples=['HTTP_REQUEST'])] = None + should_interpolate_strings: Annotated[bool | None, Field(examples=[False])] = None + event_types: Annotated[list[WebhookEventType], Field(examples=[['ACTOR.RUN.SUCCEEDED']])] condition: WebhookCondition - ignore_ssl_errors: Annotated[bool, Field(alias='ignoreSslErrors', examples=[False])] - do_not_retry: Annotated[bool, Field(alias='doNotRetry', examples=[False])] - request_url: Annotated[AnyUrl, Field(alias='requestUrl', examples=['http://example.com/'])] - last_dispatch: Annotated[ExampleWebhookDispatch | None, Field(alias='lastDispatch')] = None + ignore_ssl_errors: Annotated[bool, Field(examples=[False])] + do_not_retry: Annotated[bool, Field(examples=[False])] + request_url: Annotated[AnyUrl, Field(examples=['http://example.com/'])] + last_dispatch: ExampleWebhookDispatch | None = None stats: WebhookStats | None = None @docs_group('Models') class WebhookStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - total_dispatches: Annotated[int, Field(alias='totalDispatches', examples=[1])] + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + total_dispatches: Annotated[int, Field(examples=[1])] @docs_group('Models') class WebhookUpdate(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None - event_types: Annotated[ - list[WebhookEventType] | None, Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']]) - ] = None + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + is_ad_hoc: Annotated[bool | None, Field(examples=[False])] = None + event_types: Annotated[list[WebhookEventType] | None, Field(examples=[['ACTOR.RUN.SUCCEEDED']])] = None condition: WebhookCondition | None = None - ignore_ssl_errors: Annotated[bool | None, Field(alias='ignoreSslErrors', examples=[False])] = None - do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None - request_url: Annotated[AnyUrl | None, Field(alias='requestUrl', examples=['http://example.com/'])] = None - payload_template: Annotated[ - str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) - ] = None - headers_template: Annotated[ - str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) - ] = None + ignore_ssl_errors: Annotated[bool | None, Field(examples=[False])] = None + do_not_retry: Annotated[bool | None, Field(examples=[False])] = None + request_url: Annotated[AnyUrl | None, Field(examples=['http://example.com/'])] = None + payload_template: Annotated[str | None, Field(examples=['{\\n "userId": {{userId}}...'])] = None + headers_template: Annotated[str | None, Field(examples=['{\\n "Authorization": "Bearer ..."}'])] = None description: Annotated[str | None, Field(examples=['this is webhook description'])] = None - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None + should_interpolate_strings: Annotated[bool | None, Field(examples=[False])] = None diff --git a/tests/unit/test_postprocess_generated_models.py b/tests/unit/test_postprocess_generated_models.py index 7be2fa08..3d38851f 100644 --- a/tests/unit/test_postprocess_generated_models.py +++ b/tests/unit/test_postprocess_generated_models.py @@ -1,10 +1,12 @@ from __future__ import annotations import textwrap +from typing import Any from scripts.postprocess_generated_models import ( add_camel_case_typeddicts, add_docs_group_decorators, + apply_camel_alias_generator, build_alias_map, convert_enums_to_literals, fix_discriminators, @@ -52,6 +54,103 @@ def test_fix_discriminators_does_not_touch_unrelated() -> None: assert result == content +# -- apply_camel_alias_generator ---------------------------------------------- + + +def _model_source(*fields: str) -> str: + """Build a minimal Pydantic model module with the standard generated `ConfigDict`. + + Annotations are eager (no `from __future__ import annotations`) so the source can be `exec`'d in a bare namespace + and have Pydantic resolve the `Field` metadata directly — the text-based transform itself is import-agnostic. + """ + body = '\n'.join(f' {field}' for field in fields) + return ( + textwrap.dedent("""\ + from typing import Annotated + from pydantic import BaseModel, ConfigDict, Field + + + class Foo(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + """) + + body + + '\n' + ) + + +def test_apply_camel_alias_generator_adds_generator_to_config() -> None: + """Every model `ConfigDict` gains `alias_generator=to_camel` plus the backing import.""" + result = apply_camel_alias_generator(_model_source('url: str')) + assert 'alias_generator=to_camel' in result + assert 'from pydantic.alias_generators import to_camel' in result + + +def test_apply_camel_alias_generator_drops_regular_alias_collapsing_annotated() -> None: + """A regular alias that is the only `Field` content is dropped and `Annotated[T, Field()]` collapses to `T`.""" + result = apply_camel_alias_generator( + _model_source("source_type: Annotated[str | None, Field(alias='sourceType')] = None") + ) + assert "Field(alias='sourceType')" not in result + assert 'source_type: str | None = None' in result + + +def test_apply_camel_alias_generator_keeps_other_field_kwargs() -> None: + """A regular alias is removed but the rest of the `Field` (examples, pattern, ...) is preserved.""" + result = apply_camel_alias_generator( + _model_source("build_tag: Annotated[str | None, Field(alias='buildTag', examples=['x'])] = None") + ) + assert "alias='buildTag'" not in result + assert "build_tag: Annotated[str | None, Field(examples=['x'])] = None" in result + + +def test_apply_camel_alias_generator_keeps_irregular_alias() -> None: + """An alias that `to_camel` cannot reproduce (e.g. `gitHubGistUrl`) is left in place.""" + result = apply_camel_alias_generator( + _model_source("github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None") + ) + assert "Field(alias='gitHubGistUrl')" in result + + +def test_apply_camel_alias_generator_keeps_all_caps_alias() -> None: + """All-caps usage keys (e.g. `ACTOR_COMPUTE_UNITS`) are irregular and keep their explicit alias.""" + result = apply_camel_alias_generator( + _model_source("actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS')] = None") + ) + assert "alias='ACTOR_COMPUTE_UNITS'" in result + + +def test_apply_camel_alias_generator_is_idempotent() -> None: + """Re-running doesn't add a second `alias_generator` or otherwise change the output.""" + once = apply_camel_alias_generator(_model_source("source_type: Annotated[str, Field(alias='sourceType')]")) + twice = apply_camel_alias_generator(once) + assert once == twice + assert once.count('alias_generator=to_camel') == 1 + + +def test_apply_camel_alias_generator_preserves_wire_format() -> None: + """The stripped model resolves the same field aliases at runtime as the per-field version — wire parity.""" + namespace: dict[str, Any] = {} + source = apply_camel_alias_generator( + _model_source( + "source_type: Annotated[str | None, Field(alias='sourceType')] = None", + "github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None", + 'url: str | None = None', + ) + ) + # `dont_inherit=True` keeps this module's `from __future__ import annotations` from stringizing the exec'd + # annotations, so Pydantic resolves the `Field` metadata directly in the bare namespace. + exec(compile(source, '', 'exec', dont_inherit=True), namespace) + foo = namespace['Foo'] + aliases = {name: (field.alias or name) for name, field in foo.model_fields.items()} + assert aliases == {'source_type': 'sourceType', 'github_gist_url': 'gitHubGistUrl', 'url': 'url'} + # Both API and Pythonic spellings still validate. + assert foo.model_validate({'sourceType': 'GIT_REPO'}).source_type == 'GIT_REPO' + assert foo.model_validate({'source_type': 'GIT_REPO'}).source_type == 'GIT_REPO' + + # -- add_docs_group_decorators ------------------------------------------------ @@ -448,6 +547,36 @@ class Foo(BaseModel): assert result['Foo'] == {'url': 'url', 'method': 'method'} +def test_build_alias_map_derives_camel_for_unaliased_generator_fields() -> None: + """On a model with `alias_generator=to_camel`, unaliased fields resolve to their camelCase API spelling.""" + models = textwrap.dedent("""\ + from pydantic import BaseModel, ConfigDict + from pydantic.alias_generators import to_camel + + class Foo(BaseModel): + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + source_type: str | None = None + url: str | None = None + """) + result = build_alias_map(models) + assert result['Foo'] == {'source_type': 'sourceType', 'url': 'url'} + + +def test_build_alias_map_explicit_alias_wins_over_generator() -> None: + """An explicit irregular alias takes priority over the `to_camel` generator, matching Pydantic at runtime.""" + models = textwrap.dedent("""\ + from typing import Annotated + from pydantic import BaseModel, ConfigDict, Field + from pydantic.alias_generators import to_camel + + class Foo(BaseModel): + model_config = ConfigDict(extra='allow', populate_by_name=True, alias_generator=to_camel) + github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None + """) + result = build_alias_map(models) + assert result['Foo'] == {'github_gist_url': 'gitHubGistUrl'} + + def test_build_alias_map_skips_model_config() -> None: """`model_config` is Pydantic plumbing, not a data field — exclude it from the alias map.""" models = textwrap.dedent("""\