|
| 1 | +from typing import Dict, Optional, Union |
| 2 | + |
| 3 | +from huntflow_api_client.entities.base import BaseEntity, ListEntityMixin |
| 4 | +from huntflow_api_client.models.consts import RecommendationProcessingStatus |
| 5 | +from huntflow_api_client.models.response.recommendation import RecommendationListResponse |
| 6 | + |
| 7 | + |
| 8 | +class Recommendation(BaseEntity, ListEntityMixin): |
| 9 | + async def list( |
| 10 | + self, |
| 11 | + account_id: int, |
| 12 | + vacancy_id: int, |
| 13 | + count: int = 30, |
| 14 | + processing_status: RecommendationProcessingStatus = RecommendationProcessingStatus.ALL, |
| 15 | + next_page_cursor: Optional[str] = None, |
| 16 | + ) -> RecommendationListResponse: |
| 17 | + """ |
| 18 | + API method reference |
| 19 | + https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/recommendations/-vacancy_id- |
| 20 | +
|
| 21 | + :param account_id: Organization ID |
| 22 | + :param vacancy_id: Vacancy ID |
| 23 | + :param count: Number of items per page |
| 24 | + :param next_page_cursor: Next page cursor |
| 25 | + :param processing_status: Get all recommendations or processed/unprocessed only |
| 26 | + :return: A list of applicants recommended for a vacancy |
| 27 | + """ |
| 28 | + params: Dict[str, Union[str, int]] |
| 29 | + if next_page_cursor is not None: |
| 30 | + params = {"next_page_cursor": next_page_cursor} |
| 31 | + else: |
| 32 | + params = {"count": count} |
| 33 | + params["processing_status"] = processing_status.value |
| 34 | + |
| 35 | + response = await self._api.request( |
| 36 | + "GET", |
| 37 | + f"/accounts/{account_id}/recommendations/{vacancy_id}", |
| 38 | + params=params, |
| 39 | + ) |
| 40 | + return RecommendationListResponse.model_validate(response.json()) |
0 commit comments