flip_api.utils.paging_utils =========================== .. py:module:: flip_api.utils.paging_utils Attributes ---------- .. autoapisummary:: flip_api.utils.paging_utils.T Classes ------- .. autoapisummary:: flip_api.utils.paging_utils.PagingInfo flip_api.utils.paging_utils.FilterInfo flip_api.utils.paging_utils.IPagedResponse flip_api.utils.paging_utils.IPagedData Functions --------- .. autoapisummary:: flip_api.utils.paging_utils.get_paging_details flip_api.utils.paging_utils.get_filter_details flip_api.utils.paging_utils.get_total_pages Module Contents --------------- .. py:data:: T .. py:class:: PagingInfo Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: offset :type: int .. py:attribute:: page_number :type: int .. py:attribute:: page_size :type: int .. py:attribute:: search_str :type: str .. py:attribute:: model_config .. py:class:: FilterInfo Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: owner :type: uuid.UUID | None .. py:attribute:: model_config .. py:class:: IPagedResponse Bases: :py:obj:`pydantic.BaseModel`, :py:obj:`Generic`\ [\ :py:obj:`T`\ ] Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:attribute:: data :type: list[T] .. py:attribute:: total_rows :type: int .. py:class:: IPagedData Bases: :py:obj:`pydantic.BaseModel`, :py:obj:`Generic`\ [\ :py:obj:`T`\ ] Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:attribute:: page :type: int .. py:attribute:: page_size :type: int .. py:attribute:: total_pages :type: int .. py:attribute:: total_records :type: int .. py:attribute:: data :type: list[T] .. py:attribute:: model_config .. py:function:: get_paging_details(query_string_parameters: dict[str, str | int | float] | None = None) -> PagingInfo Parses query string parameters for pagination details. :param query_string_parameters: A dictionary of query parameters. :returns: An object containing offset, page number, page size, and search string. :rtype: PagingInfo .. py:function:: get_filter_details(query_string_parameters: dict[str, str | uuid.UUID] | None = None) -> FilterInfo Parses query string parameters for filter details. :param query_string_parameters: A dictionary of query parameters. :returns: An object containing filter criteria (e.g., owner_id). :rtype: FilterInfo .. py:function:: get_total_pages(total_records: int, page_size_int: int) -> int Calculates the total number of pages. :param total_records: The total number of records. :param page_size_int: The number of records per page. :returns: The total number of pages. :rtype: int