diff --git a/src/apify_client/_models.py b/src/apify_client/_models.py index 9adc8ee8..fa0b6378 100644 --- a/src/apify_client/_models.py +++ b/src/apify_client/_models.py @@ -1,13 +1,13 @@ # generated by datamodel-codegen: -# filename: https://docs.apify.com/api/openapi.json -# timestamp: 2026-02-27T09:48:14+00:00 +# filename: openapi.json +# timestamp: 2026-04-08T13:19:25+00:00 from __future__ import annotations from enum import StrEnum from typing import Annotated, Any, Literal -from pydantic import AnyUrl, AwareDatetime, BaseModel, ConfigDict, EmailStr, Field +from pydantic import AnyUrl, AwareDatetime, BaseModel, ConfigDict, EmailStr, Field, RootModel class PaginationResponse(BaseModel): @@ -17,7 +17,7 @@ class PaginationResponse(BaseModel): extra='allow', populate_by_name=True, ) - total: Annotated[int, Field(examples=[2], ge=0)] + total: Annotated[int, Field(examples=[1], ge=0)] """ The total number of items available across all pages. """ @@ -33,7 +33,7 @@ class PaginationResponse(BaseModel): """ Whether the results are sorted in descending order. """ - count: Annotated[int, Field(examples=[2], ge=0)] + count: Annotated[int, Field(examples=[1], ge=0)] """ The number of items returned in this response. """ @@ -91,8 +91,14 @@ class Error(BaseModel): extra='allow', populate_by_name=True, ) - type: Annotated[str, Field(examples=['run-failed'])] - message: Annotated[str, Field(examples=['Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)'])] + type: str | None = None + """ + Machine-processable error type identifier. + """ + message: str | None = None + """ + Human-readable error message describing what went wrong. + """ class ErrorResponse(BaseModel): @@ -100,7 +106,7 @@ class ErrorResponse(BaseModel): extra='allow', populate_by_name=True, ) - error: Error + error: Annotated[Error, Field(title='ErrorDetail')] class VersionSourceType(StrEnum): @@ -116,7 +122,10 @@ class EnvVar(BaseModel): populate_by_name=True, ) name: Annotated[str, Field(examples=['MY_ENV_VAR'])] - value: Annotated[str, Field(examples=['my-value'])] + 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 @@ -161,7 +170,7 @@ class Version(BaseModel): populate_by_name=True, ) version_number: Annotated[str, Field(alias='versionNumber', examples=['0.0'])] - source_type: Annotated[VersionSourceType | None, Field(alias='sourceType')] = None + 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 @@ -331,14 +340,17 @@ class CreateActorRequest(BaseModel): 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', examples=[False])] = None + restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None versions: list[Version] | None = None pricing_infos: Annotated[ list[ - PayPerEventActorPricingInfo - | PricePerDatasetItemActorPricingInfo - | FlatPricePerMonthActorPricingInfo - | FreeActorPricingInfo + Annotated[ + PayPerEventActorPricingInfo + | PricePerDatasetItemActorPricingInfo + | FlatPricePerMonthActorPricingInfo + | FreeActorPricingInfo, + Field(discriminator='pricing_model'), + ] ] | None, Field(alias='pricingInfos'), @@ -383,7 +395,7 @@ class Actor(BaseModel): 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', examples=[False])] = 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'])] @@ -392,10 +404,13 @@ class Actor(BaseModel): versions: list[Version] pricing_infos: Annotated[ list[ - PayPerEventActorPricingInfo - | PricePerDatasetItemActorPricingInfo - | FlatPricePerMonthActorPricingInfo - | FreeActorPricingInfo + Annotated[ + PayPerEventActorPricingInfo + | PricePerDatasetItemActorPricingInfo + | FlatPricePerMonthActorPricingInfo + | FreeActorPricingInfo, + Field(discriminator='pricing_model'), + ] ] | None, Field(alias='pricingInfos'), @@ -423,6 +438,13 @@ class ActorResponse(BaseModel): data: Actor +class EnvVarRequest(EnvVar): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + + class CreateOrUpdateVersionRequest(BaseModel): model_config = ConfigDict( extra='allow', @@ -430,7 +452,7 @@ class CreateOrUpdateVersionRequest(BaseModel): ) version_number: Annotated[str | None, Field(alias='versionNumber', examples=['0.0'])] = None source_type: Annotated[VersionSourceType | None, Field(alias='sourceType')] = None - env_vars: Annotated[list[EnvVar] | None, Field(alias='envVars')] = 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[ @@ -470,14 +492,17 @@ class UpdateActorRequest(BaseModel): 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 title: Annotated[str | None, Field(examples=['My Actor'])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', examples=[False])] = None + restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None versions: list[CreateOrUpdateVersionRequest] | None = None pricing_infos: Annotated[ list[ - PayPerEventActorPricingInfo - | PricePerDatasetItemActorPricingInfo - | FlatPricePerMonthActorPricingInfo - | FreeActorPricingInfo + Annotated[ + PayPerEventActorPricingInfo + | PricePerDatasetItemActorPricingInfo + | FlatPricePerMonthActorPricingInfo + | FreeActorPricingInfo, + Field(discriminator='pricing_model'), + ] ] | None, Field(alias='pricingInfos'), @@ -559,6 +584,46 @@ class VersionResponse(BaseModel): data: Version +class ErrorType(StrEnum): + """Machine-processable error type identifier.""" + + ACTOR_NOT_FOUND = 'actor-not-found' + RECORD_NOT_FOUND = 'record-not-found' + RECORD_OR_TOKEN_NOT_FOUND = 'record-or-token-not-found' + REQUEST_ID_INVALID = 'request-id-invalid' + RUN_FAILED = 'run-failed' + RUN_TIMEOUT_EXCEEDED = 'run-timeout-exceeded' + UNKNOWN_BUILD_TAG = 'unknown-build-tag' + + +class ErrorDetail(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + type: ErrorType | None = None + message: str | None = None + """ + Human-readable error message describing what went wrong. + """ + + +class ActorNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + +class ActorVersionNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class ListOfEnvVars(BaseModel): model_config = ConfigDict( extra='allow', @@ -584,6 +649,14 @@ class EnvVarResponse(BaseModel): data: EnvVar +class EnvironmentVariableNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class WebhookEventType(StrEnum): """Type of event that triggers the webhook.""" @@ -788,7 +861,7 @@ class Storages(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)""" + """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', @@ -872,10 +945,10 @@ class Build(BaseModel): usage: BuildUsage | None = None usage_total_usd: Annotated[float | None, Field(alias='usageTotalUsd', examples=[0.02])] = None usage_usd: Annotated[BuildUsage | None, Field(alias='usageUsd')] = None - input_schema: Annotated[str | None, Field(alias='inputSchema', examples=['{\\n "title": "Schema for ... }'])] = ( - None - ) - readme: Annotated[str | None, Field(examples=['# Magic Actor\\nThis Actor is magic.'])] = None + input_schema: Annotated[ + str | None, Field(alias='inputSchema', 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'])] actor_definition: Annotated[ActorDefinition | None, Field(alias='actorDefinition')] = None @@ -890,6 +963,22 @@ class BuildResponse(BaseModel): data: Build +class UnknownBuildTagError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + +class ActorBuildNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class RunMeta(BaseModel): model_config = ConfigDict( extra='allow', @@ -1075,6 +1164,66 @@ class Metamorph(BaseModel): """ +class Datasets(BaseModel): + """Aliased dataset IDs for this run.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + default: Annotated[str | None, Field(examples=['wmKPijuyDnPZAPRMk'])] = None + """ + ID of the default dataset for this run. + """ + + +class KeyValueStores(BaseModel): + """Aliased key-value store IDs for this run.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + default: Annotated[str | None, Field(examples=['eJNzqsbPiopwJcgGQ'])] = None + """ + ID of the default key-value store for this run. + """ + + +class RequestQueues(BaseModel): + """Aliased request queue IDs for this run.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + default: Annotated[str | None, Field(examples=['FL35cSF7jrxr3BY39'])] = None + """ + ID of the default request queue for this run. + """ + + +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, + ) + datasets: Datasets | None = None + """ + Aliased dataset IDs for this run. + """ + key_value_stores: Annotated[KeyValueStores | None, Field(alias='keyValueStores')] = None + """ + Aliased key-value store IDs for this run. + """ + request_queues: Annotated[RequestQueues | None, Field(alias='requestQueues')] = None + """ + Aliased request queue IDs for this run. + """ + + class Run(BaseModel): """Represents an Actor run and its associated data.""" @@ -1174,6 +1323,10 @@ class Run(BaseModel): """ ID of the default request queue for this run. """ + storage_ids: Annotated[StorageIds | None, Field(alias='storageIds')] = 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'])] = None """ Build number of the Actor build used for this run. @@ -1218,6 +1371,30 @@ class RunResponse(BaseModel): data: Run +class ActorRunFailedError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + +class ActorRunTimeoutExceededError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + +class ActorRunNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class TaskStats(BaseModel): model_config = ConfigDict( extra='allow', @@ -1266,9 +1443,10 @@ class TaskOptions(BaseModel): ) 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=[128])] = 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 - max_items: Annotated[int | None, Field(alias='maxItems')] = None class TaskInput(BaseModel): @@ -1386,6 +1564,14 @@ class ChargeRunRequest(BaseModel): count: Annotated[int, Field(examples=[1])] +class RecordOrTokenNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class StorageOwnership(StrEnum): OWNED_BY_ME = 'ownedByMe' SHARED_WITH_ME = 'sharedWithMe' @@ -1465,6 +1651,14 @@ class KeyValueStoreResponse(BaseModel): data: KeyValueStore +class KeyValueStoreNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class UpdateStoreRequest(BaseModel): model_config = ConfigDict( extra='allow', @@ -1526,6 +1720,14 @@ class RecordResponse(BaseModel): ) +class RecordNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class PutRecordRequest(BaseModel): """The request body contains the value to store in the record. The content type should be specified in the Content-Type header. @@ -1551,8 +1753,8 @@ class DatasetListItem(BaseModel): 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')] = None - act_run_id: Annotated[str | None, Field(alias='actRunId')] = None + act_id: Annotated[str | None, Field(alias='actId', examples=['zdc3Pyhyz3m8vjDeM'])] = None + act_run_id: Annotated[str | None, Field(alias='actRunId', examples=['HG7ML7M8z78YcAPEB'])] = None class ListOfDatasets(PaginationResponse): @@ -1653,6 +1855,14 @@ class DatasetResponse(BaseModel): data: Dataset +class DatasetNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class UpdateDatasetRequest(BaseModel): model_config = ConfigDict( extra='allow', @@ -1822,7 +2032,7 @@ class RequestQueueShort(BaseModel): """ modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] """ - The timestamp when the request queue was last modified. + 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'])] """ @@ -1832,15 +2042,15 @@ class RequestQueueShort(BaseModel): """ The timestamp when the request queue will expire and be deleted. """ - total_request_count: Annotated[int, Field(alias='totalRequestCount', examples=[100])] + total_request_count: Annotated[int, Field(alias='totalRequestCount', examples=[870], ge=0)] """ The total number of requests in the request queue. """ - handled_request_count: Annotated[int, Field(alias='handledRequestCount', examples=[50])] + handled_request_count: Annotated[int, Field(alias='handledRequestCount', examples=[100], ge=0)] """ The number of requests that have been handled. """ - pending_request_count: Annotated[int, Field(alias='pendingRequestCount', examples=[50])] + pending_request_count: Annotated[int, Field(alias='pendingRequestCount', examples=[670], ge=0)] """ The number of requests that are pending and have not been handled yet. """ @@ -1933,7 +2143,7 @@ class RequestQueue(BaseModel): """ The timestamp when the request queue was created. """ - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2030-12-13T08:36:13.202Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', 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. """ @@ -1977,6 +2187,14 @@ class RequestQueueResponse(BaseModel): data: RequestQueue +class RequestQueueNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class UpdateRequestQueueRequest(BaseModel): """Request object for updating a request queue.""" @@ -1991,28 +2209,79 @@ class UpdateRequestQueueRequest(BaseModel): general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None -class RequestDraft(BaseModel): - """A request that failed to be processed during a request queue operation and can be retried.""" +class HttpMethod(StrEnum): + GET = 'GET' + HEAD = 'HEAD' + POST = 'POST' + PUT = 'PUT' + DELETE = 'DELETE' + CONNECT = 'CONNECT' + OPTIONS = 'OPTIONS' + TRACE = 'TRACE' + PATCH = 'PATCH' + + +class RequestUserData(BaseModel): + """Custom user data attached to the request. Can contain arbitrary fields.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None + label: Annotated[str | None, Field(examples=['DETAIL'])] = None """ - A unique identifier assigned to the request. + Optional label for categorizing the request. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + image: Annotated[AnyUrl | None, Field(examples=['https://picserver1.eu'])] = None + """ + Optional image URL associated with the request. + """ + + +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 """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ - url: Annotated[AnyUrl, Field(examples=['https://apify.com'])] + url: Annotated[AnyUrl | None, Field(examples=['https://apify.com'])] = None """ The URL of the request. """ - method: Annotated[str, Field(examples=['GET'])] + method: HttpMethod | None = None + retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None + """ + The number of times this request has been retried. + """ + loaded_url: Annotated[AnyUrl | None, Field(alias='loadedUrl', examples=['https://apify.com/jobs'])] = None + """ + The final URL that was loaded, after redirects (if any). + """ + payload: Annotated[dict[str, Any] | None, Field(examples=[None])] = None """ - The HTTP method of the request. + The request payload, typically used with POST or PUT requests. + """ + headers: Annotated[dict[str, Any] | None, Field(examples=[None])] = None + """ + 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 + """ + 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 recorded from failed processing attempts. + """ + handled_at: Annotated[AwareDatetime | None, Field(alias='handledAt', examples=['2019-06-16T10:23:31.607Z'])] = None + """ + The timestamp when the request was marked as handled, if applicable. """ @@ -2041,6 +2310,28 @@ class AddedRequest(BaseModel): """ +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, + ) + 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'])] + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + url: Annotated[AnyUrl, Field(examples=['https://apify.com'])] + """ + The URL of the request. + """ + method: HttpMethod | None = None + + class BatchAddResult(BaseModel): """Result of a batch add operation containing successfully processed and failed requests.""" @@ -2068,8 +2359,70 @@ class BatchAddResponse(BaseModel): data: BatchAddResult -class DeletedRequest(BaseModel): - """Confirmation of a request that was successfully deleted from a request queue.""" +class RequestDraftDeleteById(BaseModel): + """A request that should be deleted, identified by its ID.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + 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 + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + + +class RequestDraftDeleteByUniqueKey(BaseModel): + """A request that should be deleted, identified by its unique key.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + 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'])] + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + + +class RequestDraftDelete(RootModel[RequestDraftDeleteById | RequestDraftDeleteByUniqueKey]): + root: Annotated[RequestDraftDeleteById | RequestDraftDeleteByUniqueKey, Field(title='RequestDraftDelete')] + """ + A request that should be deleted. + """ + + +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 + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] + """ + A unique identifier assigned to the request. + """ + + +class DeletedRequestByUniqueKey(BaseModel): + """Confirmation of a request that was successfully deleted, identified by its unique key.""" model_config = ConfigDict( extra='allow', @@ -2092,7 +2445,9 @@ class BatchDeleteResult(BaseModel): extra='allow', populate_by_name=True, ) - processed_requests: Annotated[list[DeletedRequest], Field(alias='processedRequests')] + processed_requests: Annotated[ + list[DeletedRequestById | DeletedRequestByUniqueKey], Field(alias='processedRequests') + ] """ Requests that were successfully deleted from the request queue. """ @@ -2135,75 +2490,17 @@ class UnlockRequestsResponse(BaseModel): data: UnlockRequestsResult -class RequestUserData(BaseModel): - """Custom user data attached to the request. Can contain arbitrary fields.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - label: Annotated[str | None, Field(examples=['DETAIL'])] = None - """ - Optional label for categorizing the request. - """ - image: Annotated[AnyUrl | None, Field(examples=['https://picserver1.eu'])] = None - """ - Optional image URL associated with the request. - """ - - -class Request(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, ) - id: Annotated[str, Field(examples=['dnjkDMKLmdlkmlkmld'])] + 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/career'])] - """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. - """ - url: Annotated[AnyUrl, Field(examples=['https://apify.com/career'])] - """ - The URL of the request. - """ - method: Annotated[str | None, Field(examples=['GET'])] = None - """ - The HTTP method of the request. - """ - retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None - """ - The number of times this request has been retried. - """ - loaded_url: Annotated[AnyUrl | None, Field(alias='loadedUrl', examples=['https://apify.com/jobs'])] = None - """ - The final URL that was loaded, after redirects (if any). - """ - payload: dict[str, Any] | None = None - """ - The request payload, typically used with POST or PUT requests. - """ - headers: dict[str, Any] | None = None - """ - 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 - """ - Indicates whether the request should not be retried if processing fails. - """ - error_messages: Annotated[list[str] | None, Field(alias='errorMessages')] = None - """ - Error messages recorded from failed processing attempts. - """ - handled_at: Annotated[AwareDatetime | None, Field(alias='handledAt', examples=['2019-06-16T10:23:31.607Z'])] = None - """ - The timestamp when the request was marked as handled, if applicable. - """ class ListOfRequests(BaseModel): @@ -2225,10 +2522,22 @@ class ListOfRequests(BaseModel): """ The maximum number of requests returned in this response. """ - exclusive_start_id: Annotated[str | None, Field(alias='exclusiveStartId', examples=['Ihnsp8YrvJ8102Kj'])] = None + exclusive_start_id: Annotated[ + str | None, Field(alias='exclusiveStartId', deprecated=True, examples=['Ihnsp8YrvJ8102Kj']) + ] = None """ The ID of the last request from the previous page, used for pagination. """ + cursor: Annotated[str | None, Field(examples=['eyJyZXF1ZXN0SWQiOiI0SVlLUWFXZ2FKUUlWNlMifQ'])] = None + """ + A cursor string used for current page of results. + """ + next_cursor: Annotated[ + str | None, Field(alias='nextCursor', examples=['eyJyZXF1ZXN0SWQiOiI5eFNNc1BrN1J6VUxTNXoifQ']) + ] = None + """ + A cursor string to be used to continue pagination. + """ class ListOfRequestsResponse(BaseModel): @@ -2248,7 +2557,7 @@ class RequestRegistration(BaseModel): extra='allow', populate_by_name=True, ) - request_id: Annotated[str, Field(alias='requestId', examples=['YiKoxjkaS9gjGTqhF'])] + request_id: Annotated[str, Field(alias='requestId', examples=['sbJ7klsdf7ujN9l'])] """ A unique identifier assigned to the request. """ @@ -2282,6 +2591,14 @@ class RequestResponse(BaseModel): data: Request +class RequestNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail | None = None + + class UpdateRequestResponse(BaseModel): """Response containing the result of updating a request in the request queue.""" @@ -2299,7 +2616,7 @@ class HeadRequest(BaseModel): extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['8OamqXBCpPHxyH9'])] + id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] """ A unique identifier assigned to the request. """ @@ -2311,10 +2628,7 @@ class HeadRequest(BaseModel): """ The URL of the request. """ - method: Annotated[str | None, Field(examples=['GET'])] = None - """ - The HTTP method of the request. - """ + method: HttpMethod | None = None retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None """ The number of times this request has been retried. @@ -2332,11 +2646,11 @@ class RequestQueueHead(BaseModel): """ The maximum number of requests returned. """ - queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2018-03-14T23:00:00.000Z'])] + queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2019-12-13T08:36:13.202Z'])] """ - The timestamp when the request queue was last modified. + 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=[False])] + had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] """ Whether the request queue has been accessed by multiple different clients. """ @@ -2363,7 +2677,7 @@ class LockedHeadRequest(BaseModel): extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['8OamqXBCpPHxyH9'])] + id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] """ A unique identifier assigned to the request. """ @@ -2375,10 +2689,7 @@ class LockedHeadRequest(BaseModel): """ The URL of the request. """ - method: Annotated[str | None, Field(examples=['GET'])] = None - """ - The HTTP method of the request. - """ + method: HttpMethod | None = None retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None """ The number of times this request has been retried. @@ -2400,9 +2711,9 @@ class LockedRequestQueueHead(BaseModel): """ The maximum number of requests returned. """ - queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2018-03-14T23:00:00.000Z'])] + queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', 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. + 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 """ @@ -2443,9 +2754,9 @@ class RequestLockInfo(BaseModel): extra='allow', populate_by_name=True, ) - lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-01-01T00:00:00.000Z'])] + lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-06-14T23:00:00.000Z'])] """ - The timestamp when the lock expires. + The timestamp when the lock on this request expires. """ @@ -2584,40 +2895,50 @@ class WebhookDispatchResponse(BaseModel): data: WebhookDispatch -class ScheduleActionType(StrEnum): - """Type of action to perform when the schedule triggers.""" - - RUN_ACTOR = 'RUN_ACTOR' - RUN_ACTOR_TASK = 'RUN_ACTOR_TASK' +class ScheduleBase(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + name: Annotated[str, Field(examples=['my-schedule'])] + cron_expression: Annotated[str, Field(alias='cronExpression', 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 -class ScheduleAction(BaseModel): +class ScheduleActionShortRunActor(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) id: Annotated[str, Field(examples=['ZReCs7hkdieq8ZUki'])] - type: ScheduleActionType + type: Literal['RUN_ACTOR'] actor_id: Annotated[str, Field(alias='actorId', examples=['HKhKmiCMrDgu9eXeE'])] -class ScheduleShort(BaseModel): +class ScheduleActionShortRunActorTask(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - name: Annotated[str, Field(examples=['my-schedule'])] - 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'])] - last_run_at: Annotated[AwareDatetime | None, Field(alias='lastRunAt', examples=['2019-04-12T07:33:10.202Z'])] = None - next_run_at: Annotated[AwareDatetime | None, Field(alias='nextRunAt', examples=['2019-04-12T07:34:10.202Z'])] = None - is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] - is_exclusive: Annotated[bool, Field(alias='isExclusive', examples=[True])] - cron_expression: Annotated[str, Field(alias='cronExpression', examples=['* * * * *'])] - timezone: Annotated[str, Field(examples=['UTC'])] - actions: list[ScheduleAction] + id: Annotated[str, Field(examples=['ZReCs7hkdieq8ZUki'])] + type: Literal['RUN_ACTOR_TASK'] + actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['HKhKmiCMrDgu9eXeE'])] + + +class ScheduleShort(ScheduleBase): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + actions: list[Annotated[ScheduleActionShortRunActor | ScheduleActionShortRunActorTask, Field(discriminator='type')]] class ListOfSchedules(PaginationResponse): @@ -2636,7 +2957,7 @@ class ListOfSchedulesResponse(BaseModel): data: ListOfSchedules -class ScheduleActionsRunInput(BaseModel): +class ScheduleActionRunInput(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, @@ -2645,26 +2966,25 @@ class ScheduleActionsRunInput(BaseModel): content_type: Annotated[str | None, Field(alias='contentType', examples=['application/json; charset=utf-8'])] = None -class ScheduleActionsRunOptions(BaseModel): +class ScheduleCreateActionRunActor(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - build: Annotated[str | None, Field(examples=['latest'])] = None - timeout_secs: Annotated[int | None, Field(alias='timeoutSecs', examples=[60])] = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[1024])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', examples=[False])] = None + 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 -class ScheduleCreateActions(BaseModel): +class ScheduleCreateActionRunActorTask(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - type: ScheduleActionType - actor_id: Annotated[str, Field(alias='actorId', examples=['jF8GGEvbEg4Au3NLA'])] - run_input: Annotated[ScheduleActionsRunInput | None, Field(alias='runInput')] = None - run_options: Annotated[ScheduleActionsRunOptions | None, Field(alias='runOptions')] = None + type: Literal['RUN_ACTOR_TASK'] + actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['jF8GGEvbEg4Au3NLA'])] + input: dict[str, Any] | None = None class ScheduleCreate(BaseModel): @@ -2679,40 +2999,43 @@ class ScheduleCreate(BaseModel): timezone: Annotated[str | None, Field(examples=['UTC'])] = None description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None title: str | None = None - actions: list[ScheduleCreateActions] | None = None + actions: ( + list[Annotated[ScheduleCreateActionRunActor | ScheduleCreateActionRunActorTask, Field(discriminator='type')]] + | None + ) = None -class ScheduleActions(BaseModel): +class ScheduleActionRunActor(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) id: Annotated[str, Field(examples=['c6KfSgoQzFhMk3etc'])] - type: ScheduleActionType + type: Literal['RUN_ACTOR'] actor_id: Annotated[str, Field(alias='actorId', examples=['jF8GGEvbEg4Au3NLA'])] - run_input: Annotated[ScheduleActionsRunInput | None, Field(alias='runInput')] = None - run_options: Annotated[ScheduleActionsRunOptions | None, Field(alias='runOptions')] = None + run_input: Annotated[ScheduleActionRunInput | None, Field(alias='runInput')] = None + run_options: Annotated[TaskOptions | None, Field(alias='runOptions')] = None -class Schedule(BaseModel): +class ScheduleActionRunActorTask(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + id: Annotated[str, Field(examples=['c6KfSgoQzFhMk3etc'])] + type: Literal['RUN_ACTOR_TASK'] + actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['jF8GGEvbEg4Au3NLA'])] + input: dict[str, Any] | None = None + + +class Schedule(ScheduleBase): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - name: Annotated[str, Field(examples=['my-schedule'])] - cron_expression: Annotated[str, Field(alias='cronExpression', 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])] description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = 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-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 title: str | None = None - actions: list[ScheduleActions] + actions: list[Annotated[ScheduleActionRunActor | ScheduleActionRunActorTask, Field(discriminator='type')]] class ScheduleResponse(BaseModel): @@ -2814,7 +3137,7 @@ class UserPublicInfo(BaseModel): populate_by_name=True, ) username: Annotated[str, Field(examples=['d7b9MDYsbtX5L7XAj'])] - profile: Profile + profile: Profile | None = None class PublicUserDataResponse(BaseModel): @@ -2854,12 +3177,11 @@ class Plan(BaseModel): 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, Field(alias='usageDiscountPercent', examples=[0])] + usage_discount_percent: Annotated[float | None, Field(alias='usageDiscountPercent', examples=[0])] = None enabled_platform_features: Annotated[ - list[list[Any]], + list[str], Field( - alias='enabledPlatformFeatures', - examples=[[['ACTORS'], ['STORAGE'], ['PROXY_SERPS'], ['SCHEDULER'], ['WEBHOOKS']]], + alias='enabledPlatformFeatures', examples=[['ACTORS', 'STORAGE', 'PROXY_SERPS', 'SCHEDULER', 'WEBHOOKS']] ), ] max_monthly_usage_usd: Annotated[float, Field(alias='maxMonthlyUsageUsd', examples=[9999])] @@ -2898,12 +3220,12 @@ class EffectivePlatformFeature(BaseModel): 'The "Selected public Actors for developers" feature is not enabled for your account. Please upgrade your plan or contact support@apify.com' ], ), - ] = None - disabled_reason_type: Annotated[str | None, Field(alias='disabledReasonType', examples=['DISABLED'])] = None + ] + 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']) - ] = None + ] class EffectivePlatformFeatures(BaseModel): @@ -3090,3 +3412,82 @@ class UpdateLimitsRequest(BaseModel): 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). """ + + +class BrowserInfoResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + method: Annotated[str, Field(examples=['GET'])] + """ + HTTP method of the request. + """ + client_ip: Annotated[str | None, Field(alias='clientIp', examples=['1.2.3.4'])] + """ + IP address of the client. + """ + country_code: Annotated[str | None, Field(alias='countryCode', examples=['US'])] + """ + Two-letter country code resolved from the client IP address. + """ + body_length: Annotated[int, Field(alias='bodyLength', examples=[0])] + """ + Length of the request body in bytes. + """ + headers: dict[str, str | list[str]] | None = None + """ + Request headers. Omitted when `skipHeaders=true`. + + """ + raw_headers: Annotated[list[str] | None, Field(alias='rawHeaders')] = None + """ + Raw request headers as a flat list of alternating name/value strings. + Included only when `rawHeaders=true`. + + """ + + +class EncodeAndSignData(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + encoded: Annotated[str, Field(examples=['eyJwYXlsb2FkIjoiLi4uIiwic2lnbmF0dXJlIjoiLi4uIn0='])] + + +class EncodeAndSignResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: EncodeAndSignData + + +class DecodeAndVerifyRequest(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + encoded: Annotated[str, Field(examples=['eyJwYXlsb2FkIjoiLi4uIiwic2lnbmF0dXJlIjoiLi4uIn0='])] + + +class DecodeAndVerifyData(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + 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])] + + +class DecodeAndVerifyResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: DecodeAndVerifyData diff --git a/src/apify_client/_resource_clients/actor_version.py b/src/apify_client/_resource_clients/actor_version.py index e878293d..ba34454d 100644 --- a/src/apify_client/_resource_clients/actor_version.py +++ b/src/apify_client/_resource_clients/actor_version.py @@ -7,7 +7,7 @@ from apify_client._docs import docs_group from apify_client._models import ( CreateOrUpdateVersionRequest, - EnvVar, + EnvVarRequest, SourceCodeFile, SourceCodeFolder, Version, @@ -104,7 +104,7 @@ def update( """ version_fields = CreateOrUpdateVersionRequest( build_tag=build_tag, - env_vars=[EnvVar.model_validate(v) for v in env_vars] if env_vars else None, + env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None, apply_env_vars_to_build=apply_env_vars_to_build, source_type=source_type, source_files=_source_file_list_adapter.validate_python(source_files) if source_files else None, @@ -220,7 +220,7 @@ async def update( """ version_fields = CreateOrUpdateVersionRequest( build_tag=build_tag, - env_vars=[EnvVar.model_validate(v) for v in env_vars] if env_vars else None, + env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None, apply_env_vars_to_build=apply_env_vars_to_build, source_type=source_type, source_files=_source_file_list_adapter.validate_python(source_files) if source_files else None, diff --git a/src/apify_client/_resource_clients/actor_version_collection.py b/src/apify_client/_resource_clients/actor_version_collection.py index 297b6541..a6239f26 100644 --- a/src/apify_client/_resource_clients/actor_version_collection.py +++ b/src/apify_client/_resource_clients/actor_version_collection.py @@ -7,7 +7,7 @@ from apify_client._docs import docs_group from apify_client._models import ( CreateOrUpdateVersionRequest, - EnvVar, + EnvVarRequest, ListOfVersions, ListOfVersionsResponse, SourceCodeFile, @@ -100,7 +100,7 @@ def create( version_fields = CreateOrUpdateVersionRequest( version_number=version_number, build_tag=build_tag, - env_vars=[EnvVar.model_validate(v) for v in env_vars] if env_vars else None, + env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None, apply_env_vars_to_build=apply_env_vars_to_build, source_type=source_type, source_files=_source_file_list_adapter.validate_python(source_files) if source_files else None, @@ -187,7 +187,7 @@ async def create( version_fields = CreateOrUpdateVersionRequest( version_number=version_number, build_tag=build_tag, - env_vars=[EnvVar.model_validate(v) for v in env_vars] if env_vars else None, + env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None, apply_env_vars_to_build=apply_env_vars_to_build, source_type=source_type, source_files=_source_file_list_adapter.validate_python(source_files) if source_files else None, diff --git a/src/apify_client/_resource_clients/schedule.py b/src/apify_client/_resource_clients/schedule.py index 27aa6bed..b0e2e87c 100644 --- a/src/apify_client/_resource_clients/schedule.py +++ b/src/apify_client/_resource_clients/schedule.py @@ -6,7 +6,6 @@ from apify_client._models import ( Schedule, ScheduleCreate, - ScheduleCreateActions, ScheduleInvoked, ScheduleLogResponse, ScheduleResponse, @@ -94,7 +93,7 @@ def update( is_enabled=is_enabled, is_exclusive=is_exclusive, name=name, - actions=[ScheduleCreateActions.model_validate(a) for a in actions] if actions else None, + actions=actions or None, # ty: ignore[invalid-argument-type] description=description, timezone=timezone, title=title, @@ -213,7 +212,7 @@ async def update( is_enabled=is_enabled, is_exclusive=is_exclusive, name=name, - actions=[ScheduleCreateActions.model_validate(a) for a in actions] if actions else None, + actions=actions or None, # ty: ignore[invalid-argument-type] description=description, timezone=timezone, title=title, diff --git a/src/apify_client/_resource_clients/schedule_collection.py b/src/apify_client/_resource_clients/schedule_collection.py index 01273358..94725724 100644 --- a/src/apify_client/_resource_clients/schedule_collection.py +++ b/src/apify_client/_resource_clients/schedule_collection.py @@ -8,7 +8,6 @@ ListOfSchedulesResponse, Schedule, ScheduleCreate, - ScheduleCreateActions, ScheduleResponse, ) from apify_client._resource_clients._resource_client import ResourceClient, ResourceClientAsync @@ -101,7 +100,7 @@ def create( is_enabled=is_enabled, is_exclusive=is_exclusive, name=name, - actions=[ScheduleCreateActions.model_validate(a) for a in actions] if actions else None, + actions=actions or None, description=description, timezone=timezone, title=title, @@ -194,7 +193,7 @@ async def create( is_enabled=is_enabled, is_exclusive=is_exclusive, name=name, - actions=[ScheduleCreateActions.model_validate(a) for a in actions] if actions else None, + actions=actions or None, description=description, timezone=timezone, title=title,