paperap.models.storage_path.queryset module

Provide query functionality for storage paths in Paperless-ngx.

This module contains the StoragePathQuerySet class, which enables filtering and querying storage path objects from the Paperless-ngx API. It extends the standard queryset functionality with storage path-specific filtering methods.

class paperap.models.storage_path.queryset.StoragePathQuerySet(resource, filters=None, _cache=None, _fetch_all=False, _next_url=None, _last_response=None, _iter=None, _urls_fetched=None)[source]

Bases: StandardQuerySet[StoragePath], HasStandard

QuerySet for Paperless-ngx storage paths with specialized filtering methods.

Extends StandardQuerySet to provide storage path-specific filtering capabilities, including filtering by path value, match criteria, matching algorithm, and permission settings. This queryset enables efficient querying and filtering of storage path objects from the Paperless-ngx API.

Examples

Get all storage paths:
>>> all_paths = client.storage_paths.all()
Filter by path:
>>> tax_paths = client.storage_paths.path("/documents/taxes/")
Filter by matching algorithm:
>>> auto_paths = client.storage_paths.matching_algorithm(1)  # 1 = Auto
Parameters:
  • resource (BaseResource[_Model, Self])

  • filters (dict[str, Any] | None)

  • _cache (list[_Model] | None)

  • _fetch_all (bool)

  • _next_url (str | None)

  • _last_response (ClientResponse)

  • _iter (Iterator[_Model] | None)

  • _urls_fetched (list[str] | None)

path(value, *, exact=True, case_insensitive=True)[source]

Filter storage paths by their actual path value.

Parameters:
  • value (str) – The path string to filter by.

  • exact (bool) – If True, match the exact path string. If False, match paths containing the value string. Defaults to True.

  • case_insensitive (bool) – If True, ignore case when matching. Defaults to True.

Return type:

Self

Returns:

A filtered StoragePathQuerySet containing only matching storage paths.

Examples

Find exact path match:
>>> tax_paths = client.storage_paths.path("/documents/taxes/")
Find paths containing “invoice” (case insensitive):
>>> invoice_paths = client.storage_paths.path("invoice", exact=False)
match(value, *, exact=True)[source]

Filter storage paths by their match pattern value.

Filter storage paths based on the match pattern used for automatic document routing in Paperless-ngx.

Parameters:
  • value (str) – The match pattern string to filter by.

  • exact (bool) – If True, match the exact pattern string. If False, match patterns containing the value string. Defaults to True.

Return type:

Self

Returns:

A filtered StoragePathQuerySet containing only matching storage paths.

Examples

Find paths with exact match pattern:
>>> invoice_paths = client.storage_paths.match("invoice")
Find paths with match patterns containing “tax”:
>>> tax_paths = client.storage_paths.match("tax", exact=False)
matching_algorithm(value)[source]

Filter storage paths by their matching algorithm.

Filter storage paths based on the algorithm used for matching documents to storage paths in Paperless-ngx.

Parameters:

value (int) – The matching algorithm ID to filter by. Common values are: 1: Auto (let Paperless decide) 2: Exact (exact string matching) 3: Regular expression 4: Fuzzy match

Return type:

Self

Returns:

A filtered StoragePathQuerySet containing only storage paths using the specified matching algorithm.

Examples

Find paths using regular expressions:
>>> regex_paths = client.storage_paths.matching_algorithm(3)
case_insensitive(insensitive=True)[source]

Filter storage paths by their case sensitivity setting.

Filter storage paths based on whether they use case-insensitive matching for document routing.

Parameters:

insensitive (bool) – If True, return storage paths configured for case-insensitive matching. If False, return paths with case-sensitive matching. Defaults to True.

Return type:

Self

Returns:

A filtered StoragePathQuerySet containing only storage paths with the specified case sensitivity setting.

Examples

Find case-insensitive paths:
>>> insensitive_paths = client.storage_paths.case_insensitive()
Find case-sensitive paths:
>>> sensitive_paths = client.storage_paths.case_insensitive(False)
user_can_change(can_change=True)[source]

Filter storage paths by user modification permissions.

Filter storage paths based on whether the current user has permission to modify them in the Paperless-ngx system.

Parameters:

can_change (bool) – If True, return storage paths that the current user can modify. If False, return paths that the user cannot modify. Defaults to True.

Return type:

Self

Returns:

A filtered StoragePathQuerySet containing only storage paths with the specified permission setting.

Examples

Find paths the current user can modify:
>>> editable_paths = client.storage_paths.user_can_change()
Find paths the current user cannot modify:
>>> readonly_paths = client.storage_paths.user_can_change(False)