Skip to content

Commit 23ca2b0

Browse files
committed
Testing ConnectorConfig, client function, and service
1 parent 950f37d commit 23ca2b0

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

firebase_admin/dataconnect.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from dataclasses import dataclass
2+
from firebase_admin import App
3+
from typing import Any, Dict, Generic, Optional, TypeVar, Union
4+
5+
@dataclass(frozen=True)
6+
class ConnectorConfig:
7+
"""
8+
Attributes:
9+
service_id (str): The Google Cloud project ID of the service.
10+
location (str): The region of the service.
11+
connector (str): The name of the connector.
12+
"""
13+
14+
service_id: str
15+
location: str
16+
connector: str
17+
18+
def __post_init__(self):
19+
if not self.service_id:
20+
raise ValueError("service_id cannot be empty")
21+
if not self.location:
22+
raise ValueError("location cannot be empty")
23+
if not self.connector:
24+
raise ValueError("connector cannot be empty")
25+
26+
27+
class DataConnect:
28+
def __init__(self, app: App, config: ConnectorConfig) -> None:
29+
"""Initializes a DataConnect client instance"""
30+
self._app: App = app
31+
self._config = config
32+
33+
def client(config: ConnectorConfig, app: Optional[App] = None) -> DataConnect:
34+
"""Returns a DataConnect client for the specified configuration"""

0 commit comments

Comments
 (0)