Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statuses client #9

Merged
merged 2 commits into from
Nov 8, 2023
Merged
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
9 changes: 9 additions & 0 deletions openproject/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def __init__(self, base_url: str, api_token: str):

self.work_packages = WorkPackages(self)
self.projects = Projects(self)
self.statuses = Statuses(self)

def _handle_response(self, response: httpx.Response):
if response.status_code == 401:
Expand Down Expand Up @@ -131,3 +132,11 @@ def update(self, id: int, **kwargs):

def delete(self, id: int):
return self.client._send_request("DELETE", f"/projects/{id}")


class Statuses(SubClient):
def list(self):
return self.client._send_request("GET", "/statuses")

def view(self, id: int):
return self.client._send_request("GET", f"/statuses/{id}")