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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- `mastodon`, `telegram` and `discord` in `PLATFORMS` and the `Platform` type,
matching the `/v1` spec's `Channel.platform` enum.

### Changed

- The PyPI distribution name is now `postify-sdk` (was `postify`), matching the
Expand Down
18 changes: 15 additions & 3 deletions scripts/sync-spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,26 @@ url="${POSTIFY_SPEC_URL:-https://app.usepostify.com/v1/openapi.json}"

if [[ -n "${POSTIFY_SPEC_SOURCE:-}" ]]; then
echo "Vendoring spec from ${POSTIFY_SPEC_SOURCE}"
cp "${POSTIFY_SPEC_SOURCE}" "${dest}"
cp "${POSTIFY_SPEC_SOURCE}" "${dest}.tmp"
else
echo "Fetching spec from ${url}"
curl -fsSL "${url}" -o "${dest}.tmp"
python -c "import json,sys; json.load(open(sys.argv[1]))" "${dest}.tmp"
mv "${dest}.tmp" "${dest}"
fi

# Production serves the spec minified. Re-serialise it the way spec/v1.json is
# committed (2-space indent, UTF-8, trailing newline) so a drift PR shows only
# the real change instead of rewriting all 5,000+ lines onto one.
python - "${dest}.tmp" "${dest}" <<'PY'
import json, sys

with open(sys.argv[1], encoding="utf-8") as src:
doc = json.load(src)
with open(sys.argv[2], "w", encoding="utf-8", newline="\n") as out:
json.dump(doc, out, indent=2, ensure_ascii=False)
out.write("\n")
PY
rm -f "${dest}.tmp"

ops=$(python - "$dest" <<'PY'
import json, sys

Expand Down
7 changes: 5 additions & 2 deletions spec/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -4277,7 +4277,10 @@
"pinterest",
"youtube",
"bluesky",
"reddit"
"reddit",
"mastodon",
"telegram",
"discord"
],
"description": "Social platform this channel publishes to."
},
Expand Down Expand Up @@ -4766,7 +4769,7 @@
"type": "null"
}
],
"description": "Most recent delivery error, if any."
"description": "Why the latest delivery failed, as a sentence you can show your users. Present only when `stage` is `failed` or `dlq`; otherwise null."
}
},
"required": [
Expand Down
6 changes: 6 additions & 0 deletions src/postify/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
"youtube",
"bluesky",
"reddit",
"mastodon",
"telegram",
"discord",
)
Platform = Union[
Literal[
Expand All @@ -96,6 +99,9 @@
"youtube",
"bluesky",
"reddit",
"mastodon",
"telegram",
"discord",
],
str,
]
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_an_unknown_platform_or_status_does_not_raise() -> None:
channel = models.Channel.model_validate(
{
"id": "chn_1",
"platform": "mastodon", # not in this SDK's PLATFORMS tuple
"platform": "friendster", # not in this SDK's PLATFORMS tuple
"handle": "@acme",
"avatar_url": None,
"followers": None,
Expand All @@ -157,7 +157,7 @@ def test_an_unknown_platform_or_status_does_not_raise() -> None:
"created_at": "2026-08-05T12:00:00.000Z",
}
)
assert channel.platform == "mastodon"
assert channel.platform == "friendster"
assert channel.status == "quarantined"


Expand Down
Loading