Twitter

Twitter-APIを扱うための型です。

Members

Functions

callAPI
auto callAPI(T args)

各APIを叩くためのメソッドです

get
auto get(string url, X param)
Undocumented in source. Be warned that the author may not have intended to support it.
post
auto post(string url, X param)
Undocumented in source. Be warned that the author may not have intended to support it.
postImage
auto postImage(string url, string endPoint, string[] filenames, X param)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

account
struct account
Undocumented in source.
media
struct media
Undocumented in source.
oauth
struct oauth
Undocumented in source.
statuses
struct statuses
Undocumented in source.
userstream
struct userstream
Undocumented in source.

Examples

import std.json;
import std.process;
import std.stdio;
import std.string;
import graphite.twitter;


immutable consumerToken =
    ConsumerToken("consumer_key",
                  "consumer_secret");

void main()
{
    // リクエストトークンの取得
    Twitter reqTok = Twitter(Twitter.oauth.requestToken(consumerToken, null));
    
    // ブラウザで認証してもらう
    browse(reqTok.callAPI!"oauth.authorizeURL"());

    // pinコードを入力してもらう
    write("please put pin-code: ");

    // pinコードからアクセストークンを取得
    Twitter accTok = Twitter(reqTok.callAPI!"oauth.accessToken"(readln().chomp()));

    // ツイート
    accTok.callAPI!"statuses.update"(["status": "Tweet by dlang-code"]);
}

Meta