diff --git a/README.md b/README.md index 893de8e..6fc5991 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,10 @@ This tap: - [Contacts](https://developers.hubspot.com/docs/methods/contacts/get_contacts) - [Contact Lists](http://developers.hubspot.com/docs/methods/lists/get_lists) - [Deals](http://developers.hubspot.com/docs/methods/deals/get_deals_modified) + - [Meetings](https://developers.hubspot.com/docs/api/crm/meetings) + - [Calls](https://developers.hubspot.com/docs/api/crm/calls) - [Deal Pipelines](https://developers.hubspot.com/docs/methods/deal-pipelines/get-all-deal-pipelines) - [Email Events](http://developers.hubspot.com/docs/methods/email/get_events) - - [Engagements](https://developers.hubspot.com/docs/methods/engagements/get-all-engagements) - [Forms](http://developers.hubspot.com/docs/methods/forms/v2/get_forms) - [Keywords](http://developers.hubspot.com/docs/methods/keywords/get_keywords) - [Owners](http://developers.hubspot.com/docs/methods/owners/get_owners) diff --git a/tap_hubspot/schemas/calls.json b/tap_hubspot/schemas/calls.json new file mode 100644 index 0000000..46f2046 --- /dev/null +++ b/tap_hubspot/schemas/calls.json @@ -0,0 +1,76 @@ +{ + "type": "object", + "properties":{ + "id": { + "type": ["null","string"] + }, + "createdAt": { + "type": ["null", "string"], + "format": "date-time" + }, + "updatedAt": { + "type": ["null", "string"], + "format": "date-time" + }, + "archived": { + "type": ["null", "boolean"] + }, + "properties": { + "type": "object", + "properties": { + "createdate": { + "type": ["null", "string"], + "format": "date-time" + }, + "hs_call_body": { + "type": ["null", "string"] + }, + "hs_call_duration": { + "type": ["null", "string"], + "format": "number" + }, + "hs_call_from_number": { + "type": ["null", "string"] + }, + "hs_call_recording_url": { + "type": ["null", "string"] + }, + "hs_call_status": { + "type": ["null", "string"] + }, + "hs_call_title": { + "type": ["null", "string"] + }, + "hs_call_to_number": { + "type": ["null", "string"] + }, + "hs_call_direction": { + "type": ["null", "string"] + }, + "hs_activity_type": { + "type": ["null", "string"] + }, + "hs_call_disposition": { + "type": ["null", "string"] + }, + "hs_call_callee_object_type_id": { + "type": ["null", "string"] + }, + "hs_call_callee_object_id": { + "type": ["null", "string"] + }, + "hs_lastmodifieddate": { + "type": ["null", "string"], + "format": "date-time" + }, + "hs_timestamp": { + "type": ["null", "string"], + "format": "date-time" + }, + "hubspot_owner_id": { + "type": ["null", "string"] + } + } + } + } +} \ No newline at end of file diff --git a/tap_hubspot/schemas/engagements.json b/tap_hubspot/schemas/engagements.json deleted file mode 100644 index fe599c8..0000000 --- a/tap_hubspot/schemas/engagements.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "lastUpdated": { - "type": ["null", "integer"], - "format": "date-time" - }, - "engagement": { - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "portalId": { - "type": "integer" - }, - "active": { - "type": "boolean" - }, - "createdAt": { - "type": ["null", "integer"], - "format": "date-time" - }, - "lastUpdated": { - "type": ["null", "integer"], - "format": "date-time" - }, - "ownerId": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "timestamp": { - "type": ["null", "integer"], - "format": "date-time" - } - } - }, - "associations": { - "type": ["null", "object"], - "properties": { - "contactIds": { - "type": ["null", "array"], - "items": { - "type": "integer" - } - }, - "companyIds": { - "type": ["null", "array"], - "items": { - "type": "integer" - } - }, - "dealIds": { - "type": ["null", "array"], - "items": { - "type": "integer" - } - } - } - }, - "attachments": { - "type": ["null", "array"], - "items": { - "type": "object", - "properties": { - "id": { - "type": "integer" - } - } - } - }, - "metadata": { - "type": ["null", "object"], - "properties": { - "body": { - "type": ["null", "string"] - }, - "from": { - "type": ["null", "object"], - "properties": { - "email": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - }, - "to": { - "type": ["null", "array"], - "items": { - "type": "object", - "properties": { - "email": { - "type": "string" - } - } - } - }, - "cc": { - "type": ["null", "array"], - "items": { - "type": "object", - "properties": { - "email": { - "type": "string" - } - } - } - }, - "bcc": { - "type": ["null", "array"], - "items": { - "type": "object", - "properties": { - "email": { - "type": "string" - } - } - } - }, - "subject": { - "type": ["null", "string"] - }, - "html": { - "type": ["null", "string"] - }, - "text": { - "type": ["null", "string"] - }, - "status": { - "type": ["null", "string"] - }, - "forObjectType": { - "type": ["null", "string"] - }, - "startTime": { - "type": ["null", "integer"] - }, - "endTime": { - "type": ["null", "integer"] - }, - "title": { - "type": ["null", "string"] - }, - "toNumber": { - "type": ["null", "string"] - }, - "fromNumber": { - "type": ["null", "string"] - }, - "externalId": { - "type": ["null", "string"] - }, - "durationMilliseconds": { - "type": ["null", "integer"] - }, - "externalAccountId": { - "type": ["null", "string"] - }, - "recordingUrl": { - "type": ["null", "string"], - "format": "uri" - }, - "disposition": { - "type": ["null", "string"] - } - } - } - } -} diff --git a/tap_hubspot/streams.py b/tap_hubspot/streams.py index 3f44a0d..2805c99 100644 --- a/tap_hubspot/streams.py +++ b/tap_hubspot/streams.py @@ -47,6 +47,25 @@ def schema(self) -> dict: return self.cached_schema +class CallsStream(HubspotStream): + name = "calls" + path = f"/crm/v3/objects/calls" + primary_keys = ["id"] + + def get_url_params( + self, context: Optional[dict], next_page_token: Optional[Any] + ) -> Dict[str, Any]: + params = super().get_url_params(context, next_page_token) + params["properties"] = ",".join(self.properties) + return params + + @property + def schema(self) -> dict: + if self.cached_schema is None: + self.cached_schema, self.properties = self.get_custom_schema() + return self.cached_schema + + class OwnersStream(HubspotStream): """Define custom stream.""" diff --git a/tap_hubspot/tap.py b/tap_hubspot/tap.py index d9a559c..fbe3a8e 100644 --- a/tap_hubspot/tap.py +++ b/tap_hubspot/tap.py @@ -17,6 +17,7 @@ CompaniesStream, DealsStream, MeetingsStream, + CallsStream, OwnersStream, PropertiesCompaniesStream, PropertiesContactsStream, @@ -59,6 +60,7 @@ CompaniesStream, DealsStream, MeetingsStream, + CallsStream, PropertiesCompaniesStream, PropertiesContactsStream, PropertiesDealsStream,