Move GraphQL constants into the module
This commit is contained in:
@@ -73,160 +73,161 @@ class GraphQL(object):
|
||||
else:
|
||||
raise FBchatUserError("A query or doc_id must be specified")
|
||||
|
||||
FRAGMENT_USER = """
|
||||
QueryFragment User: User {
|
||||
id,
|
||||
name,
|
||||
first_name,
|
||||
last_name,
|
||||
profile_picture.width(<pic_size>).height(<pic_size>) {
|
||||
uri
|
||||
},
|
||||
is_viewer_friend,
|
||||
url,
|
||||
gender,
|
||||
viewer_affinity
|
||||
}
|
||||
"""
|
||||
|
||||
FRAGMENT_GROUP = """
|
||||
QueryFragment Group: MessageThread {
|
||||
name,
|
||||
thread_key {
|
||||
thread_fbid
|
||||
},
|
||||
image {
|
||||
uri
|
||||
},
|
||||
is_group_thread,
|
||||
all_participants {
|
||||
nodes {
|
||||
messaging_actor {
|
||||
id
|
||||
}
|
||||
FRAGMENT_USER = """
|
||||
QueryFragment User: User {
|
||||
id,
|
||||
name,
|
||||
first_name,
|
||||
last_name,
|
||||
profile_picture.width(<pic_size>).height(<pic_size>) {
|
||||
uri
|
||||
},
|
||||
is_viewer_friend,
|
||||
url,
|
||||
gender,
|
||||
viewer_affinity
|
||||
}
|
||||
"""
|
||||
|
||||
FRAGMENT_GROUP = """
|
||||
QueryFragment Group: MessageThread {
|
||||
name,
|
||||
thread_key {
|
||||
thread_fbid
|
||||
},
|
||||
image {
|
||||
uri
|
||||
},
|
||||
is_group_thread,
|
||||
all_participants {
|
||||
nodes {
|
||||
messaging_actor {
|
||||
id
|
||||
}
|
||||
}
|
||||
},
|
||||
customization_info {
|
||||
participant_customizations {
|
||||
participant_id,
|
||||
nickname
|
||||
},
|
||||
customization_info {
|
||||
participant_customizations {
|
||||
participant_id,
|
||||
nickname
|
||||
outgoing_bubble_color,
|
||||
emoji
|
||||
},
|
||||
thread_admins {
|
||||
id
|
||||
},
|
||||
group_approval_queue {
|
||||
nodes {
|
||||
requester {
|
||||
id
|
||||
}
|
||||
}
|
||||
},
|
||||
approval_mode,
|
||||
joinable_mode {
|
||||
mode,
|
||||
link
|
||||
},
|
||||
event_reminders {
|
||||
nodes {
|
||||
id,
|
||||
lightweight_event_creator {
|
||||
id
|
||||
},
|
||||
outgoing_bubble_color,
|
||||
emoji
|
||||
},
|
||||
thread_admins {
|
||||
id
|
||||
},
|
||||
group_approval_queue {
|
||||
time,
|
||||
location_name,
|
||||
event_title,
|
||||
event_reminder_members {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
},
|
||||
guest_list_state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
FRAGMENT_PAGE = """
|
||||
QueryFragment Page: Page {
|
||||
id,
|
||||
name,
|
||||
profile_picture.width(32).height(32) {
|
||||
uri
|
||||
},
|
||||
url,
|
||||
category_type,
|
||||
city {
|
||||
name
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
SEARCH_USER = (
|
||||
"""
|
||||
Query SearchUser(<search> = '', <limit> = 10) {
|
||||
entities_named(<search>) {
|
||||
search_results.of_type(user).first(<limit>) as users {
|
||||
nodes {
|
||||
requester {
|
||||
id
|
||||
}
|
||||
@User
|
||||
}
|
||||
},
|
||||
approval_mode,
|
||||
joinable_mode {
|
||||
mode,
|
||||
link
|
||||
},
|
||||
event_reminders {
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
+ FRAGMENT_USER
|
||||
)
|
||||
|
||||
SEARCH_GROUP = (
|
||||
"""
|
||||
Query SearchGroup(<search> = '', <limit> = 10, <pic_size> = 32) {
|
||||
viewer() {
|
||||
message_threads.with_thread_name(<search>).last(<limit>) as groups {
|
||||
nodes {
|
||||
id,
|
||||
lightweight_event_creator {
|
||||
id
|
||||
},
|
||||
time,
|
||||
location_name,
|
||||
event_title,
|
||||
event_reminder_members {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
},
|
||||
guest_list_state
|
||||
}
|
||||
}
|
||||
@Group
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
"""
|
||||
+ FRAGMENT_GROUP
|
||||
)
|
||||
|
||||
FRAGMENT_PAGE = """
|
||||
QueryFragment Page: Page {
|
||||
id,
|
||||
name,
|
||||
profile_picture.width(32).height(32) {
|
||||
uri
|
||||
},
|
||||
url,
|
||||
category_type,
|
||||
city {
|
||||
name
|
||||
}
|
||||
}
|
||||
SEARCH_PAGE = (
|
||||
"""
|
||||
|
||||
SEARCH_USER = (
|
||||
"""
|
||||
Query SearchUser(<search> = '', <limit> = 10) {
|
||||
entities_named(<search>) {
|
||||
search_results.of_type(user).first(<limit>) as users {
|
||||
nodes {
|
||||
@User
|
||||
}
|
||||
Query SearchPage(<search> = '', <limit> = 10) {
|
||||
entities_named(<search>) {
|
||||
search_results.of_type(page).first(<limit>) as pages {
|
||||
nodes {
|
||||
@Page
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
+ FRAGMENT_USER
|
||||
)
|
||||
}
|
||||
"""
|
||||
+ FRAGMENT_PAGE
|
||||
)
|
||||
|
||||
SEARCH_GROUP = (
|
||||
"""
|
||||
Query SearchGroup(<search> = '', <limit> = 10, <pic_size> = 32) {
|
||||
viewer() {
|
||||
message_threads.with_thread_name(<search>).last(<limit>) as groups {
|
||||
nodes {
|
||||
@Group
|
||||
}
|
||||
SEARCH_THREAD = (
|
||||
"""
|
||||
Query SearchThread(<search> = '', <limit> = 10) {
|
||||
entities_named(<search>) {
|
||||
search_results.first(<limit>) as threads {
|
||||
nodes {
|
||||
__typename,
|
||||
@User,
|
||||
@Group,
|
||||
@Page
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
+ FRAGMENT_GROUP
|
||||
)
|
||||
|
||||
SEARCH_PAGE = (
|
||||
"""
|
||||
Query SearchPage(<search> = '', <limit> = 10) {
|
||||
entities_named(<search>) {
|
||||
search_results.of_type(page).first(<limit>) as pages {
|
||||
nodes {
|
||||
@Page
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
+ FRAGMENT_PAGE
|
||||
)
|
||||
|
||||
SEARCH_THREAD = (
|
||||
"""
|
||||
Query SearchThread(<search> = '', <limit> = 10) {
|
||||
entities_named(<search>) {
|
||||
search_results.first(<limit>) as threads {
|
||||
nodes {
|
||||
__typename,
|
||||
@User,
|
||||
@Group,
|
||||
@Page
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
+ FRAGMENT_USER
|
||||
+ FRAGMENT_GROUP
|
||||
+ FRAGMENT_PAGE
|
||||
)
|
||||
}
|
||||
"""
|
||||
+ FRAGMENT_USER
|
||||
+ FRAGMENT_GROUP
|
||||
+ FRAGMENT_PAGE
|
||||
)
|
||||
|
Reference in New Issue
Block a user