Coverage for functions \ flipdare \ core \ request_guard.py: 100%
12 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
1#!/usr/bin/env python
2# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
3#
4# This file is part of Flipdare's proprietary software and contains
5# confidential and copyrighted material. Unauthorised copying,
6# modification, distribution, or use of this file is strictly
7# prohibited without prior written permission from Flipdare Pty Ltd.
8#
9# This software includes third-party components licensed under MIT,
10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
11#
14from typing import TypeGuard
15from firebase_functions import https_fn
17from flipdare.app_types import JsonDict
18from flipdare.request.request_types import AppHttpRequest
20__all__ = ["RequestGuard"]
23class RequestGuard:
24 @staticmethod
25 def is_request(
26 req: AppHttpRequest | https_fn.CallableRequest[JsonDict],
27 ) -> TypeGuard[AppHttpRequest]:
28 return isinstance(req, AppHttpRequest)
30 @staticmethod
31 def is_callable(
32 req: AppHttpRequest | https_fn.CallableRequest[JsonDict],
33 ) -> TypeGuard[https_fn.CallableRequest[JsonDict]]:
34 return isinstance(req, https_fn.CallableRequest)