Skip to content

Commit

Permalink
feat: zoho crm connector
Browse files Browse the repository at this point in the history
  • Loading branch information
andyh565 committed Oct 15, 2024
1 parent 444967d commit 804f18a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
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

0 comments on commit 804f18a

Please sign in to comment.