Added GraphQL requests

This commit is contained in:
Mads Marquart
2017-06-22 22:38:15 +02:00
parent c81d7d2bfb
commit 11e59e023c
12 changed files with 564 additions and 202 deletions

View File

@@ -5,8 +5,8 @@ from fbchat.models import *
client = Client('<email>', '<password>')
print('Own id: {}'.format(client.id))
print('Own id: {}'.format(client.uid))
client.sendMessage('Hi me!', thread_id=self.id, thread_type=ThreadType.USER)
client.sendMessage('Hi me!', thread_id=client.uid, thread_type=ThreadType.USER)
client.logout()

View File

@@ -34,19 +34,19 @@ print("Is user client's friend: {}".format(user.is_friend))
# Fetches a list of the 20 top threads you're currently chatting with
threads = client.fetchThreadList()
# Fetches the next 10 threads
threads += client.fetchThreadList(offset=20, amount=10)
threads += client.fetchThreadList(offset=20, limit=10)
print("Thread's INFO: {}".format(threads))
print("Threads: {}".format(threads))
# Gets the last 10 messages sent to the thread
messages = client.fetchThreadMessages(offset=0, amount=10, thread_id='<thread id>', thread_type=ThreadType)
messages = client.fetchThreadMessages(thread_id='<thread id>', limit=10)
# Since the message come in reversed order, reverse them
messages.reverse()
# Prints the content of all the messages
for message in messages:
print(message.body)
print(message.text)
# Here should be an example of `getUnread`