diff --git a/sdks/python/src/honcho/aio.py b/sdks/python/src/honcho/aio.py index 2d02418e..75a09bdc 100644 --- a/sdks/python/src/honcho/aio.py +++ b/sdks/python/src/honcho/aio.py @@ -23,6 +23,7 @@ from __future__ import annotations import json import logging +import warnings from collections.abc import AsyncGenerator from datetime import datetime from typing import TYPE_CHECKING, Any, ClassVar, Literal @@ -588,7 +589,7 @@ class PeerAio(AsyncMetadataConfigMixin): ] @validate_call(config=ConfigDict(arbitrary_types_allowed=True)) - async def card( + async def get_card( self, target: str | PeerBase | None = None, ) -> list[str] | None: @@ -604,6 +605,20 @@ class PeerAio(AsyncMetadataConfigMixin): response = PeerCardResponse.model_validate(data) return response.peer_card + @validate_call(config=ConfigDict(arbitrary_types_allowed=True)) + async def card( + self, + target: str | PeerBase | None = None, + ) -> list[str] | None: + """Deprecated: use get_card() instead.""" + + warnings.warn( + "card() is deprecated, use get_card() instead", + DeprecationWarning, + stacklevel=2, + ) + return await self.get_card(target=target) + @validate_call(config=ConfigDict(arbitrary_types_allowed=True)) async def set_card( self, diff --git a/sdks/python/src/honcho/peer.py b/sdks/python/src/honcho/peer.py index f53542c1..c58eabc2 100644 --- a/sdks/python/src/honcho/peer.py +++ b/sdks/python/src/honcho/peer.py @@ -5,6 +5,7 @@ from __future__ import annotations import datetime import logging +import warnings from collections.abc import Generator from typing import TYPE_CHECKING, Any, Literal @@ -446,7 +447,7 @@ class Peer(PeerBase, MetadataConfigMixin): ] @validate_call(config=ConfigDict(arbitrary_types_allowed=True)) - def card( + def get_card( self, target: str | PeerBase | None = None, ) -> list[str] | None: @@ -476,6 +477,19 @@ class Peer(PeerBase, MetadataConfigMixin): return response.peer_card + @validate_call(config=ConfigDict(arbitrary_types_allowed=True)) + def card( + self, + target: str | PeerBase | None = None, + ) -> list[str] | None: + """Deprecated: use get_card() instead.""" + warnings.warn( + "card() is deprecated, use get_card() instead", + DeprecationWarning, + stacklevel=2, + ) + return self.get_card(target=target) + @validate_call(config=ConfigDict(arbitrary_types_allowed=True)) def set_card( self, diff --git a/sdks/typescript/__tests__/peer.test.ts b/sdks/typescript/__tests__/peer.test.ts index 35f0b32e..b51a8483 100644 --- a/sdks/typescript/__tests__/peer.test.ts +++ b/sdks/typescript/__tests__/peer.test.ts @@ -444,7 +444,7 @@ describe('Peer', () => { expect(result).toEqual(cardData) // Verify with get - const card = await peer.card() + const card = await peer.getCard() expect(card).toEqual(cardData) }) @@ -458,7 +458,7 @@ describe('Peer', () => { expect(result).toEqual(cardData) // Verify with get - const card = await observer.card(observed) + const card = await observer.getCard(observed) expect(card).toEqual(cardData) }) diff --git a/sdks/typescript/src/peer.ts b/sdks/typescript/src/peer.ts index 9d81453b..0fb4dfa6 100644 --- a/sdks/typescript/src/peer.ts +++ b/sdks/typescript/src/peer.ts @@ -664,7 +664,7 @@ export class Peer { * @returns Promise resolving to an array of strings containing the peer card items, * or null if no peer card exists */ - async card(target?: string | Peer): Promise { + async getCard(target?: string | Peer): Promise { const validatedTarget = CardTargetSchema.parse(target) const response = await this._getCard({ @@ -674,6 +674,13 @@ export class Peer { return response.peer_card } + /** + * @deprecated Use {@link getCard} instead. + */ + async card(target?: string | Peer): Promise { + return this.getCard(target) + } + /** * Set the peer card for this peer. * diff --git a/tests/sdk/sdk_integration_test.py b/tests/sdk/sdk_integration_test.py index cffe6b1c..d9c5906f 100644 --- a/tests/sdk/sdk_integration_test.py +++ b/tests/sdk/sdk_integration_test.py @@ -114,7 +114,7 @@ def test_peer_card_operations(honcho_test_client: Honcho): target = honcho_test_client.peer(id="card-test-target") # Initially card should be None - card = peer.card() + card = peer.get_card() assert card is None # Set own card @@ -123,7 +123,7 @@ def test_peer_card_operations(honcho_test_client: Honcho): assert result == own_card # Verify with get - card = peer.card() + card = peer.get_card() assert card == own_card # Set card for target @@ -132,9 +132,9 @@ def test_peer_card_operations(honcho_test_client: Honcho): assert result == target_card # Verify with get - card = peer.card(target=target) + card = peer.get_card(target=target) assert card == target_card # Own card should still be unchanged - card = peer.card() + card = peer.get_card() assert card == own_card