mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
feat: add get_data_vault_store to facade classes and exports
- StackServerApp.get_data_vault_store returns sync DataVaultStore - AsyncStackServerApp.get_data_vault_store returns AsyncDataVaultStore - Export DataVaultStore and AsyncDataVaultStore from package root
This commit is contained in:
@@ -29,9 +29,11 @@ from stack_auth.errors import (
|
||||
from stack_auth.models import (
|
||||
ActiveSession,
|
||||
ApiKey,
|
||||
AsyncDataVaultStore,
|
||||
AsyncServerItem,
|
||||
BaseUser,
|
||||
ContactChannel,
|
||||
DataVaultStore,
|
||||
EmailDeliveryInfo,
|
||||
GeoInfo,
|
||||
Item,
|
||||
@@ -82,6 +84,8 @@ __all__ = [
|
||||
"sync_authenticate_request",
|
||||
"async_authenticate_request",
|
||||
# Models
|
||||
"DataVaultStore",
|
||||
"AsyncDataVaultStore",
|
||||
"BaseUser",
|
||||
"ServerUser",
|
||||
"Team",
|
||||
|
||||
@@ -17,6 +17,7 @@ from stack_auth._constants import DEFAULT_BASE_URL
|
||||
from stack_auth._pagination import PaginatedResult, _PaginationMeta
|
||||
from stack_auth._token_store import TokenStore, TokenStoreInit, resolve_token_store
|
||||
from stack_auth.errors import ApiKeyError, NotFoundError
|
||||
from stack_auth.models.data_vault import AsyncDataVaultStore, DataVaultStore
|
||||
from stack_auth.models.email import EmailDeliveryInfo
|
||||
from stack_auth.models.payments import AsyncServerItem, Item, Product, ServerItem
|
||||
from stack_auth.models.api_keys import (
|
||||
@@ -925,6 +926,17 @@ class StackServerApp:
|
||||
data = self._client.request("GET", "/emails/delivery-stats")
|
||||
return EmailDeliveryInfo.model_validate(data)
|
||||
|
||||
# -- data vault ----------------------------------------------------------
|
||||
|
||||
def get_data_vault_store(self, store_id: str) -> DataVaultStore:
|
||||
"""Get a data vault store by ID.
|
||||
|
||||
The returned :class:`DataVaultStore` object provides ``get``,
|
||||
``set``, ``delete``, and ``list_keys`` methods for key-value
|
||||
operations within the store.
|
||||
"""
|
||||
return DataVaultStore(store_id, _client=self._client)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# AsyncStackServerApp (async)
|
||||
@@ -1730,3 +1742,14 @@ class AsyncStackServerApp:
|
||||
"""Get email delivery statistics."""
|
||||
data = await self._client.request("GET", "/emails/delivery-stats")
|
||||
return EmailDeliveryInfo.model_validate(data)
|
||||
|
||||
# -- data vault ----------------------------------------------------------
|
||||
|
||||
def get_data_vault_store(self, store_id: str) -> AsyncDataVaultStore:
|
||||
"""Get a data vault store by ID.
|
||||
|
||||
The returned :class:`AsyncDataVaultStore` object provides async
|
||||
``get``, ``set``, ``delete``, and ``list_keys`` methods for
|
||||
key-value operations within the store.
|
||||
"""
|
||||
return AsyncDataVaultStore(store_id, _client=self._client)
|
||||
|
||||
Reference in New Issue
Block a user