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
831 changes: 822 additions & 9 deletions openapi.public.json

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions proofline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
CustomerAssessmentDetail,
CustomerFinding,
CustomerReviewDetail,
FileReviewRequest,
FileReviewResponse,
PatchReviewRequest,
PatchReviewResponse,
PatchTriggerSource,
Expand All @@ -22,6 +24,7 @@
RunNowRequest,
RunNowResponse,
StartSession,
StopResponse,
)
from ._transport import VERSION as __version__
from ._transport import ProoflineError
Expand All @@ -39,6 +42,8 @@
"CustomerAssessmentDetail",
"CustomerFinding",
"CustomerReviewDetail",
"FileReviewRequest",
"FileReviewResponse",
"PatchReviewRequest",
"PatchReviewResponse",
"PatchTriggerSource",
Expand All @@ -55,6 +60,7 @@
"RunNowResponse",
"SecretStr",
"StartSession",
"StopResponse",
"__version__",
"models",
]
212 changes: 212 additions & 0 deletions proofline/_generated/api/default/request_file_review.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
from http import HTTPStatus
from typing import Any
from urllib.parse import quote
from uuid import UUID

import httpx

from ...client import AuthenticatedClient, Client
from ...models.file_review_request import FileReviewRequest
from ...models.file_review_response import FileReviewResponse
from ...models.problem import Problem
from ...models.run_now_refused import RunNowRefused
from ...types import Response


def _get_kwargs(
org_id: UUID,
repo_id: UUID,
*,
body: FileReviewRequest,
) -> dict[str, Any]:
headers: dict[str, Any] = {}

_kwargs: dict[str, Any] = {
"method": "post",
"url": "/api/v1/organizations/{org_id}/repositories/{repo_id}/file-reviews".format(
org_id=quote(str(org_id), safe=""),
repo_id=quote(str(repo_id), safe=""),
),
}

_kwargs["json"] = body.to_dict()

headers["Content-Type"] = "application/json"

_kwargs["headers"] = headers
return _kwargs


def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> FileReviewResponse | Problem | RunNowRefused:
if response.status_code == 200:
response_200 = FileReviewResponse.from_dict(response.json())

return response_200

if response.status_code == 400:
response_400 = RunNowRefused.from_dict(response.json())

return response_400

response_default = Problem.from_dict(response.json())

return response_default


def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[FileReviewResponse | Problem | RunNowRefused]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
org_id: UUID,
repo_id: UUID,
*,
client: AuthenticatedClient,
body: FileReviewRequest,
) -> Response[FileReviewResponse | Problem | RunNowRefused]:
"""Review selected whole files

Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and
verifies every path at that commit. The retained selection is immutable; a repeat by the same person
returns its review. Results remain in Proofline and are never posted to GitHub.

Args:
org_id (UUID):
repo_id (UUID):
body (FileReviewRequest): Whole files selected at one exact pushed commit.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[FileReviewResponse | Problem | RunNowRefused]
"""

kwargs = _get_kwargs(
org_id=org_id,
repo_id=repo_id,
body=body,
)

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
org_id: UUID,
repo_id: UUID,
*,
client: AuthenticatedClient,
body: FileReviewRequest,
) -> FileReviewResponse | Problem | RunNowRefused | None:
"""Review selected whole files

Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and
verifies every path at that commit. The retained selection is immutable; a repeat by the same person
returns its review. Results remain in Proofline and are never posted to GitHub.

Args:
org_id (UUID):
repo_id (UUID):
body (FileReviewRequest): Whole files selected at one exact pushed commit.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
FileReviewResponse | Problem | RunNowRefused
"""

return sync_detailed(
org_id=org_id,
repo_id=repo_id,
client=client,
body=body,
).parsed


async def asyncio_detailed(
org_id: UUID,
repo_id: UUID,
*,
client: AuthenticatedClient,
body: FileReviewRequest,
) -> Response[FileReviewResponse | Problem | RunNowRefused]:
"""Review selected whole files

Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and
verifies every path at that commit. The retained selection is immutable; a repeat by the same person
returns its review. Results remain in Proofline and are never posted to GitHub.

Args:
org_id (UUID):
repo_id (UUID):
body (FileReviewRequest): Whole files selected at one exact pushed commit.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[FileReviewResponse | Problem | RunNowRefused]
"""

kwargs = _get_kwargs(
org_id=org_id,
repo_id=repo_id,
body=body,
)

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
org_id: UUID,
repo_id: UUID,
*,
client: AuthenticatedClient,
body: FileReviewRequest,
) -> FileReviewResponse | Problem | RunNowRefused | None:
"""Review selected whole files

Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and
verifies every path at that commit. The retained selection is immutable; a repeat by the same person
returns its review. Results remain in Proofline and are never posted to GitHub.

Args:
org_id (UUID):
repo_id (UUID):
body (FileReviewRequest): Whole files selected at one exact pushed commit.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
FileReviewResponse | Problem | RunNowRefused
"""

return (
await asyncio_detailed(
org_id=org_id,
repo_id=repo_id,
client=client,
body=body,
)
).parsed
24 changes: 16 additions & 8 deletions proofline/_generated/api/default/request_patch_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ def sync_detailed(

Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's
review when one exists. The review reads only that commit and the patch, and is never posted to a
pull request. Requires live GitHub read access; the same patch on the same base always returns the
same review.
pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull
request against the patch and reports each outcome on the review, without changing the pull
request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying
the same findings, always returns the same review.

Args:
org_id (UUID):
Expand Down Expand Up @@ -118,8 +120,10 @@ def sync(

Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's
review when one exists. The review reads only that commit and the patch, and is never posted to a
pull request. Requires live GitHub read access; the same patch on the same base always returns the
same review.
pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull
request against the patch and reports each outcome on the review, without changing the pull
request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying
the same findings, always returns the same review.

Args:
org_id (UUID):
Expand Down Expand Up @@ -154,8 +158,10 @@ async def asyncio_detailed(

Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's
review when one exists. The review reads only that commit and the patch, and is never posted to a
pull request. Requires live GitHub read access; the same patch on the same base always returns the
same review.
pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull
request against the patch and reports each outcome on the review, without changing the pull
request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying
the same findings, always returns the same review.

Args:
org_id (UUID):
Expand Down Expand Up @@ -193,8 +199,10 @@ async def asyncio(

Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's
review when one exists. The review reads only that commit and the patch, and is never posted to a
pull request. Requires live GitHub read access; the same patch on the same base always returns the
same review.
pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull
request against the patch and reports each outcome on the review, without changing the pull
request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying
the same findings, always returns the same review.

Args:
org_id (UUID):
Expand Down
Loading
Loading