diff --git a/openapi.public.json b/openapi.public.json index 080d3c67..62d32318 100644 --- a/openapi.public.json +++ b/openapi.public.json @@ -2197,6 +2197,17 @@ } ], "description": "The git hook that asked for this patch review: `HOOK_PRE_COMMIT` or\n `HOOK_PRE_PUSH`. Null for any other review, and for a patch review\n requested without naming a hook." + }, + "walkthrough": { + "anyOf": [ + { + "$ref": "#/components/schemas/WalkthroughView" + }, + { + "type": "null" + } + ], + "description": "The reviewed head's changed files in reading groups, with a line per\n file. Absent until the walkthrough is stored, and for a review that\n has none." } }, "required": [ @@ -6201,6 +6212,111 @@ "untrusted_text" ], "type": "object" + }, + "WalkthroughFileView": { + "properties": { + "additions": { + "format": "int64", + "type": "integer" + }, + "change": { + "description": "GitHub's change status, upper case, such as `ADDED` or `RENAMED`.", + "type": "string" + }, + "deletions": { + "format": "int64", + "type": "integer" + }, + "depth": { + "description": "The route plan's depth tier. Absent for a file the review did not\n evaluate.", + "type": [ + "string", + "null" + ] + }, + "generated": { + "description": "Whether `line` is model-authored.", + "type": "boolean" + }, + "line": { + "description": "A model sentence, or the deterministic line when there is none.", + "type": "string" + }, + "path": { + "type": "string" + }, + "previous_path": { + "type": [ + "string", + "null" + ] + }, + "skip_class": { + "description": "Why the review did not evaluate the file, such as `LOCKFILE` or\n `REPOSITORY_FILTER`.", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "path", + "change", + "additions", + "deletions", + "line", + "generated" + ], + "type": "object" + }, + "WalkthroughGroupView": { + "properties": { + "description": { + "type": [ + "string", + "null" + ] + }, + "files": { + "items": { + "$ref": "#/components/schemas/WalkthroughFileView" + }, + "type": "array" + }, + "kind": { + "description": "`FEATURE`, `FIX`, `REFACTOR`, `CONFIGURATION`, `INFRASTRUCTURE`,\n `DATA`, `DEPENDENCIES`, `TESTS` or `DOCS`.", + "type": "string" + }, + "title": { + "type": "string" + } + }, + "required": [ + "title", + "kind", + "files" + ], + "type": "object" + }, + "WalkthroughView": { + "description": "One review's walkthrough of its pinned head. Titles and lines are model\n text over untrusted repository content: render them as text.", + "properties": { + "groups": { + "description": "Groups in reading order.", + "items": { + "$ref": "#/components/schemas/WalkthroughGroupView" + }, + "type": "array" + }, + "head_sha": { + "type": "string" + } + }, + "required": [ + "head_sha", + "groups" + ], + "type": "object" } }, "securitySchemes": { diff --git a/proofline/_generated/models/__init__.py b/proofline/_generated/models/__init__.py index d7572b7c..7f6e8d05 100644 --- a/proofline/_generated/models/__init__.py +++ b/proofline/_generated/models/__init__.py @@ -170,6 +170,9 @@ from .thread_provider_state import ThreadProviderState from .thread_reply_evidence import ThreadReplyEvidence from .untrusted_text import UntrustedText +from .walkthrough_file_view import WalkthroughFileView +from .walkthrough_group_view import WalkthroughGroupView +from .walkthrough_view import WalkthroughView __all__ = ( "ActionUnavailability", @@ -342,4 +345,7 @@ "ThreadProviderState", "ThreadReplyEvidence", "UntrustedText", + "WalkthroughFileView", + "WalkthroughGroupView", + "WalkthroughView", ) diff --git a/proofline/_generated/models/customer_review_detail.py b/proofline/_generated/models/customer_review_detail.py index 5ff58278..d5019de7 100644 --- a/proofline/_generated/models/customer_review_detail.py +++ b/proofline/_generated/models/customer_review_detail.py @@ -27,6 +27,7 @@ from ..models.review_diff_stats import ReviewDiffStats from ..models.review_open_items import ReviewOpenItems from ..models.subject_view import SubjectView + from ..models.walkthrough_view import WalkthroughView T = TypeVar("T", bound="CustomerReviewDetail") @@ -174,6 +175,10 @@ class CustomerReviewDetail: `HOOK_PRE_COMMIT` or `HOOK_PRE_PUSH`. Null for any other review, and for a patch review requested without naming a hook. + walkthrough (None | Unset | WalkthroughView): The reviewed head's changed files in reading groups, with a line + per + file. Absent until the walkthrough is stored, and for a review that + has none. """ actions: ReviewActions @@ -235,6 +240,7 @@ class CustomerReviewDetail: stopped_from: None | str | Unset = UNSET superseded_by_review_id: None | Unset | UUID = UNSET trigger_source: None | PatchTriggerSource | Unset = UNSET + walkthrough: None | Unset | WalkthroughView = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -248,6 +254,7 @@ def to_dict(self) -> dict[str, Any]: from ..models.refresh_view import RefreshView # noqa: PLC0415 from ..models.review_diff_stats import ReviewDiffStats # noqa: PLC0415 from ..models.review_open_items import ReviewOpenItems # noqa: PLC0415 + from ..models.walkthrough_view import WalkthroughView # noqa: PLC0415 actions = self.actions.to_dict() @@ -583,6 +590,14 @@ def to_dict(self) -> dict[str, Any]: else: trigger_source = self.trigger_source + walkthrough: dict[str, Any] | None | Unset + if isinstance(self.walkthrough, Unset): + walkthrough = UNSET + elif isinstance(self.walkthrough, WalkthroughView): + walkthrough = self.walkthrough.to_dict() + else: + walkthrough = self.walkthrough + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -692,6 +707,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["superseded_by_review_id"] = superseded_by_review_id if trigger_source is not UNSET: field_dict["trigger_source"] = trigger_source + if walkthrough is not UNSET: + field_dict["walkthrough"] = walkthrough return field_dict @@ -712,6 +729,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.review_diff_stats import ReviewDiffStats # noqa: PLC0415 from ..models.review_open_items import ReviewOpenItems # noqa: PLC0415 from ..models.subject_view import SubjectView # noqa: PLC0415 + from ..models.walkthrough_view import WalkthroughView # noqa: PLC0415 d = dict(src_dict) actions = ReviewActions.from_dict(d.pop("actions")) @@ -1304,6 +1322,23 @@ def _parse_trigger_source(data: object) -> None | PatchTriggerSource | Unset: trigger_source = _parse_trigger_source(d.pop("trigger_source", UNSET)) + def _parse_walkthrough(data: object) -> None | Unset | WalkthroughView: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + walkthrough_type_0 = WalkthroughView.from_dict(data) + + return walkthrough_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | WalkthroughView, data) + + walkthrough = _parse_walkthrough(d.pop("walkthrough", UNSET)) + customer_review_detail = cls( actions=actions, assessment_count=assessment_count, @@ -1364,6 +1399,7 @@ def _parse_trigger_source(data: object) -> None | PatchTriggerSource | Unset: stopped_from=stopped_from, superseded_by_review_id=superseded_by_review_id, trigger_source=trigger_source, + walkthrough=walkthrough, ) customer_review_detail.additional_properties = d diff --git a/proofline/_generated/models/walkthrough_file_view.py b/proofline/_generated/models/walkthrough_file_view.py new file mode 100644 index 00000000..b202e631 --- /dev/null +++ b/proofline/_generated/models/walkthrough_file_view.py @@ -0,0 +1,165 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="WalkthroughFileView") + + +@_attrs_define +class WalkthroughFileView: + """ + Attributes: + additions (int): + change (str): GitHub's change status, upper case, such as `ADDED` or `RENAMED`. + deletions (int): + generated (bool): Whether `line` is model-authored. + line (str): A model sentence, or the deterministic line when there is none. + path (str): + depth (None | str | Unset): The route plan's depth tier. Absent for a file the review did not + evaluate. + previous_path (None | str | Unset): + skip_class (None | str | Unset): Why the review did not evaluate the file, such as `LOCKFILE` or + `REPOSITORY_FILTER`. + """ + + additions: int + change: str + deletions: int + generated: bool + line: str + path: str + depth: None | str | Unset = UNSET + previous_path: None | str | Unset = UNSET + skip_class: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + additions = self.additions + + change = self.change + + deletions = self.deletions + + generated = self.generated + + line = self.line + + path = self.path + + depth: None | str | Unset + if isinstance(self.depth, Unset): + depth = UNSET + else: + depth = self.depth + + previous_path: None | str | Unset + if isinstance(self.previous_path, Unset): + previous_path = UNSET + else: + previous_path = self.previous_path + + skip_class: None | str | Unset + if isinstance(self.skip_class, Unset): + skip_class = UNSET + else: + skip_class = self.skip_class + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "additions": additions, + "change": change, + "deletions": deletions, + "generated": generated, + "line": line, + "path": path, + } + ) + if depth is not UNSET: + field_dict["depth"] = depth + if previous_path is not UNSET: + field_dict["previous_path"] = previous_path + if skip_class is not UNSET: + field_dict["skip_class"] = skip_class + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + additions = d.pop("additions") + + change = d.pop("change") + + deletions = d.pop("deletions") + + generated = d.pop("generated") + + line = d.pop("line") + + path = d.pop("path") + + def _parse_depth(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + depth = _parse_depth(d.pop("depth", UNSET)) + + def _parse_previous_path(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + previous_path = _parse_previous_path(d.pop("previous_path", UNSET)) + + def _parse_skip_class(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + skip_class = _parse_skip_class(d.pop("skip_class", UNSET)) + + walkthrough_file_view = cls( + additions=additions, + change=change, + deletions=deletions, + generated=generated, + line=line, + path=path, + depth=depth, + previous_path=previous_path, + skip_class=skip_class, + ) + + walkthrough_file_view.additional_properties = d + return walkthrough_file_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/walkthrough_group_view.py b/proofline/_generated/models/walkthrough_group_view.py new file mode 100644 index 00000000..8782fdfe --- /dev/null +++ b/proofline/_generated/models/walkthrough_group_view.py @@ -0,0 +1,114 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.walkthrough_file_view import WalkthroughFileView + + +T = TypeVar("T", bound="WalkthroughGroupView") + + +@_attrs_define +class WalkthroughGroupView: + """ + Attributes: + files (list[WalkthroughFileView]): + kind (str): `FEATURE`, `FIX`, `REFACTOR`, `CONFIGURATION`, `INFRASTRUCTURE`, + `DATA`, `DEPENDENCIES`, `TESTS` or `DOCS`. + title (str): + description (None | str | Unset): + """ + + files: list[WalkthroughFileView] + kind: str + title: str + description: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + files = [] + for files_item_data in self.files: + files_item = files_item_data.to_dict() + files.append(files_item) + + kind = self.kind + + title = self.title + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "files": files, + "kind": kind, + "title": title, + } + ) + if description is not UNSET: + field_dict["description"] = description + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.walkthrough_file_view import WalkthroughFileView # noqa: PLC0415 + + d = dict(src_dict) + files = [] + _files = d.pop("files") + for files_item_data in _files: + files_item = WalkthroughFileView.from_dict(files_item_data) + + files.append(files_item) + + kind = d.pop("kind") + + title = d.pop("title") + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + walkthrough_group_view = cls( + files=files, + kind=kind, + title=title, + description=description, + ) + + walkthrough_group_view.additional_properties = d + return walkthrough_group_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/walkthrough_view.py b/proofline/_generated/models/walkthrough_view.py new file mode 100644 index 00000000..05c079b8 --- /dev/null +++ b/proofline/_generated/models/walkthrough_view.py @@ -0,0 +1,85 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.walkthrough_group_view import WalkthroughGroupView + + +T = TypeVar("T", bound="WalkthroughView") + + +@_attrs_define +class WalkthroughView: + """One review's walkthrough of its pinned head. Titles and lines are model + text over untrusted repository content: render them as text. + + Attributes: + groups (list[WalkthroughGroupView]): Groups in reading order. + head_sha (str): + """ + + groups: list[WalkthroughGroupView] + head_sha: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + groups = [] + for groups_item_data in self.groups: + groups_item = groups_item_data.to_dict() + groups.append(groups_item) + + head_sha = self.head_sha + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "groups": groups, + "head_sha": head_sha, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.walkthrough_group_view import WalkthroughGroupView # noqa: PLC0415 + + d = dict(src_dict) + groups = [] + _groups = d.pop("groups") + for groups_item_data in _groups: + groups_item = WalkthroughGroupView.from_dict(groups_item_data) + + groups.append(groups_item) + + head_sha = d.pop("head_sha") + + walkthrough_view = cls( + groups=groups, + head_sha=head_sha, + ) + + walkthrough_view.additional_properties = d + return walkthrough_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties