from memair import Memair
# Use Otto the sandbox user's access token or create your own at https://memair.com/temporary_access_token
access_token = '0000000000000000000000000000000000000000000000000000000000000000'
user = Memair(access_token)
recommendation = user.query('''
mutation {
CreateRecommendation(
priority: 73.9
type: video
expires_at: tomorrow
url: "https://youtu.be/LQCoHLQkFxw"
)
{
id
timestamp
is_expired
is_actioned
}
}
''')
recommendation_id = recommendation['data']['CreateRecommendation']['id']
recommendation
{'data': {'CreateRecommendation': {'id': '10', 'timestamp': '2018-11-22T20:40:19Z', 'is_expired': False, 'is_actioned': False}}}
user.query('''
mutation {
ActionRecommendation(
id: %s
actioned_at: yesterday
)
{
id
is_actioned
actioned_at
}
}
''' % recommendation_id)
{'data': {'ActionRecommendation': {'id': '10', 'is_actioned': True, 'actioned_at': '2018-11-21T05:00:00Z'}}}
user.query('''
mutation delete_recommendation{
DeleteRecommendation(
id: %s
)
}
''' % recommendation_id)
{'data': {'DeleteRecommendation': True}}