Giter Club home page Giter Club logo

goyish-typetalk's Introduction

#goyish-typetalk Typetalk API の Go 言語ラッパーライブラリです。

Build Status

##インストール go get github.com/zaneli/goyish-typetalk/typetalk

##認証 ###アクセストークンの取得 import ( "fmt" "github.com/zaneli/goyish-typetalk/typetalk" "log" )

client := typetalk.NewClient()
auth, err := client.GetAccessToken(<YOUR_CLIENT_ID>, <YOUR_CLIENT_SECRET>, typetalk.My, typetalk.TopicRead, typetalk.TopicPost)
if err != nil {
  log.Fatal(err)
}
fmt.Println(auth.AccessToken)
fmt.Println(auth.RefreshToken)

// client を使用してAPIアクセス
client.GetMyProfile()

(スコープはtypetalk.My, typetalk.TopicRead, typetalk.TopicPostから複数指定可)

###アクセストークンの更新 client := typetalk.NewClient() auth, err := client.UpdateAccessToken(<YOUR_CLIENT_ID>, <YOUR_CLIENT_SECRET>, ) if err != nil { log.Fatal(err) } fmt.Println(auth.AccessToken)

// client を使用してAPIアクセス
client.GetMyProfile()

###事前に取得済みのアクセストークンを設定 auth := typetalk.AuthedClient()

// client を使用してAPIアクセス
client.GetMyProfile()

##APIの実行 ###プロフィールの取得 res, err := client.GetMyProfile() if err != nil { log.Fatal(err) } fmt.Println(res)

###投稿メッセージリストの取得 res, err := client.GetTopicMessages(<TOPIC_ID>) if err != nil { log.Fatal(err) } fmt.Println(res) または

res, err := client.GetTopicMessagesApi(<TOPIC_ID>).Count(<COUNT_NUM>).From(<POST_ID>).Forward().Call()
if err != nil {
  log.Fatal(err)
}
fmt.Println(res)

###メッセージの投稿 res, err := client.PostMessage(, <TOPIC_ID>) if err != nil { log.Fatal(err) } fmt.Println(res) または

res, err := client.PostMessageApi(<MESSAGE>, <TOPIC_ID>).ReplyTo(<POST_ID>).FileKeys(<FILE_KEY0>, <FILE_KEY1>, ...).Call()
if err != nil {
  log.Fatal(err)
}
fmt.Println(res)

その他、API リファレンスを参照下さい。

goyish-typetalk's People

Contributors

zaneli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.