Skip to content

Latest commit

 

History

History
540 lines (457 loc) · 132 KB

README.md

File metadata and controls

540 lines (457 loc) · 132 KB

Employees

(accounting.employees)

Overview

Available Operations

list

List Employees

Example Usage

import apideck_unify
from apideck_unify import Apideck
from apideck_unify.utils import parse_datetime
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.employees.list(raw=False, service_id="salesforce", limit=20, fields="id,updated_at", filter_={
        "updated_since": parse_datetime("2020-09-30T07:43:32.000Z"),
        "status": apideck_unify.AccountingEmployeesFilterStatus.ACTIVE,
    }, pass_through={
        "search": "San Francisco",
    })

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description Example
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
cursor OptionalNullable[str] ➖ Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.
limit Optional[int] ➖ Number of results to return. Minimum 1, Maximum 200, Default 20
fields OptionalNullable[str] ➖ The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
filter_ Optional[models.AccountingEmployeesFilter] ➖ Apply filters {
"updated_since": "2020-09-30T07:43:32.000Z",
"status": "active"
}
pass_through Dict[str, Any] ➖ Optional unmapped key/values that will be passed through to downstream as query parameters. Ie: ?pass_through[search]=leads becomes ?search=leads {
"search": "San Francisco"
}
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingEmployeesAllResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

create

Create Employee

Example Usage

import apideck_unify
from apideck_unify import Apideck
from datetime import date
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.employees.create(raw=False, service_id="salesforce", display_id="123456", first_name="John", last_name="Doe", display_name="John Doe", emails=[
        {
            "id": "123",
            "email": "elon@musk.com",
            "type": apideck_unify.EmailType.PRIMARY,
        },
    ], employee_number="EMP-001", job_title="Senior Accountant", status=apideck_unify.EmployeeStatus.ACTIVE, is_contractor=False, department={
        "display_id": "123456",
        "name": "Acme Inc.",
    }, location={
        "id": "123456",
        "display_id": "123456",
        "name": "New York Office",
    }, manager={
        "id": "12345",
        "name": "Jane Smith",
    }, hire_date=date.fromisoformat("2020-01-15"), termination_date=date.fromisoformat("2025-12-31"), gender=apideck_unify.Gender.MALE, birth_date=date.fromisoformat("1990-05-20"), subsidiary={
        "display_id": "123456",
        "name": "Acme Inc.",
    }, tracking_categories=[
        {
            "id": "123456",
            "code": "100",
            "name": "New York",
            "parent_id": "123456",
            "parent_name": "New York",
        },
    ], currency=apideck_unify.Currency.USD, notes="Some notes about this employee", addresses=[
        {
            "id": "123",
            "type": apideck_unify.Type.PRIMARY,
            "string": "25 Spring Street, Blackburn, VIC 3130",
            "name": "HQ US",
            "line1": "Main street",
            "line2": "apt #",
            "line3": "Suite #",
            "line4": "delivery instructions",
            "line5": "Attention: Finance Dept",
            "street_number": "25",
            "city": "San Francisco",
            "state": "CA",
            "postal_code": "94104",
            "country": "US",
            "latitude": "40.759211",
            "longitude": "-73.984638",
            "county": "Santa Clara",
            "contact_name": "Elon Musk",
            "salutation": "Mr",
            "phone_number": "111-111-1111",
            "fax": "122-111-1111",
            "email": "elon@musk.com",
            "website": "https://elonmusk.com",
            "notes": "Address notes or delivery instructions.",
            "row_version": "1-12345",
        },
    ], phone_numbers=[
        {
            "id": "12345",
            "country_code": "1",
            "area_code": "323",
            "number": "111-111-1111",
            "extension": "105",
            "type": apideck_unify.PhoneNumberType.PRIMARY,
        },
    ], bank_account={
        "bank_name": "Chase Bank",
        "account_number": "123465",
        "account_name": "Main Operating Account",
        "account_type": apideck_unify.AccountType.CREDIT_CARD,
        "iban": "GB33BUKB20201555555555",
        "bic": "CHASUS33",
        "routing_number": "021000021",
        "bsb_number": "062-001",
        "branch_identifier": "001",
        "bank_code": "BNH",
        "currency": apideck_unify.Currency.USD,
        "country": "US",
    }, custom_fields=[
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
            "value": "Uses Salesforce and Marketo",
        },
    ], row_version="1-12345", pass_through=[
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
    ])

    assert res.create_accounting_employee_response is not None

    # Handle response
    print(res.create_accounting_employee_response)

