|
5 | 5 |
|
6 | 6 | class ProjectsApi: |
7 | 7 | def __init__(self, client: HttpClient, account_id: str) -> None: |
8 | | - self.account_id = account_id |
9 | | - self.client = client |
| 8 | + self._account_id = account_id |
| 9 | + self._client = client |
10 | 10 |
|
11 | 11 | def get_list(self) -> list[Project]: |
12 | | - response = self.client.get(f"/api/accounts/{self.account_id}/projects") |
| 12 | + response = self._client.get(f"/api/accounts/{self._account_id}/projects") |
13 | 13 | return [Project(**project) for project in response] |
14 | 14 |
|
15 | 15 | def get_by_id(self, project_id: int) -> Project: |
16 | | - response = self.client.get( |
17 | | - f"/api/accounts/{self.account_id}/projects/{project_id}" |
| 16 | + response = self._client.get( |
| 17 | + f"/api/accounts/{self._account_id}/projects/{project_id}" |
18 | 18 | ) |
19 | 19 | return Project(**response) |
20 | 20 |
|
21 | 21 | def create(self, project_name: str) -> Project: |
22 | | - response = self.client.post( |
23 | | - f"/api/accounts/{self.account_id}/projects", |
| 22 | + response = self._client.post( |
| 23 | + f"/api/accounts/{self._account_id}/projects", |
24 | 24 | json={"project": {"name": project_name}}, |
25 | 25 | ) |
26 | 26 | return Project(**response) |
27 | 27 |
|
28 | 28 | def update(self, project_id: int, project_name: str) -> Project: |
29 | | - response = self.client.patch( |
30 | | - f"/api/accounts/{self.account_id}/projects/{project_id}", |
| 29 | + response = self._client.patch( |
| 30 | + f"/api/accounts/{self._account_id}/projects/{project_id}", |
31 | 31 | json={"project": {"name": project_name}}, |
32 | 32 | ) |
33 | 33 | return Project(**response) |
34 | 34 |
|
35 | 35 | def delete(self, project_id: int) -> DeletedObject: |
36 | | - response = self.client.delete( |
37 | | - f"/api/accounts/{self.account_id}/projects/{project_id}", |
| 36 | + response = self._client.delete( |
| 37 | + f"/api/accounts/{self._account_id}/projects/{project_id}", |
38 | 38 | ) |
39 | 39 | return DeletedObject(**response) |
0 commit comments