Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ All notable changes to this project will be documented here.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.2] — 2026-10-05

### Fixed

- **`Facebook.get_group_metadata` / `AsyncFacebook.get_group_metadata`**
called `/facebook/groups/metadata`, an endpoint the API doesn't have, so
every call returned 404. They now call `/facebook/groups/details` and
return its raw JSON.

### Deprecated

- `get_group_metadata()` — use `get_group_details()` (typed `GroupInfo`).
Emits `DeprecationWarning`; removed in 0.2.0.

### Docs

- README: JavaScript/TypeScript and Go SDKs are released (no longer
"coming soon"); MCP server linked; endpoint count corrected to 50.

## [0.1.1] — 2026-06-22

### Fixed (breaking for the typed-model methods)
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ calls.
**Groups**
- `get_group_id(group)`
- `get_group_details(group)` → `GroupInfo` (typed model)
- `get_group_metadata(group)` — lightweight metadata only
- `get_group_posts(group)`
- `get_group_videos(group_id)`

Expand Down
2 changes: 1 addition & 1 deletion socialapis/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# this manually for a release — use `git tag vX.Y.Z` and the CI does the
# rest via hatchling's dynamic-version feature (see pyproject.toml).

__version__ = "0.1.1"
__version__ = "0.1.2"
23 changes: 18 additions & 5 deletions socialapis/facebook/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from __future__ import annotations

import warnings
from types import TracebackType
from typing import TYPE_CHECKING, Any

Expand Down Expand Up @@ -247,13 +248,19 @@ def get_group_details(self, group: str, **kwargs: Any) -> GroupInfo:
return GroupInfo.model_validate(response.json())

def get_group_metadata(self, group: str, **kwargs: Any) -> dict[str, Any]:
"""Return lightweight Group metadata (name, id, url, image).
"""Deprecated: use :meth:`get_group_details`.

Cheaper than ``get_group_details`` when you only need IDs/names.
Backed by ``GET /facebook/groups/metadata``.
The API has no ``/facebook/groups/metadata`` endpoint, so this method
returned 404 in 0.1.0–0.1.1. It now calls ``GET /facebook/groups/details``
and returns the raw JSON. It will be removed in 0.2.0.
"""
warnings.warn(
"get_group_metadata() is deprecated; use get_group_details().",
DeprecationWarning,
stacklevel=2,
)
return self._get(
"/facebook/groups/metadata",
"/facebook/groups/details",
_params(("link", _as_facebook_group_url(group)), extra=kwargs),
).json()

Expand Down Expand Up @@ -713,9 +720,15 @@ async def get_group_details(self, group: str, **kwargs: Any) -> GroupInfo:
return GroupInfo.model_validate(response.json())

async def get_group_metadata(self, group: str, **kwargs: Any) -> dict[str, Any]:
"""Deprecated: use :meth:`get_group_details`. See the sync client."""
warnings.warn(
"get_group_metadata() is deprecated; use get_group_details().",
DeprecationWarning,
stacklevel=2,
)
return (
await self._get(
"/facebook/groups/metadata",
"/facebook/groups/details",
_params(("link", _as_facebook_group_url(group)), extra=kwargs),
)
).json()
Expand Down
22 changes: 22 additions & 0 deletions tests/test_facebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,28 @@ def test_get_group_id_routes_to_groups_id_endpoint() -> None:
)


@respx.mock
def test_get_group_metadata_is_deprecated_alias_for_group_details() -> None:
route = respx.get("https://api.socialapis.io/facebook/groups/details").mock(
return_value=httpx.Response(200, json={"group_id": "187988788687356"})
)
with Facebook(api_token="t") as fb, pytest.warns(DeprecationWarning, match="get_group_details"):
data = fb.get_group_metadata("gieldagryplanszowe")
assert route.called
assert data == {"group_id": "187988788687356"}


@respx.mock
async def test_async_get_group_metadata_routes_to_group_details() -> None:
route = respx.get("https://api.socialapis.io/facebook/groups/details").mock(
return_value=httpx.Response(200, json={"group_id": "187988788687356"})
)
async with AsyncFacebook(api_token="t") as fb:
with pytest.warns(DeprecationWarning, match="get_group_details"):
await fb.get_group_metadata("gieldagryplanszowe")
assert route.called


@respx.mock
def test_search_pages_passes_query_and_extra_kwargs() -> None:
route = respx.get("https://api.socialapis.io/facebook/search/pages").mock(
Expand Down
Loading