From 862df97ce91b31d44f74e4aa6251504c3d7b59c4 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 19 Nov 2022 03:25:11 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20New=20Source:=20Genesys=20[pytho?= =?UTF-8?q?n=20cdk]=20(#17559)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: start genesys boilerplate connector * chore: first connection working * chore: declare args * chore: mapped genesys regional endpoints to sources * Update source.py * Update source.py * Update users.json * Create locations.json * Create groups.json * Update configured_catalog.json * chore: notes for links to all other schemas * Update configured_catalog.json * Delete locations.json * Delete groups.json * Create telephony_locations.json * Create telephony_providers_edges.json * Create telephony_stations.json * Create user_groups.json * Create user_users.json * Delete users.json * Update source.py * Update source.py * Update source.py * Update zuora_auth.py * Added TelephonyProvidersEdgesDidpools * Added TelephonyProvidersEdgesDids * Added TelephonyProvidersEdgesExtensions * Added TelephonyProvidersEdgesLines * Add TelephonyProvidersEdgesOutboundroutes * Added TelephonyProvidersEdgesPhones * Added TelephonyProvidersEdgesSites * Added TelephonyProvidersEdgesTrunks * Added RoutingAssessments and RoutingQueues * Update class names * Added RoutingOutboundEvents * implemented pageSize * Finalised stream pagination * finalise to full refresh for now * Update acceptance-test-config.yml * Delete test_incremental_streams.py * Update source.py * unit tests * Revert "Update source.py" This reverts commit 10d996e83ed6aa789a0266b74e942ee4ccdae5b3. * Revert "Update source.py" This reverts commit af5e79af662f1a7dc2432ebbea0af8d02e2965f2. * Revert "Revert "Update source.py"" This reverts commit ed56ed41f36084a767364791a4ce96fb3e4d505b. * Revert "Update zuora_auth.py" This reverts commit 9a1b9fd07d9d06b838739446209d9d141c0d052d. * chore: lint and syntax * Create genesys.md * Update builds.md * Update spec.json * final lint * Update user_users.json * Update user_users.json * Update user_users.json * Update user_users.json * Update user_groups.json * Update user_groups.json * Update user_users.json * Update telephony_stations.json * Update telephony_locations.json * tests * fix schema issues for unit tests * Update acceptance-test-config.yml * Update README.md * Delete sample_state.json * Update source.py * Update source.py * correct static method * Update genesys.md * resolve oAuth connector * update deps * source def and logo * auto-bump connector version Co-authored-by: Vincent Koc Co-authored-by: Octavia Squidington III --- .../init/src/main/resources/icons/genesys.svg | 7 + .../resources/seed/source_definitions.yaml | 6 + .../src/main/resources/seed/source_specs.yaml | 53 ++++ airbyte-integrations/builds.md | 1 + .../connectors/source-genesys/.dockerignore | 6 + .../connectors/source-genesys/Dockerfile | 38 +++ .../connectors/source-genesys/README.md | 131 ++++++++ .../source-genesys/acceptance-test-config.yml | 36 +++ .../source-genesys/acceptance-test-docker.sh | 16 + .../connectors/source-genesys/build.gradle | 9 + .../integration_tests/__init__.py | 3 + .../integration_tests/acceptance.py | 16 + .../integration_tests/configured_catalog.json | 164 ++++++++++ .../integration_tests/invalid_config.json | 6 + .../integration_tests/sample_config.json | 6 + .../connectors/source-genesys/main.py | 13 + .../source-genesys/requirements.txt | 2 + .../connectors/source-genesys/setup.py | 29 ++ .../source-genesys/source_genesys/__init__.py | 8 + .../source_genesys/authenicator.py | 26 ++ .../schemas/routing_outbound_events.json | 70 +++++ .../schemas/routing_routing_assessments.json | 45 +++ .../schemas/routing_routing_queues.json | 118 +++++++ .../schemas/telephony_locations.json | 125 ++++++++ .../schemas/telephony_providers_edges.json | 136 ++++++++ .../telephony_providers_edges_didpools.json | 70 +++++ .../telephony_providers_edges_dids.json | 92 ++++++ .../telephony_providers_edges_extensions.json | 92 ++++++ .../telephony_providers_edges_lines.json | 142 +++++++++ ...ephony_providers_edges_outboundroutes.json | 98 ++++++ .../telephony_providers_edges_phones.json | 247 +++++++++++++++ .../telephony_providers_edges_sites.json | 221 +++++++++++++ .../telephony_providers_edges_trunks.json | 161 ++++++++++ .../schemas/telephony_stations.json | 73 +++++ .../source_genesys/schemas/user_groups.json | 62 ++++ .../source_genesys/schemas/user_users.json | 114 +++++++ .../source-genesys/source_genesys/source.py | 294 ++++++++++++++++++ .../source-genesys/source_genesys/spec.json | 51 +++ .../source-genesys/unit_tests/__init__.py | 3 + .../source-genesys/unit_tests/test_source.py | 23 ++ .../source-genesys/unit_tests/test_streams.py | 59 ++++ docs/integrations/sources/genesys.md | 27 ++ 42 files changed, 2899 insertions(+) create mode 100644 airbyte-config/init/src/main/resources/icons/genesys.svg create mode 100644 airbyte-integrations/connectors/source-genesys/.dockerignore create mode 100644 airbyte-integrations/connectors/source-genesys/Dockerfile create mode 100644 airbyte-integrations/connectors/source-genesys/README.md create mode 100644 airbyte-integrations/connectors/source-genesys/acceptance-test-config.yml create mode 100644 airbyte-integrations/connectors/source-genesys/acceptance-test-docker.sh create mode 100644 airbyte-integrations/connectors/source-genesys/build.gradle create mode 100644 airbyte-integrations/connectors/source-genesys/integration_tests/__init__.py create mode 100644 airbyte-integrations/connectors/source-genesys/integration_tests/acceptance.py create mode 100644 airbyte-integrations/connectors/source-genesys/integration_tests/configured_catalog.json create mode 100644 airbyte-integrations/connectors/source-genesys/integration_tests/invalid_config.json create mode 100644 airbyte-integrations/connectors/source-genesys/integration_tests/sample_config.json create mode 100644 airbyte-integrations/connectors/source-genesys/main.py create mode 100644 airbyte-integrations/connectors/source-genesys/requirements.txt create mode 100644 airbyte-integrations/connectors/source-genesys/setup.py create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/__init__.py create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/authenicator.py create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_outbound_events.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_routing_assessments.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_routing_queues.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_locations.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_didpools.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_dids.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_extensions.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_lines.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_outboundroutes.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_phones.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_sites.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_trunks.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_stations.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/user_groups.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/schemas/user_users.json create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/source.py create mode 100644 airbyte-integrations/connectors/source-genesys/source_genesys/spec.json create mode 100644 airbyte-integrations/connectors/source-genesys/unit_tests/__init__.py create mode 100644 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py create mode 100644 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py create mode 100644 docs/integrations/sources/genesys.md diff --git a/airbyte-config/init/src/main/resources/icons/genesys.svg b/airbyte-config/init/src/main/resources/icons/genesys.svg new file mode 100644 index 00000000000000..0d1d8b0fbfd478 --- /dev/null +++ b/airbyte-config/init/src/main/resources/icons/genesys.svg @@ -0,0 +1,7 @@ + \ No newline at end of file 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 9fc2d96a24753e..7448851dc13ac9 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -516,6 +516,12 @@ icon: freshservice.svg sourceType: api releaseStage: alpha +- name: Genesys + sourceDefinitionId: 5ea4459a-8f1a-452a-830f-a65c38cc438d + dockerRepository: airbyte/source-genesys + dockerImageTag: 0.1.0 + documentationUrl: https://docs.airbyte.com/integrations/sources/genesys + icon: genesys.svg - name: GetLago sourceDefinitionId: e1a3866b-d3b2-43b6-b6d7-8c1ee4d7f53f dockerRepository: airbyte/source-getlago 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 dfc41f7a69fbff..aedb137d001d4c 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -4364,6 +4364,59 @@ supportsNormalization: false supportsDBT: false supported_destination_sync_modes: [] +- dockerImage: "airbyte/source-genesys:0.1.0" + spec: + documentationUrl: "https://docs.airbyte.io/integrations/sources/genesys" + connectionSpecification: + $schema: "http://json-schema.org/draft-07/schema#" + title: "Genesys Connector Configuration" + type: "object" + required: + - "start_date" + - "tenant_endpoint" + - "client_id" + - "client_secret" + properties: + client_id: + type: "string" + title: "Client ID" + description: "Your OAuth user Client ID" + airbyte_secret: true + order: 0 + client_secret: + type: "string" + title: "Client Secret" + description: "Your OAuth user Client Secret" + airbyte_secret: true + order: 1 + tenant_endpoint: + title: "Tenant Endpoint Location" + type: "string" + description: "Please choose the right endpoint where your Tenant is located.\ + \ More info by this Link" + enum: + - "Americas (US East)" + - "Americas (US East 2)" + - "Americas (US West)" + - "Americas (Canada)" + - "Americas (São Paulo)" + - "EMEA (Frankfurt)" + - "EMEA (Dublin)" + - "EMEA (London)" + - "Asia Pacific (Mumbai)" + - "Asia Pacific (Seoul)" + - "Asia Pacific (Sydney)" + order: 2 + start_date: + type: "string" + title: "Start Date" + description: "Start Date in format: YYYY-MM-DD" + pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" + order: 3 + supportsNormalization: false + supportsDBT: false + supported_destination_sync_modes: [] - dockerImage: "airbyte/source-getlago:0.1.0" spec: documentationUrl: "https://docs.airbyte.com/integrations/sources/getlago" diff --git a/airbyte-integrations/builds.md b/airbyte-integrations/builds.md index 6f77fee24a0c90..b59dd842895d6a 100644 --- a/airbyte-integrations/builds.md +++ b/airbyte-integrations/builds.md @@ -43,6 +43,7 @@ | Freshdesk | [![source-freshdesk](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-freshdesk%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-freshdesk) | | Freshsales | [![source-freshsales](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-freshsales%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-freshsales) | | Freshservice | [![source-service](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-freshservice%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-freshservice) | +| Genesys | [![source-genesys](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-genesys%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-genesys) | | GitHub | [![source-github](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-github%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-github) | | GitLab | [![source-gitlab](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-gitlab%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-gitlab) | | Gong | [![source-gong](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-gong%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-gong) | diff --git a/airbyte-integrations/connectors/source-genesys/.dockerignore b/airbyte-integrations/connectors/source-genesys/.dockerignore new file mode 100644 index 00000000000000..b905df323f439d --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/.dockerignore @@ -0,0 +1,6 @@ +* +!Dockerfile +!main.py +!source_genesys +!setup.py +!secrets diff --git a/airbyte-integrations/connectors/source-genesys/Dockerfile b/airbyte-integrations/connectors/source-genesys/Dockerfile new file mode 100644 index 00000000000000..39db0db35fd907 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/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_genesys ./source_genesys + +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-genesys diff --git a/airbyte-integrations/connectors/source-genesys/README.md b/airbyte-integrations/connectors/source-genesys/README.md new file mode 100644 index 00000000000000..eb5b860d788760 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/README.md @@ -0,0 +1,131 @@ +# Genesys Source + +This is the repository for the Genesys source connector, written in Python. +For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/genesys). + +We are using `OAuth2` as this is the only supported authentication method. +## Local development + +### Prerequisites +#### 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-genesys:build +``` + +#### Create credentials +**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/genesys) +to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_genesys/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. + +**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source genesys 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-genesys:dev +``` + +You can also build the connector image via Gradle: +``` +./gradlew :airbyte-integrations:connectors:source-genesys: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-genesys:dev spec +docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-genesys:dev check --config /secrets/config.json +docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-genesys:dev discover --config /secrets/config.json +docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-genesys: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-genesys:unitTest +``` +To run acceptance and custom integration tests: +``` +./gradlew :airbyte-integrations:connectors:source-genesys: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-genesys/acceptance-test-config.yml b/airbyte-integrations/connectors/source-genesys/acceptance-test-config.yml new file mode 100644 index 00000000000000..f01a257bf2f6e3 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/acceptance-test-config.yml @@ -0,0 +1,36 @@ +# 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-genesys:dev +tests: + spec: + - spec_path: "source_genesys/spec.json" + 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: [ + "routing_outbound_events", + "routing_routing_assessments", + "routing_routing_queues", + "telephony_locations", + "telephony_providers_edges_didpools", + "telephony_providers_edges_dids", + "telephony_providers_edges_extensions", + "telephony_providers_edges_lines", + "telephony_providers_edges_outboundroutes", + "telephony_providers_edges_phones", + "telephony_providers_edges_sites", + "telephony_providers_edges_trunks", + "telephony_providers_edges", + "telephony_stations", + "user_groups", + ] + full_refresh: + - config_path: "secrets/config.json" + configured_catalog_path: "integration_tests/configured_catalog.json" diff --git a/airbyte-integrations/connectors/source-genesys/acceptance-test-docker.sh b/airbyte-integrations/connectors/source-genesys/acceptance-test-docker.sh new file mode 100644 index 00000000000000..c51577d10690c1 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/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-genesys/build.gradle b/airbyte-integrations/connectors/source-genesys/build.gradle new file mode 100644 index 00000000000000..8482754e0f6213 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/build.gradle @@ -0,0 +1,9 @@ +plugins { + id 'airbyte-python' + id 'airbyte-docker' + id 'airbyte-source-acceptance-test' +} + +airbytePython { + moduleDirectory 'source_genesys' +} diff --git a/airbyte-integrations/connectors/source-genesys/integration_tests/__init__.py b/airbyte-integrations/connectors/source-genesys/integration_tests/__init__.py new file mode 100644 index 00000000000000..1100c1c58cf510 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/integration_tests/__init__.py @@ -0,0 +1,3 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# diff --git a/airbyte-integrations/connectors/source-genesys/integration_tests/acceptance.py b/airbyte-integrations/connectors/source-genesys/integration_tests/acceptance.py new file mode 100644 index 00000000000000..1302b2f57e10ec --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/integration_tests/acceptance.py @@ -0,0 +1,16 @@ +# +# 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.""" + # TODO: setup test dependencies if needed. otherwise remove the TODO comments + yield + # TODO: clean up test dependencies diff --git a/airbyte-integrations/connectors/source-genesys/integration_tests/configured_catalog.json b/airbyte-integrations/connectors/source-genesys/integration_tests/configured_catalog.json new file mode 100644 index 00000000000000..9e934be14ffec4 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/integration_tests/configured_catalog.json @@ -0,0 +1,164 @@ +{ + "streams": [ + { + "stream": { + "name": "routing_outbound_events", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "routing_routing_assessments", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "routing_routing_queues", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_locations", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges_dids", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges_didpools", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges_extensions", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges_lines", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges_outboundroutes", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges_trunks", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges_sites", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_providers_edges_phones", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "telephony_stations", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "user_users", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + }, + { + "stream": { + "name": "user_groups", + "json_schema": {}, + "supported_sync_modes": ["full_refresh"], + "source_defined_cursor": false + }, + "sync_mode": "full_refresh", + "destination_sync_mode": "overwrite" + } + ] +} diff --git a/airbyte-integrations/connectors/source-genesys/integration_tests/invalid_config.json b/airbyte-integrations/connectors/source-genesys/integration_tests/invalid_config.json new file mode 100644 index 00000000000000..dc0a6008dc9e11 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/integration_tests/invalid_config.json @@ -0,0 +1,6 @@ +{ + "client-id": "aaa-bbb-ccc", + "client-secret": "123", + "start_date": "999-01-01", + "tenant_endpoint": "Bad Location" +} diff --git a/airbyte-integrations/connectors/source-genesys/integration_tests/sample_config.json b/airbyte-integrations/connectors/source-genesys/integration_tests/sample_config.json new file mode 100644 index 00000000000000..3da4af51c30bad --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/integration_tests/sample_config.json @@ -0,0 +1,6 @@ +{ + "client_id": "aaa-bbb-ccc", + "client_secret": "123", + "start_date": "2022-09-01", + "tenant_endpoint": "Asia Pacific (Sydney)" +} diff --git a/airbyte-integrations/connectors/source-genesys/main.py b/airbyte-integrations/connectors/source-genesys/main.py new file mode 100644 index 00000000000000..b5f211422164a7 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/main.py @@ -0,0 +1,13 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +import sys + +from airbyte_cdk.entrypoint import launch +from source_genesys import SourceGenesys + +if __name__ == "__main__": + source = SourceGenesys() + launch(source, sys.argv[1:]) diff --git a/airbyte-integrations/connectors/source-genesys/requirements.txt b/airbyte-integrations/connectors/source-genesys/requirements.txt new file mode 100644 index 00000000000000..0411042aa0911f --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/requirements.txt @@ -0,0 +1,2 @@ +-e ../../bases/source-acceptance-test +-e . diff --git a/airbyte-integrations/connectors/source-genesys/setup.py b/airbyte-integrations/connectors/source-genesys/setup.py new file mode 100644 index 00000000000000..cd94065bf9d6db --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/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.2", +] + +TEST_REQUIREMENTS = [ + "pytest~=6.1", + "pytest-mock~=3.6.1", + "source-acceptance-test", +] + +setup( + name="source_genesys", + description="Source implementation for Genesys.", + 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-genesys/source_genesys/__init__.py b/airbyte-integrations/connectors/source-genesys/source_genesys/__init__.py new file mode 100644 index 00000000000000..9ac0ccae127f80 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/__init__.py @@ -0,0 +1,8 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +from .source import SourceGenesys + +__all__ = ["SourceGenesys"] diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/authenicator.py b/airbyte-integrations/connectors/source-genesys/source_genesys/authenicator.py new file mode 100644 index 00000000000000..9a915050503cf1 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/authenicator.py @@ -0,0 +1,26 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + +import logging +from typing import Any, Mapping +from urllib import parse + +from airbyte_cdk.sources.streams.http.requests_native_auth import Oauth2Authenticator + +logger = logging.getLogger("airbyte") + + +class GenesysOAuthAuthenticator(Oauth2Authenticator): + def __init__(self, base_url: str, client_id: str, client_secret: str): + super().__init__(parse.urljoin(base_url, "/oauth/token"), client_id, client_secret, "") + + def build_refresh_request_body(self) -> Mapping[str, Any]: + if not self.get_refresh_token(): + return { + "grant_type": "client_credentials", + "client_id": self.get_client_id(), + "client_secret": self.get_client_secret(), + } + else: + return super().build_refresh_request_body() diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_outbound_events.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_outbound_events.json new file mode 100644 index 00000000000000..02672da5b6e058 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_outbound_events.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "errorEntity": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "relatedEntity": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "timestamp": { + "type": ["null", "string"], + "format": "date-time" + }, + "level": { + "type": ["null", "string"] + }, + "category": { + "type": ["null", "string"] + }, + "correlationId": { + "type": ["null", "string"] + }, + "eventMessage": { + "type": "object", + "properties": { + "code": { + "type": ["null", "string"] + }, + "message": { + "type": ["null", "string"] + }, + "messageWithParams": { + "type": ["null", "string"] + } + } + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_routing_assessments.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_routing_assessments.json new file mode 100644 index 00000000000000..fc1a8c7a9f009d --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_routing_assessments.json @@ -0,0 +1,45 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "queues": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "kpiAssessments": { + "type": "object", + "properties": { + "kpi": { + "type": ["null", "string"] + }, + "assessmentResult": { + "type": ["null", "string"] + } + } + }, + "state": { + "type": ["null", "string"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_routing_queues.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_routing_queues.json new file mode 100644 index 00000000000000..f00960aad86595 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/routing_routing_queues.json @@ -0,0 +1,118 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "memberCount": { + "type": ["null", "number"] + }, + "userMemberCount": { + "type": ["null", "number"] + }, + "joinedMemberCount": { + "type": ["null", "number"] + }, + "memberGroups": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "skillEvaluationMethod": { + "type": ["null", "string"] + }, + "queueFlow": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "autoAnswerOnly": { + "type": ["null", "boolean"] + }, + "enableTranscription": { + "type": ["null", "boolean"] + }, + "enableManualAssignment": { + "type": ["null", "boolean"] + }, + "callingPartyName": { + "type": ["null", "string"] + }, + "callingPartyNumber": { + "type": ["null", "string"] + }, + "defaultScripts": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "peerId": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_locations.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_locations.json new file mode 100644 index 00000000000000..5df8038df5c01b --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_locations.json @@ -0,0 +1,125 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["string"] + }, + "name": { + "type": ["null", "string"] + }, + "contactuser": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "emergencyNumber": { + "type": "object", + "properties": { + "e164": { + "type": ["null", "string"] + }, + "number": { + "type": ["null", "string"] + }, + "type": { + "type": ["null", "string"] + } + } + }, + "address": { + "type": "object", + "properties": { + "city": { + "type": ["null", "string"] + }, + "country": { + "type": ["null", "string"] + }, + "countryName": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "street1": { + "type": ["null", "string"] + }, + "street2": { + "type": ["null", "string"] + }, + "zipcode": { + "type": ["null", "string"] + } + } + }, + "state": { + "type": ["null", "string"] + }, + "notes": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "profileImage": { + "type": "object", + "properties": { + "resolution": { + "type": ["null", "string"] + }, + "imageUri": { + "type": ["null", "string"] + } + } + }, + "floorplanImage": { + "type": "object", + "properties": { + "resolution": { + "type": ["null", "string"] + }, + "imageUri": { + "type": ["null", "string"] + } + } + }, + "addressVerificationDetails": { + "type": "object", + "properties": { + "status": { + "type": ["null", "string"] + }, + "dateFinished": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateStarted": { + "type": ["null", "string"], + "format": "date-time" + }, + "service": { + "type": ["null", "string"] + } + } + }, + "addressVerified": { + "type": ["null", "boolean"] + }, + "addressStored": { + "type": ["null", "boolean"] + }, + "images": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges.json new file mode 100644 index 00000000000000..b278bbe090254c --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges.json @@ -0,0 +1,136 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "webRtcForceTurn": { + "type": ["null", "string"] + }, + "make": { + "type": ["null", "string"] + }, + "model": { + "type": ["null", "string"] + }, + "apiVersion": { + "type": ["null", "string"] + }, + "softwareVersion": { + "type": ["null", "string"] + }, + "softwareVersionTimestamp": { + "type": ["null", "string"] + }, + "softwareVersionPlatform": { + "type": ["null", "string"] + }, + "softwareVersionConfiguration": { + "type": ["null", "string"] + }, + "fullSoftwareVersion": { + "type": ["null", "string"] + }, + "pairingId": { + "type": ["null", "string"] + }, + "fingerprint": { + "type": ["null", "string"] + }, + "fingerprintHint": { + "type": ["null", "string"] + }, + "currentVersion": { + "type": ["null", "string"] + }, + "stagedVersion": { + "type": ["null", "string"] + }, + "patch": { + "type": ["null", "string"] + }, + "statusCode": { + "type": ["null", "string"] + }, + "onlineStatus": { + "type": ["null", "string"] + }, + "serialNumber": { + "type": ["null", "string"] + }, + "physicalEdge": { + "type": ["null", "boolean"] + }, + "managed": { + "type": ["null", "boolean"] + }, + "edgeDeploymentType": { + "type": ["null", "string"] + }, + "conversationCount": { + "type": ["null", "number"] + }, + "callDrainingState": { + "type": ["null", "string"] + }, + "proxy": { + "type": ["null", "string"] + }, + "offlineConfigCalled": { + "type": ["null", "boolean"] + }, + "osName": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_didpools.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_didpools.json new file mode 100644 index 00000000000000..50b501d75e8f5a --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_didpools.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "startPhoneNumber": { + "type": ["null", "string"] + }, + "endPhoneNumber": { + "type": ["null", "string"] + }, + "comments": { + "type": ["null", "string"] + }, + "provider": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_dids.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_dids.json new file mode 100644 index 00000000000000..8741d917e14876 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_dids.json @@ -0,0 +1,92 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "phoneNumber": { + "type": ["null", "string"] + }, + "didPool": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "owner": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "ownerType": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_extensions.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_extensions.json new file mode 100644 index 00000000000000..48270fc196a039 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_extensions.json @@ -0,0 +1,92 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "number": { + "type": ["null", "string"] + }, + "owner": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "extensionPool": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "ownerType": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_lines.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_lines.json new file mode 100644 index 00000000000000..c0b9c7dfd4f587 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_lines.json @@ -0,0 +1,142 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "edgeGroup": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "template": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "site": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "lineBaseSettings": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "primaryEdge": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "secondaryEdge": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_outboundroutes.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_outboundroutes.json new file mode 100644 index 00000000000000..c1d504e337722f --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_outboundroutes.json @@ -0,0 +1,98 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "classificationTypes": { + "type": ["array"] + }, + "enabled": { + "type": ["null", "boolean"] + }, + "distribution": { + "type": ["null", "string"] + }, + "externalTrunkBases": { + "type": "array", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "site": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "managed": { + "type": ["null", "boolean"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_phones.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_phones.json new file mode 100644 index 00000000000000..815d81c4e6dd21 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_phones.json @@ -0,0 +1,247 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "site": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "phoneBaseSettings": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "lineBaseSettings": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "phoneMetaBase": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "lines": { + "type": "array", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "status": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "secondaryStatus": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "userAgentInfo": { + "type": "object", + "properties": { + "firmwareVersion": { + "type": ["null", "string"] + }, + "manufacturer": { + "type": ["null", "string"] + }, + "model": { + "type": ["null", "string"] + } + } + }, + "capabilities": { + "type": "object", + "properties": { + "provisions": { + "type": ["null", "boolean"] + }, + "registers": { + "type": ["null", "boolean"] + }, + "dualRegisters": { + "type": ["null", "boolean"] + }, + "hardwareIdType": { + "type": ["null", "string"] + }, + "allowReboot": { + "type": ["null", "boolean"] + }, + "noRebalance": { + "type": ["null", "boolean"] + }, + "noCloudProvisioning": { + "type": ["null", "boolean"] + }, + "mediaCodecs": { + "type": ["null", "string"] + }, + "cdm": { + "type": ["null", "boolean"] + } + } + }, + "webRtcUser": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "primaryEdge": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "secondaryEdge": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "managed": { + "type": ["null", "boolean"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_sites.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_sites.json new file mode 100644 index 00000000000000..9bf6ac1ed2d55a --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_sites.json @@ -0,0 +1,221 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "primarySites": { + "type": "array", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "secondarySites": { + "type": "array", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "primaryEdges": { + "type": "array", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "secondaryEdges": { + "type": "array", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "addraddressesess": { + "type": "object", + "properties": { + "address": { + "type": ["null", "string"] + }, + "display": { + "type": ["null", "string"] + }, + "mediaType": { + "type": ["null", "string"] + }, + "type": { + "type": ["null", "string"] + }, + "extension": { + "type": ["null", "string"] + }, + "countryCode": { + "type": ["null", "string"] + }, + "integration": { + "type": ["null", "string"] + } + } + }, + "edges": { + "type": "array", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "edgeAutoUpdateConfig": { + "type": "object", + "properties": { + "timeZone": { + "type": ["null", "string"] + }, + "rrule": { + "type": ["null", "string"] + }, + "start": { + "type": ["null", "string"], + "format": "date-time" + }, + "end": { + "type": ["null", "string"], + "format": "date-time" + } + } + }, + "mediaRegionsUseLatencyBased": { + "type": ["null", "boolean"] + }, + "location": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "managed": { + "type": ["null", "boolean"] + }, + "ntpSettings": { + "type": "object", + "properties": { + "servers": { + "type": ["null", "string"] + } + } + }, + "mediaModel": { + "type": ["null", "string"] + }, + "coreSite": { + "type": ["null", "boolean"] + }, + "siteConnections": { + "type": "array", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_trunks.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_trunks.json new file mode 100644 index 00000000000000..0f793c4b6a3643 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_providers_edges_trunks.json @@ -0,0 +1,161 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "descriptions": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "dateCreated": { + "type": ["null", "string"], + "format": "date-time" + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "modifiedBy": { + "type": ["null", "string"] + }, + "createdBy": { + "type": ["null", "string"] + }, + "state": { + "type": ["null", "string"] + }, + "modifiedByApp": { + "type": ["null", "string"] + }, + "createdByApp": { + "type": ["null", "string"] + }, + "trunkType": { + "type": ["null", "string"] + }, + "edge": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "trunkBase": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "trunkMetabase": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "edgeGroup": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "inService": { + "type": ["null", "boolean"] + }, + "enabled": { + "type": ["null", "boolean"] + }, + "logicalInterface": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "connectedStatus": { + "type": "object", + "properties": { + "connected": { + "type": ["null", "boolean"] + }, + "connectedStateTime": { + "type": ["null", "string"], + "format": "date-time" + } + } + }, + "optionsEnabledStatus": { + "type": ["null", "string"] + }, + "registersEnabledStatus": { + "type": ["null", "string"] + }, + "family": { + "type": ["null", "number"] + }, + "proxyAddressList": { + "type": ["array"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_stations.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_stations.json new file mode 100644 index 00000000000000..a9fdc14ad80f70 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/telephony_stations.json @@ -0,0 +1,73 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "descriptions": { + "type": ["null", "string"] + }, + "status": { + "type": ["null", "string"] + }, + "userId": { + "type": ["null", "string"] + }, + "webRtcUserId": { + "type": ["null", "string"] + }, + "primaryEdge": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "secondaryEdge": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "type": { + "type": ["null", "string"] + }, + "lineAppearanceId": { + "type": ["null", "string"] + }, + "webRtcMediaDscp": { + "type": ["null", "number"] + }, + "webRtcPersistentEnabled": { + "type": ["null", "boolean"] + }, + "webRtcForceTurn": { + "type": ["null", "boolean"] + }, + "webRtcCallAppearances": { + "type": ["null", "number"] + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/user_groups.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/user_groups.json new file mode 100644 index 00000000000000..d4b58f210815f3 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/user_groups.json @@ -0,0 +1,62 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "dateModified": { + "type": ["null", "string"], + "format": "date-time" + }, + "memberCount": { + "type": ["null", "number"] + }, + "state": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "type": { + "type": ["null", "string"] + }, + "addresses": { + "type": "array", + "properties": { + "address": { + "type": ["null", "string"] + }, + "display": { + "type": ["null", "string"] + }, + "type": { + "type": ["null", "string"] + }, + "mediaType": { + "type": ["null", "string"] + } + } + }, + "rulesVisible": { + "type": ["null", "boolean"] + }, + "visibility": { + "type": ["null", "string"] + }, + "chat": { + "type": "object", + "properties": { + "jabberId": { + "type": ["null", "string"] + } + } + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/user_users.json b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/user_users.json new file mode 100644 index 00000000000000..b9c4474735d419 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/schemas/user_users.json @@ -0,0 +1,114 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "division": { + "type": "object", + "properties": { + "id": { + "type": ["null", "string"] + }, + "name": { + "type": ["null", "string"] + }, + "selfUri": { + "type": ["null", "string"] + } + } + }, + "chat": { + "type": "object", + "properties": { + "jabberId": { + "type": ["null", "string"] + } + } + }, + "department": { + "type": ["null", "string"] + }, + "email": { + "type": ["null", "string"] + }, + "primaryContactInfo": { + "type": "array", + "properties": { + "address": { + "type": ["null", "string"] + }, + "display": { + "type": ["null", "string"] + }, + "mediaType": { + "type": ["null", "string"] + }, + "type": { + "type": ["null", "string"] + }, + "extension": { + "type": ["null", "string"] + }, + "countryCode": { + "type": ["null", "string"] + }, + "integration": { + "type": ["null", "string"] + } + } + }, + "addresses": { + "type": "array", + "properties": { + "address": { + "type": ["null", "string"] + }, + "display": { + "type": ["null", "string"] + }, + "mediaType": { + "type": ["null", "string"] + }, + "type": { + "type": ["null", "string"] + }, + "extension": { + "type": ["null", "string"] + }, + "countryCode": { + "type": ["null", "string"] + }, + "integration": { + "type": ["null", "string"] + } + } + }, + "state": { + "type": ["null", "string"] + }, + "title": { + "type": ["null", "string"] + }, + "username": { + "type": ["null", "string"] + }, + "version": { + "type": ["null", "number"] + }, + "acdAutoAnswer": { + "type": ["null", "boolean"] + }, + "dateLastLogin": { + "type": ["null", "string"], + "format": "date-time" + }, + "selfUri": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/source.py b/airbyte-integrations/connectors/source-genesys/source_genesys/source.py new file mode 100644 index 00000000000000..016c9780f3b7e5 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/source.py @@ -0,0 +1,294 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + +import urllib.parse +from abc import ABC +from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional, Tuple + +import requests +from airbyte_cdk.sources import AbstractSource +from airbyte_cdk.sources.streams import Stream +from airbyte_cdk.sources.streams.http import HttpStream +from source_genesys.authenicator import GenesysOAuthAuthenticator + + +class GenesysStream(HttpStream, ABC): + url_base = "https://api.mypurecloud.com.au/api/v2/" + page_size = 500 + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def backoff_time(self, response: requests.Response) -> Optional[int]: + delay_time = response.headers.get("Retry-After") + if delay_time: + return int(delay_time) + + def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]: + response_json = response.json() + + if response_json.get("nextUri"): + next_query_string = urllib.parse.urlsplit(response_json.get("nextUri")).query + return dict(urllib.parse.parse_qsl(next_query_string)) + + 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]: + params = {"pageSize": self.page_size} + + # Handle pagination by inserting the next page's token in the request parameters + if next_page_token: + params.update(next_page_token) + return params + + def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: + json_response = response.json() + yield from json_response.get("entities", []) + + +class RoutingOutboundEvents(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/routing/routing/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "routing/assessments" + + +class RoutingRoutingAssessments(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/routing/routing/ + """ + + page_size = 200 + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "routing/assessments" + + +class RoutingRoutingQueues(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/routing/routing/ + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "routing/queues" + + +class TelephonyLocations(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/locations-apis + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "locations" + + +class TelephonyProvidersEdges(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges" + + +class TelephonyProvidersEdgesDids(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges/dids" + + +class TelephonyProvidersEdgesDidpools(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges/didpools" + + +class TelephonyProvidersEdgesExtensions(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges/extensions" + + +class TelephonyProvidersEdgesLines(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges/lines" + + +class TelephonyProvidersEdgesOutboundroutes(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges/outboundroutes" + + +class TelephonyProvidersEdgesPhones(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges/phones" + + +class TelephonyProvidersEdgesSites(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges/sites" + + +class TelephonyProvidersEdgesTrunks(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/telephony-apis + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "telephony/providers/edges/trunks" + + +class TelephonyStations(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/telephony/stations-apis + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "stations" + + +class UserUsers(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/useragentman/users/ + """ + + primary_key = "id" + + def path(self, **kwargs) -> str: + return "users" + + +class UserGroups(GenesysStream): + """ + API Docs: https://developer.genesys.cloud/useragentman/groups/ + """ + + primary_key = "id" + cursor_field = "dateModified" + + def path(self, **kwargs) -> str: + return "groups" + + +class SourceGenesys(AbstractSource): + def build_refresh_request_body(self) -> Mapping[str, Any]: + + return { + "grant_type": "client_credentials", + "client_id": self.get_client_id(), + "client_secret": self.get_client_secret(), + } + + def check_connection(self, logger, config) -> Tuple[bool, any]: + """ + TODO: Implement true connection checks using an endpoint that is always live + Testing connection availability for the connector by granting the credentials. + """ + return True, None + + def streams(self, config: Mapping[str, Any]) -> List[Stream]: + + GENESYS_TENANT_ENDPOINT_MAP: Dict = { + "Americas (US East)": "https://login.mypurecloud.com", + "Americas (US East 2)": "https://login.use2.us-gov-pure.cloud", + "Americas (US West)": "https://login.usw2.pure.cloud", + "Americas (Canada)": "https://login.cac1.pure.cloud", + "Americas (São Paulo)": "https://login.sae1.pure.cloud", + "EMEA (Frankfurt)": "https://login.mypurecloud.de", + "EMEA (Dublin)": "https://login.mypurecloud.ie", + "EMEA (London)": "https://login.euw2.pure.cloud", + "Asia Pacific (Mumbai)": "https://login.aps1.pure.cloud", + "Asia Pacific (Seoul)": "https://login.apne2.pure.cloud", + "Asia Pacific (Sydney)": "https://login.mypurecloud.com.au", + } + base_url = GENESYS_TENANT_ENDPOINT_MAP.get(config["tenant_endpoint"]) + args = {"authenticator": GenesysOAuthAuthenticator(base_url, config["client_id"], config["client_secret"])} + + # response = self.get_connection_response(config) + # response.raise_for_status() + + # args = {"authenticator": TokenAuthenticator(response.json()["access_token"])} + return [ + RoutingOutboundEvents(**args), + RoutingRoutingAssessments(**args), + RoutingRoutingQueues(**args), + TelephonyLocations(**args), + TelephonyProvidersEdges(**args), + TelephonyProvidersEdgesDids(**args), + TelephonyProvidersEdgesDidpools(**args), + TelephonyProvidersEdgesExtensions(**args), + TelephonyProvidersEdgesLines(**args), + TelephonyProvidersEdgesOutboundroutes(**args), + TelephonyProvidersEdgesPhones(**args), + TelephonyProvidersEdgesSites(**args), + TelephonyProvidersEdgesTrunks(**args), + TelephonyStations(**args), + UserGroups(**args), + UserUsers(**args), + ] diff --git a/airbyte-integrations/connectors/source-genesys/source_genesys/spec.json b/airbyte-integrations/connectors/source-genesys/source_genesys/spec.json new file mode 100644 index 00000000000000..ceb1db8e7699eb --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/source_genesys/spec.json @@ -0,0 +1,51 @@ +{ + "documentationUrl": "https://docs.airbyte.io/integrations/sources/genesys", + "connectionSpecification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Genesys Connector Configuration", + "type": "object", + "required": ["start_date", "tenant_endpoint", "client_id", "client_secret"], + "properties": { + "client_id": { + "type": "string", + "title": "Client ID", + "description": "Your OAuth user Client ID", + "airbyte_secret": true, + "order": 0 + }, + "client_secret": { + "type": "string", + "title": "Client Secret", + "description": "Your OAuth user Client Secret", + "airbyte_secret": true, + "order": 1 + }, + "tenant_endpoint": { + "title": "Tenant Endpoint Location", + "type": "string", + "description": "Please choose the right endpoint where your Tenant is located. More info by this Link", + "enum": [ + "Americas (US East)", + "Americas (US East 2)", + "Americas (US West)", + "Americas (Canada)", + "Americas (São Paulo)", + "EMEA (Frankfurt)", + "EMEA (Dublin)", + "EMEA (London)", + "Asia Pacific (Mumbai)", + "Asia Pacific (Seoul)", + "Asia Pacific (Sydney)" + ], + "order": 2 + }, + "start_date": { + "type": "string", + "title": "Start Date", + "description": "Start Date in format: YYYY-MM-DD", + "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", + "order": 3 + } + } + } +} diff --git a/airbyte-integrations/connectors/source-genesys/unit_tests/__init__.py b/airbyte-integrations/connectors/source-genesys/unit_tests/__init__.py new file mode 100644 index 00000000000000..1100c1c58cf510 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/unit_tests/__init__.py @@ -0,0 +1,3 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# diff --git a/airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py b/airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py new file mode 100644 index 00000000000000..4baac756343616 --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py @@ -0,0 +1,23 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + +from unittest.mock import MagicMock + +from source_genesys.source import SourceGenesys + + +def test_check_connection(mocker): + source = SourceGenesys() + logger_mock, config_mock = MagicMock(), MagicMock() + SourceGenesys.get_connection_response = MagicMock() + assert source.check_connection(logger_mock, config_mock) == (True, None) + + +def test_streams(mocker): + source = SourceGenesys() + config_mock = MagicMock() + SourceGenesys.get_connection_response = MagicMock() + streams = source.streams(config_mock) + expected_streams_number = 16 + assert len(streams) == expected_streams_number diff --git a/airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py b/airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py new file mode 100644 index 00000000000000..21833d4a08917b --- /dev/null +++ b/airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py @@ -0,0 +1,59 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + +from http import HTTPStatus +from unittest.mock import MagicMock + +import pytest +from source_genesys.source import GenesysStream + + +@pytest.fixture +def patch_base_class(mocker): + # Mock abstract methods to enable instantiating abstract class + mocker.patch.object(GenesysStream, "path", "v0/example_endpoint") + mocker.patch.object(GenesysStream, "primary_key", "test_primary_key") + mocker.patch.object(GenesysStream, "__abstractmethods__", set()) + + +def test_request_params(patch_base_class): + stream = GenesysStream() + inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None} + expected_params = {"pageSize": 500} + assert stream.request_params(**inputs) == expected_params + + +def test_request_headers(patch_base_class): + stream = GenesysStream() + inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None} + assert len(stream.request_headers(**inputs)) == 0 + + +def test_http_method(patch_base_class): + stream = GenesysStream() + 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 = GenesysStream() + assert stream.should_retry(response_mock) == should_retry + + +def test_backoff_time(patch_base_class): + response_mock = MagicMock() + stream = GenesysStream() + expected_backoff_time = 1 + assert stream.backoff_time(response_mock) == expected_backoff_time diff --git a/docs/integrations/sources/genesys.md b/docs/integrations/sources/genesys.md new file mode 100644 index 00000000000000..e756d2dd26881a --- /dev/null +++ b/docs/integrations/sources/genesys.md @@ -0,0 +1,27 @@ +# Genesys + +## Overview +The Genesys source retrieves data from [Genesys](https://www.genesys.com/) using their [JSON REST APIs](https://developer.genesys.cloud/devapps/api-explorer). + +## Setup Guide + +### Requirements +We are using `OAuth2` as this is the only supported authentication method. So you will need to follow the steps below to generate the `Client ID` and `Client Secret`. + +- Genesys region +- Client ID +- Client Secret + +You can follow the documentation on [API credentials](https://developer.genesys.cloud/authorization/platform-auth/use-client-credentials#obtain-an-access-token) or you can login directly to the [OAuth admin page](https://apps.mypurecloud.com/directory/#/admin/integrations/oauth) + +## Supported Streams +- [Locations](https://developer.genesys.cloud/telephony/locations-apis) +- [Routing](https://developer.genesys.cloud/routing/routing/) +- [Stations](https://developer.genesys.cloud/telephony/stations-apis) +- [Telephony](hhttps://developer.genesys.cloud/telephony/telephony-apis) +- [Users](https://developer.genesys.cloud/useragentman/users/) + +## Changelog +| Version | Date | Pull Request | Subject | +| :------ | :--------- | :------------------------------------------------------- | :-------------------------- | +| 0.1.0 | 2022-10-06 | [17559](https://github.com/airbytehq/airbyte/pull/17559) | The Genesys Source is created |