feat!: require project_id and move Client API under /projects/{project_id}#1
Closed
jeroenrinzema wants to merge 1 commit into
Closed
feat!: require project_id and move Client API under /projects/{project_id}#1jeroenrinzema wants to merge 1 commit into
jeroenrinzema wants to merge 1 commit into
Conversation
…t_id} Every authenticated Lunogram Client API endpoint is now scoped to a project. The project UUID is supplied once when constructing the client and is injected into every Client API path as a `/projects/<project_id>/` segment; callers no longer pass it per request. BREAKING CHANGE: `Lunogram(api_key)` becomes `Lunogram(api_key, project_id)`. Auth is unchanged (same API key / token); only the URL gains the project. - client.py: add required `project_id`, build a project-scoped reference and thread it through `user`/`organization`. - utils/reference.py: turn the path reference into a project-scoped factory (validates non-empty UUID); add inbox/devices/push/auth-method-session paths. - app/objects.py and app/models/**: accept and use the injected reference. - README: document construction with the project and the new URLs.
This was referenced Jun 22, 2026
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Lunogram Client API now scopes every authenticated endpoint to a project:
/api/client/...becomes/api/client/projects/{projectID}/.... This is an intentional, breaking hard cut — there is no backwards compatibility.This PR makes the project a required client-construction parameter. You pass the project UUID once when instantiating the client, and the SDK injects
/projects/<project_id>into every Client API path automatically. Callers never pass the project per call.Authentication is unchanged (same API key / token) — only the URL gained the project segment.
Breaking change
Lunogram(api_key)is nowLunogram(api_key, project_id). Theproject_idis required and validated as a non-empty UUID string.Before
After
Old → new paths
All paths move under
/api/client/projects/{projectID}/:/api/client/users…/projects/{projectID}/users/api/client/users/events…/projects/{projectID}/users/events/api/client/users/scheduled…/projects/{projectID}/users/scheduled/api/client/users/devices…/projects/{projectID}/users/devices/api/client/users/inbox(/count,/read,/archived)…/projects/{projectID}/users/inbox…/api/client/organizations…/projects/{projectID}/organizations/api/client/organizations/users…/projects/{projectID}/organizations/users/api/client/organizations/events…/projects/{projectID}/organizations/events/api/client/organizations/scheduled…/projects/{projectID}/organizations/scheduled/api/client/organizations/inbox(/count,/read,/archived)…/projects/{projectID}/organizations/inbox…/api/client/push/vapid…/projects/{projectID}/push/vapid/api/client/auth-methods/{authMethodID}/sessions…/projects/{projectID}/auth-methods/{authMethodID}/sessionsImplementation
client.py:Lunogram.__init__now takes a requiredproject_id; builds a project-scoped path reference and threads it throughuser/organization.utils/reference.py: the path reference becomes a project-scoped factory (client(project_id)) that validates a non-empty UUID and centralizes the single/projects/<project_id>/injection. Added paths for user devices, user/org inbox (+/count,/read,/archived),push/vapid, andauth-methods/{id}/sessions.app/objects.pyandapp/models/**: accept and use the injected reference rather than a module-level singleton. No path is double-prefixed.README.md: documents constructing the client with the project and the new URLs.Validation
python -m build --wheel)./projects/<project_id>/…prefix; empty/invalidproject_idis rejected withValueError.Dependency / merge order
This depends on the platform Client API change that moves endpoints under
/projects/{projectID}. It should merge once that ships.