Skip to content

Commit

Permalink
🎉 New source: Timely #13292 (#14335)
Browse files Browse the repository at this point in the history
* Added Timely source python connector

* Added Pagination

* fix: linting

* fix: tests, linting and naming

* chore: added connector to definitions

* fix: icon is blank

* auto-bump connector version

Co-authored-by: Yashkumar Makwana <[email protected]>
Co-authored-by: Octavia Squidington III <[email protected]>
  • Loading branch information
3 people authored Jul 15, 2022
1 parent 994f781 commit bf9bfd1
Show file tree
Hide file tree
Showing 27 changed files with 1,148 additions and 0 deletions.
13 changes: 13 additions & 0 deletions airbyte-config/init/src/main/resources/icons/timely.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,14 @@
icon: tiktok.svg
sourceType: api
releaseStage: generally_available
- name: Timely
sourceDefinitionId: bc617b5f-1b9e-4a2d-bebe-782fd454a771
dockerRepository: airbyte/source-timely
dockerImageTag: 0.1.0
documentationUrl: https://docs.airbyte.io/integrations/sources/timely
icon: timely.svg
sourceType: api
releaseStage: alpha
- name: Trello
sourceDefinitionId: 8da67652-004c-11ec-9a03-0242ac130003
dockerRepository: airbyte/source-trello
Expand Down
30 changes: 30 additions & 0 deletions airbyte-config/init/src/main/resources/seed/source_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9419,6 +9419,36 @@
- "app_id"
- "secret"
additionalProperties: true
- dockerImage: "airbyte/source-timely:0.1.0"
spec:
documentationUrl: "https://docsurl.com"
connectionSpecification:
$schema: "http://json-schema.org/draft-07/schema#"
title: "Timely Integration Spec"
type: "object"
required:
- "account_id"
- "start_date"
- "bearer_token"
additionalProperties: false
properties:
account_id:
title: "account_id"
type: "string"
description: "Timely account id"
start_date:
title: "startDate"
type: "string"
description: "start date"
pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
example: "2022-05-06"
bearer_token:
title: "Bearer token"
type: "string"
description: "Timely bearer token"
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-trello:0.1.6"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/trello"
Expand Down
6 changes: 6 additions & 0 deletions airbyte-integrations/connectors/source-timely/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*
!Dockerfile
!main.py
!source_timely
!setup.py
!secrets
38 changes: 38 additions & 0 deletions airbyte-integrations/connectors/source-timely/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM python:3.9.11-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_timely ./source_timely

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-timely
19 changes: 19 additions & 0 deletions airbyte-integrations/connectors/source-timely/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
This is the first python custom source connector which is made for Timely.<br>
To get started using this connector, you will be needing three things.<br>

1. Account ID
2. Bearer Token
3. Start-date

**Account ID** - Anyone who has admin access to Timelyapp.com you can find your account id, on the URL of your home page.

Once, you have the account create an application on the Timelyapp.com where you need to specify your application name, this will generate Client_secret, Client_id, and redirect_uri.

**Bearer Token** - To connect to the timelyapp API, I recommend using Postman or any other open source application that will get you the bearer token.
For Postman users, it will ask you to enter Auth url, Token url, Client_id, Client secret. For more details on how to work with timelyapp, please click [here](https://dev.timelyapp.com/#introduction)

**Start-date** - Please enter the start date in yy-mm--dd format to get the enteries from the start-date, this will pull all the record from the date entered to the present date.

That's all you need to get this connector working

**Working locally**- navigate yourself to the source-timely/sample_files/config.json, and enter the ID, token and date to get this connector working.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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-timely:dev
tests:
spec:
- spec_path: "source_timely/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: []
full_refresh:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/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-)

# 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:dev \
--acceptance-test-config /test_input

9 changes: 9 additions & 0 deletions airbyte-integrations/connectors/source-timely/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
id 'airbyte-python'
id 'airbyte-docker'
id 'airbyte-source-acceptance-test'
}

airbytePython {
moduleDirectory 'source_timely_integration'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"todo-stream-name": {
"todo-field-name": "todo-abnormal-value"
}
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"streams": [
{
"stream": {
"name": "events",
"json_schema": {},
"supported_sync_modes": [
"full_refresh"
]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"primary_key": [
[
"id"
]
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"account_id": "123",
"start_date": "2022-04-01",
"bearer_token": "51UWRAsFuIbeygfIY3XfucQUGiX"
}
13 changes: 13 additions & 0 deletions airbyte-integrations/connectors/source-timely/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#


import sys

from airbyte_cdk.entrypoint import launch
from source_timely import SourceTimely

if __name__ == "__main__":
source = SourceTimely()
launch(source, sys.argv[1:])
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-e ../../bases/source-acceptance-test
-e .
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"account_id":"XXXXX",
"start_date":"2022-04-01",
"bearer_token":"XXXXXX"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"streams": [
{
"stream": {
"name": "events",
"json_schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"account_id": {
"type": "string"
}
}
},
"supported_sync_modes": ["full_refresh"],
"supported_destination_sync_modes": ["overwrite", "append_dedup"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "append_dedup"
}
]
}
29 changes: 29 additions & 0 deletions airbyte-integrations/connectors/source-timely/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#


from setuptools import find_packages, setup

MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
]

TEST_REQUIREMENTS = [
"pytest~=6.1",
"pytest-mock~=3.6.1",
"source-acceptance-test",
]

setup(
name="source_timely",
description="Source implementation for Timely Integration.",
author="Airbyte",
author_email="[email protected]",
packages=find_packages(),
install_requires=MAIN_REQUIREMENTS,
package_data={"": ["*.json", "schemas/*.json", "schemas/shared/*.json"]},
extras_require={
"tests": TEST_REQUIREMENTS,
},
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#


from .source import SourceTimely

__all__ = ["SourceTimely"]
Loading

0 comments on commit bf9bfd1

Please sign in to comment.