Skip to content

Commit

Permalink
Merge pull request #4 from harrystech/ynaim94/add-other-contents
Browse files Browse the repository at this point in the history
Add remaining content type
  • Loading branch information
ynaim94-harrys authored Sep 28, 2022
2 parents 503192a + 132feca commit 92bf42d
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 0 deletions.
83 changes: 83 additions & 0 deletions tap_gladly/schemas/export_conversation-customer_activity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
},
"title": {
"type": "string"
},
"body": {
"type": "string"
},
"activityType": {
"type": "string"
},
"sourceName": {
"type": "string"
},
"link": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"text": {
"type": "string"
}
}
},
"occurredAt": {
"type": "string"
},
"receivedAt": {
"type": "string"
}
},
"required": [
"activityType",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
62 changes: 62 additions & 0 deletions tap_gladly/schemas/export_conversation-facebook_message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
},
"pageId": {
"type": "string"
},
"userId": {
"type": "string"
}
},
"required": [
"content",
"pageId",
"userId",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
54 changes: 54 additions & 0 deletions tap_gladly/schemas/export_conversation-instagram_direct.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"content",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
54 changes: 54 additions & 0 deletions tap_gladly/schemas/export_conversation-twitter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"content",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
54 changes: 54 additions & 0 deletions tap_gladly/schemas/export_conversation-whatsapp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"content",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
40 changes: 40 additions & 0 deletions tap_gladly/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ def schema_filepath(self):
"conversation_status_change": "export_conversation-conversation_status_change.json", # noqa
"phone_call": "export_conversation-phone_call.json",
"voicemail": "export_conversation-voicemail.json",
"customer_activity": "export_conversation-customer_activity.json",
"facebook_message": "export_conversation-facebook_message.json",
"twitter": "export_conversation-twitter.json",
"instagram_direct": "export_conversation-instagram_direct.json",
"whatsapp": "export_conversation-whatsapp.json",
}

try:
Expand Down Expand Up @@ -148,3 +153,38 @@ class ExportFileConversationItemsVoiceMail(ExportFileConversationItemsStream):

name = "conversation_voicemail"
content_type = "voicemail"


class ExportFileConversationItemsCustomerActivity(ExportFileConversationItemsStream):
"""Export conversation items stream where content type is voicemail."""

name = "conversation_customer_activity"
content_type = "customer_activity"


class ExportFileConversationItemsFacebookMessage(ExportFileConversationItemsStream):
"""Export conversation items stream where content type is voicemail."""

name = "conversation_facebook_message"
content_type = "facebook_message"


class ExportFileConversationItemsTwitter(ExportFileConversationItemsStream):
"""Export conversation items stream where content type is voicemail."""

name = "conversation_twitter"
content_type = "twitter"


class ExportFileConversationItemsInstagramDirect(ExportFileConversationItemsStream):
"""Export conversation items stream where content type is voicemail."""

name = "conversation_instagram_direct"
content_type = "instagram_direct"


class ExportFileConversationItemsWhatsapp(ExportFileConversationItemsStream):
"""Export conversation items stream where content type is voicemail."""

name = "conversation_whatsapp"
content_type = "whatsapp"
10 changes: 10 additions & 0 deletions tap_gladly/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
ExportFileConversationItemsChatMessage,
ExportFileConversationItemsConversationNote,
ExportFileConversationItemsConversationStatusChange,
ExportFileConversationItemsCustomerActivity,
ExportFileConversationItemsFacebookMessage,
ExportFileConversationItemsInstagramDirect,
ExportFileConversationItemsPhoneCall,
ExportFileConversationItemsSms,
ExportFileConversationItemsTopicChange,
ExportFileConversationItemsTwitter,
ExportFileConversationItemsVoiceMail,
ExportFileConversationItemsWhatsapp,
ExportFileTopicsStream,
)

Expand All @@ -28,6 +33,11 @@
ExportFileConversationItemsPhoneCall,
ExportFileConversationItemsVoiceMail,
ExportFileTopicsStream,
ExportFileConversationItemsCustomerActivity,
ExportFileConversationItemsFacebookMessage,
ExportFileConversationItemsTwitter,
ExportFileConversationItemsInstagramDirect,
ExportFileConversationItemsWhatsapp,
]


Expand Down

0 comments on commit 92bf42d

Please sign in to comment.