diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index 4f8608cba5f6..efa4563f8e3a 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -1173,6 +1173,14 @@ icon: zendesk.svg sourceType: api releaseStage: generally_available +- name: Zendesk Sell + sourceDefinitionId: 982eaa4c-bba1-4cce-a971-06a41f700b8c + dockerRepository: airbyte/source-zendesk-sell + dockerImageTag: 0.1.0 + documentationUrl: https://docs.airbyte.com/integrations/sources/zendesk-sell + icon: zendesk.svg + sourceType: api + releaseStage: alpha - name: Zendesk Sunshine sourceDefinitionId: 325e0640-e7b3-4e24-b823-3361008f603f dockerRepository: airbyte/source-zendesk-sunshine diff --git a/airbyte-config/init/src/main/resources/seed/source_specs.yaml b/airbyte-config/init/src/main/resources/seed/source_specs.yaml index ea9316dbe684..b1f00f3b467b 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -11974,6 +11974,26 @@ path_in_connector_config: - "credentials" - "client_secret" +- dockerImage: "airbyte/source-zendesk-sell:0.1.0" + spec: + documentationUrl: "https://docs.airbyte.com/integrations/sources/zendesk-sell" + connectionSpecification: + $schema: "http://json-schema.org/draft-07/schema#" + title: "Source Zendesk Sell Spec" + type: "object" + required: + - "api_token" + properties: + api_token: + title: "API token" + type: "string" + description: "The API token for authenticating to Zendesk Sell" + examples: + - "f23yhd630otl94y85a8bf384958473pto95847fd006da49382716or937ruw059" + airbyte_secret: true + supportsNormalization: false + supportsDBT: false + supported_destination_sync_modes: [] - dockerImage: "airbyte/source-zendesk-sunshine:0.1.1" spec: documentationUrl: "https://docs.airbyte.com/integrations/sources/zendesk_sunshine" diff --git a/airbyte-integrations/connectors/source-zendesk-sell/.dockerignore b/airbyte-integrations/connectors/source-zendesk-sell/.dockerignore new file mode 100644 index 000000000000..7c3c867373cf --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/.dockerignore @@ -0,0 +1,6 @@ +* +!Dockerfile +!main.py +!source_zendesk_sell +!setup.py +!secrets diff --git a/airbyte-integrations/connectors/source-zendesk-sell/Dockerfile b/airbyte-integrations/connectors/source-zendesk-sell/Dockerfile new file mode 100644 index 000000000000..381fff970479 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/Dockerfile @@ -0,0 +1,38 @@ +FROM python:3.9.13-alpine3.15 as base + +# build and load all requirements +FROM base as builder +WORKDIR /airbyte/integration_code + +# upgrade pip to the latest version +RUN apk --no-cache upgrade \ + && pip install --upgrade pip \ + && apk --no-cache add tzdata build-base + + +COPY setup.py ./ +# install necessary packages to a temporary folder +RUN pip install --prefix=/install . + +# build a clean environment +FROM base +WORKDIR /airbyte/integration_code + +# copy all loaded and built libraries to a pure basic image +COPY --from=builder /install /usr/local +# add default timezone settings +COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime +RUN echo "Etc/UTC" > /etc/timezone + +# bash is installed for more convenient debugging. +RUN apk --no-cache add bash + +# copy payload code only +COPY main.py ./ +COPY source_zendesk_sell ./source_zendesk_sell + +ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" +ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] + +LABEL io.airbyte.version=0.1.0 +LABEL io.airbyte.name=airbyte/source-zendesk-sell diff --git a/airbyte-integrations/connectors/source-zendesk-sell/README.md b/airbyte-integrations/connectors/source-zendesk-sell/README.md new file mode 100644 index 000000000000..741adc1a197c --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/README.md @@ -0,0 +1,133 @@ +# Zendesk Sell Source + +This is the repository for the Zendesk Sell source connector, written in Python. +For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/zendesk-sell). + +## Local development + +### Prerequisites +**To iterate on this connector, make sure to complete this prerequisites section.** + +#### Minimum Python version required `= 3.9.0` + +#### Build & Activate Virtual Environment and install dependencies +From this connector directory, create a virtual environment: +``` +python -m venv .venv +``` + +This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your +development environment of choice. To activate it from the terminal, run: +``` +source .venv/bin/activate +pip install -r requirements.txt +pip install '.[tests]' +``` +If you are in an IDE, follow your IDE's instructions to activate the virtualenv. + +Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is +used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`. +If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything +should work as you expect. + +#### Building via Gradle +You can also build the connector in Gradle. This is typically used in CI and not needed for your development workflow. + +To build using Gradle, from the Airbyte repository root, run: +``` +./gradlew :airbyte-integrations:connectors:source-zendesk-sell:build +``` + +#### Create credentials +**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/zendesk-sell) +to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_zendesk_sell/spec.yaml` file. +Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information. +See `integration_tests/sample_config.json` for a sample config file. +Note that the full process to generate api tokens is available [here](https://developer.zendesk.com/documentation/sales-crm/first-call/#1-generate-an-access-token) + +**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source zendesk-sell test creds` +and place them into `secrets/config.json`. + +### Locally running the connector +``` +python main.py spec +python main.py check --config secrets/config.json +python main.py discover --config secrets/config.json +python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json +``` + +### Locally running the connector docker image + +#### Build +First, make sure you build the latest Docker image: +``` +docker build . -t airbyte/source-zendesk-sell:dev +``` + +You can also build the connector image via Gradle: +``` +./gradlew :airbyte-integrations:connectors:source-zendesk-sell:airbyteDocker +``` +When building via Gradle, the docker image name and tag, respectively, are the values of the `io.airbyte.name` and `io.airbyte.version` `LABEL`s in +the Dockerfile. + +#### Run +Then run any of the connector commands as follows: +``` +docker run --rm airbyte/source-zendesk-sell:dev spec +docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-zendesk-sell:dev check --config /secrets/config.json +docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-zendesk-sell:dev discover --config /secrets/config.json +docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-zendesk-sell:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json +``` +## Testing +Make sure to familiarize yourself with [pytest test discovery](https://docs.pytest.org/en/latest/goodpractices.html#test-discovery) to know how your test files and methods should be named. +First install test dependencies into your virtual environment: +``` +pip install .[tests] +``` +### Unit Tests +To run unit tests locally, from the connector directory run: +``` +python -m pytest unit_tests +``` + +### Integration Tests +There are two types of integration tests: Acceptance Tests (Airbyte's test suite for all source connectors) and custom integration tests (which are specific to this connector). +#### Custom Integration tests +Place custom tests inside `integration_tests/` folder, then, from the connector root, run +``` +python -m pytest integration_tests +``` +#### Acceptance Tests +Customize `acceptance-test-config.yml` file to configure tests. See [Source Acceptance Tests](https://docs.airbyte.io/connector-development/testing-connectors/source-acceptance-tests-reference) for more information. +If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py. +To run your integration tests with acceptance tests, from the connector root, run +``` +python -m pytest integration_tests -p integration_tests.acceptance +``` +To run your integration tests with docker + +### Using gradle to run tests +All commands should be run from airbyte project root. +To run unit tests: +``` +./gradlew :airbyte-integrations:connectors:source-zendesk-sell:unitTest +``` +To run acceptance and custom integration tests: +``` +./gradlew :airbyte-integrations:connectors:source-zendesk-sell:integrationTest +``` + +## Dependency Management +All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development. +We split dependencies between two groups, dependencies that are: +* required for your connector to work need to go to `MAIN_REQUIREMENTS` list. +* required for the testing need to go to `TEST_REQUIREMENTS` list + +### Publishing a new version of the connector +You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what? +1. Make sure your changes are passing unit and integration tests. +1. Bump the connector version in `Dockerfile` -- just increment the value of the `LABEL io.airbyte.version` appropriately (we use [SemVer](https://semver.org/)). +1. Create a Pull Request. +1. Pat yourself on the back for being an awesome contributor. +1. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master. diff --git a/airbyte-integrations/connectors/source-zendesk-sell/acceptance-test-config.yml b/airbyte-integrations/connectors/source-zendesk-sell/acceptance-test-config.yml new file mode 100644 index 000000000000..9e44467ce664 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/acceptance-test-config.yml @@ -0,0 +1,30 @@ +# See [Source Acceptance Tests](https://docs.airbyte.io/connector-development/testing-connectors/source-acceptance-tests-reference) +# for more information about how to configure these tests +connector_image: airbyte/source-zendesk-sell:dev +tests: + spec: + - spec_path: "source_zendesk_sell/spec.yaml" + connection: + - config_path: "secrets/config.json" + status: "succeed" + - config_path: "integration_tests/invalid_config.json" + status: "failed" + discovery: + - config_path: "secrets/config.json" + basic_read: + - config_path: "secrets/config.json" + configured_catalog_path: "integration_tests/configured_catalog.json" + empty_streams: [] + # TODO uncomment this block to specify that the tests should assert the connector outputs the records provided in the input file a file + # expect_records: + # path: "integration_tests/expected_records.txt" + # extra_fields: no + # exact_order: no + # extra_records: yes + incremental: # TODO if your connector does not implement incremental sync, remove this block + - config_path: "secrets/config.json" + configured_catalog_path: "integration_tests/configured_catalog.json" + future_state_path: "integration_tests/abnormal_state.json" + full_refresh: + - config_path: "secrets/config.json" + configured_catalog_path: "integration_tests/configured_catalog.json" diff --git a/airbyte-integrations/connectors/source-zendesk-sell/acceptance-test-docker.sh b/airbyte-integrations/connectors/source-zendesk-sell/acceptance-test-docker.sh new file mode 100644 index 000000000000..c51577d10690 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/acceptance-test-docker.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env sh + +# Build latest connector image +docker build . -t $(cat acceptance-test-config.yml | grep "connector_image" | head -n 1 | cut -d: -f2-) + +# Pull latest acctest image +docker pull airbyte/source-acceptance-test:latest + +# Run +docker run --rm -it \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /tmp:/tmp \ + -v $(pwd):/test_input \ + airbyte/source-acceptance-test \ + --acceptance-test-config /test_input + diff --git a/airbyte-integrations/connectors/source-zendesk-sell/build.gradle b/airbyte-integrations/connectors/source-zendesk-sell/build.gradle new file mode 100644 index 000000000000..4b2aeaebf368 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/build.gradle @@ -0,0 +1,9 @@ +plugins { + id 'airbyte-python' + id 'airbyte-docker' + id 'airbyte-source-acceptance-test' +} + +airbytePython { + moduleDirectory 'source_zendesk_sell' +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/__init__.py b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/__init__.py new file mode 100644 index 000000000000..1100c1c58cf5 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/__init__.py @@ -0,0 +1,3 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# diff --git a/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/abnormal_state.json b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/abnormal_state.json new file mode 100644 index 000000000000..871548c4aa59 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/abnormal_state.json @@ -0,0 +1,5 @@ +{ + "contacts": { + "created_at": "33190962600" + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/acceptance.py b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/acceptance.py new file mode 100644 index 000000000000..950b53b59d41 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/acceptance.py @@ -0,0 +1,14 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +import pytest + +pytest_plugins = ("source_acceptance_test.plugin",) + + +@pytest.fixture(scope="session", autouse=True) +def connector_setup(): + """This fixture is a placeholder for external resources that acceptance test might require.""" + yield diff --git a/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/configured_catalog.json b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/configured_catalog.json new file mode 100644 index 000000000000..3e127d892132 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/configured_catalog.json @@ -0,0 +1,220 @@ +{ + "streams": [ + { + "stream": { + "name": "pipelines", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "stages", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "deals", + "json_schema": {}, + "supported_sync_modes": ["full_refresh", "incremental"], + "source_defined_cursor": true, + "default_cursor_field": ["updated_at"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "incremental", + "destination_sync_mode": "append" + }, + { + "stream": { + "name": "contacts", + "json_schema": {}, + "supported_sync_modes": ["full_refresh", "incremental"], + "source_defined_cursor": true, + "default_cursor_field": ["updated_at"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "incremental", + "destination_sync_mode": "append" + }, + { + "stream": { + "name": "leads", + "json_schema": {}, + "supported_sync_modes": ["full_refresh", "incremental"], + "source_defined_cursor": true, + "default_cursor_field": ["updated_at"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "incremental", + "destination_sync_mode": "append" + }, + { + "stream": { + "name": "call_outcomes", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "deal_sources", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "deal_unqualified_reasons", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "lead_conversions", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "lead_sources", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "lead_unqualified_reasons", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "loss_reasons", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "notes", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "orders", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "products", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "tags", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "tasks", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "text_messages", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "users", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "visit_outcomes", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "visits", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_primary_key": [["id"]] + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + } + ] +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/invalid_config.json b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/invalid_config.json new file mode 100644 index 000000000000..cb2463e43ef3 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/invalid_config.json @@ -0,0 +1,3 @@ +{ + "api_token": "" +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/sample_config.json b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/sample_config.json new file mode 100644 index 000000000000..84230b311b70 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/sample_config.json @@ -0,0 +1,3 @@ +{ + "api_token": "c56afd675afe19b87a8bf810666927baa58854fd006da22795850ee957eec854" +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/sample_state.json b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/sample_state.json new file mode 100644 index 000000000000..b431595f17b8 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/integration_tests/sample_state.json @@ -0,0 +1,5 @@ +{ + "contacts": { + "created_at": "1604479286" + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/main.py b/airbyte-integrations/connectors/source-zendesk-sell/main.py new file mode 100644 index 000000000000..e5cc433b0d36 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/main.py @@ -0,0 +1,13 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +import sys + +from airbyte_cdk.entrypoint import launch +from source_zendesk_sell import SourceZendeskSell + +if __name__ == "__main__": + source = SourceZendeskSell() + launch(source, sys.argv[1:]) diff --git a/airbyte-integrations/connectors/source-zendesk-sell/requirements.txt b/airbyte-integrations/connectors/source-zendesk-sell/requirements.txt new file mode 100644 index 000000000000..0411042aa091 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/requirements.txt @@ -0,0 +1,2 @@ +-e ../../bases/source-acceptance-test +-e . diff --git a/airbyte-integrations/connectors/source-zendesk-sell/setup.py b/airbyte-integrations/connectors/source-zendesk-sell/setup.py new file mode 100644 index 000000000000..ab5314798e39 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/setup.py @@ -0,0 +1,29 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +from setuptools import find_packages, setup + +MAIN_REQUIREMENTS = [ + "airbyte-cdk~=0.4", +] + +TEST_REQUIREMENTS = [ + "pytest~=6.1", + "pytest-mock~=3.6.1", + "source-acceptance-test", +] + +setup( + name="source_zendesk_sell", + description="Source implementation for Zendesk Sell.", + author="Airbyte", + author_email="contact@airbyte.io", + packages=find_packages(), + install_requires=MAIN_REQUIREMENTS, + package_data={"": ["*.json", "*.yaml", "schemas/*.json", "schemas/shared/*.json"]}, + extras_require={ + "tests": TEST_REQUIREMENTS, + }, +) diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/__init__.py b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/__init__.py new file mode 100644 index 000000000000..153d0c6b7b8e --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/__init__.py @@ -0,0 +1,8 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +from .source import SourceZendeskSell + +__all__ = ["SourceZendeskSell"] diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/call_outcomes.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/call_outcomes.json new file mode 100644 index 000000000000..0ca39aa5f870 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/call_outcomes.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/calls.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/calls.json new file mode 100644 index 000000000000..94612ce6a249 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/calls.json @@ -0,0 +1,57 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "user_id": { + "type": ["null", "number"] + }, + "summary": { + "type": ["null", "string"] + }, + "recording_url": { + "type": ["null", "string"] + }, + "outcome_id": { + "type": ["null", "number"] + }, + "duration": { + "type": ["null", "number"] + }, + "phone_number": { + "type": ["null", "number"] + }, + "incoming": { + "type": ["null", "boolean"] + }, + "missed": { + "type": ["null", "boolean"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "resource_id": { + "type": ["null", "number"] + }, + "associated_deal_ids": { + "type": ["null", "array"] + }, + "made_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/collaborations.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/collaborations.json new file mode 100644 index 000000000000..89e857aa5031 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/collaborations.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "resource_id": { + "type": ["null", "number"] + }, + "collaborator_id": { + "type": ["null", "number"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/contacts.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/contacts.json new file mode 100644 index 000000000000..022461fce783 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/contacts.json @@ -0,0 +1,100 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "owner_id": { + "type": ["null", "number"] + }, + "is_organization": { + "type": ["null", "boolean"] + }, + "contact_id": { + "type": ["null", "number"] + }, + "parent_organization_id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "first_name": { + "type": ["null", "string"] + }, + "last_name": { + "type": ["null", "string"] + }, + "customer_status": { + "type": ["null", "string"] + }, + "prospect_status": { + "type": ["null", "string"] + }, + "title": { + "type": ["null", "string"] + }, + "description": { + "type": ["null", "string"] + }, + "industry": { + "type": ["null", "string"] + }, + "website": { + "type": ["null", "string"] + }, + "email": { + "type": ["null", "string"] + }, + "phone": { + "type": ["null", "string"] + }, + "mobile": { + "type": ["null", "string"] + }, + "fax": { + "type": ["null", "string"] + }, + "twitter": { + "type": ["null", "string"] + }, + "facebook": { + "type": ["null", "string"] + }, + "linkedin": { + "type": ["null", "string"] + }, + "skype": { + "type": ["null", "string"] + }, + "address": { + "type": ["null", "string"] + }, + "billing_address": { + "type": ["null", "string"] + }, + "shipping_address": { + "type": ["null", "string"] + }, + "tags": { + "type": ["null", "array"] + }, + "custom_fields": { + "type": ["null", "object"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deal_sources.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deal_sources.json new file mode 100644 index 000000000000..4c1d21218947 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deal_sources.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deal_unqualified_reasons.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deal_unqualified_reasons.json new file mode 100644 index 000000000000..0ca39aa5f870 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deal_unqualified_reasons.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deals.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deals.json new file mode 100644 index 000000000000..c0f3104de75a --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/deals.json @@ -0,0 +1,87 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "owner_id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "value": { + "type": ["null", "number", "string"] + }, + "currency": { + "type": ["null", "string"] + }, + "hot": { + "type": ["null", "boolean"] + }, + "stage_id": { + "type": ["null", "number"] + }, + "last_stage_change_at": { + "type": ["null", "string"], + "format": "date-time" + }, + "last_stage_change_by_id": { + "type": ["null", "number"] + }, + "last_activity_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "source_id": { + "type": ["null", "number"] + }, + "loss_reason_id": { + "type": ["null", "number"] + }, + "unqualified_reason_id": { + "type": ["null", "number"] + }, + "dropbox_email": { + "type": ["null", "string"] + }, + "contact_id": { + "type": ["null", "number"] + }, + "organization_id": { + "type": ["null", "number"] + }, + "estimated_close_date": { + "type": ["null", "string"] + }, + "customized_win_likelihood": { + "type": ["null", "number"] + }, + "tags": { + "type": ["null", "array"] + }, + "custom_fields": { + "type": ["null", "object"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "added_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_conversions.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_conversions.json new file mode 100644 index 000000000000..0f973d1cd534 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_conversions.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "lead_id": { + "type": ["null", "number"] + }, + "individual_id": { + "type": ["null", "number"] + }, + "organization_id": { + "type": ["null", "number"] + }, + "deal_id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_sources.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_sources.json new file mode 100644 index 000000000000..4c1d21218947 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_sources.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_unqualified_reasons.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_unqualified_reasons.json new file mode 100644 index 000000000000..f93853b912d9 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/lead_unqualified_reasons.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/leads.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/leads.json new file mode 100644 index 000000000000..d31d0c53d6a0 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/leads.json @@ -0,0 +1,85 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "owner_id": { + "type": ["null", "number"] + }, + "first_name": { + "type": ["null", "string"] + }, + "last_name": { + "type": ["null", "string"] + }, + "organization_name": { + "type": ["null", "string"] + }, + "status": { + "type": ["null", "string"] + }, + "source_id": { + "type": ["null", "number"] + }, + "title": { + "type": ["null", "string"] + }, + "description": { + "type": ["null", "string"] + }, + "industry": { + "type": ["null", "string"] + }, + "website": { + "type": ["null", "string"] + }, + "email": { + "type": ["null", "string"] + }, + "phone": { + "type": ["null", "string"] + }, + "mobile": { + "type": ["null", "string"] + }, + "fax": { + "type": ["null", "string"] + }, + "twitter": { + "type": ["null", "string"] + }, + "facebook": { + "type": ["null", "string"] + }, + "linkedin": { + "type": ["null", "string"] + }, + "skype": { + "type": ["null", "string"] + }, + "address": { + "type": ["null", "string"] + }, + "tags": { + "type": ["null", "array"] + }, + "custom_fields": { + "type": ["null", "object"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/loss_reasons.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/loss_reasons.json new file mode 100644 index 000000000000..f93853b912d9 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/loss_reasons.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/notes.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/notes.json new file mode 100644 index 000000000000..3ac4eb3fe957 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/notes.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "resource_id": { + "type": ["null", "number"] + }, + "content": { + "type": ["null", "string"] + }, + "is_important": { + "type": ["null", "boolean"] + }, + "tags": { + "type": ["null", "array"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "type": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/orders.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/orders.json new file mode 100644 index 000000000000..d789fb749c46 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/orders.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "deal_id": { + "type": ["null", "number"] + }, + "discount": { + "type": ["null", "number"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/pipelines.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/pipelines.json new file mode 100644 index 000000000000..6d25e0550eef --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/pipelines.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "disabled": { + "type": ["null", "boolean"] + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/products.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/products.json new file mode 100644 index 000000000000..47f7873f7ec0 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/products.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "description": { + "type": ["null", "string"] + }, + "sku": { + "type": ["null", "string"] + }, + "active": { + "type": ["null", "boolean"] + }, + "max_discount": { + "type": ["null", "number"] + }, + "max_markup": { + "type": ["null", "number"] + }, + "cost": { + "type": ["null", "number"] + }, + "cost_currency": { + "type": ["null", "string"] + }, + "prices": { + "type": ["null", "array"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/stages.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/stages.json new file mode 100644 index 000000000000..0a826d2e8eae --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/stages.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "category": { + "type": ["null", "string"] + }, + "active": { + "type": ["null", "boolean"] + }, + "position": { + "type": ["null", "number"] + }, + "likelihood": { + "type": ["null", "number"] + }, + "pipeline_id": { + "type": ["null", "number"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/tags.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/tags.json new file mode 100644 index 000000000000..4c1d21218947 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/tags.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/tasks.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/tasks.json new file mode 100644 index 000000000000..66a456a01b3e --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/tasks.json @@ -0,0 +1,53 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "owner_id": { + "type": ["null", "number"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "resource_id": { + "type": ["null", "number"] + }, + "completed": { + "type": ["null", "boolean"] + }, + "completed_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "due_date": { + "type": ["null", "string"] + }, + "overdue": { + "type": ["null", "boolean"] + }, + "remind_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "content": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/text_messages.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/text_messages.json new file mode 100644 index 000000000000..2fbbc8db5c0e --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/text_messages.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "associated_deal_ids": { + "type": ["null", "array"] + }, + "content": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "incoming": { + "type": ["null", "boolean"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "resource_id": { + "type": ["null", "number"] + }, + "resource_phone_number": { + "type": ["null", "string"] + }, + "sent_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "user_id": { + "type": ["null", "number"] + }, + "user_phone_number": { + "type": ["null", "string"] + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/users.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/users.json new file mode 100644 index 000000000000..1c8c43003290 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/users.json @@ -0,0 +1,66 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "email": { + "type": ["null", "string"] + }, + "status": { + "type": ["null", "string"] + }, + "invited": { + "type": ["null", "boolean"] + }, + "confirmed": { + "type": ["null", "boolean"] + }, + "phone_number": { + "type": ["null", "string"] + }, + "role": { + "type": ["null", "string"] + }, + "roles": { + "type": ["null", "array"] + }, + "team_name": { + "type": ["null", "string"] + }, + "group": { + "type": ["null", "object"] + }, + "reports_to": { + "type": ["null", "number"] + }, + "timezone": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "deleted_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "zendesk_user_id": { + "type": ["null", "string"] + }, + "identity_type": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/visit_outcomes.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/visit_outcomes.json new file mode 100644 index 000000000000..0ca39aa5f870 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/visit_outcomes.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "name": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/visits.json b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/visits.json new file mode 100644 index 000000000000..5118a43d1929 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/schemas/visits.json @@ -0,0 +1,45 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "number"] + }, + "creator_id": { + "type": ["null", "number"] + }, + "outcome_id": { + "type": ["null", "number"] + }, + "resource_type": { + "type": ["null", "string"] + }, + "resource_id": { + "type": ["null", "number"] + }, + "visited_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "resource_address": { + "type": ["null", "string"] + }, + "rep_location_verification_status": { + "type": ["null", "string"] + }, + "summary": { + "type": ["null", "string"] + }, + "created_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + }, + "updated_at": { + "type": ["null", "string"], + "format": "date-time", + "airbyte_type": "timestamp_with_timezone" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/source.py b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/source.py new file mode 100644 index 000000000000..d6868c021c71 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/source.py @@ -0,0 +1,346 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +import re +from abc import ABC +from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Tuple + +import requests +from airbyte_cdk.models import SyncMode +from airbyte_cdk.sources import AbstractSource +from airbyte_cdk.sources.streams import Stream +from airbyte_cdk.sources.streams.http import HttpStream +from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator + + +# Basic full refresh stream +class ZendeskSellStream(HttpStream, ABC): + """ + This class represents a stream output by the connector. + This is an abstract base class meant to contain all the common functionality at the API level e.g: the API base URL, pagination strategy, + parsing responses etc.. + """ + + url_base = "https://api.getbase.com/v2/" + primary_key = None + + def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]: + try: + meta_links = {} + regex_page = r"[=?/]page[_=/-]?(\d{1,3})" + data = response.json() + if data: + meta_links = data.get("meta", {}).get("links") + if "next_page" in meta_links.keys(): + return {"page": int(re.findall(regex_page, meta_links["next_page"])[0])} + return None + except Exception as e: + self.logger.error(f"{e.__class__} occurred, while trying to get next page information from the following dict {meta_links}") + + def request_params( + self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, any] = None, next_page_token: Mapping[str, Any] = None + ) -> MutableMapping[str, Any]: + if next_page_token: + return {"page": next_page_token["page"]} + else: + return {} + + def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: + items = response.json()["items"] + yield from [item["data"] for item in items] + + +class Pipelines(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/pipelines/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "pipelines" + + +class Stages(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/stages/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "stages" + + +class Contacts(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/contacts/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "contacts" + + +class Deals(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/deals/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "deals" + + +class Leads(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/leads/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "leads" + + +class CallOutcomes(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/call-outcomes/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "call_outcomes" + + +class Calls(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/calls/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "calls" + + +class Collaborations(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/collaborations/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "collaborations" + + +class DealSources(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/deal-sources/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "deal_sources" + + +class DealUnqualifiedReasons(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/deal-unqualified-reasons/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "deal_unqualified_reasons" + + +class LeadConversions(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/lead-conversions/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "lead_conversions" + + +class LeadSources(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/lead-sources/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "lead_sources" + + +class LeadUnqualifiedReasons(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/lead-unqualified-reasons/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "lead_unqualified_reasons" + + +class LossReasons(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/loss-reasons/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "loss_reasons" + + +class Notes(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/notes/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "notes" + + +class Orders(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/orders/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "orders" + + +class Products(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/products/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "products" + + +class Tags(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/tags/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "tags" + + +class Tasks(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/tasks/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "tasks" + + +class TextMessages(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/text-messages/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "text_messages" + + +class Users(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/users/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "users" + + +class VisitOutcomes(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/visit-outcomes/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "visit_outcomes" + + +class Visits(ZendeskSellStream): + """ + Docs: https://developer.zendesk.com/api-reference/sales-crm/resources/visits/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "visits" + + +# Source +class SourceZendeskSell(AbstractSource): + def check_connection(self, logger, config) -> Tuple[bool, any]: + try: + authenticator = TokenAuthenticator(token=config["api_token"]) + stream = Contacts(authenticator=authenticator) + records = stream.read_records(sync_mode=SyncMode.full_refresh) + next(records) + return True, None + except Exception as e: + return False, e + + def streams(self, config: Mapping[str, Any]) -> List[Stream]: + auth = TokenAuthenticator(token=config["api_token"]) + return [ + Contacts(authenticator=auth), + Deals(authenticator=auth), + Leads(authenticator=auth), + Pipelines(authenticator=auth), + Stages(authenticator=auth), + CallOutcomes(authenticator=auth), + Calls(authenticator=auth), + Collaborations(authenticator=auth), + DealSources(authenticator=auth), + DealUnqualifiedReasons(authenticator=auth), + LeadConversions(authenticator=auth), + LeadSources(authenticator=auth), + LeadUnqualifiedReasons(authenticator=auth), + LossReasons(authenticator=auth), + Notes(authenticator=auth), + Orders(authenticator=auth), + Products(authenticator=auth), + Tags(authenticator=auth), + Tasks(authenticator=auth), + TextMessages(authenticator=auth), + Users(authenticator=auth), + VisitOutcomes(authenticator=auth), + Visits(authenticator=auth), + ] diff --git a/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/spec.yaml b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/spec.yaml new file mode 100644 index 000000000000..eb92f5a7083e --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/source_zendesk_sell/spec.yaml @@ -0,0 +1,15 @@ +documentationUrl: https://docs.airbyte.com/integrations/sources/zendesk-sell +connectionSpecification: + $schema: http://json-schema.org/draft-07/schema# + title: Source Zendesk Sell Spec + type: object + required: + - api_token + properties: + api_token: + title: API token + type: string + description: "The API token for authenticating to Zendesk Sell" + examples: + - "f23yhd630otl94y85a8bf384958473pto95847fd006da49382716or937ruw059" + airbyte_secret: true diff --git a/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/__init__.py b/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/__init__.py new file mode 100644 index 000000000000..1100c1c58cf5 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/__init__.py @@ -0,0 +1,3 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# diff --git a/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/test_source.py b/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/test_source.py new file mode 100644 index 000000000000..063308dd0189 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/test_source.py @@ -0,0 +1,29 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + +from unittest.mock import MagicMock + +from pytest import fixture +from source_zendesk_sell.source import SourceZendeskSell + + +@fixture +def config(): + return {"config": {"user_auth_key": "", "start_date": "2021-01-01T00:00:00Z", "outcome_names": ""}} + + +def test_check_connection(mocker, requests_mock, config): + source = SourceZendeskSell() + logger_mock, config_mock = MagicMock(), MagicMock() + requests_mock.get("https://api.getbase.com/v2/contacts", json={"items": [{"data": {}}]}) + + assert source.check_connection(logger_mock, config_mock) == (True, None) + + +def test_streams(mocker): + source = SourceZendeskSell() + config_mock = MagicMock() + streams = source.streams(config_mock) + expected_streams_number = 23 + assert len(streams) == expected_streams_number diff --git a/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/test_streams.py b/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/test_streams.py new file mode 100644 index 000000000000..aac02fc6c0e2 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sell/unit_tests/test_streams.py @@ -0,0 +1,151 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + +from http import HTTPStatus +from unittest.mock import MagicMock + +import pytest +from source_zendesk_sell.source import ZendeskSellStream + + +@pytest.fixture +def patch_base_class(mocker): + # Mock abstract methods to enable instantiating abstract class + mocker.patch.object(ZendeskSellStream, "path", "v0/example_endpoint") + mocker.patch.object(ZendeskSellStream, "primary_key", "test_primary_key") + mocker.patch.object(ZendeskSellStream, "__abstractmethods__", set()) + + +def test_request_params(patch_base_class): + stream = ZendeskSellStream() + inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None} + expected_params = {} + assert stream.request_params(**inputs) == expected_params + + +@pytest.mark.parametrize( + ("inputs", "expected_token"), + [ + ( + { + "items": [], + "meta": { + "type": "collection", + "count": 25, + "links": { + "self": "https://api.getbase.com/v2/contacts?page=2&per_page=25", + "first_page": "https://api.getbase.com/v2/contacts?page=1&per_page=25", + "prev_page": "https://api.getbase.com/v2/contacts?page=1&per_page=25", + "next_page": "https://api.getbase.com/v2/contacts?page=3&per_page=25", + }, + }, + }, + {"page": 3}, + ), + ( + { + "items": [], + "meta": { + "type": "collection", + "count": 25, + "links": { + "self": "https://api.getbase.com/v2/contacts?page=2&per_page=25", + "first_page": "https://api.getbase.com/v2/contacts?page=1&per_page=25", + "prev_page": "https://api.getbase.com/v2/contacts?page=1&per_page=25", + }, + }, + }, + None, + ), + ({None}, None), + ], +) +def test_next_page_token(mocker, requests_mock, patch_base_class, inputs, expected_token): + stream = ZendeskSellStream() + response = mocker.MagicMock() + response.json.return_value = inputs + assert stream.next_page_token(response) == expected_token + + +def test_parse_response(patch_base_class, mocker): + stream = ZendeskSellStream() + response = mocker.MagicMock() + response.json.return_value = { + "items": [ + { + "data": { + "id": 302488228, + "creator_id": 2393211, + "contact_id": 302488227, + "created_at": "2020-11-12T09:05:47Z", + "updated_at": "2022-03-23T16:53:22Z", + "title": None, + "name": "Octavia Squidington", + "first_name": "Octavia", + "last_name": "Squidington", + }, + "meta": {"version": 36, "type": "contact"}, + } + ], + "meta": { + "type": "collection", + "count": 25, + "links": { + "self": "https://api.getbase.com/v2/contacts?page=2&per_page=25", + "first_page": "https://api.getbase.com/v2/contacts?page=1&per_page=25", + "prev_page": "https://api.getbase.com/v2/contacts?page=1&per_page=25", + "next_page": "https://api.getbase.com/v2/contacts?page=3&per_page=25", + }, + }, + } + expected_parsed_object = { + "id": 302488228, + "creator_id": 2393211, + "contact_id": 302488227, + "created_at": "2020-11-12T09:05:47Z", + "updated_at": "2022-03-23T16:53:22Z", + "title": None, + "name": "Octavia Squidington", + "first_name": "Octavia", + "last_name": "Squidington", + } + assert next(stream.parse_response(response)) == expected_parsed_object + + +def test_request_headers(patch_base_class): + stream = ZendeskSellStream() + stream_slice = None + stream_state = None + next_page_token = {"page": 2} + expected_headers = {"page": 2} + assert stream.request_params(stream_slice, stream_state, next_page_token) == expected_headers + + +def test_http_method(patch_base_class): + stream = ZendeskSellStream() + expected_method = "GET" + assert stream.http_method == expected_method + + +@pytest.mark.parametrize( + ("http_status", "should_retry"), + [ + (HTTPStatus.OK, False), + (HTTPStatus.BAD_REQUEST, False), + (HTTPStatus.TOO_MANY_REQUESTS, True), + (HTTPStatus.INTERNAL_SERVER_ERROR, True), + ], +) +def test_should_retry(patch_base_class, http_status, should_retry): + response_mock = MagicMock() + response_mock.status_code = http_status + stream = ZendeskSellStream() + assert stream.should_retry(response_mock) == should_retry + + +def test_backoff_time(patch_base_class): + response_mock = MagicMock() + stream = ZendeskSellStream() + expected_backoff_time = None + assert stream.backoff_time(response_mock) == expected_backoff_time diff --git a/docs/integrations/sources/zendesk-sell.md b/docs/integrations/sources/zendesk-sell.md new file mode 100644 index 000000000000..0706b6bc563b --- /dev/null +++ b/docs/integrations/sources/zendesk-sell.md @@ -0,0 +1,79 @@ +# Zendesk Sunshine + +## Sync overview + +The Zendesk Sell source supports Full Refresh. + +This source can sync data for the [Zendesk Sell API](https://developer.zendesk.com/api-reference/sales-crm/introduction/). + +### Output schema + +This Source is capable of syncing the following core Streams: + +* Call Outcomes +* Calls +* Collaborations +* Contacts +* Deal Sources +* Deal Unqualified Reason +* Deals +* Lead Conversions +* Lead Sources +* Lead Unqualified Reason +* Leads +* Loss Reasons +* Notes +* Orders +* Pipelines +* Products +* Stages +* Tags +* Tasks +* Text Messages +* Users +* Visit Outcomes +* Visits + +### Data type mapping + +| Integration Type | Airbyte Type | Notes | +| :--- | :--- | :--- | +| `string` | `string` | | +| `number` | `number` | | +| `array` | `array` | | +| `object` | `object` | | + +### Features + +| Feature | Supported?\(Yes/No\) | Notes | +| :--- | :--- | :--- | +| Full Refresh Sync | Yes | | +| Incremental Sync | Yes | | + +### Performance considerations + +The connector is restricted by normal Zendesk [requests limitation](https://developer.zendesk.com/api-reference/ticketing/account-configuration/usage_limits/) + +The Zendesk connector should not run into Zendesk API limitations under normal usage. Please [create an issue](https://github.com/airbytehq/airbyte/issues) if you see any rate limit issues that are not automatically retried successfully. + +## Getting started + +### Requirements + +* Zendesk Sell API Token + + +### Setup guide + +Please follow this [guide](https://developer.zendesk.com/documentation/custom-data/custom-objects/getting-started-with-custom-objects/#enabling-custom-objects) + +Generate an API Token or oauth2.0 Access token as described in [here](https://developer.zendesk.com/api-reference/ticketing/introduction/#security-and-authentication) + +We recommend creating a restricted, read-only key specifically for Airbyte access. This will allow you to control which resources Airbyte should be able to access. + +## Changelog + +| Version | Date | Pull Request | Subject | +| :--- | :--- | :--- | :--- | +| 0.1.0 | 2022-10-27 | [17888](https://github.com/airbytehq/airbyte/pull/17888) | Initial Release | +