fixed README; fixed debug output

This commit is contained in:
tastytea 2018-01-13 16:07:00 +01:00
parent eb3916c84e
commit 080cbad43f
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
4 changed files with 17 additions and 12 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7) cmake_minimum_required (VERSION 3.7)
project (mastodon-cpp project (mastodon-cpp
VERSION 0.1.0 VERSION 0.1.1
LANGUAGES CXX LANGUAGES CXX
) )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")

View File

@ -16,7 +16,7 @@ All versions below 1.0.0 (SOVERSION 0) are considered insecure, unstable and can
### Development version ### Development version
git clone https:// git clone https://github.com/tastytea/mastodon-cpp.git
## Compile ## Compile
@ -25,7 +25,7 @@ All versions below 1.0.0 (SOVERSION 0) are considered insecure, unstable and can
cmake .. cmake ..
make make
If you want to compile a debug build, use `cmake -DCMAKE_BUILD_TYPE=Debug` If you want to compile a debug build, use `cmake -DCMAKE_BUILD_TYPE=Debug ..`
instead. instead.
# Usage # Usage
@ -50,16 +50,16 @@ If you use a debug build, you get more verbose error messages.
# TODO # TODO
* Version 0.1.0 * Version 0.1.0
* [x] Implement all GET methods * [x] Implement all GET calls
* [x] Usable error handling * [x] Usable error handling
* [x] Network stuff * [x] Network stuff
* [x] Comprehensive example * [x] Comprehensive example
* Version 0.2.0 * Version 0.2.0
* [ ] Implement all PATCH methods * [ ] Implement all PATCH calls
* [ ] Implement all POST methods * [ ] Implement all POST calls
* [ ] Implement all DELETE methods * [ ] Implement all DELETE calls
* Version 0.3.0 * Version 0.3.0
* [ ] Handling HTTP statuses 301 & 302 * [ ] Handle HTTP statuses 301 & 302
* Later * Later
* [ ] Escape user input * [ ] Escape user input
* [ ] Asynchronous I/O * [ ] Asynchronous I/O

View File

@ -17,6 +17,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
#include "macros.hpp"
#include "mastodon-cpp.hpp" #include "mastodon-cpp.hpp"
using namespace Mastodon; using namespace Mastodon;
@ -74,7 +75,7 @@ const std::uint16_t API::get(const Mastodon::API::v1 &call,
strcall = "/api/v1/timelines/public"; strcall = "/api/v1/timelines/public";
break; break;
default: default:
cerr << "ERROR: Invalid call.\n"; ttdebug << "ERROR: Invalid call.\n";
return 1; return 1;
break; break;
} }
@ -168,7 +169,7 @@ const std::uint16_t API::get(const Mastodon::API::v1 &call,
strcall = "/api/v1/timelines/list/" + argument; strcall = "/api/v1/timelines/list/" + argument;
break; break;
default: default:
cerr << "ERROR: Invalid call.\n"; ttdebug << "ERROR: Invalid call.\n";
return 1; return 1;
break; break;
} }

View File

@ -32,8 +32,7 @@ int main(int argc, char *argv[])
"only_media=1" "only_media=1"
}; };
ret = masto.get(API::v1::accounts_id_statuses, uid, ret = masto.get(API::v1::accounts_id_statuses, uid,parameters, answer);
parameters, answer);
if (ret == 0) if (ret == 0)
{ {
std::cout << answer << '\n'; std::cout << answer << '\n';
@ -64,6 +63,11 @@ int main(int argc, char *argv[])
return ret; return ret;
} }
} }
else
{
std::cerr << "Error code: " << ret << '\n';
return ret;
}
return 0; return 0;
} }