|
| 1 | +from huntflow_api_client.entities.base import BaseEntity, GetEntityMixin, ListEntityMixin |
| 2 | +from huntflow_api_client.models.response.survey import ( |
| 3 | + SurveyAnswerTypeAResponse, |
| 4 | + SurveySchemasTypeAListResponse, |
| 5 | + SurveySchemaTypeAResponse, |
| 6 | +) |
| 7 | + |
| 8 | + |
| 9 | +class SurveyTypeA(BaseEntity, GetEntityMixin, ListEntityMixin): |
| 10 | + async def list( |
| 11 | + self, |
| 12 | + account_id: int, |
| 13 | + active: bool = True, |
| 14 | + ) -> SurveySchemasTypeAListResponse: |
| 15 | + """ |
| 16 | + API method reference |
| 17 | + https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/surveys/type_a |
| 18 | +
|
| 19 | + :param account_id: Organization ID |
| 20 | + :param active: Shows only active schemas |
| 21 | + :return: List of all applicant feedback forms in organization. |
| 22 | + """ |
| 23 | + params = {"active": active} |
| 24 | + response = await self._api.request( |
| 25 | + "GET", |
| 26 | + f"/accounts/{account_id}/surveys/type_a", |
| 27 | + params=params, |
| 28 | + ) |
| 29 | + return SurveySchemasTypeAListResponse.model_validate(response.json()) |
| 30 | + |
| 31 | + async def get(self, account_id: int, survey_id: int) -> SurveySchemaTypeAResponse: |
| 32 | + """ |
| 33 | + API method reference |
| 34 | + https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/surveys/type_a/-survey_id- |
| 35 | +
|
| 36 | + :param account_id: Organization ID |
| 37 | + :param survey_id: Survey ID |
| 38 | + :return: An applicant feedback forms in organization. |
| 39 | + """ |
| 40 | + response = await self._api.request( |
| 41 | + "GET", |
| 42 | + f"/accounts/{account_id}/surveys/type_a/{survey_id}", |
| 43 | + ) |
| 44 | + return SurveySchemaTypeAResponse.model_validate(response.json()) |
| 45 | + |
| 46 | + async def get_applicant_answer( |
| 47 | + self, |
| 48 | + account_id: int, |
| 49 | + survey_id: int, |
| 50 | + answer_id: int, |
| 51 | + ) -> SurveyAnswerTypeAResponse: |
| 52 | + """ |
| 53 | + API method reference |
| 54 | + https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/surveys/type_a/-survey_id-/answers/-answer_id- |
| 55 | +
|
| 56 | + :param account_id: Organization ID |
| 57 | + :param survey_id: Survey ID |
| 58 | + :param answer_id: Answer ID |
| 59 | + :return: Returns answer of applicant feedback form. |
| 60 | + """ |
| 61 | + response = await self._api.request( |
| 62 | + "GET", |
| 63 | + f"/accounts/{account_id}/surveys/type_a/{survey_id}/answers/{answer_id}", |
| 64 | + ) |
| 65 | + return SurveyAnswerTypeAResponse.model_validate(response.json()) |
0 commit comments