Skip to content

Commit

Permalink
feat: add get_open_api_specification method to BuildClient (#336)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danpoletaev authored Jan 27, 2025
1 parent 41b2391 commit 9ebcedb
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/apify_client/clients/resource_clients/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ def abort(self) -> dict:
"""
return self._abort()

def get_open_api_specification(self) -> dict | None:
"""Return OpenAPI specification of the Actor's build.
https://docs.apify.com/api/v2/actor-build-openapi-specification-get
Returns:
OpenAPI specification of the Actor's build.
"""
response = self.http_client.call(
url=self._url('openapi-specification'),
method='GET',
)

response_data: dict = response.json()

return response_data

def wait_for_finish(self, *, wait_secs: int | None = None) -> dict | None:
"""Wait synchronously until the build finishes or the server times out.
Expand Down Expand Up @@ -103,6 +120,23 @@ async def delete(self) -> None:
"""
return await self._delete()

async def get_open_api_specification(self) -> dict | None:
"""Return OpenAPI specification of the Actor's build.
https://docs.apify.com/api/v2/actor-build-openapi-specification-get
Returns:
OpenAPI specification of the Actor's build.
"""
response = await self.http_client.call(
url=self._url('openapi-specification'),
method='GET',
)

response_data: dict = response.json()

return response_data

async def wait_for_finish(self, *, wait_secs: int | None = None) -> dict | None:
"""Wait synchronously until the build finishes or the server times out.
Expand Down

0 comments on commit 9ebcedb

Please sign in to comment.