merge-api / merge-sdk-python

The Python SDK for accessing various Merge Unified APIs
Other
0 stars 1 forks source link

v2.1.0 Add type hints and expand API query option #4

Closed conorbergman closed 2 years ago

conorbergman commented 2 years ago

From changelog:

Version 2.1.0

Date: 2022-08-29

from MergePythonSDK.shared import Configuration, ApiClient
from MergePythonSDK.hris.api.employees_api import EmployeesApi

configuration = Configuration()
configuration.access_token = "YOUR_API_KEY_HERE"
configuration.api_key_prefix['tokenAuth'] = 'Bearer'
configuration.api_key['accountTokenAuth'] = 'YOUR_X_ACCOUNT_TOKEN_HERE'
with ApiClient(configuration) as api_client:
    hris_employees_api_instance = EmployeesApi(api_client)
    try:
        # Test expands
        _id = "YOUR_EMPLOYEE_ID_HERE"
        employee_expands = hris_employees_api_instance.employees_retrieve(
          _id, expand="employments"
        )
        assert employee_expands.employments.employee == employee_expands.id