SuperTweet interface driver classes.

Dependents:   SuperTweet_TestProgram StarBoardOrangeExpansion1 GSL_04-Network_Twitter

Committer:
shintamainjp
Date:
Fri Oct 29 23:04:12 2010 +0000
Revision:
2:d463d3fc4f81
Parent:
1:2d211e591fc8
Modified default value of a callback function to NULL.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shintamainjp 0:d48d92e6c145 1 /**
shintamainjp 0:d48d92e6c145 2 * SuperTweet API interface driver. (Version 0.0.1)
shintamainjp 0:d48d92e6c145 3 *
shintamainjp 0:d48d92e6c145 4 * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
shintamainjp 0:d48d92e6c145 5 * http://shinta.main.jp/
shintamainjp 0:d48d92e6c145 6 */
shintamainjp 0:d48d92e6c145 7
shintamainjp 0:d48d92e6c145 8 #include <string>
shintamainjp 0:d48d92e6c145 9 #include "HTTPClient.h"
shintamainjp 0:d48d92e6c145 10
shintamainjp 1:2d211e591fc8 11 /**
shintamainjp 1:2d211e591fc8 12 * SuperTweet driver class.
shintamainjp 1:2d211e591fc8 13 */
shintamainjp 0:d48d92e6c145 14 class SuperTweet {
shintamainjp 0:d48d92e6c145 15 public:
shintamainjp 1:2d211e591fc8 16
shintamainjp 1:2d211e591fc8 17 /**
shintamainjp 1:2d211e591fc8 18 * Create.
shintamainjp 1:2d211e591fc8 19 *
shintamainjp 1:2d211e591fc8 20 * @param account Account name.
shintamainjp 1:2d211e591fc8 21 * @param password Password.
shintamainjp 1:2d211e591fc8 22 */
shintamainjp 0:d48d92e6c145 23 SuperTweet(const std::string account, const std::string password);
shintamainjp 1:2d211e591fc8 24
shintamainjp 1:2d211e591fc8 25 /**
shintamainjp 1:2d211e591fc8 26 * Dispose.
shintamainjp 1:2d211e591fc8 27 */
shintamainjp 0:d48d92e6c145 28 virtual ~SuperTweet();
shintamainjp 1:2d211e591fc8 29
shintamainjp 1:2d211e591fc8 30 /**
shintamainjp 1:2d211e591fc8 31 * Set timeout.
shintamainjp 1:2d211e591fc8 32 *
shintamainjp 1:2d211e591fc8 33 * @param ms Timeout. [ms]
shintamainjp 1:2d211e591fc8 34 */
shintamainjp 0:d48d92e6c145 35 void setTimeout(int ms);
shintamainjp 1:2d211e591fc8 36
shintamainjp 1:2d211e591fc8 37 /**
shintamainjp 1:2d211e591fc8 38 * Returns the 20 most recent statuses posted by the authenticating user.
shintamainjp 1:2d211e591fc8 39 *
shintamainjp 1:2d211e591fc8 40 * @param func A pointer to a callback function.
shintamainjp 1:2d211e591fc8 41 * @return Result code.
shintamainjp 1:2d211e591fc8 42 */
shintamainjp 2:d463d3fc4f81 43 virtual HTTPResult getStatusesUserTimeline(void (*func)(char *buf, size_t siz) = NULL) = 0;
shintamainjp 1:2d211e591fc8 44
shintamainjp 1:2d211e591fc8 45 /**
shintamainjp 1:2d211e591fc8 46 * Returns the 20 most recent statuses, including retweets if they exist, posted by the authenticating user and the user's they follow.
shintamainjp 1:2d211e591fc8 47 *
shintamainjp 1:2d211e591fc8 48 * @param func A pointer to a callback function.
shintamainjp 1:2d211e591fc8 49 * @return Result code.
shintamainjp 1:2d211e591fc8 50 */
shintamainjp 2:d463d3fc4f81 51 virtual HTTPResult getStatusesHomeTimeline(void (*func)(char *buf, size_t siz) = NULL) = 0;
shintamainjp 1:2d211e591fc8 52
shintamainjp 1:2d211e591fc8 53 /**
shintamainjp 1:2d211e591fc8 54 * Updates the authenticating user's status.
shintamainjp 1:2d211e591fc8 55 * A status update with text identical to the authenticating user's text identical
shintamainjp 1:2d211e591fc8 56 * to the authenticating user's current status will be ignored to prevent duplicates.
shintamainjp 1:2d211e591fc8 57 *
shintamainjp 1:2d211e591fc8 58 * @param func A pointer to a callback function.
shintamainjp 1:2d211e591fc8 59 * @return Result code.
shintamainjp 1:2d211e591fc8 60 */
shintamainjp 2:d463d3fc4f81 61 virtual HTTPResult postStatusesUpdate(const std::string datatext, void (*func)(char *buf, size_t siz) = NULL) = 0;
shintamainjp 1:2d211e591fc8 62
shintamainjp 0:d48d92e6c145 63 protected:
shintamainjp 0:d48d92e6c145 64 static const std::string URLBASE_V1;
shintamainjp 0:d48d92e6c145 65 const std::string account;
shintamainjp 0:d48d92e6c145 66 const std::string password;
shintamainjp 0:d48d92e6c145 67 HTTPClient client;
shintamainjp 0:d48d92e6c145 68 };