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
2 changes: 1 addition & 1 deletion src/pyticktick/models/v2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def override_forbid_extra_message_injector(
):
_type: str | PydanticCustomError = PydanticCustomError(
"custom_pyticktick_extra_forbidden",
"Extra inputs are not permitted by default. Please set `override_forbid_extra` to `True` if you believe the TickTick API has diverged from the model. See https://pyticktick.pretzer.io/guides/settings/overriding_models_that_forbid_extra_fields/ for more information.",
f"Extra inputs are not permitted by default for `{cls.__name__}`. Please set `override_forbid_extra` to `True` if you believe the TickTick API has diverged from the model. See https://pyticktick.pretzer.io/guides/settings/overriding_models_that_forbid_extra_fields/ for more information.", # pyright: ignore[reportArgumentType] # ty: ignore[invalid-argument-type]
)
else:
_type = error_dict["type"]
Expand Down
8 changes: 8 additions & 0 deletions src/pyticktick/models/v2/responses/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class UserSignOnV2(BaseModelV2):
validation_alias="inboxId",
description="The user's inbox ID.",
)
register_date: datetime = Field(
validation_alias="registerDate",
description="The date when the user registered for TickTick, in seconds since the epoch.",
)
token: str = Field(
description="The user's authentication token that is used for short-term authentication.",
)
Expand Down Expand Up @@ -130,6 +134,10 @@ class UserStatusV2(BaseModelV2):
validation_alias="proEndDate",
description="The date when the user's premium subscription is slated to end.",
)
register_date: datetime = Field(
validation_alias="registerDate",
description="The date when the user registered for TickTick, in seconds since the epoch.",
)
subscribe_type: str | None = Field(
default=None,
validation_alias="subscribeType",
Expand Down
2 changes: 1 addition & 1 deletion src/pyticktick/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ def retry_api_v1(
),
stop=stop_after_attempt(attempts),
wait=wait_exponential(multiplier=1, min=min_wait, max=max_wait),
before_sleep=before_sleep_log(_logger, logging.INFO),
before_sleep=before_sleep_log(_logger, logging.INFO), # ty: ignore[invalid-argument-type]
)
2 changes: 1 addition & 1 deletion tests/integration/v1/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
retry=(retry_if_exception_type(ValueError)),
stop=stop_after_attempt(10),
wait=wait_exponential(multiplier=1, min=5, max=30),
before_sleep=before_sleep_log(_logger, logging.INFO),
before_sleep=before_sleep_log(_logger, logging.INFO), # ty: ignore[invalid-argument-type]
)


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/v2/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
retry=(retry_if_exception_type(ValueError)),
stop=stop_after_attempt(10),
wait=wait_exponential(multiplier=1, min=5, max=30),
before_sleep=before_sleep_log(_logger, logging.INFO),
before_sleep=before_sleep_log(_logger, logging.INFO), # ty: ignore[invalid-argument-type]
)


Expand Down
1 change: 1 addition & 0 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ def test_v2_usersignonv2(test_v2_username, test_v2_token) -> UserSignOnV2:
"gracePeriod": False,
"pro": False,
"ds": False,
"registerDate": "2000-01-01T01:01:01.000+0000",
},
)
4 changes: 2 additions & 2 deletions tests/unit/test_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_update_model_config_nested():
assert isinstance(data, PostBatchTaskV2)
assert data.extra_field == "value" # pyright: ignore[reportAttributeAccessIssue] # ty: ignore[unresolved-attribute]
assert data.add[0].extra_nested_field == "value" # pyright: ignore[reportAttributeAccessIssue] # ty: ignore[unresolved-attribute]
assert data.add[0].items[0].extra_nested_nested_field == "value" # pyright: ignore[reportOptionalSubscript,reportAttributeAccessIssue] # ty: ignore[possibly-missing-attribute, not-subscriptable]
assert data.add[0].items[0].extra_nested_nested_field == "value" # pyright: ignore[reportOptionalSubscript,reportAttributeAccessIssue] # ty: ignore[not-subscriptable, unresolved-attribute]
assert data.update[0].extra_nested_field == "value" # pyright: ignore[reportAttributeAccessIssue] # ty: ignore[unresolved-attribute]
assert data.update[0].reminders[0].extra_extra_nested_field == "value" # pyright: ignore[reportOptionalSubscript,reportAttributeAccessIssue] # ty: ignore[possibly-missing-attribute, not-subscriptable]
assert data.update[0].reminders[0].extra_extra_nested_field == "value" # pyright: ignore[reportOptionalSubscript,reportAttributeAccessIssue] # ty: ignore[not-subscriptable, unresolved-attribute]
assert data.delete[0].extra_nested_field == "value" # pyright: ignore[reportAttributeAccessIssue] # ty: ignore[unresolved-attribute]
2 changes: 1 addition & 1 deletion tests/unit/v2/test_v2_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ class CustomModel(BaseModelV2):
assert model.field2 == 10

invalid_data = {**valid_data, "extra_field": "not allowed"}
match_ = r"Extra inputs are not permitted by default. Please set `override_forbid_extra` to `True`" # noqa: E501
match_ = r"Extra inputs are not permitted by default for `CustomModel`. Please set `override_forbid_extra` to `True` if you believe the TickTick API has diverged from the model." # noqa: E501
with pytest.raises(ValidationError, match=match_):
CustomModel.model_validate(invalid_data)
Loading
Loading