2.0.6 • Published 5 months ago

telegra.ph-next v2.0.6

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
5 months ago

📝 telegra.ph-next

Tiny API helper for Telegra.ph, forked from telegra.ph with various improvements:

  • No dependencies
  • No frivolous tests
  • 100% typescript source
  • Use any HTTP client
  • Uses JSDoc

Installation

$ npm install telegra.ph-next --save

Example

Create an account

import Telegraph from "telegra.ph-next"

const client = new Telegraph()

const account = client.createAccount()
client.token = account.access_token

const pages = await client.getPageList()
console.log(pages)

Use existing account

import Telegraph from "telegra.ph-next"

const client = new Telegraph(process.env.TOKEN)

const pages = await client.getPageList()
console.log(pages)

Use arbitrary HTTP Client

import Telegraph from "telegra.ph-next"
import { Fetch } from "telegra.ph/clients"

const client = new Telegraph(process.env.TOKEN, { client: Fetch })

const pages = await client.getPageList()
console.log(pages)

API documentation

createAccount

.createAccount(shortName, name, url)

createPage

.createPage(title, content, authorName, authorUrl, returnContent)

editAccountInfo

.editAccountInfo(shortName, name, url)

editPage

.editPage(path, title, content, authorName, authorUrl, returnContent)

getPage

.getPage(path, returnContent)

getViews

.getViews(path, year, month, day, hour)

getPageList

.getPageList(path, offset, limit)

revokeAccessToken

.revokeAccessToken()

2.0.5

5 months ago

2.0.6

5 months ago

2.0.2

5 months ago

2.0.1

5 months ago

2.0.0

5 months ago