### Install affinda via pip Source: https://github.com/affinda/affinda-python/blob/master/README.md Install the Affinda Python client library using pip. ```shell pip install affinda ``` -------------------------------- ### AffindaAPI.__init__ (patched, exported) — signature from affinda/_patch.py Source: https://github.com/affinda/affinda-python The patched AffindaAPI constructor that users receive. It accepts a TokenCredential and optional kwargs; if base_url is not provided, it defaults to 'https://{region}.affinda.com'. It installs BearerTokenWithoutTLSEnforcementPolicy unless authentication_policy is already in kwargs, and builds the configuration and pipeline client. ```python class AffindaAPI(AffindaAPIGenerated): def __init__( self, credential, # type: "TokenCredential" **kwargs, # type: Any ): if "base_url" not in kwargs: _base_url = "https://{region}.affinda.com" else: _base_url = kwargs.pop("base_url") if "authentication_policy" not in kwargs: kwargs["authentication_policy"] = BearerTokenWithoutTLSEnforcementPolicy(credential) self._config = AffindaAPIConfiguration(credential=credential, **kwargs) self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) ... ``` -------------------------------- ### Using AffindaAPI as context manager Source: https://github.com/affinda/affinda-python Example of using AffindaAPI with a context manager to automatically close the pipeline. Requires a TokenCredential with a valid API key. The pipeline is closed automatically after the with block. ```python from affinda import AffindaAPI, TokenCredential with AffindaAPI(credential=TokenCredential(token="KEY")) as client: docs = client.get_all_documents(limit=10) # pipeline closed automatically ``` -------------------------------- ### getAllInvitations - Get list of all invitations Source: https://github.com/affinda/affinda-python/blob/master/docs/samples_python.md Retrieves all invitations for the organization. Requires a valid token. ```python from affinda import AffindaAPI, TokenCredential token = "REPLACE_TOKEN" credential = TokenCredential(token=token) client = AffindaAPI(credential=credential) invitations = client.get_all_invitations() print(invitations.as_dict()) ``` -------------------------------- ### GET /v3/workspaces/{identifier}/usage Source: https://github.com/affinda/affinda-python Retrieves monthly credits consumption for a workspace. Optionally filter by start and end month. ```APIDOC ## GET /v3/workspaces/{identifier}/usage ### Description Retrieves monthly credits consumption for a workspace. ### Method GET ### Endpoint /v3/workspaces/{identifier}/usage ### Parameters #### Path Parameters - **identifier** (string) - Required - Workspace identifier. #### Query Parameters - **start** (string) - Optional - Start month (YYYY-MM). - **end** (string) - Optional - End month (YYYY-MM). ### Response #### Success Response (200) Returns a list of UsageByWorkspace objects, each with: - **month** (string) - Month. - **count** (integer) - Usage count. ``` -------------------------------- ### Quickstart: Parse a resume with AffindaAPI Source: https://github.com/affinda/affinda-python/blob/master/README.md Set up the Affinda client with a token credential, upload a document, and access parsed data. Replace API_KEY, WORKSPACE_ID, and FILE_PATH with your own values. ```python from pathlib import Path from affinda import AffindaAPI, TokenCredential API_KEY = "YOUR_API_KEY" # replace with your actual key WORKSPACE_ID = "YOUR_WORKSPACE_IDENTIFIER" # e.g. "vBAdDBer" FILE_PATH = Path("resume.pdf") # path to the résumé you want to parse # Set up the client credential = TokenCredential(token=API_KEY) client = AffindaAPI(credential=credential) # Upload the document and wait until processing finishes with FILE_PATH.open("rb") as f: doc = client.create_document( file=f, workspace=WORKSPACE_ID, ) # Access parsed data print(doc.data) ``` -------------------------------- ### GET /v3/collections/{identifier}/usage Source: https://github.com/affinda/affinda-python Retrieves usage statistics for a collection, optionally filtered by start and end months. ```APIDOC ## [GET] /v3/collections/{identifier}/usage ### Description Retrieves usage statistics for a collection, optionally filtered by start and end months. ### Method GET ### Endpoint /v3/collections/{identifier}/usage ### Parameters #### Path Parameters - **identifier** (str) - Required - Collection identifier. #### Query Parameters - **start** (Optional[str]) - Optional - Start month. - **end** (Optional[str]) - Optional - End month. ### Response #### Success Response (200) - **List[UsageByCollection]** - List of usage records with month and count. ``` -------------------------------- ### Async client basic usage example Source: https://github.com/affinda/affinda-python Shows how to use the async client: create an AffindaAPI instance with an AsyncTokenCredential, then call create_document asynchronously. Requires an API key and a workspace ID. ```python import asyncio from affinda.aio import AffindaAPI, AsyncTokenCredential async def main(): async with AffindaAPI(credential=AsyncTokenCredential(token="YOUR_API_KEY")) as client: doc = await client.create_document( file=open("resume.pdf", "rb"), workspace="vBAdDBer", ) print(doc.data) asyncio.run(main()) ``` -------------------------------- ### ResumeSkillSourcesItem.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a ResumeSkillSourcesItem instance. This constructor accepts keyword arguments for the section and position fields. ```APIDOC ## ResumeSkillSourcesItem.__init__ ### Description Initializes a ResumeSkillSourcesItem instance. This constructor accepts keyword arguments for the section and position fields. ### Method Constructor ### Signature ```python def __init__(**kwargs) ``` ### Parameters #### Keyword Arguments - **section** (str or ~affinda.models.ResumeSkillSourcesItemSection) - Optional - Known values are: "Achievements", "AdditionalInformation", "Education", "Extracurriculars", "Organisations", "Other", "PersonalDetails", "Projects", "Publications", "Referees", "Skills", "Summary", "Training", "WorkExperience", "NotPopulated", "Header", "Footer", "Skills/Interests/Languages", "Training/Certifications", "Extracurriculars/Leadership". - **position** (int) - Optional - Position of the source item. ``` -------------------------------- ### GET /v3/collections/{identifier}/usage Source: https://github.com/affinda/affinda-python Retrieves usage statistics for a specific collection. Supports a date range via start and end query parameters. ```APIDOC ## GET /v3/collections/{identifier}/usage ### Description Retrieves usage statistics for a specific collection. Supports a date range via start and end query parameters. ### Method GET ### Endpoint /v3/collections/{identifier}/usage ### Parameters #### Path Parameters - **identifier** (string) - Required - The collection identifier #### Query Parameters - **start** (string) - Optional - Start date - **end** (string) - Optional - End date ### Response #### Success Response (200) - Usage statistics ``` -------------------------------- ### Show generate_models help Source: https://github.com/affinda/affinda-python/blob/master/README.md Display all available options for the generate_models command. ```bash python -m affinda generate_models --help ``` -------------------------------- ### BearerTokenWithoutTLSEnforcementPolicy class Source: https://github.com/affinda/affinda-python Internal policy that sets enforce_https = False on every request, allowing the client to communicate with http:// hosts (e.g., local dev servers). Installed by default by the patched AffindaAPI constructor unless authentication_policy is supplied. ```python class BearerTokenWithoutTLSEnforcementPolicy(BearerTokenCredentialPolicy): def on_request(self, request: PipelineRequest): request.context.options["enforce_https"] = False return super().on_request(request) ``` -------------------------------- ### getUsageByCollection - Get usage by collection Source: https://github.com/affinda/affinda-python/blob/master/docs/samples_python.md Retrieves usage statistics for a collection within a specified date range. Requires a valid token and collection identifier. Uses start and end parameters (e.g., "2023-06" to "2023-07"). Prints each usage record as a dictionary. ```python from affinda import AffindaAPI, TokenCredential token = "REPLACE_TOKEN" collection_identifier = "REPLACE_IDENTIFIER" credential = TokenCredential(token=token) client = AffindaAPI(credential=credential) res = client.get_usage_by_collection(collection_identifier, start="2023-06", end="2023-07") for usage in res: print(usage.as_dict()) # noqa: T201 ``` -------------------------------- ### Workspace.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a new Workspace instance. All required parameters must be provided to send to Azure. ```APIDOC ## Workspace.__init__ ### Description Initializes a new Workspace instance. All required parameters must be provided to send to Azure. ### Method Constructor ### Parameters #### Arguments - `identifier` (str) - Required - Uniquely identify a workspace. - `organization` (Organization) - Optional - Organization associated with the workspace. - `name` (str) - Optional - Name of the workspace. - `visibility` (str or WorkspaceVisibility) - Optional - Visibility of the workspace. Known values: "organization", "private". - `collections` (list[WorkspaceCollectionsItem]) - Optional - Collections associated with the workspace. - `document_types` (list[str]) - Optional - Document types associated with this workspace. - `reject_invalid_documents` (bool) - Optional - If true, uploaded document will be rejected if wrong type or cannot be determined. - `reject_duplicates` (bool) - Optional - If true, parsing fails on duplicate documents; if false, parses normally. - `members` (list[User]) - Optional - Members of the workspace. - `unvalidated_docs_count` (int) - Optional - Number of unvalidated documents in the workspace. - `confirmed_docs_count` (int) - Optional - Number of validated documents in the workspace. - `ingest_email` (str) - Optional - Email address for ingesting documents. - `whitelist_ingest_addresses` (list[str]) - Optional - Allowed email addresses for ingestion. - `document_splitter` (WorkspaceDocumentSplitter) - Optional - Document splitter configuration. ### Response No return value. ``` -------------------------------- ### ThemeConfigPalette.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a ThemeConfigPalette instance. This constructor accepts keyword arguments for each palette property, such as mode, background, text, and various color options. ```APIDOC ## ThemeConfigPalette.__init__ ### Description Initializes a ThemeConfigPalette instance. This constructor accepts keyword arguments for each palette property, such as mode, background, text, and various color options. ### Method Constructor ### Signature ```python def __init__(**kwargs) ``` ### Parameters #### Keyword Arguments - **mode** (str or ~affinda.models.ThemeConfigPaletteMode) - Optional - Known values are: "light", "dark". - **background** (any) - Optional - Anything. - **text** (~affinda.models.ThemeConfigPaletteText) - Optional - - **divider** (str) - Optional - - **primary** (~affinda.models.PaletteColorOptions) - Optional - - **secondary** (~affinda.models.PaletteColorOptions) - Optional - - **success** (~affinda.models.PaletteColorOptions) - Optional - - **annotation** (~affinda.models.PaletteColorOptions) - Optional - - **error** (~affinda.models.PaletteColorOptions) - Optional - - **info** (~affinda.models.PaletteColorOptions) - Optional - - **warning** (~affinda.models.PaletteColorOptions) - Optional - ### Response No return value. ``` -------------------------------- ### get_all_documents usage example Source: https://github.com/affinda/affinda-python Example of calling get_all_documents with filters and iterating over the results. Requires a valid API key. ```python from affinda import AffindaAPI, TokenCredential client = AffindaAPI(credential=TokenCredential(token="KEY")) page = client.get_all_documents( workspace="vBAdDBer", state="validated", ordering=["-created_dt"], limit=50, include_data=True, ) for summary in page.results: print(summary.identifier, summary.data) ``` -------------------------------- ### Resume.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a Resume object, which inherits from Document. This model represents a resume document in the Affinda API. ```APIDOC ## Resume.__init__ ### Description Initializes a Resume object with required parameters. ### Method Constructor ### Parameters #### Arguments - **meta** (~affinda.models.DocumentMeta) - Required - Metadata for the document. - **error** (~affinda.models.DocumentError) - Optional - Error information. - **warnings** (list[~affinda.models.DocumentWarning]) - Optional - List of warnings. - **data** (~affinda.models.ResumeData) - Optional - A JSON-encoded string of the ResumeData object. ### Response No return value. ``` -------------------------------- ### ResumeSearchConfig.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a new instance of the ResumeSearchConfig class. This constructor accepts keyword arguments for all configurable properties of the resume search configuration. ```APIDOC ## ResumeSearchConfig.__init__ ### Description Initializes a new instance of the ResumeSearchConfig class. This constructor accepts keyword arguments for all configurable properties of the resume search configuration. ### Method Constructor ### Signature ```python def __init__(**kwargs) ``` ### Parameters #### Keyword Arguments - **allow_pdf_download** (bool) - Optional - - **max_results** (int) - Optional - Maximum number of results that can be returned. Setting to "null" means no limitation. - **display_job_title** (bool) - Optional - - **display_location** (bool) - Optional - - **display_years_experience** (bool) - Optional - - **display_occupation_group** (bool) - Optional - - **display_education** (bool) - Optional - - **display_skills** (bool) - Optional - - **display_languages** (bool) - Optional - - **display_management_level** (bool) - Optional - - **display_keywords** (bool) - Optional - - **weight_job_title** (float) - Optional - - **weight_location** (float) - Optional - - **weight_years_experience** (float) - Optional - - **weight_occupation_group** (float) - Optional - - **weight_education** (float) - Optional - - **weight_skills** (float) - Optional - - **weight_languages** (float) - Optional - - **weight_management_level** (float) - Optional - - **weight_keywords** (float) - Optional - - **indices** (list[str]) - Optional - List of index names. - **show_index_dropdown** (bool) - Optional - Controls whether or not the index dropdown is displayed to the user. - **search_tool_theme** (~affinda.models.ResumeSearchConfigSearchToolTheme) - Optional - Customize the theme of the embeded search tool. - **actions** (list[~affinda.models.SearchConfigAction]) - Optional - A list of actions to show in the dropdown in the embedded search tool. - **hide_toolbar** (bool) - Optional - Hide the reset/import toolbar. - **hide_side_panel** (bool) - Optional - Hide the entire side panel. - **custom_fields_config** (list[~affinda.models.CustomFieldConfig]) - Optional - - **distance_unit** (str or ~affinda.models.ResumeSearchConfigDistanceUnit) - Optional - The unit of distance to use for location based searches. Known values are: "mi", "km". ### Response No return value. ``` -------------------------------- ### get_resume_search_suggestion_skill Source: https://github.com/affinda/affinda-python/blob/master/docs/sync_operations.md Get skill suggestions based on provided skill(s). Provided one or more skills, get related suggestions for your search. ```APIDOC ## get_resume_search_suggestion_skill ### Description Get skill suggestions based on provided skill(s). Provided one or more skills, get related suggestions for your search. ### Method Function call ### Signature ```python def get_resume_search_suggestion_skill(skills, **kwargs) ``` ### Parameters - `skills` (`list[str]`) - Required - Skill to query suggestions for. - `cls` (`callable`) - Optional - A custom type or function that will be passed the direct response. ### Returns `list[str]`: list of str, or the result of cls(response) ### Raises - `None`: ~azure.core.exceptions.HttpResponseError ``` -------------------------------- ### ResumeSearchParameters.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a new instance of the ResumeSearchParameters class. All required parameters must be populated in order to send to Azure. ```APIDOC ## ResumeSearchParameters.__init__ ### Description Initializes a new instance of the ResumeSearchParameters class. All required parameters must be populated in order to send to Azure. ### Method Constructor ### Parameters #### Arguments - **indices** (list[str]) - Required - - **job_description** (str) - Optional - A random string that uniquely identify the resource. - **resume** (str) - Optional - A random string that uniquely identify the resource. - **job_titles** (list[str]) - Optional - - **job_titles_current_only** (bool) - Optional - Search only through the canditate's current job. - **job_titles_required** (bool) - Optional - - **job_titles_weight** (float) - Optional - - **years_experience_min** (int) - Optional - Minimum years of total work experience. - **years_experience_max** (int) - Optional - Maximum years of total work experience. - **years_experience_required** (bool) - Optional - - **years_experience_weight** (float) - Optional - - **locations** (list[~affinda.models.ResumeSearchParametersLocation]) - Optional - Search by location name or by coordinates. - **locations_weight** (float) - Optional - - **locations_required** (bool) - Optional - - **skills** (list[~affinda.models.ResumeSearchParametersSkill]) - Optional - - **skills_weight** (float) - Optional - - **languages** (list[~affinda.models.ResumeSearchParametersSkill]) - Optional - - **languages_weight** (float) - Optional - - **institutions** (list[str]) - Optional - - **institutions_required** (bool) - Optional - - **degrees** (list[str]) - Optional - - **degrees_required** (bool) - Optional - - **highest_degree_types** (list[str or ~affinda.models.EducationLevel]) - Optional - - **highest_degree_types_required** (bool) - Optional - - **is_current_student** (bool) - Optional - Search for student canditates. - **is_current_student_required** (bool) - Optional - - **is_recent_graduate** (bool) - Optional - Search for canditates that graduated less than a year ago. - **is_recent_graduate_required** (bool) - Optional - - **education_weight** (float) - Optional - - **search_expression** (str) - Optional - Search through resumes' raw text. - **search_expression_required** (bool) - Optional - - **search_expression_weight** (float) - Optional - - **soc_codes** (list[int]) - Optional - - **soc_codes_weight** (float) - Optional - - **soc_codes_required** (bool) - Optional - - **management_level** (str or ~affinda.models.ManagementLevel) - Optional - Known values are: "None", "Low", "Mid", "Upper". - **management_level_required** (bool) - Optional - - **management_level_weight** (float) - Optional - - **custom_data** (list[~affinda.models.ResumeSearchParametersCustomData]) - Optional - ### Response No response body. ``` -------------------------------- ### update_document usage example Source: https://github.com/affinda/affinda-python Example of updating a document by renaming it, setting an expiry time, and confirming it. Uses DocumentUpdate with optional fields and prints the updated file name. ```python import datetime from affinda import AffindaAPI, TokenCredential from affinda.models import DocumentUpdate client = AffindaAPI(credential=TokenCredential(token="KEY")) body = DocumentUpdate( file_name="renamed.pdf", expiry_time=datetime.datetime(2030, 12, 31, 23, 59, 59), is_confirmed=True, ) updated = client.update_document("dABC123", body) print(updated.meta.file_name) ``` -------------------------------- ### get_resume_search_suggestion_job_title Source: https://github.com/affinda/affinda-python/blob/master/docs/sync_operations.md Get job title suggestions based on provided job title(s). Provided one or more job titles, get related suggestions for your search. ```APIDOC ## get_resume_search_suggestion_job_title ### Description Get job title suggestions based on provided job title(s). Provided one or more job titles, get related suggestions for your search. ### Method Function call ### Signature ```python def get_resume_search_suggestion_job_title(job_titles, **kwargs) ``` ### Parameters - `job_titles` (`list[str]`) - Required - Job title to query suggestions for. - `cls` (`callable`) - Optional - A custom type or function that will be passed the direct response. ### Returns `list[str]`: list of str, or the result of cls(response) ### Raises - `None`: ~azure.core.exceptions.HttpResponseError ``` -------------------------------- ### Basic AffindaAPI client creation with TokenCredential Source: https://github.com/affinda/affinda-python Creates an AffindaAPI client using a TokenCredential with your API key and the 'api' region (or Region.API_EU1 for EU). Then fetches a document by ID and prints it as a dictionary. ```python from affinda import AffindaAPI, TokenCredential client = AffindaAPI( credential=TokenCredential(token="YOUR_API_KEY"), region="api", # or Region.API_EU1 for the EU region ) doc = client.get_document("dABC123") print(doc.as_dict()) ``` -------------------------------- ### getResumeSearchSuggestionSkill - Get skill suggestions Source: https://github.com/affinda/affinda-python/blob/master/docs/samples_python.md Uses the AffindaAPI client to get suggested skills based on provided skills. Replace the token with a valid API token. ```python from affinda import AffindaAPI, TokenCredential token = "REPLACE_TOKEN" credential = TokenCredential(token=token) client = AffindaAPI(credential=credential) suggested_skills = client.get_resume_search_suggestion_skill(["Javascript", "Python"]) print(suggested_skills) ``` -------------------------------- ### DataPoint.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a new DataPoint object. All required parameters must be provided to send to Azure. ```APIDOC ## DataPoint.__init__ ### Description Initializes a new DataPoint object. All required parameters must be provided to send to Azure. ### Method Constructor ### Parameters - `identifier` (str) - Required - Uniquely identify a data point. - `name` (str) - Required - Name of the data point. - `slug` (str) - Required - A camelCase string that will be used as the key in the API response. - `description` (str) - Optional - Description of the data point. - `annotation_content_type` (str or AnnotationContentType) - Required - The different data types of annotations. Known values are: "text", "integer", "float", "decimal", "date", "datetime", "daterange", "boolean", "enum", "location", "phonenumber", "json", "table", "expectedremuneration", "jobtitle", "language", "skill", "yearsexperience", "group", "table_deprecated", "url", "image", "docclf". - `organization` (Organization) - Required - The organization associated with the data point. - `extractor` (str) - Required - Uniquely identify an extractor. - `multiple` (bool) - Optional - Indicates if multiple values are allowed. - `no_rect` (bool) - Optional - Indicates if no rectangle is required. - `parent` (str) - Optional - The identifier of the parent data point if applicable. - `children` (list[DataPoint]) - Optional - List of child data points. - `available_data_sources` (list[MappingDataSource]) - Optional - List of available data sources. - `mapping_data_source` (str) - Optional - If populated, the model will learn to predict this field using the data source, rather than relying on fuzzy string matching. - `manual_entry` (bool) - Optional - If true, the model will not be used to predict this data point. Instead, the user will be able to manually enter the value in the validation tool. ### Response No return value. ``` -------------------------------- ### Example: edit_document_pages usage Source: https://github.com/affinda/affinda-python Example usage of edit_document_pages with a client created using AffindaAPI and TokenCredential. Creates a DocumentEditRequest with a single split for pages [0, 1] and prints the identifiers of the resulting documents. ```python from affinda import AffindaAPI, TokenCredential from affinda.models import DocumentEditRequest, DocumentSplit client = AffindaAPI(credential=TokenCredential(token="KEY")) body = DocumentEditRequest(splits=[DocumentSplit(pages=[0, 1])]) metas = client.edit_document_pages("dABC123", body) for meta in metas: print(meta.identifier) ``` -------------------------------- ### ResumeRedact.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a ResumeRedact object with required meta and optional error, warnings, and data fields. ```APIDOC ## ResumeRedact.__init__ ### Description Initializes a ResumeRedact object with required meta and optional error, warnings, and data fields. ### Method Constructor ### Parameters #### Keyword Arguments - **meta** (~affinda.models.DocumentMeta) - Required - Metadata for the document. - **error** (~affinda.models.DocumentError) - Optional - Error information. - **warnings** (list[~affinda.models.DocumentWarning]) - Optional - List of warnings. - **data** (~affinda.models.ResumeRedactData) - Optional - Redacted resume data. ### Response No return value. ``` -------------------------------- ### ResumeSearchMatchDetails.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a ResumeSearchMatchDetails object with optional keyword arguments for various search score components. ```APIDOC ## ResumeSearchMatchDetails.__init__ ### Description Initializes a ResumeSearchMatchDetails object with optional keyword arguments for various search score components. ### Method Constructor ### Parameters #### Keyword Arguments - **job_title** (JobTitleSearchScoreComponent) - Optional - Job title score component. - **management_level** (ManagementLevelSearchScoreComponent) - Optional - Management level score component. - **experience** (ExperienceSearchScoreComponent) - Optional - Experience score component. - **skills** (SkillsSearchScoreComponent) - Optional - Skills score component. - **languages** (LanguagesSearchScoreComponent) - Optional - Languages score component. - **location** (LocationSearchScoreComponent) - Optional - Location score component. - **education** (EducationSearchScoreComponent) - Optional - Education score component. - **occupation_group** (OccupationGroupSearchScoreComponent) - Optional - Occupation group score component. - **search_expression** (SearchExpressionSearchScoreComponent) - Optional - Search expression score component. ### Response No return value. ``` -------------------------------- ### getResumeSearchSuggestionJobTitle - Get job title suggestions Source: https://github.com/affinda/affinda-python/blob/master/docs/samples_python.md Uses the AffindaAPI client to get suggested job titles based on provided job titles. Replace the token with a valid API token. ```python from affinda import AffindaAPI, TokenCredential token = "REPLACE_TOKEN" credential = TokenCredential(token=token) client = AffindaAPI(credential=credential) suggested_job_titles = client.get_resume_search_suggestion_job_title(["Software Developer", "Team Lead"]) print(suggested_job_titles) ``` -------------------------------- ### ThemeConfigPaletteText.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a ThemeConfigPaletteText instance. This constructor accepts keyword arguments for the text color properties: primary, secondary, and disabled. ```APIDOC ## ThemeConfigPaletteText.__init__ ### Description Initializes a ThemeConfigPaletteText instance. This constructor accepts keyword arguments for the text color properties: primary, secondary, and disabled. ### Method Constructor ### Signature ```python def __init__(**kwargs) ``` ### Parameters #### Keyword Arguments - **primary** (str) - Optional - - **secondary** (str) - Optional - - **disabled** (str) - Optional - ### Response No return value. ``` -------------------------------- ### GET /v3/workspace_memberships Source: https://github.com/affinda/affinda-python Retrieves all workspace memberships. ```APIDOC ## GET /v3/workspace_memberships ### Description Retrieves all workspace memberships. ### Method GET ### Endpoint /v3/workspace_memberships ### Response #### Success Response (200) - **results** (array) - List of workspace memberships. ``` -------------------------------- ### ResumeSearchResult.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a new instance of the ResumeSearchResult class. All required parameters must be provided to send to Azure. ```APIDOC ## ResumeSearchResult.__init__ ### Description Initializes a new instance of the ResumeSearchResult class. All required parameters must be provided to send to Azure. ### Method Constructor ### Parameters #### Keyword Arguments - **identifier** (str) - Required - A random string that uniquely identify the resource. - **score** (float) - Required - - **pdf** (str) - Required - - **name** (str) - Optional - - **job_title** (~affinda.models.JobTitleSearchScoreComponent) - Required - - **management_level** (~affinda.models.ManagementLevelSearchScoreComponent) - Required - - **experience** (~affinda.models.ExperienceSearchScoreComponent) - Required - - **skills** (~affinda.models.SkillsSearchScoreComponent) - Required - - **languages** (~affinda.models.LanguagesSearchScoreComponent) - Required - - **location** (~affinda.models.LocationSearchScoreComponent) - Required - - **education** (~affinda.models.EducationSearchScoreComponent) - Required - - **occupation_group** (~affinda.models.OccupationGroupSearchScoreComponent) - Required - - **search_expression** (~affinda.models.SearchExpressionSearchScoreComponent) - Required - - **custom_data** (dict[str, ~affinda.models.ComponentsNqbw24SchemasCustomdatasearchscorecomponentAdditionalproperties]) - Required - Dictionary of custom data search score components. ### Response No return value. ``` -------------------------------- ### GET /v3/resume_search/config Source: https://github.com/affinda/affinda-python Retrieves the resume search configuration. ```APIDOC ## GET /v3/resume_search/config ### Description Retrieves the resume search configuration. ### Method GET ### Endpoint /v3/resume_search/config ### Response #### Success Response (200) - **config** (object) - Resume search configuration ``` -------------------------------- ### CollectionCreate.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a new CollectionCreate object with required and optional parameters for creating a collection in the Affinda API. ```APIDOC ## CollectionCreate.__init__ ### Description Initializes a new CollectionCreate object with required and optional parameters for creating a collection in the Affinda API. ### Method Constructor ### Parameters #### Arguments - **name** (str) - Required - The name of the collection. - **workspace** (str) - Required - Uniquely identify a workspace. - **extractor** (str) - Optional - Uniquely identify an extractor. Required if you are not a super user. - **base_extractor** (str) - Optional - Not applicable, please leave empty. This feature is reserved for super user. - **auto_validation_threshold** (float) - Optional - Auto validation threshold value. - **enable_auto_validation_threshold** (bool) - Optional - Enable auto validation threshold. - **fields** (list[~affinda.models.FieldGroup]) - Optional - List of field groups. - **fields_layout** (~affinda.models.FieldsLayout) - Optional - Fields layout configuration. - **date_format_preference** (str or ~affinda.models.DateFormatPreference) - Optional - Known values are: "DMY", "MDY", "YMD". - **date_format_from_document** (bool) - Optional - Predict the date format from any dates in the document that is not ambiguous. - **extractor_config** (~affinda.models.ExtractorConfig) - Optional - Extra configurations specific to an extractor. - **allow_openai** (bool) - Optional - Whether to allow OpenAI API to be used to assist in creating a model for this collection. - **trains_extractor** (bool) - Optional - Whether this collection feeds documents into the extractor's training queue. This setting can only be toggled for custom extractors. - **disable_confirmation_if_validation_rules_fail** (bool) - Optional - If True, users cannot validate documents with missing mandatory fields, or failing validation rules. ### Response No return value. ``` -------------------------------- ### get_extractor Source: https://github.com/affinda/affinda-python/blob/master/docs/sync_operations.md Get specific extractor. Return a specific extractor. ```APIDOC ## get_extractor ### Description Get specific extractor. Return a specific extractor. ### Method GET ### Endpoint Not specified ### Parameters #### Path Parameters - **identifier** (str) - Required - Extractor's identifier. #### Query Parameters - **cls** (callable) - Optional - A custom type or function that will be passed the direct response ### Response #### Success Response (200) - **~affinda.models.Extractor** - Extractor, or the result of cls(response) ### Raises - None: ~azure.core.exceptions.HttpResponseError ``` -------------------------------- ### AffindaAPI async __init__ (patched) Source: https://github.com/affinda/affinda-python Patched async constructor for AffindaAPI. Sets default base_url to https://{region}.affinda.com, installs AsyncBearerTokenWithoutTLSEnforcementPolicy if no authentication_policy is provided, and initializes configuration and AsyncPipelineClient. ```python class AffindaAPI(AffindaAPIGenerated): def __init__( self, credential, # type: "IAsyncTokenCredential" region="api", # type: Union[str, "_models.Region"] **kwargs, # type: Any ): if "base_url" not in kwargs: _base_url = "https://{region}.affinda.com" else: _base_url = kwargs.pop("base_url") if "authentication_policy" not in kwargs: kwargs["authentication_policy"] = AsyncBearerTokenWithoutTLSEnforcementPolicy( credential ) self._config = AffindaAPIConfiguration(credential=credential, region=region, **kwargs) self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) ``` -------------------------------- ### GET /v3/mappings/{identifier} Source: https://github.com/affinda/affinda-python Retrieves a specific mapping by its identifier. ```APIDOC ## [GET] /v3/mappings/{identifier} ### Description Retrieves a specific mapping by its identifier. ### Method GET ### Endpoint /v3/mappings/{identifier} ### Parameters #### Path Parameters - **identifier** (string) - Required - The identifier of the mapping ### Response #### Success Response (200) - Mapping details ``` -------------------------------- ### Meta.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a new instance of the Meta class. This constructor accepts keyword arguments for all document metadata fields. ```APIDOC ## Meta.__init__ ### Description Initializes a new instance of the Meta class. This constructor accepts keyword arguments for all document metadata fields. ### Method Constructor ### Parameters #### Keyword Arguments - **identifier** (str) - Optional - Unique identifier for the document. - **custom_identifier** (str) - Optional - Optional identifier for the document that you can set to track the document in the Affinda system. Is not required to be unique. - **file_name** (str) - Optional - Optional filename of the file. - **ready** (bool) - Optional - If true, the document has finished processing. Particularly useful if an endpoint request specified wait=False, when polling use this variable to determine when to stop polling. - **ready_dt** (datetime) - Optional - The datetime when the document was ready. - **failed** (bool) - Optional - If true, some exception was raised during processing. Check the 'error' field of the main return object. - **expiry_time** (datetime) - Optional - The date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry. - **language** (str) - Optional - The document's language. - **pdf** (str) - Optional - The URL to the document's pdf (if the uploaded document is not already pdf, it's converted to pdf as part of the parsing process). - **parent_document** (MetaParentDocument) - Optional - If this document is part of a splitted document, this attribute points to the original document that this document is splitted from. - **child_documents** (list[MetaChildDocumentsItem]) - Optional - If this document has been splitted into a number of child documents, this attribute points to those child documents. - **pages** (list[PageMeta]) - Optional - The document's pages. - **is_verified** (bool) - Optional - This is true if the 'confirm' button has been clicked in the Affinda validation tool. - **review_url** (str) - Optional - Signed URL (valid for 60 minutes) to access the validation tool. Not applicable for documents types such a resumes. - **ocr_confidence** (float) - Optional - The overall confidence in the conversion of image to text. (only applicable for images or PDF documents without a text layer). - **created_dt** (datetime) - Optional - No description provided. - **document_type** (str) - Optional - No description provided. - **region_bias** (RegionBias) - Optional - No description provided. - **is_ocrd** (bool) - Optional - No description provided. ### Response #### Success Response - **identifier** (str) - Unique identifier for the document. - **custom_identifier** (str) - Optional identifier for the document that you can set to track the document in the Affinda system. Is not required to be unique. - **file_name** (str) - Optional filename of the file. - **ready** (bool) - If true, the document has finished processing. Particularly useful if an endpoint request specified wait=False, when polling use this variable to determine when to stop polling. - **ready_dt** (datetime) - The datetime when the document was ready. - **failed** (bool) - If true, some exception was raised during processing. Check the 'error' field of the main return object. - **expiry_time** (datetime) - The date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry. - **language** (str) - The document's language. - **pdf** (str) - The URL to the document's pdf (if the uploaded document is not already pdf, it's converted to pdf as part of the parsing process). - **parent_document** (MetaParentDocument) - If this document is part of a splitted document, this attribute points to the original document that this document is splitted from. - **child_documents** (list[MetaChildDocumentsItem]) - If this document has been splitted into a number of child documents, this attribute points to those child documents. - **pages** (list[PageMeta]) - The document's pages. - **is_verified** (bool) - This is true if the 'confirm' button has been clicked in the Affinda validation tool. - **review_url** (str) - Signed URL (valid for 60 minutes) to access the validation tool. Not applicable for documents types such a resumes. - **ocr_confidence** (float) - The overall confidence in the conversion of image to text. (only applicable for images or PDF documents without a text layer). - **created_dt** (datetime) - No description provided. - **document_type** (str) - No description provided. - **region_bias** (RegionBias) - No description provided. - **is_ocrd** (bool) - No description provided. ``` -------------------------------- ### ResumeSearchMatch.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes a ResumeSearchMatch object with optional keyword arguments for score and details. ```APIDOC ## ResumeSearchMatch.__init__ ### Description Initializes a ResumeSearchMatch object with optional keyword arguments for score and details. ### Method Constructor ### Parameters #### Keyword Arguments - **score** (float) - Optional - The matching score between the provided resume and job description. - **details** (ResumeSearchMatchDetails) - Optional - Details of the match. ### Response No return value. ``` -------------------------------- ### GET /v3/invitations/{identifier} Source: https://github.com/affinda/affinda-python Retrieves a specific invitation by its identifier. ```APIDOC ## [GET] /v3/invitations/{identifier} ### Description Retrieves a specific invitation by its identifier. ### Method GET ### Endpoint /v3/invitations/{identifier} ### Parameters #### Path Parameters - **identifier** (string) - Required - The identifier of the invitation ### Response #### Success Response (200) - Invitation details ``` -------------------------------- ### GET /v3/extractors/{identifier} Source: https://github.com/affinda/affinda-python Retrieves a specific extractor by its identifier. ```APIDOC ## [GET] /v3/extractors/{identifier} ### Description Retrieves a specific extractor by its identifier. ### Method GET ### Endpoint /v3/extractors/{identifier} ### Parameters #### Path Parameters - **identifier** (string) - Required - The identifier of the extractor ### Response #### Success Response (200) - Extractor details ``` -------------------------------- ### AffindaAPI.__init__ Source: https://github.com/affinda/affinda-python Constructor for the AffindaAPI sync client. Initializes the client with a credential and optional configuration for region, base URL, and Azure SDK pipeline settings. ```APIDOC ## AffindaAPI.__init__ ### Description Constructor for the AffindaAPI sync client. Initializes the client with a credential and optional configuration for region, base URL, and Azure SDK pipeline settings. ### Method Constructor ### Parameters #### Required Parameters - **credential** (TokenCredential) - Required - Supplies `get_token()` for the bearer-token authentication policy. Use `affinda.TokenCredential(token="...")`. #### Optional Parameters - **region** (str or ~affinda.models.Region) - Optional - Default: `"api"` - Passed via `**kwargs` to `AffindaAPIConfiguration`; substitutes the `{region}` placeholder in the base URL. Valid enum values: `"api"`, `"api.eu1"`, `"api.us1"`. - **base_url** (str) - Optional - Default: `"https://{region}.affinda.com"` - If provided via `**kwargs`, replaces the default base URL entirely (the `{region}` placeholder is then unused). Enables pointing the client at `http://localhost` etc. - **authentication_policy** (Azure policy) - Optional - Default: `BearerTokenWithoutTLSEnforcementPolicy(credential)` - Only overridden if already present in `**kwargs`. - **sdk_moniker** (str) - Optional - Default: `"affinda/{VERSION}"` (set by the configuration) - User-agent moniker. - **credential_scopes** (list[str]) - Optional - Default: `["https://management.azure.com/.default"]` - Scopes passed to the bearer token policy. - **region-independent pipeline kwargs** (see configuration.md) - Optional - Any Azure SDK pipeline configuration keyword forwarded to `AffindaAPIConfiguration` and `PipelineClient`, e.g. `retry_policy`, `proxy_policy`, `connection_timeout`, `user_agent`. ### Returns / instance attributes The constructor returns `None` (Python). After construction the instance exposes: - `_config` — the `AffindaAPIConfiguration` instance (`affinda._configuration`). - `_client` — the `azure.core.PipelineClient`. - `_serialize` / `_deserialize` — `msrest.Serializer` / `msrest.Deserializer` built from all model classes in `affinda.models` (`client_side_validation` disabled). - All 140 operation methods from `AffindaAPIOperationsMixin` (see operations-documents.md and siblings). ### Raises | Error | Condition | |-------|-----------| | `ValueError` | `credential` is `None` (raised inside `AffindaAPIConfiguration.__init__`, `affinda/_configuration.py:42`) | ### Request Example ```python from affinda import AffindaAPI, TokenCredential client = AffindaAPI( credential=TokenCredential(token="YOUR_API_KEY"), region="api", # or Region.API_EU1 for the EU region ) doc = client.get_document("dABC123") print(doc.as_dict()) ``` ### Request Example ```python from affinda import AffindaAPI, TokenCredential from azure.core.exceptions import HttpResponseError, ClientAuthenticationError client = AffindaAPI( credential=TokenCredential(token="YOUR_API_KEY"), base_url="http://localhost:8000", # disables the TLS enforcement policy on requests ) try: doc = client.get_document("dABC123") except ClientAuthenticationError as exc: # HTTP 401 print("Bad API key:", exc) except HttpResponseError as exc: # HTTP 400/403/404/409 mapped here # exc.model is a affinda.models.RequestError instance when deserializable print("API error:", exc.status_code, exc.model.as_dict() if exc.model else exc) ``` ``` -------------------------------- ### OrganizationCreate.__init__ Source: https://github.com/affinda/affinda-python/blob/master/docs/models.md Initializes an OrganizationCreate object. All required parameters must be populated in order to send to Azure. ```APIDOC ## OrganizationCreate.__init__ ### Description Initializes an OrganizationCreate object. All required parameters must be populated in order to send to Azure. ### Method Constructor ### Parameters #### Arguments - **name** (str) - Required - The name of the organization. - **avatar** (IO) - Optional - Upload avatar for the organization. - **resthook_signature_key** (str) - Optional - Used to sign webhook payloads so you can verify their integrity. ### Response No return value. ```