Skip to main content
Glama
base.py995 B
"""Base repository interface for data storage.""" import abc from typing import Any, Generic, List, Optional, Type, TypeVar from pydantic import BaseModel T = TypeVar("T", bound=BaseModel) class Repository(Generic[T], abc.ABC): """Abstract base class for repositories.""" @abc.abstractmethod def create(self, entity: T) -> T: """Create a new entity.""" pass @abc.abstractmethod def get(self, id: str) -> Optional[T]: """Get an entity by ID.""" pass @abc.abstractmethod def get_all(self) -> List[T]: """Get all entities.""" pass @abc.abstractmethod def update(self, entity: T) -> T: """Update an entity.""" pass @abc.abstractmethod def delete(self, id: str) -> None: """Delete an entity by ID.""" pass @abc.abstractmethod def search(self, **kwargs: Any) -> List[T]: """Search for entities based on criteria.""" pass

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Liam-Deacon/zettelkasten-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server