Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: zoho crm connector #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
pypi:
enabled: true
packageName: airbyte-source-zoho-crm
registryOverrides:
registries:
cloud:
enabled: true
oss:
Expand All @@ -27,10 +27,6 @@ data:
- language:python
- cdk:python
connectorTestSuitesOptions:
- suite: liveTests
testConnections:
- name: zoho-crm_config_dev_null
id: 0000da93-11f4-4e8f-8ede-42b9789b974d
- suite: unitTests
- suite: integrationTests
testSecrets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional

import requests
from airbyte_cdk.entrypoint import logger
from airbyte_cdk.sources.streams.http import HttpStream

from .api import ZohoAPI
Expand Down Expand Up @@ -109,14 +110,20 @@ def __init__(self, config: Mapping[str, Any]):
self._config = config

def _init_modules_meta(self) -> List[ModuleMeta]:
modules_meta_json = self.api.modules_settings()
contacts_modules_meta_json = self.api.module_settings("Contacts")
leads_modules_meta_json = self.api.module_settings("Leads")

modules_meta_json = contacts_modules_meta_json + leads_modules_meta_json
modules = [ModuleMeta.from_dict(module) for module in modules_meta_json]
return list(filter(lambda module: module.api_supported, modules))
return list(filter(lambda module: module.api_name == "Contacts" or module.api_name == "Leads", modules))

def _populate_fields_meta(self, module: ModuleMeta):
fields_meta_json = self.api.fields_settings(module.api_name)
fields_meta = []
for field in fields_meta_json:
if 'json_type' not in field:
logger.warn(f"Unsupported Zoho field {field['api_name']} found")
continue
pick_list_values = field.get("pick_list_values", [])
if pick_list_values:
field["pick_list_values"] = [ZohoPickListItem.from_dict(pick_list_item) for pick_list_item in field["pick_list_values"]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ class AutoNumberDict(FromDictMixin):
@dataclasses.dataclass
class FieldMeta(FromDictMixin):
json_type: str
length: Optional[int]
api_name: str
data_type: str
decimal_place: Optional[int]
system_mandatory: bool
display_label: str
pick_list_values: Optional[List[ZohoPickListItem]]
length: Optional[int] = None
decimal_place: Optional[int] = None
pick_list_values: Optional[List[ZohoPickListItem]] = None
auto_number: Optional[AutoNumberDict] = AutoNumberDict(prefix="", suffix="")

def _default_type_kwargs(self) -> Dict[str, str]:
Expand Down Expand Up @@ -155,7 +155,6 @@ def _string_field(self) -> FieldType:
elif self.data_type == ZohoDataType.bigint:
typedef["airbyte_type"] = "big_integer"
elif self.data_type == ZohoDataType.autonumber:
print(self.auto_number)
if self.auto_number.get("prefix") or self.auto_number.get("suffix"):
typedef["format"] = "string"
else:
Expand Down
Loading