📚 Official unofficial Golang bindings for Telegraph API https://telegra.ph/api
Go to file
Maxim Lebedev 128023ad07
😎 Kaboom! All done and closes #1
All methods and types available! Yaay!
2016-12-24 22:09:28 +05:00
.gitignore 🏁 Fast start 2016-12-22 00:37:14 +05:00
.travis.yml 😎 Kaboom! All done and closes #1 2016-12-24 22:09:28 +05:00
CONTRIBUTORS.md 🏁 Fast start 2016-12-22 00:37:14 +05:00
LICENSE.md 🏁 Fast start 2016-12-22 00:37:14 +05:00
README.md 😎 Kaboom! All done and closes #1 2016-12-24 22:09:28 +05:00
account.go 😎 Kaboom! All done and closes #1 2016-12-24 22:09:28 +05:00
content.go 😎 Kaboom! All done and closes #1 2016-12-24 22:09:28 +05:00
page.go 😎 Kaboom! All done and closes #1 2016-12-24 22:09:28 +05:00
telegraph.go 😎 Kaboom! All done and closes #1 2016-12-24 22:09:28 +05:00
telegraph_test.go 😎 Kaboom! All done and closes #1 2016-12-24 22:09:28 +05:00

README.md

GoLang bindings for the Telegraph API

This project is just to provide a wrapper around the API without any additional features.

License
Build Status
GoDoc
Go Report
Patreon
discord

All methods and types available! Yaay!

Start using telegraph

Download and install it:
$ go get -u github.com/toby3d/telegraph

Import it in your code:
import "github.com/toby3d/telegraph"

Example

This is an example of "quick start", which shows how to create a new account for future pages, as well as creating a first simple page with the name, picture and signature:

package main

import (
    "github.com/toby3d/telegraph"
    "log"
)

// Example content. Not abuse tags, okay? Be easy, bro.
const data = `<figure><img src="http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg"/>
    <figcaption>Cat turns the wheel? Pretty weird... But cute.</figcaption></figure>
    <p><i>Hello</i>, my name is <b>Page</b>, <u>look at me</u>!</p>`

func main() {
    // Create new Telegraph account. Author name/link can be epmty.
    // So secure. Much anonymously. Wow.
    acc, err := telegraph.CreateAccount(
        "toby3d", // required for assign all new pages (invisible for others)
        "Maxim Lebedev",
        "https://telegram.me/toby3d",
    )
    if err != nil {
        log.Fatal(err.Error())
    }

    // Boom!.. And your text will be understandable for Telegraph. MAGIC.
    content, _ := telegraph.ContentFormat(data)
    
    newPage := &telegraph.Page{
        Title:   "My awesome page",
        Content: content,

        // Not necessarily, but, hey, it's just an example.
        AuthorName: acc.AuthorName,
        AuthorURL:  acc.AuthorURL,
    }

    if page, err := acc.CreatePage(newPage, false); err != nil {
        log.Print(err.Error())
    } else {
        log.Println("Kaboom! Page created, look what happened:", page.URL)
    }
}

Requirements

Documentation