about summary refs log tree commit diff stats
path: root/src/client.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-04-13 11:24:24 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-04-13 11:24:24 -0400
commit7e85b35d7d1714e3f85434b891a1050ad584e337 (patch)
tree1ca626fe9551734d6d98e50b841b7365d49ba088 /src/client.h
parent891d57d200f55b91f80b6d3b4dd0c30479be6109 (diff)
downloadlibtwittercpp-7e85b35d7d1714e3f85434b891a1050ad584e337.tar.gz
libtwittercpp-7e85b35d7d1714e3f85434b891a1050ad584e337.tar.bz2
libtwittercpp-7e85b35d7d1714e3f85434b891a1050ad584e337.zip
Added ability to upload media and tweet it
Images (static and animated) and videos have been tested. Currently all media uploads occur in one large chunk; support to break down chunks will be added later.
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/client.h b/src/client.h index 1ab5c70..3a133e4 100644 --- a/src/client.h +++ b/src/client.h
@@ -1,7 +1,12 @@
1#ifndef TWITTER_H_ABFF6A12 1#ifndef TWITTER_H_ABFF6A12
2#define TWITTER_H_ABFF6A12 2#define TWITTER_H_ABFF6A12
3 3
4#include "twitter.h" 4#include "codes.h"
5#include "tweet.h"
6#include "auth.h"
7#include <list>
8#include <curl_easy.h>
9#include <curl_header.h>
5 10
6namespace OAuth { 11namespace OAuth {
7 class Consumer; 12 class Consumer;
@@ -16,12 +21,18 @@ namespace twitter {
16 client(const auth& _auth); 21 client(const auth& _auth);
17 ~client(); 22 ~client();
18 23
19 response updateStatus(std::string msg, tweet& result); 24 response updateStatus(std::string msg, tweet& result, std::list<long> media_ids = {});
25 response uploadMedia(std::string media_type, const char* data, long data_length, long& media_id);
20 26
21 private: 27 private:
22 OAuth::Consumer* _oauth_consumer; 28 OAuth::Consumer* _oauth_consumer;
23 OAuth::Token* _oauth_token; 29 OAuth::Token* _oauth_token;
24 OAuth::Client* _oauth_client; 30 OAuth::Client* _oauth_client;
31
32 bool performGet(std::string url, long& response_code, json& result);
33 bool performPost(std::string url, std::string dataStr, long& response_code, json& result);
34 bool performMultiPost(std::string url, const curl_httppost* fields, long& response_code, json& result);
35 response codeForError(int httpcode, json errors) const;
25 }; 36 };
26 37
27}; 38};