paperap.models.responses.list module
Response models for list-based API responses from Paperless-ngx.
This module contains models that represent paginated list responses from the Paperless-ngx API. These models handle the standard response format for collections of resources, including pagination metadata.
- class paperap.models.responses.list.ListResponse(**data)[source]
Bases:
StandardModel
Model representing a paginated list response from the Paperless-ngx API.
This class models the standard structure of list responses returned by the Paperless-ngx API, which include pagination metadata and the actual results. While not currently used in the main codebase, it’s maintained for documentation and potential future implementation.
- next
URL to fetch the next page of results, or None if this is the last page.
- Type:
str | None
- previous
URL to fetch the previous page of results, or None if this is the first page.
- Type:
str | None
- all
List of IDs for all items matching the query, across all pages.
- Type:
list[int]
- results
List of model instances for the current page.
- Type:
list[StandardModel]
Example
```python # Example of what a ListResponse might look like when implemented response = ListResponse(
count=150, next=”https://paperless.example.com/api/documents/?page=2”, previous=None, all=[1, 2, 3, 4, …], results=[Document(…), Document(…), …]
)
# Access total count total = response.count
# Iterate through current page results for document in response.results:
print(document.title)
- Parameters:
data (
Any
)
- count: int
- next: str | None
- previous: str | None
- all: list[int]
- results: list[StandardModel]
- class Meta(model)
Bases:
Meta
- Parameters:
model (type[_Self])
- blacklist_filtering_params: ClassVar[set[str]] = {}
- field_map: dict[str, str] = {}
- filtering_disabled: ClassVar[set[str]] = {}
- filtering_fields: ClassVar[set[str]] = {'_resource', 'all', 'count', 'id', 'next', 'previous', 'results'}
- read_only_fields: ClassVar[set[str]] = {'id'}
- supported_filtering_params: ClassVar[set[str]] = {'id', 'id__in', 'limit'}
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'ignore', 'populate_by_name': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].