From c19f348999295c17da1d08f9104bc6c658261a1f Mon Sep 17 00:00:00 2001 From: Aakash Kumar Date: Sun, 11 Sep 2022 00:56:17 +0530 Subject: [PATCH 1/3] first commit --- .../source_lever_hiring/source.py | 18 +++++++++++------- .../source_lever_hiring/spec.json | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/source.py b/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/source.py index d70ef1c2abef..0568c0dc98ed 100644 --- a/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/source.py +++ b/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/source.py @@ -6,18 +6,22 @@ from airbyte_cdk.sources import AbstractSource from airbyte_cdk.sources.streams import Stream -from airbyte_cdk.sources.streams.http.auth import Oauth2Authenticator +from airbyte_cdk.sources.streams.http.auth import BasicHttpAuthenticator, Oauth2Authenticator from .streams import Applications, Interviews, Notes, Offers, Opportunities, Referrals, Users def _auth_from_config(config): - return Oauth2Authenticator( - client_id=config["credentials"]["client_id"], - client_secret=config["credentials"]["client_secret"], - refresh_token=config["credentials"]["refresh_token"], - token_refresh_endpoint=f"{SourceLeverHiring.URL_MAP_ACCORDING_ENVIRONMENT[config['environment']]['login']}oauth/token", - ) + + if config and config["credemtials"] and 'api_key' in config["credentials"]: + return BasicHttpAuthenticator(username=config["credentials"]["api_key"], auth_method="Basic") + else: + return Oauth2Authenticator( + client_id=config["credentials"]["client_id"], + client_secret=config["credentials"]["client_secret"], + refresh_token=config["credentials"]["refresh_token"], + token_refresh_endpoint=f"{SourceLeverHiring.URL_MAP_ACCORDING_ENVIRONMENT[config['environment']]['login']}oauth/token", + ) class SourceLeverHiring(AbstractSource): diff --git a/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/spec.json b/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/spec.json index 4df7073f2dc7..31fbaa7bf346 100644 --- a/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/spec.json +++ b/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/spec.json @@ -50,6 +50,25 @@ "airbyte_secret": true } } + }, + { + "type": "object", + "title": "Authenticate via Lever (Api Key)", + "required": ["api_key"], + "properties": { + "auth_type": { + "type": "string", + "const": "Api Key", + "enum": ["Api Key"], + "default": "Api Key", + "order": 0 + }, + "api_key": { + "title": "Api key", + "type": "string", + "description": "The Api Key of your Lever Hiring developer application." + } + } } ] }, From faeeab1994903b7ef7c769184cd8f4688310299e Mon Sep 17 00:00:00 2001 From: Aakash Kumar Date: Sun, 11 Sep 2022 00:57:44 +0530 Subject: [PATCH 2/3] first commit ## What Adding Basic Authentication to Lever Hiring Issue raised in commit: https://github.com/airbytehq/airbyte/issues/16358 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## How *Describe the solution* ## Recommended reading order 1. `x.java` 2. `y.python` ## 🚨 User Impact 🚨 Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed. ## Pre-merge Checklist Expand the relevant checklist and delete the others.
New Connector ### Community member or Airbyter - [ ] **Community member?** Grant edit access to maintainers ([instructions](https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork#enabling-repository-maintainer-permissions-on-existing-pull-requests)) - [ ] Secrets in the connector's spec are annotated with `airbyte_secret` - [ ] Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run `./gradlew :airbyte-integrations:connectors::integrationTest`. - [ ] Code reviews completed - [ ] Documentation updated - [ ] Connector's `README.md` - [ ] Connector's `bootstrap.md`. See [description and examples](https://docs.google.com/document/d/1ypdgmwmEHWv-TrO4_YOQ7pAJGVrMp5BOkEVh831N260/edit?usp=sharing) - [ ] `docs/integrations//.md` including changelog. See changelog [example](https://docs.airbyte.io/integrations/sources/stripe#changelog) - [ ] `docs/integrations/README.md` - [ ] `airbyte-integrations/builds.md` - [ ] PR name follows [PR naming conventions](https://docs.airbyte.io/contributing-to-airbyte/updating-documentation#issues-and-pull-requests) ### Airbyter If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items. - [ ] Create a non-forked branch based on this PR and test the below items on it - [ ] Build is successful - [ ] If new credentials are required for use in CI, add them to GSM. [Instructions](https://docs.airbyte.io/connector-development#using-credentials-in-ci). - [ ] [`/test connector=connectors/` command](https://docs.airbyte.io/connector-development#updating-an-existing-connector) is passing - [ ] New Connector version released on Dockerhub by running the `/publish` command described [here](https://docs.airbyte.io/connector-development#updating-an-existing-connector) - [ ] After the connector is published, connector added to connector index as described [here](https://docs.airbyte.io/connector-development#publishing-a-connector) - [ ] Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described [here](https://docs.airbyte.io/connector-development#publishing-a-connector)
Updating a connector ### Community member or Airbyter - [ ] Grant edit access to maintainers ([instructions](https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork#enabling-repository-maintainer-permissions-on-existing-pull-requests)) - [ ] Secrets in the connector's spec are annotated with `airbyte_secret` - [ ] Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run `./gradlew :airbyte-integrations:connectors::integrationTest`. - [ ] Code reviews completed - [ ] Documentation updated - [ ] Connector's `README.md` - [ ] Connector's `bootstrap.md`. See [description and examples](https://docs.google.com/document/d/1ypdgmwmEHWv-TrO4_YOQ7pAJGVrMp5BOkEVh831N260/edit?usp=sharing) - [ ] Changelog updated in `docs/integrations//.md` including changelog. See changelog [example](https://docs.airbyte.io/integrations/sources/stripe#changelog) - [ ] PR name follows [PR naming conventions](https://docs.airbyte.io/contributing-to-airbyte/updating-documentation#issues-and-pull-requests) ### Airbyter If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items. - [ ] Create a non-forked branch based on this PR and test the below items on it - [ ] Build is successful - [ ] If new credentials are required for use in CI, add them to GSM. [Instructions](https://docs.airbyte.io/connector-development#using-credentials-in-ci). - [ ] [`/test connector=connectors/` command](https://docs.airbyte.io/connector-development#updating-an-existing-connector) is passing - [ ] New Connector version released on Dockerhub and connector version bumped by running the `/publish` command described [here](https://docs.airbyte.io/connector-development#updating-an-existing-connector)
Connector Generator - [ ] Issue acceptance criteria met - [ ] PR name follows [PR naming conventions](https://docs.airbyte.io/contributing-to-airbyte/updating-documentation#issues-and-pull-requests) - [ ] If adding a new generator, add it to the [list of scaffold modules being tested](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connector-templates/generator/build.gradle#L41) - [ ] The generator test modules (all connectors with `-scaffold` in their name) have been updated with the latest scaffold by running `./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates` then checking in your changes - [ ] Documentation which references the generator is updated as needed
## Tests
Unit *Put your unit tests output here.*
Integration *Put your integration tests output here.*
Acceptance *Put your acceptance tests output here.*
--- .vscode/settings.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e52044ed1069..11fc0fe603ca 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,5 +41,8 @@ "editor.codeActionsOnSave": { "source.fixAll.stylelint": true } - } + }, + "python.analysis.extraPaths": [ + "./airbyte-cdk/python" + ] } From 049b4c90bafab2fe27020d4f384615b8f1ca5a49 Mon Sep 17 00:00:00 2001 From: Aakash Kumar Date: Fri, 16 Sep 2022 10:45:22 +0530 Subject: [PATCH 3/3] review changes --- .../source-lever-hiring/source_lever_hiring/source.py | 2 +- .../source-lever-hiring/source_lever_hiring/spec.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/source.py b/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/source.py index 0568c0dc98ed..a6a482f142c3 100644 --- a/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/source.py +++ b/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/source.py @@ -13,7 +13,7 @@ def _auth_from_config(config): - if config and config["credemtials"] and 'api_key' in config["credentials"]: + if config and config["credentials"] and 'api_key' in config["credentials"]: return BasicHttpAuthenticator(username=config["credentials"]["api_key"], auth_method="Basic") else: return Oauth2Authenticator( diff --git a/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/spec.json b/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/spec.json index 31fbaa7bf346..a98605823780 100644 --- a/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/spec.json +++ b/airbyte-integrations/connectors/source-lever-hiring/source_lever_hiring/spec.json @@ -66,7 +66,9 @@ "api_key": { "title": "Api key", "type": "string", - "description": "The Api Key of your Lever Hiring developer application." + "description": "The Api Key of your Lever Hiring developer application.", + "airbyte_secret": true, + "order":1 } } }