diff --git a/src/apify_client/_models.py b/src/apify_client/_models.py index be7a738d..79fbb3ac 100644 --- a/src/apify_client/_models.py +++ b/src/apify_client/_models.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: -# filename: https://docs.apify.com/api/openapi.json -# timestamp: 2026-04-09T08:30:29+00:00 +# filename: openapi.json +# timestamp: 2026-04-13T07:02:33+00:00 from __future__ import annotations @@ -152,8 +152,8 @@ class SourceCodeFile(BaseModel): extra='allow', populate_by_name=True, ) - format: SourceCodeFileFormat - content: Annotated[str, Field(examples=["console.log('This is the main.js file');"])] + 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'])] @@ -229,14 +229,6 @@ class CommonActorPricingInfo(BaseModel): reason_for_change: Annotated[str | None, Field(alias='reasonForChange')] = None -@docs_group('Models') -class PricingModel(StrEnum): - PAY_PER_EVENT = 'PAY_PER_EVENT' - PRICE_PER_DATASET_ITEM = 'PRICE_PER_DATASET_ITEM' - FLAT_PRICE_PER_MONTH = 'FLAT_PRICE_PER_MONTH' - FREE = 'FREE' - - @docs_group('Models') class ActorChargeEvent(BaseModel): model_config = ConfigDict( @@ -678,6 +670,27 @@ class ActorNotFoundError(BaseModel): error: ActorNotFoundErrorDetail | None = None +@docs_group('Models') +class RecordOrTokenNotFoundErrorDetail(ErrorDetail): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + type: Annotated[Literal['record-or-token-not-found'], Field(title='ErrorType')] = 'record-or-token-not-found' + """ + Machine-processable error type identifier. + """ + + +@docs_group('Models') +class RecordOrTokenNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: RecordOrTokenNotFoundErrorDetail | None = None + + @docs_group('Models') class RecordNotFoundErrorDetail(ErrorDetail): model_config = ConfigDict( @@ -1631,7 +1644,7 @@ class CreateTaskRequest(BaseModel): populate_by_name=True, ) act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] - name: Annotated[str, Field(examples=['my-task'])] + name: Annotated[str | None, Field(examples=['my-task'])] = None options: TaskOptions | None = None input: TaskInput | None = None title: str | None = None @@ -1734,27 +1747,6 @@ class ChargeRunRequest(BaseModel): count: Annotated[int, Field(examples=[1])] -@docs_group('Models') -class RecordOrTokenNotFoundErrorDetail(ErrorDetail): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - type: Annotated[Literal['record-or-token-not-found'], Field(title='ErrorType')] = 'record-or-token-not-found' - """ - Machine-processable error type identifier. - """ - - -@docs_group('Models') -class RecordOrTokenNotFoundError(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - error: RecordOrTokenNotFoundErrorDetail | None = None - - @docs_group('Models') class StorageOwnership(StrEnum): OWNED_BY_ME = 'ownedByMe' @@ -2474,7 +2466,7 @@ class RequestBase(BaseModel): """ A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ - url: Annotated[AnyUrl | None, Field(examples=['https://apify.com'])] = None + url: Annotated[str | None, Field(examples=['https://apify.com'])] = None """ The URL of the request. """ @@ -2487,7 +2479,7 @@ class RequestBase(BaseModel): """ The final URL that was loaded, after redirects (if any). """ - payload: Annotated[dict[str, Any] | None, Field(examples=[None])] = None + payload: Annotated[str | dict[str, Any] | None, Field(examples=[None])] = None """ The request payload, typically used with POST or PUT requests. """ @@ -2552,7 +2544,7 @@ class RequestDraft(BaseModel): """ 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[str, Field(examples=['https://apify.com'])] """ The URL of the request. """ @@ -2871,7 +2863,7 @@ class HeadRequest(BaseModel): """ 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[str, Field(examples=['https://apify.com'])] """ The URL of the request. """ @@ -2935,7 +2927,7 @@ class LockedHeadRequest(BaseModel): """ 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[str, Field(examples=['https://apify.com'])] """ The URL of the request. """ @@ -3036,7 +3028,7 @@ class WebhookCreate(BaseModel): 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[AnyUrl, Field(alias='requestUrl', examples=['http://example.com/'])] + request_url: Annotated[str, Field(alias='requestUrl', examples=['http://example.com/'])] payload_template: Annotated[ str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) ] = None diff --git a/src/apify_client/_resource_clients/webhook_collection.py b/src/apify_client/_resource_clients/webhook_collection.py index f8eb1967..d1c579f9 100644 --- a/src/apify_client/_resource_clients/webhook_collection.py +++ b/src/apify_client/_resource_clients/webhook_collection.py @@ -2,8 +2,6 @@ from typing import TYPE_CHECKING, Any -from pydantic import AnyUrl - from apify_client._docs import docs_group from apify_client._models import ( ListOfWebhooks, @@ -105,7 +103,7 @@ def create( """ webhook_create = WebhookCreate( event_types=list(event_types), - request_url=AnyUrl(request_url), + request_url=request_url, payload_template=payload_template, headers_template=headers_template, ignore_ssl_errors=ignore_ssl_errors, @@ -208,7 +206,7 @@ async def create( """ webhook_create = WebhookCreate( event_types=list(event_types), - request_url=AnyUrl(request_url), + request_url=request_url, payload_template=payload_template, headers_template=headers_template, ignore_ssl_errors=ignore_ssl_errors, diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 1368761c..2f4d4cef 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -5,7 +5,6 @@ import impit import pytest -from pydantic import AnyUrl from apify_client._models import WebhookCondition, WebhookCreate, WebhookEventType from apify_client._resource_clients._resource_client import ResourceClientBase @@ -39,12 +38,12 @@ def test_webhook_representation_list_to_base64() -> None: WebhookCreate( event_types=[WebhookEventType.ACTOR_RUN_CREATED], condition=WebhookCondition(), - request_url=AnyUrl('https://example.com/run-created'), + request_url='https://example.com/run-created', ), WebhookCreate( event_types=[WebhookEventType.ACTOR_RUN_SUCCEEDED], condition=WebhookCondition(), - request_url=AnyUrl('https://example.com/run-succeeded'), + request_url='https://example.com/run-succeeded', payload_template='{"hello": "world", "resource":{{resource}}}', ), ] @@ -77,12 +76,12 @@ def test_webhook_representation_list_from_dicts() -> None: WebhookCreate( event_types=[WebhookEventType.ACTOR_RUN_CREATED], condition=WebhookCondition(), - request_url=AnyUrl('https://example.com/run-created'), + request_url='https://example.com/run-created', ), WebhookCreate( event_types=[WebhookEventType.ACTOR_RUN_SUCCEEDED], condition=WebhookCondition(), - request_url=AnyUrl('https://example.com/run-succeeded'), + request_url='https://example.com/run-succeeded', payload_template='{"hello": "world"}', ), ]