All documentation refers to telegra.ph/api but we just made it easier.
createAccount
params | type | Required |
---|---|---|
short_name | String | true |
author_name | String | true |
author_url | String | true |
Example :
var ph = new butthx.ph()
function createAccount(){
let res = ph.createAccount(short_name,author_name,author_url)
Logger.log(res)
}
editAccountInfo
params | type | required |
---|---|---|
short_name | String | true |
author_name | String | true |
author_url | String | true |
Example :
var ph = new butthx.ph(token,author_name,author_url)
function editAccountInfo(){
let res = ph.editAccountInfo(new_short_name,new_author_name,new_author_url)
Logger.log(res)
}
getAccountInfo
params | type | required |
---|---|---|
fields | Array | true |
Example :
var ph = new butthx.ph(token,author_name,author_url)
function getAccountInfo(){
let res = ph.getAccountInfo([“short_name”,“author_name”,“author_url”])
Logger.log(res)
}
revokeAccessToken
Example :
var ph = new butthx.ph(token,author_name,author_url)
function revokeAccessToken(){
let res = ph.revokeAccessToken()
Logger.log(res)
}
createPage
params | type | required |
---|---|---|
title | String | true |
content | Array of JSON | true |
return_content | boolean | opsional |
Example :
var ph = new butthx.ph(token,author_name,author_url)
function createPage(){
let content = [{
tag : 'p',
children : ['hello world']
},{
tag : 'a',
children : ['hello this link'],
attrs : {href : 'https://telegra.ph/api'}
}]
let res = ph.createPage('hello world',content,true)
Logger.log(res)
}
editPage
params | type | required |
---|---|---|
path | String | true |
title | String | true |
content | Array of JSON | true |
return_content | boolean | opsional |
Example :
var ph = new butthx.ph(token,author_name,author_url)
function editPage(){
let content = [{
tag : 'p',
children : ['hello world 2']
},{
tag : 'a',
children : ['hello this link 2'],
attrs : {href : 'https://telegra.ph/api'}
}]
let res = ph.editPage('hello-world-01-28-13','hello world 2',content,true)
Logger.log(res)
}
getPage
params | type | required |
---|---|---|
path | String | true |
return_content | boolean | opsional |
Example :
var ph = new butthx.ph(token,author_name,author_url)
function getPage(){
let res = ph.getPage('hello-world-01-28-13',true)
Logger.log(res)
}
getPageList
params | type | required |
---|---|---|
offset | Integer | true |
limit | Integer | true |
Example :
var ph = new butthx.ph(token,author_name,author_url)
function getPageList(){
let res = ph.getPageList(0,50)
Logger.log(res)
}
getViews
params | type | required |
---|---|---|
path | String | true |
year | Integer | true |
month | Integer | true |
day | Integer | true |
hour | Integer | opsional |
Example :
var ph = new butthx.ph(token,author_name,author_url)
function getViews(){
let res = ph.getViews('hello-world-01-28-13',2021,1,3)
Logger.log(res)
}
request
params | type | required |
---|---|---|
method | String | true |
data | JSON | true |
Example :
var ph = new butthx.ph()
function request(){
let res = ph.request('createAccount',{
short_name : 'short_name',
author_url : 'author_url',
author_name : 'author_name'
})
Logger.log(res)
}