Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 24c5f0f

Browse files
committed
Add api keys management methods
1 parent 376c1da commit 24c5f0f

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/facturapi/organizations.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,39 @@ def update_domain(self, organization_id: str, domain: str) -> dict:
227227
"""
228228
url = self._get_request_url([organization_id, "domain"])
229229
return self._execute_request("PUT", url, json_data={"domain": domain}).json()
230+
231+
def get_test_api_key(self, organization_id: str) -> str:
232+
"""Retrieves the test environment secret API key of an organization
233+
234+
Args:
235+
organization_id (str): ID of the organization
236+
237+
Returns:
238+
str: Test API Key
239+
"""
240+
url = self._get_request_url([organization_id, "apikeys", "test"])
241+
return self._execute_request("GET", url).json()
242+
243+
def renew_test_api_key(self, organization_id: str) -> str:
244+
"""Renews the test environment secret API key of an organization
245+
246+
Args:
247+
organization_id (str): ID of the organization
248+
249+
Returns:
250+
str: Test API Key
251+
"""
252+
url = self._get_request_url([organization_id, "apikeys", "test"])
253+
return self._execute_request("PUT", url).json()
254+
255+
def renew_live_api_key(self, organization_id: str) -> str:
256+
"""Renews the live environment secret API key of an organization
257+
258+
Args:
259+
organization_id (str): ID of the organization
260+
261+
Returns:
262+
str: Live API Key
263+
"""
264+
url = self._get_request_url([organization_id, "apikeys", "live"])
265+
return self._execute_request("PUT", url).json()

0 commit comments

Comments
 (0)