"""API Utility Functions. Functions to support generating API Responses. """ from oto import status as response_code from oto.response import Response def make_pagination_response( items, offset=0, limit=50, total_records=0, status=response_code.OK): """Create get items response. Wraps item list in pagination API list. NOTE: Pagination isn't supported, this will need to be implemented if needed in the future. Args: items (list): List of objects offset (int): Pagination offset limit (int): Pagination limit status (int): HTTP response status code Returns: Response object """ message = { 'items': items, 'pagination': { 'type': 'standard', 'offset': offset, 'limit': limit, 'total_records': total_records or len(items) } } return Response(message=message, status=status)