{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from memair import Memair\n", "# Use Otto the sandbox user's access token or create your own at https://memair.com/temporary_access_token\n", "access_token = '0000000000000000000000000000000000000000000000000000000000000000'\n", "\n", "user = Memair(access_token)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'data': {'CreateRecommendation': {'id': '10',\n", " 'timestamp': '2018-11-22T20:40:19Z',\n", " 'is_expired': False,\n", " 'is_actioned': False}}}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "recommendation = user.query('''\n", " mutation {\n", " CreateRecommendation(\n", " priority: 73.9\n", " type: video\n", " expires_at: tomorrow\n", " url: \"https://youtu.be/LQCoHLQkFxw\"\n", " )\n", " {\n", " id\n", " timestamp\n", " is_expired\n", " is_actioned\n", " }\n", " }\n", "''')\n", "\n", "recommendation_id = recommendation['data']['CreateRecommendation']['id']\n", "recommendation" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'data': {'ActionRecommendation': {'id': '10',\n", " 'is_actioned': True,\n", " 'actioned_at': '2018-11-21T05:00:00Z'}}}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "user.query('''\n", " mutation {\n", " ActionRecommendation(\n", " id: %s\n", " actioned_at: yesterday\n", " )\n", " {\n", " id\n", " is_actioned\n", " actioned_at\n", " }\n", " }\n", "''' % recommendation_id)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'data': {'DeleteRecommendation': True}}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "user.query('''\n", " mutation delete_recommendation{\n", " DeleteRecommendation(\n", " id: %s\n", " )\n", " }\n", "''' % recommendation_id)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }