From 922bc6bc8e6983c820328f2c3b7645a2fb304199 Mon Sep 17 00:00:00 2001 From: apify-service-account Date: Fri, 10 Apr 2026 08:30:53 +0000 Subject: [PATCH 1/2] [TODO]: update generated models from apify-docs PR #2416 --- src/apify_client/_models.py | 406 ++++++++++++++++++------------------ 1 file changed, 203 insertions(+), 203 deletions(-) diff --git a/src/apify_client/_models.py b/src/apify_client/_models.py index be7a738d..0a093ec0 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-10T08:30:51+00:00 from __future__ import annotations @@ -1735,30 +1735,88 @@ class ChargeRunRequest(BaseModel): @docs_group('Models') -class RecordOrTokenNotFoundErrorDetail(ErrorDetail): +class DatasetStats(BaseModel): 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. - """ + read_count: Annotated[int, Field(alias='readCount', examples=[22])] + write_count: Annotated[int, Field(alias='writeCount', examples=[3])] + storage_bytes: Annotated[int, Field(alias='storageBytes', examples=[783])] @docs_group('Models') -class RecordOrTokenNotFoundError(BaseModel): +class Dataset(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - error: RecordOrTokenNotFoundErrorDetail | None = None + 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 + fields: list[str] | None = None + schema_: Annotated[ + dict[str, Any] | None, + Field( + alias='schema', + examples=[ + { + 'actorSpecification': 1, + 'title': 'My dataset', + 'views': { + 'overview': { + 'title': 'Overview', + 'transformation': {'fields': ['linkUrl']}, + 'display': { + 'component': 'table', + 'properties': {'linkUrl': {'label': 'Link URL', 'format': 'link'}}, + }, + } + }, + } + ], + ), + ] = None + """ + 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']) + ] + items_public_url: Annotated[ + AnyUrl | None, + Field( + alias='itemsPublicUrl', + 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 + """ + 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 + stats: DatasetStats | None = None @docs_group('Models') -class StorageOwnership(StrEnum): - OWNED_BY_ME = 'ownedByMe' - SHARED_WITH_ME = 'sharedWithMe' +class DatasetResponse(BaseModel): + """Response containing dataset metadata.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: Dataset @docs_group('Models') @@ -1812,32 +1870,158 @@ class KeyValueStore(BaseModel): @docs_group('Models') -class ListOfKeyValueStores(PaginationResponse): +class KeyValueStoreResponse(BaseModel): + """Response containing key-value store data.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[KeyValueStore] + data: KeyValueStore @docs_group('Models') -class ListOfKeyValueStoresResponse(BaseModel): +class RequestQueueStats(BaseModel): + """Statistics about request queue operations and storage.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfKeyValueStores + delete_count: Annotated[int | None, Field(alias='deleteCount', 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 + """ + The number of times requests from the head were read. + """ + read_count: Annotated[int | None, Field(alias='readCount', 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 + """ + The total storage size in bytes used by the request queue. + """ + write_count: Annotated[int | None, Field(alias='writeCount', examples=[10])] = None + """ + The total number of write operations performed on the request queue. + """ @docs_group('Models') -class KeyValueStoreResponse(BaseModel): - """Response containing key-value store data.""" +class RequestQueue(BaseModel): + """A request queue object containing metadata and statistics.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: KeyValueStore + id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] + """ + A unique identifier assigned to the request queue. + """ + name: Annotated[str | None, Field(examples=['some-name'])] = None + """ + The name of the request queue. + """ + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + """ + The ID of the user who owns the request queue. + """ + created_at: Annotated[AwareDatetime, Field(alias='createdAt', 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'])] + """ + 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'])] + """ + The timestamp when the request queue was last accessed. + """ + 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=[100], ge=0)] + """ + The number of requests that have been handled. + """ + 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. + """ + had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', 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']) + ] + """ + The URL to view the request queue in the Apify console. + """ + stats: RequestQueueStats | None = None + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + + +@docs_group('Models') +class RequestQueueResponse(BaseModel): + """Response containing request queue data.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: RequestQueue + + +@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' + SHARED_WITH_ME = 'sharedWithMe' + + +@docs_group('Models') +class ListOfKeyValueStores(PaginationResponse): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + items: list[KeyValueStore] + + +@docs_group('Models') +class ListOfKeyValueStoresResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: ListOfKeyValueStores @docs_group('Models') @@ -1973,91 +2157,6 @@ class ListOfDatasetsResponse(BaseModel): data: ListOfDatasets -@docs_group('Models') -class DatasetStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - read_count: Annotated[int, Field(alias='readCount', examples=[22])] - write_count: Annotated[int, Field(alias='writeCount', examples=[3])] - storage_bytes: Annotated[int, Field(alias='storageBytes', examples=[783])] - - -@docs_group('Models') -class Dataset(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - 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 - fields: list[str] | None = None - schema_: Annotated[ - dict[str, Any] | None, - Field( - alias='schema', - examples=[ - { - 'actorSpecification': 1, - 'title': 'My dataset', - 'views': { - 'overview': { - 'title': 'Overview', - 'transformation': {'fields': ['linkUrl']}, - 'display': { - 'component': 'table', - 'properties': {'linkUrl': {'label': 'Link URL', 'format': 'link'}}, - }, - } - }, - } - ], - ), - ] = None - """ - 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']) - ] - items_public_url: Annotated[ - AnyUrl | None, - Field( - alias='itemsPublicUrl', - 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 - """ - 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 - stats: DatasetStats | None = None - - -@docs_group('Models') -class DatasetResponse(BaseModel): - """Response containing dataset metadata.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: Dataset - - @docs_group('Models') class DatasetNotFoundError(BaseModel): model_config = ConfigDict( @@ -2308,105 +2407,6 @@ class ListOfRequestQueuesResponse(BaseModel): data: ListOfRequestQueues -@docs_group('Models') -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 - """ - The number of delete operations performed on the request queue. - """ - head_item_read_count: Annotated[int | None, Field(alias='headItemReadCount', examples=[5])] = None - """ - The number of times requests from the head were read. - """ - read_count: Annotated[int | None, Field(alias='readCount', 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 - """ - The total storage size in bytes used by the request queue. - """ - write_count: Annotated[int | None, Field(alias='writeCount', examples=[10])] = None - """ - The total number of write operations performed on the request queue. - """ - - -@docs_group('Models') -class RequestQueue(BaseModel): - """A request queue object containing metadata and statistics.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] - """ - A unique identifier assigned to the request queue. - """ - name: Annotated[str | None, Field(examples=['some-name'])] = None - """ - The name of the request queue. - """ - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - """ - The ID of the user who owns the request queue. - """ - created_at: Annotated[AwareDatetime, Field(alias='createdAt', 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'])] - """ - 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'])] - """ - The timestamp when the request queue was last accessed. - """ - 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=[100], ge=0)] - """ - The number of requests that have been handled. - """ - 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. - """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', 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']) - ] - """ - The URL to view the request queue in the Apify console. - """ - stats: RequestQueueStats | None = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None - - -@docs_group('Models') -class RequestQueueResponse(BaseModel): - """Response containing request queue data.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: RequestQueue - - @docs_group('Models') class RequestQueueNotFoundError(BaseModel): model_config = ConfigDict( From 21a913109da9ede041b5b9f3bef0cc361c283b29 Mon Sep 17 00:00:00 2001 From: apify-service-account Date: Fri, 10 Apr 2026 09:39:22 +0000 Subject: [PATCH 2/2] [TODO]: update generated models from apify-docs PR #2416 --- src/apify_client/_models.py | 758 ++++++++++++++++++------------------ 1 file changed, 379 insertions(+), 379 deletions(-) diff --git a/src/apify_client/_models.py b/src/apify_client/_models.py index 0a093ec0..51c1d2ef 100644 --- a/src/apify_client/_models.py +++ b/src/apify_client/_models.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: openapi.json -# timestamp: 2026-04-10T08:30:51+00:00 +# timestamp: 2026-04-10T09:39:20+00:00 from __future__ import annotations @@ -1979,184 +1979,6 @@ class RequestQueueResponse(BaseModel): data: RequestQueue -@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' - SHARED_WITH_ME = 'sharedWithMe' - - -@docs_group('Models') -class ListOfKeyValueStores(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - items: list[KeyValueStore] - - -@docs_group('Models') -class ListOfKeyValueStoresResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: ListOfKeyValueStores - - -@docs_group('Models') -class KeyValueStoreNotFoundError(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - error: RecordNotFoundErrorDetail | None = None - - -@docs_group('Models') -class UpdateStoreRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - name: str | None = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None - - -@docs_group('Models') -class KeyValueStoreKey(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - 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'], - ), - ] - """ - A public link to access this record directly. - """ - - -@docs_group('Models') -class ListOfKeys(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - 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 - - -@docs_group('Models') -class ListOfKeysResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: ListOfKeys - - -@docs_group('Models') -class RecordResponse(BaseModel): - """The response body contains the value of the record. The content type of the response - is determined by the Content-Type header stored with the record. - - """ - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - - -@docs_group('Models') -class RecordNotFoundError(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - error: RecordNotFoundErrorDetail | None = None - - -@docs_group('Models') -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. - - """ - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - - -@docs_group('Models') -class DatasetListItem(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - 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 - - -@docs_group('Models') -class ListOfDatasets(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - items: list[DatasetListItem] - - -@docs_group('Models') -class ListOfDatasetsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: ListOfDatasets - - @docs_group('Models') class DatasetNotFoundError(BaseModel): model_config = ConfigDict( @@ -2166,16 +1988,6 @@ class DatasetNotFoundError(BaseModel): error: RecordNotFoundErrorDetail | None = None -@docs_group('Models') -class UpdateDatasetRequest(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - name: str | None = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None - - @docs_group('Models') class PutItemsRequest(BaseModel): """The request body containing the item(s) to add to the dataset. Can be a single @@ -2317,98 +2129,72 @@ class DatasetStatisticsResponse(BaseModel): @docs_group('Models') -class RequestQueueShort(BaseModel): - """A shortened request queue object for list responses.""" - +class KeyValueStoreKey(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] - """ - A unique identifier assigned to the request queue. - """ - name: Annotated[str, Field(examples=['some-name'])] - """ - The name of the request queue. - """ - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - """ - The ID of the user who owns the request queue. - """ - username: Annotated[str, Field(examples=['janedoe'])] - """ - The username of the user who owns the request queue. - """ - created_at: Annotated[AwareDatetime, Field(alias='createdAt', 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'])] - """ - 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'])] - """ - 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 - """ - The timestamp when the request queue will expire and be deleted. - """ - 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=[100], ge=0)] - """ - The number of requests that have been handled. - """ - 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. - """ - act_id: Annotated[str | None, Field(alias='actId')] = None - """ - The ID of the Actor that created this request queue. - """ - act_run_id: Annotated[str | None, Field(alias='actRunId')] = None - """ - The ID of the Actor run that created this request queue. - """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + 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'], + ), + ] """ - Whether the request queue has been accessed by multiple different clients. + A public link to access this record directly. """ @docs_group('Models') -class ListOfRequestQueues(PaginationResponse): - """A paginated list of request queues.""" +class ListOfKeys(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + 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 + +@docs_group('Models') +class ListOfKeysResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[RequestQueueShort] - """ - The array of request queues. - """ + data: ListOfKeys @docs_group('Models') -class ListOfRequestQueuesResponse(BaseModel): - """Response containing a list of request queues.""" +class KeyValueStoreNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: RecordNotFoundErrorDetail | None = None + + +@docs_group('Models') +class RecordResponse(BaseModel): + """The response body contains the value of the record. The content type of the response + is determined by the Content-Type header stored with the record. + + """ model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfRequestQueues @docs_group('Models') -class RequestQueueNotFoundError(BaseModel): +class RecordNotFoundError(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, @@ -2417,18 +2203,16 @@ class RequestQueueNotFoundError(BaseModel): @docs_group('Models') -class UpdateRequestQueueRequest(BaseModel): - """Request object for updating a request queue.""" +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. + + """ model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: str | None = None - """ - The new name for the request queue. - """ - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') @@ -2510,6 +2294,111 @@ class RequestBase(BaseModel): """ +@docs_group('Models') +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 | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None + """ + A unique identifier assigned to the request. + """ + + +@docs_group('Models') +class ListOfRequests(BaseModel): + """A paginated list of requests from the request queue.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + items: list[Request] + """ + The array of requests. + """ + count: Annotated[int | None, Field(examples=[2])] = None + """ + The total number of requests matching the query. + """ + limit: Annotated[int, Field(examples=[2])] + """ + The maximum number of requests returned in this response. + """ + 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. + """ + + +@docs_group('Models') +class ListOfRequestsResponse(BaseModel): + """Response containing a list of requests from the request queue.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: ListOfRequests + + +@docs_group('Models') +class RequestQueueNotFoundError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: RecordNotFoundErrorDetail | None = None + + +@docs_group('Models') +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'])] + """ + A unique identifier assigned to the request. + """ + was_already_present: Annotated[bool, Field(alias='wasAlreadyPresent', 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])] + """ + Indicates whether a request with the same unique key has already been processed by the request queue. + """ + + +@docs_group('Models') +class AddRequestResponse(BaseModel): + """Response containing the result of adding a request to the request queue.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: RequestRegistration + + @docs_group('Models') class AddedRequest(BaseModel): """Information about a request that was successfully added to a request queue.""" @@ -2684,144 +2573,48 @@ class BatchDeleteResult(BaseModel): list[DeletedRequestById | DeletedRequestByUniqueKey], Field(alias='processedRequests') ] """ - Requests that were successfully deleted from the request queue. - """ - unprocessed_requests: Annotated[list[RequestDraft], Field(alias='unprocessedRequests')] - """ - Requests that failed to be deleted and can be retried. - """ - - -@docs_group('Models') -class BatchDeleteResponse(BaseModel): - """Response containing the result of a batch delete operation.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: BatchDeleteResult - - -@docs_group('Models') -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])] - """ - Number of requests that were successfully unlocked. - """ - - -@docs_group('Models') -class UnlockRequestsResponse(BaseModel): - """Response containing the result of unlocking requests.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: UnlockRequestsResult - - -@docs_group('Models') -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 | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None - """ - A unique identifier assigned to the request. - """ - - -@docs_group('Models') -class ListOfRequests(BaseModel): - """A paginated list of requests from the request queue.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - items: list[Request] - """ - The array of requests. - """ - count: Annotated[int | None, Field(examples=[2])] = None - """ - The total number of requests matching the query. - """ - limit: Annotated[int, Field(examples=[2])] - """ - The maximum number of requests returned in this response. - """ - 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. + Requests that were successfully deleted from the request queue. """ - next_cursor: Annotated[ - str | None, Field(alias='nextCursor', examples=['eyJyZXF1ZXN0SWQiOiI5eFNNc1BrN1J6VUxTNXoifQ']) - ] = None + unprocessed_requests: Annotated[list[RequestDraft], Field(alias='unprocessedRequests')] """ - A cursor string to be used to continue pagination. + Requests that failed to be deleted and can be retried. """ @docs_group('Models') -class ListOfRequestsResponse(BaseModel): - """Response containing a list of requests from the request queue.""" +class BatchDeleteResponse(BaseModel): + """Response containing the result of a batch delete operation.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfRequests + data: BatchDeleteResult @docs_group('Models') -class RequestRegistration(BaseModel): - """Result of registering a request in the request queue, either by adding a new request or updating an existing one.""" +class UnlockRequestsResult(BaseModel): + """Result of unlocking requests in the request queue.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - request_id: Annotated[str, Field(alias='requestId', examples=['sbJ7klsdf7ujN9l'])] - """ - A unique identifier assigned to the request. - """ - was_already_present: Annotated[bool, Field(alias='wasAlreadyPresent', 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])] + unlocked_count: Annotated[int, Field(alias='unlockedCount', examples=[10])] """ - Indicates whether a request with the same unique key has already been processed by the request queue. + Number of requests that were successfully unlocked. """ @docs_group('Models') -class AddRequestResponse(BaseModel): - """Response containing the result of adding a request to the request queue.""" +class UnlockRequestsResponse(BaseModel): + """Response containing the result of unlocking requests.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: RequestRegistration + data: UnlockRequestsResult @docs_group('Models') @@ -2855,6 +2648,31 @@ class UpdateRequestResponse(BaseModel): data: RequestRegistration +@docs_group('Models') +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'])] + """ + The timestamp when the lock on this request expires. + """ + + +@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, + ) + data: RequestLockInfo + + @docs_group('Models') class HeadRequest(BaseModel): """A request from the request queue head without lock information.""" @@ -3000,28 +2818,210 @@ class HeadAndLockResponse(BaseModel): @docs_group('Models') -class RequestLockInfo(BaseModel): - """Information about a request lock.""" +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, ) - lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-06-14T23:00:00.000Z'])] + error: RecordOrTokenNotFoundErrorDetail | None = None + + +@docs_group('Models') +class StorageOwnership(StrEnum): + OWNED_BY_ME = 'ownedByMe' + SHARED_WITH_ME = 'sharedWithMe' + + +@docs_group('Models') +class ListOfKeyValueStores(PaginationResponse): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + items: list[KeyValueStore] + + +@docs_group('Models') +class ListOfKeyValueStoresResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: ListOfKeyValueStores + + +@docs_group('Models') +class UpdateStoreRequest(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + name: str | None = None + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + + +@docs_group('Models') +class DatasetListItem(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + 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 + + +@docs_group('Models') +class ListOfDatasets(PaginationResponse): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + items: list[DatasetListItem] + + +@docs_group('Models') +class ListOfDatasetsResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: ListOfDatasets + + +@docs_group('Models') +class UpdateDatasetRequest(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + name: str | None = None + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + + +@docs_group('Models') +class RequestQueueShort(BaseModel): + """A shortened request queue object for list responses.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] """ - The timestamp when the lock on this request expires. + A unique identifier assigned to the request queue. + """ + name: Annotated[str, Field(examples=['some-name'])] + """ + The name of the request queue. + """ + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + """ + The ID of the user who owns the request queue. + """ + username: Annotated[str, Field(examples=['janedoe'])] + """ + The username of the user who owns the request queue. + """ + created_at: Annotated[AwareDatetime, Field(alias='createdAt', 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'])] + """ + 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'])] + """ + 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 + """ + The timestamp when the request queue will expire and be deleted. + """ + 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=[100], ge=0)] + """ + The number of requests that have been handled. + """ + 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. + """ + act_id: Annotated[str | None, Field(alias='actId')] = None + """ + The ID of the Actor that created this request queue. + """ + act_run_id: Annotated[str | None, Field(alias='actRunId')] = None + """ + The ID of the Actor run that created this request queue. + """ + had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + """ + Whether the request queue has been accessed by multiple different clients. """ @docs_group('Models') -class ProlongRequestLockResponse(BaseModel): - """Response containing updated lock information after prolonging a request lock.""" +class ListOfRequestQueues(PaginationResponse): + """A paginated list of request queues.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: RequestLockInfo + items: list[RequestQueueShort] + """ + The array of request queues. + """ + + +@docs_group('Models') +class ListOfRequestQueuesResponse(BaseModel): + """Response containing a list of request queues.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: ListOfRequestQueues + + +@docs_group('Models') +class UpdateRequestQueueRequest(BaseModel): + """Request object for updating a request queue.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + name: str | None = None + """ + The new name for the request queue. + """ + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models')