Initial Commit
Co-authored-by: Subin <subinthattaparambil@gmail.com> Co-authored-by: Manoj <manojmj92@gmail.com> Co-authored-by: Nithin <webofnithin@gmail.com>
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
json.data do
|
||||
json.page_details @page_details
|
||||
json.user_access_token @user_access_token
|
||||
end
|
||||
9
app/views/api/v1/contacts/index.json.jbuilder
Normal file
9
app/views/api/v1/contacts/index.json.jbuilder
Normal file
@@ -0,0 +1,9 @@
|
||||
json.payload do
|
||||
json.array! @contacts do |contact|
|
||||
json.id contact.id
|
||||
json.name contact.name
|
||||
json.email contact.email
|
||||
json.phone_number contact.phone_number
|
||||
json.thumbnail contact.avatar.thumb.url
|
||||
end
|
||||
end
|
||||
7
app/views/api/v1/contacts/show.json.jbuilder
Normal file
7
app/views/api/v1/contacts/show.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
json.payload do
|
||||
json.id @contact.id
|
||||
json.name @contact.name
|
||||
json.email @contact.email
|
||||
json.phone_number @contact.phone_number
|
||||
json.thumbnail @contact.avatar.thumb.url
|
||||
end
|
||||
7
app/views/api/v1/contacts/update.json.jbuilder
Normal file
7
app/views/api/v1/contacts/update.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
json.payload do
|
||||
json.id @contact.id
|
||||
json.name @contact.name
|
||||
json.email @contact.email
|
||||
json.phone_number @contact.phone_number
|
||||
json.thumbnail @contact.avatar.thumb.url
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
json.payload do
|
||||
json.assignee @conversation.assignee
|
||||
json.conversation_id @conversation.display_id
|
||||
end
|
||||
14
app/views/api/v1/conversations/get_messages.json.jbuilder
Normal file
14
app/views/api/v1/conversations/get_messages.json.jbuilder
Normal file
@@ -0,0 +1,14 @@
|
||||
json.payload do
|
||||
json.array! @messages do |message|
|
||||
json.id message.id
|
||||
json.content message.content
|
||||
json.inbox_id message.inbox_id
|
||||
json.conversation_id message.conversation.display_id
|
||||
json.message_type message.message_type_before_type_cast
|
||||
json.created_at message.created_at.to_i
|
||||
json.private message.private
|
||||
json.fb_id message.fb_id
|
||||
json.attachment message.attachment.push_event_data if message.attachment
|
||||
json.sender message.user.push_event_data if message.user
|
||||
end
|
||||
end
|
||||
34
app/views/api/v1/conversations/index.json.jbuilder
Normal file
34
app/views/api/v1/conversations/index.json.jbuilder
Normal file
@@ -0,0 +1,34 @@
|
||||
json.data do
|
||||
json.meta do
|
||||
json.open_count @conversations_count[:open]
|
||||
json.resolved_count @conversations_count[:closed]
|
||||
json.conversation_type @type
|
||||
end
|
||||
|
||||
json.payload do
|
||||
json.array! @conversations do |conversation|
|
||||
json.meta do
|
||||
json.sender do
|
||||
json.id conversation.sender_id
|
||||
json.name conversation.sender.name
|
||||
json.thumbnail conversation.sender.avatar.thumb.url
|
||||
json.channel conversation.inbox.try(:channel).try(:name)
|
||||
end
|
||||
json.assignee conversation.assignee
|
||||
end
|
||||
|
||||
json.id conversation.display_id
|
||||
unless conversation.unread_incoming_messages.count == 0
|
||||
json.messages conversation.unread_messages.map(&:push_event_data)
|
||||
else
|
||||
json.messages [conversation.messages.last.try(:push_event_data)]
|
||||
end
|
||||
json.inbox_id conversation.inbox.id
|
||||
json.status conversation.status_before_type_cast
|
||||
json.timestamp conversation.messages.last.try(:created_at).try(:to_i)
|
||||
json.user_last_seen_at conversation.user_last_seen_at.to_i
|
||||
json.agent_last_seen_at conversation.agent_last_seen_at.to_i
|
||||
json.unread_count conversation.unread_incoming_messages.count
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
json.data do
|
||||
json.meta do
|
||||
end
|
||||
|
||||
json.payload do
|
||||
json.labels @labels
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
json.id @message.id
|
||||
json.content @message.content
|
||||
json.inbox_id @message.inbox_id
|
||||
json.conversation_id @message.conversation_id
|
||||
json.message_type @message.message_type_before_type_cast
|
||||
json.created_at @message.created_at.to_i
|
||||
json.private @message.private
|
||||
json.attachment @message.attachment.push_event_data if @message.attachment
|
||||
18
app/views/api/v1/conversations/show.json.jbuilder
Normal file
18
app/views/api/v1/conversations/show.json.jbuilder
Normal file
@@ -0,0 +1,18 @@
|
||||
json.meta do
|
||||
json.labels @conversation.label_list
|
||||
end
|
||||
|
||||
json.payload do
|
||||
json.array! @messages do |message|
|
||||
json.id message.id
|
||||
json.content message.content
|
||||
json.inbox_id message.inbox_id
|
||||
json.conversation_id message.conversation.display_id
|
||||
json.message_type message.message_type_before_type_cast
|
||||
json.created_at message.created_at.to_i
|
||||
json.private message.private
|
||||
json.fb_id message.fb_id
|
||||
json.attachment message.attachment.push_event_data if message.attachment
|
||||
json.sender message.user.push_event_data if message.user
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
json.meta do
|
||||
end
|
||||
|
||||
json.payload do
|
||||
json.success @status
|
||||
json.current_status @conversation.status_before_type_cast
|
||||
json.conversation_id @conversation.display_id
|
||||
end
|
||||
|
||||
8
app/views/api/v1/inbox_members/show.json.jbuilder
Normal file
8
app/views/api/v1/inbox_members/show.json.jbuilder
Normal file
@@ -0,0 +1,8 @@
|
||||
json.data do
|
||||
json.payload do
|
||||
json.array! @agents do |agent|
|
||||
json.user_id agent.id
|
||||
json.name agent.name
|
||||
end
|
||||
end
|
||||
end
|
||||
15
app/views/api/v1/inboxes/index.json.jbuilder
Normal file
15
app/views/api/v1/inboxes/index.json.jbuilder
Normal file
@@ -0,0 +1,15 @@
|
||||
json.data do
|
||||
json.meta do
|
||||
end
|
||||
|
||||
json.payload do
|
||||
json.array! @inboxes do |inbox|
|
||||
json.id inbox.id
|
||||
json.channel_id inbox.channel_id
|
||||
json.name inbox.name
|
||||
json.channel_type inbox.channel_type
|
||||
json.avatar_url inbox.channel.avatar.url
|
||||
json.page_id inbox.channel.page_id
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/views/api/v1/labels/index.json.jbuilder
Normal file
8
app/views/api/v1/labels/index.json.jbuilder
Normal file
@@ -0,0 +1,8 @@
|
||||
json.data do
|
||||
json.meta do
|
||||
end
|
||||
|
||||
json.payload do
|
||||
json.labels @labels
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user