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
15 changes: 15 additions & 0 deletions taskbadger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ paths:
tags:
- Task Endpoints
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'200':
Expand Down Expand Up @@ -109,6 +110,7 @@ paths:
summary: Create Payload
required: true
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'201':
Expand Down Expand Up @@ -159,6 +161,7 @@ paths:
tags:
- Task Endpoints
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'200':
Expand Down Expand Up @@ -229,6 +232,7 @@ paths:
summary: Update Payload
required: true
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'200':
Expand Down Expand Up @@ -289,6 +293,7 @@ paths:
value: 100
summary: Update Payload
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'200':
Expand Down Expand Up @@ -338,6 +343,7 @@ paths:
tags:
- Task Endpoints
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'204':
Expand Down Expand Up @@ -369,6 +375,7 @@ paths:
tags:
- Action Endpoints
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'200':
Expand Down Expand Up @@ -411,6 +418,7 @@ paths:
$ref: '#/components/schemas/ActionRequest'
required: true
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'201':
Expand Down Expand Up @@ -452,6 +460,7 @@ paths:
tags:
- Action Endpoints
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'200':
Expand Down Expand Up @@ -498,6 +507,7 @@ paths:
$ref: '#/components/schemas/ActionRequest'
required: true
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'200':
Expand Down Expand Up @@ -543,6 +553,7 @@ paths:
schema:
$ref: '#/components/schemas/PatchedActionRequest'
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'200':
Expand Down Expand Up @@ -583,6 +594,7 @@ paths:
tags:
- Action Endpoints
security:
- projectKeyAuth: []
- bearerAuth: []
responses:
'204':
Expand Down Expand Up @@ -934,6 +946,9 @@ components:
bearerAuth:
type: http
scheme: bearer
projectKeyAuth:
type: http
scheme: bearer
externalDocs:
url: https://docs.taskbadger.net
description: Task Badger Documentation
17 changes: 12 additions & 5 deletions taskbadger/internal/api/action_endpoints/action_cancel.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from http import HTTPStatus
from typing import Any, Optional, Union
from typing import Any, cast
from urllib.parse import quote
from uuid import UUID

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import Response
from ...types import UNSET, Response


def _get_kwargs(
Expand All @@ -15,15 +16,21 @@ def _get_kwargs(
task_id: str,
id: UUID,
) -> dict[str, Any]:

_kwargs: dict[str, Any] = {
"method": "delete",
"url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/{id}/",
"url": "/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/{id}/".format(
organization_slug=quote(str(organization_slug), safe=""),
project_slug=quote(str(project_slug), safe=""),
task_id=quote(str(task_id), safe=""),
id=quote(str(id), safe=""),
),
}

return _kwargs


def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None:
if response.status_code == 204:
return None

Expand All @@ -33,7 +40,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
return None


def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand Down
19 changes: 12 additions & 7 deletions taskbadger/internal/api/action_endpoints/action_create.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from http import HTTPStatus
from typing import Any, Optional, Union
from typing import Any, cast
from urllib.parse import quote

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.action import Action
from ...models.action_request import ActionRequest
from ...types import Response
from ...types import UNSET, Response


def _get_kwargs(
Expand All @@ -21,7 +22,11 @@ def _get_kwargs(

_kwargs: dict[str, Any] = {
"method": "post",
"url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/",
"url": "/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/".format(
organization_slug=quote(str(organization_slug), safe=""),
project_slug=quote(str(project_slug), safe=""),
task_id=quote(str(task_id), safe=""),
),
}

_kwargs["json"] = body.to_dict()
Expand All @@ -32,7 +37,7 @@ def _get_kwargs(
return _kwargs


def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Action]:
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Action | None:
if response.status_code == 201:
response_201 = Action.from_dict(response.json())

Expand All @@ -44,7 +49,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
return None


def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Action]:
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Action]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand Down Expand Up @@ -100,7 +105,7 @@ def sync(
*,
client: AuthenticatedClient,
body: ActionRequest,
) -> Optional[Action]:
) -> Action | None:
"""Create Action

Create an action for a task
Expand Down Expand Up @@ -173,7 +178,7 @@ async def asyncio(
*,
client: AuthenticatedClient,
body: ActionRequest,
) -> Optional[Action]:
) -> Action | None:
"""Create Action

Create an action for a task
Expand Down
21 changes: 14 additions & 7 deletions taskbadger/internal/api/action_endpoints/action_get.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from http import HTTPStatus
from typing import Any, Optional, Union
from typing import Any, cast
from urllib.parse import quote
from uuid import UUID

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.action import Action
from ...types import Response
from ...types import UNSET, Response


def _get_kwargs(
Expand All @@ -16,15 +17,21 @@ def _get_kwargs(
task_id: str,
id: UUID,
) -> dict[str, Any]:

_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/{id}/",
"url": "/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/{id}/".format(
organization_slug=quote(str(organization_slug), safe=""),
project_slug=quote(str(project_slug), safe=""),
task_id=quote(str(task_id), safe=""),
id=quote(str(id), safe=""),
),
}

return _kwargs


def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Action]:
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Action | None:
if response.status_code == 200:
response_200 = Action.from_dict(response.json())

Expand All @@ -36,7 +43,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
return None


def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Action]:
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Action]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand Down Expand Up @@ -92,7 +99,7 @@ def sync(
id: UUID,
*,
client: AuthenticatedClient,
) -> Optional[Action]:
) -> Action | None:
"""Get Action

Fetch an action
Expand Down Expand Up @@ -165,7 +172,7 @@ async def asyncio(
id: UUID,
*,
client: AuthenticatedClient,
) -> Optional[Action]:
) -> Action | None:
"""Get Action

Fetch an action
Expand Down
Loading
Loading