SHARE
TWEET

Untitled

a guest Aug 18th, 2019 64 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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top