Parameters

Parameter Type Required Description Example
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
display_id OptionalNullable[str] ➖ Id to be displayed. 123456
first_name OptionalNullable[str] ➖ The first name of the employee. John
last_name OptionalNullable[str] ➖ The last name of the employee. Doe
display_name OptionalNullable[str] ➖ The display name of the employee. John Doe
emails List[models.Email] ➖ Email addresses of the employee.
employee_number OptionalNullable[str] ➖ The employee number or identifier. EMP-001
job_title OptionalNullable[str] ➖ The job title of the employee. Senior Accountant
status OptionalNullable[models.EmployeeStatus] ➖ The status of the employee. active
is_contractor OptionalNullable[bool] ➖ Whether the employee is a contractor. false
department OptionalNullable[models.LinkedDepartmentInput] ➖ N/A
location OptionalNullable[models.LinkedLocationInput] ➖ N/A
manager Optional[models.AccountingEmployeeManager] ➖ The manager of the employee.
hire_date datetime ➖ The date the employee was hired. 2020-01-15
termination_date datetime ➖ The date the employee was terminated. 2025-12-31
gender OptionalNullable[models.Gender] ➖ The gender represents the gender identity of a person. male
birth_date datetime ➖ The date of birth of the employee. 1990-05-20
subsidiary OptionalNullable[models.LinkedSubsidiaryInput] ➖ N/A
tracking_categories List[Nullable[models.LinkedTrackingCategory]] ➖ A list of linked tracking categories.
currency OptionalNullable[models.Currency] ➖ Indicates the associated currency for an amount of money. Values correspond to ISO 4217. USD
notes OptionalNullable[str] ➖ Notes about the employee. Some notes about this employee
addresses List[models.Address] ➖ Addresses of the employee.
phone_numbers List[models.PhoneNumber] ➖ Phone numbers of the employee.
bank_account Optional[models.BankAccount] ➖ N/A
custom_fields List[models.CustomField] ➖ N/A
row_version OptionalNullable[str] ➖ A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. 1-12345
pass_through List[models.PassThroughBody] ➖ The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingEmployeesAddResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

get

Get Employee

Example Usage

