Skip to content

Commit

Permalink
typing(rpc): Richer annotation for the return type of list_surveys
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jan 3, 2025
1 parent 3e4ef9a commit 0ae2c53
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/unreleased/Typing-20250103-101152.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: Typing
body: Richer annotation for the return type of `list_surveys`
time: 2025-01-03T10:11:52.478901-06:00
custom:
Issue: "1245"
2 changes: 1 addition & 1 deletion src/citric/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ def list_surveys(
username: str | None = None,
*,
survey_group_id: int | None = None,
) -> list[dict[str, t.Any]]:
) -> list[types.SurveyListElement]:
"""Get all surveys or only those owned by a user.
Calls :rpc_method:`list_surveys`.
Expand Down
25 changes: 25 additions & 0 deletions src/citric/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,31 @@ class SetQuotaPropertiesResult(t.TypedDict):
"""The quota properties."""


class SurveyListElement(t.TypedDict, total=False):
"""List surveys result."""

sid: int
"""The survey ID."""

gsid: int
"""The survey group ID.
.. minlimesurveyattribute:: 6.9.0
"""

surveyls_title: str
"""The survey title."""

startdate: str
"""The survey start date."""

expires: str
"""The survey expiration date."""

active: YesNo
"""Whether the survey is active."""


class SurveyProperties(t.TypedDict, total=False):
"""Survey properties result."""

Expand Down

0 comments on commit 0ae2c53

Please sign in to comment.