Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Masto = require('mastodon')
  2.  
  3. var M = new Masto({
  4.     access_token: process.env.ACCESS_TOKEN,
  5.     timeout_ms: 60*1000,  // optional HTTP request timeout to apply to all requests.
  6.     api_url: 'https://yourinstance.com/api/v1/', // optional, defaults to https://mastodon.social/api/v1/
  7.   })
  8.  
  9. exports.handler = function(event, context, callback) {
  10.     const {status = ''} = event.queryStringParameters;
  11.     var statusUri = 'statuses/' + status + '/context';
  12.     M.get(statusUri, {}).then(resp =>
  13.     {
  14.         callback(null, {
  15.             statusCode: 200,
  16.             body: JSON.stringify(resp.data.descendants)
  17.         });
  18.     }).catch(e => {
  19.         callback(e);
  20.     });
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement