8000 feat: add `get_open_api_specification` method to `BuildClient` (#336) · apify/apify-client-python@9ebcedb · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ebcedb

Browse files
authored
feat: add get_open_api_specification method to BuildClient (#336)
Recently we've introduced new endpoint: `/v2/actor-builds/:buildId/openapi-specification` **This PR adds this endpoint to BuildClient** P.S. The link to the documentation is correct, but docs are not yet merged into production. I'll merge this PR after the docs are merged.
1 parent 41b2391 commit 9ebcedb

File tree

1 file changed

+34
-0
lines changed
  • src/apify_client/clients/resource_clients

1 file changed

+34
-0
lines changed

src/apify_client/clients/resource_clients/build.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,23 @@ def abort(self) -> dict:
4343
"""
4444
return self._abort()
4545

46+
def get_open_api_specification(self) -> dict | None:
47+
"""Return OpenAPI specification of the Actor's build.
48+
49+
https://docs.apify.com/api/v2/actor-build-openapi-specification-get
50+
51+
Returns:
52+
OpenAPI specification of the Actor's build.
53+
"""
54+
response = self.http_client.call(
55+
url=self._url('openapi-specification'),
56+
method='GET',
57+
)
58+
59+
response_data: dict = response.json()
60+
61+
return response_data
62+
4663
def wait_for_finish(self, *, wait_secs: int | None = None) -> dict | None:
4764
"""Wait synchronously until the build finishes or the server times out.
4865
@@ -103,6 +120,23 @@ async def delete(self) -> None:
103120
"""
104121
return await self._delete()
105122

123+
async def get_open_api_specification(self) -> dict | None:
124+
"""Return OpenAPI specification of the Actor's build.
125+
126+
https://docs.apify.com/api/v2/actor-build-openapi-specification-get
127+
128+
Returns:
129+
OpenAPI specification of the Actor's build.
130+
"""
131+
response = await self.http_client.call(
132+
url=self._url('openapi-specification'),
133+
method='GET',
134+
)
135+
136+
response_data: dict = response.json()
137+
138+
return response_data
139+
106140
async def wait_for_finish(self, *, wait_secs: int | None = None) -> dict | None:
107141
"""Wait synchronously until the build finishes or the server times out.
108142

0 commit comments

Comments
 (0)
0