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

✨ Source Close.com: add support for custom fields #32984

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.4.3
LABEL io.airbyte.version=0.5.0
LABEL io.airbyte.name=airbyte/source-close-com
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@


from .datetime_incremental_sync import CustomDatetimeIncrementalSync
from .source_lc import SourceCloseCom
from .source import SourceCloseCom

__all__ = ["SourceCloseCom", "CustomDatetimeIncrementalSync"]
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def request_params(
stream_slice: Mapping[str, Any] = None,
next_page_token: Mapping[str, Any] = None,
) -> MutableMapping[str, Any]:

params = {}
if self.number_of_items_per_page:
params.update({"_limit": self.number_of_items_per_page})
Expand All @@ -69,6 +68,21 @@ def request_params(

return params

def get_custom_field_schema(self) -> Mapping[str, Any]:
"""Get custom field schema if it exists."""
if self.path() not in {"lead", "contact", "opportunity", "activity"}:
return {}
resp = requests.request("GET", url=f"{self.url_base}/custom_field/{self.path()}/", headers=self.authenticator.get_auth_header())
resp.raise_for_status()
resp_json: Mapping[str, Any] = resp.json()["data"]
return {f"custom.{data['id']}": {"type": ["null", "string", "number", "boolean"]} for data in resp_json}

def get_json_schema(self):
"""Override default get_json_schema method to add custom fields to schema."""
schema = super().get_json_schema()
schema["properties"].update(self.get_custom_field_schema())
return schema
marcosmarxm marked this conversation as resolved.
Show resolved Hide resolved

def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]:
yield from response.json()["data"]

Expand All @@ -88,7 +102,6 @@ def backoff_time(self, response: requests.Response) -> Optional[float]:


class IncrementalCloseComStream(CloseComStream):

cursor_field = "date_updated"

def get_updated_state(
Expand Down
5 changes: 3 additions & 2 deletions docs/integrations/sources/close-com.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ The Close.com connector is subject to rate limits. For more information on this

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------|:-------------------------------------------------------------------------------------------------------|
| 0.4.3 | 2023-10-28 | [31534](https://github.com/airbytehq/airbyte/pull/31534) | Fixed Email Activities Stream Pagination |
| 0.4.2 | 2023-08-08 | [29206](https://github.com/airbytehq/airbyte/pull/29206) | Fixed the issue with `DatePicker` format for `start date` |
| 0.5.0 | 2023-11-30 | [32984](https://github.com/airbytehq/airbyte/pull/32984) | Add support for custom fields |
| 0.4.3 | 2023-10-28 | [31534](https://github.com/airbytehq/airbyte/pull/31534) | Fixed Email Activities Stream Pagination |
| 0.4.2 | 2023-08-08 | [29206](https://github.com/airbytehq/airbyte/pull/29206) | Fixed the issue with `DatePicker` format for `start date` |
| 0.4.1 | 2023-07-04 | [27950](https://github.com/airbytehq/airbyte/pull/27950) | Add human readable titles to API Key and Start Date fields |
| 0.4.0 | 2023-06-27 | [27776](https://github.com/airbytehq/airbyte/pull/27776) | Update the `Email Followup Tasks` stream schema |
| 0.3.0 | 2023-05-12 | [26024](https://github.com/airbytehq/airbyte/pull/26024) | Update the `Email sequences` stream schema |
Expand Down
Loading