/
Conversation.js
82 lines (78 loc) · 1.63 KB
/
Conversation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { fetchQuery, graphql } from 'react-relay'
import { conversation } from '../../utils'
import { merge } from '../../helpers'
const query = graphql`
query ConversationQuery(
$id: ID!
$createdAt: GoogleProtobufTimestampInput
$updatedAt: GoogleProtobufTimestampInput
$readAt: GoogleProtobufTimestampInput
$wroteAt: GoogleProtobufTimestampInput
$title: String!
$topic: String!
$infos: String!
$members: [BertyEntityConversationMemberInput]
) {
Conversation(
id: $id
createdAt: $createdAt
updatedAt: $updatedAt
readAt: $readAt
wroteAt: $wroteAt
title: $title
topic: $topic
infos: $infos
members: $members
) {
...Conversation
id
createdAt
updatedAt
readAt
wroteAt
title
topic
infos
members {
id
createdAt
updatedAt
wroteAt
status
contact {
id
createdAt
updatedAt
sigchain
status
devices {
id
createdAt
updatedAt
name
status
apiVersion
contactId
}
displayName
displayStatus
overrideDisplayName
overrideDisplayStatus
}
conversationId
contactId
}
}
}
`
export const defaultVariables = conversation.default
export default context => ({
graphql: query,
defaultVariables,
fetch: async variables =>
(await fetchQuery(
context.environment,
query,
merge([defaultVariables, variables])
)).Conversation,
})