from apideck_unify import Apideck
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.employees.get(id="<id>", service_id="salesforce", raw=False, fields="id,updated_at")

    assert res.get_accounting_employee_response is not None

    # Handle response
    print(res.get_accounting_employee_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
fields OptionalNullable[str] ➖ The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingEmployeesOneResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

update

Update Employee

Example Usage

import apideck_unify
from apideck_unify import Apideck
from datetime import date
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.employees.update(id="<id>", service_id="salesforce", raw=False, display_id="123456", first_name="John", last_name="Doe", display_name="John Doe", emails=[
        {
            "id": "123",
            "email": "elon@musk.com",
            "type": apideck_unify.EmailType.PRIMARY,
        },
    ], employee_number="EMP-001", job_title="Senior Accountant", status=apideck_unify.EmployeeStatus.ACTIVE, is_contractor=False, department={
        "display_id": "123456",
        "name": "Acme Inc.",
    }, location={
        "id": "123456",
        "display_id": "123456",
        "name": "New York Office",
    }, manager={
        "id": "12345",
        "name": "Jane Smith",
    }, hire_date=date.fromisoformat("2020-01-15"), termination_date=date.fromisoformat("2025-12-31"), gender=apideck_unify.Gender.MALE, birth_date=date.fromisoformat("1990-05-20"), subsidiary={
        "display_id": "123456",
        "name": "Acme Inc.",
    }, tracking_categories=[
        {
            "id": "123456",
            "code": "100",
            "name": "New York",
            "parent_id": "123456",
            "parent_name": "New York",
        },
    ], currency=apideck_unify.Currency.USD, notes="Some notes about this employee", addresses=[
        {
            "id": "123",
            "type": apideck_unify.Type.PRIMARY,
            "string": "25 Spring Street, Blackburn, VIC 3130",
            "name": "HQ US",
            "line1": "Main street",
            "line2": "apt #",
            "line3": "Suite #",
            "line4": "delivery instructions",
            "line5": "Attention: Finance Dept",
            "street_number": "25",
            "city": "San Francisco",
            "state": "CA",
            "postal_code": "94104",
            "country": "US",
            "latitude": "40.759211",
            "longitude": "-73.984638",
            "county": "Santa Clara",
            "contact_name": "Elon Musk",
            "salutation": "Mr",
            "phone_number": "111-111-1111",
            "fax": "122-111-1111",
            "email": "elon@musk.com",
            "website": "https://elonmusk.com",
            "notes": "Address notes or delivery instructions.",
            "row_version": "1-12345",
        },
    ], phone_numbers=[
        {
            "id": "12345",
            "country_code": "1",
            "area_code": "323",
            "number": "111-111-1111",
            "extension": "105",
            "type": apideck_unify.PhoneNumberType.PRIMARY,
        },
    ], bank_account={
        "bank_name": "Chase Bank",
        "account_number": "123465",
        "account_name": "Main Operating Account",
        "account_type": apideck_unify.AccountType.CREDIT_CARD,
        "iban": "GB33BUKB20201555555555",
        "bic": "CHASUS33",
        "routing_number": "021000021",
        "bsb_number": "062-001",
        "branch_identifier": "001",
        "bank_code": "BNH",
        "currency": apideck_unify.Currency.USD,
        "country": "US",
    }, custom_fields=[
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
            "value": "Uses Salesforce and Marketo",
        },
    ], row_version="1-12345", pass_through=[
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
    ])

    assert res.update_accounting_employee_response is not None

    # Handle response
    print(res.update_accounting_employee_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
display_id OptionalNullable[str] ➖ Id to be displayed. 123456
first_name OptionalNullable[str] ➖ The first name of the employee. John
last_name OptionalNullable[str] ➖ The last name of the employee. Doe
display_name OptionalNullable[str] ➖ The display name of the employee. John Doe
emails List[models.Email] ➖ Email addresses of the employee.
employee_number OptionalNullable[str] ➖ The employee number or identifier. EMP-001
job_title OptionalNullable[str] ➖ The job title of the employee. Senior Accountant
status OptionalNullable[models.EmployeeStatus] ➖ The status of the employee. active
is_contractor OptionalNullable[bool] ➖ Whether the employee is a contractor. false
department OptionalNullable[models.LinkedDepartmentInput] ➖ N/A
location OptionalNullable[models.LinkedLocationInput] ➖ N/A
manager Optional[models.AccountingEmployeeManager] ➖ The manager of the employee.
hire_date datetime ➖ The date the employee was hired. 2020-01-15
termination_date datetime ➖ The date the employee was terminated. 2025-12-31
gender OptionalNullable[models.Gender] ➖ The gender represents the gender identity of a person. male
birth_date datetime ➖ The date of birth of the employee. 1990-05-20
subsidiary OptionalNullable[models.LinkedSubsidiaryInput] ➖ N/A
tracking_categories List[Nullable[models.LinkedTrackingCategory]] ➖ A list of linked tracking categories.
currency OptionalNullable[models.Currency] ➖ Indicates the associated currency for an amount of money. Values correspond to ISO 4217. USD
notes OptionalNullable[str] ➖ Notes about the employee. Some notes about this employee
addresses List[models.Address] ➖ Addresses of the employee.
phone_numbers List[models.PhoneNumber] ➖ Phone numbers of the employee.
bank_account Optional[models.BankAccount] ➖ N/A
custom_fields List[models.CustomField] ➖ N/A
row_version OptionalNullable[str] ➖ A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. 1-12345
pass_through List[models.PassThroughBody] ➖ The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingEmployeesUpdateResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

delete

Delete Employee

Example Usage

from apideck_unify import Apideck
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.employees.delete(id="<id>", service_id="salesforce", raw=False)

    assert res.delete_accounting_employee_response is not None

    # Handle response
    print(res.delete_accounting_employee_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingEmployeesDeleteResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*