npm i @interaapps/pastefy
import { PastefyClient } from '@interaapps/pastefy';
const client = new PastefyClient('api-token')
const paste = await client.getPaste('...')
npm i @interaapps/accounts
import { AccountsClient } from '@interaapps/accounts';
const client = new AccountsClient('api-token')
const currentUser = await client.getCurrentUser('...')
npm i @interaapps/punyshort
import { PunyshortClient } from '@interaapps/punyshort';
const client = new PunyshortClient('api-token')
const shortenLink = await client.shortenLink('...')
npm i @interaapps/accounts @interaapps/pastefy
export const oauthClient = new InteraAppsOAuth2Client('jw7tpy97etwd0jn', undefined)
const redirectUri = oauthClient
.urlBuilder()
.setRedirectUri(window.location.protocol + '//' + window.location.host + '/login-app.html')
.setResponseType('token')
.setScopes(['user:read', 'pastefy|pastes', 'pastefy|folders'])
.build()
window.location.href = redirectUri
login-app.html
const token = (new URLSearchParams(window.location.hash.replace('#', ''))).get('access_token')
const client = new AccountsClient(token)
const pastefy = new PastefyClient(await client.getKeyFor('pastefy'))
console.log('User pastes:', await pastefy.getUserPastes())