整形
This commit is contained in:
@@ -12,23 +12,23 @@ MediaStore MediaStore::parse(const unsigned int _responseCode, const std::string
|
|||||||
MediaStore media;
|
MediaStore media;
|
||||||
|
|
||||||
if (_responseCode / 100 == 2) {
|
if (_responseCode / 100 == 2) {
|
||||||
if(j.count("media_id_string") != 0){
|
if (j.count("media_id_string") != 0) {
|
||||||
media.id(j["media_id_string"]);
|
media.id(j["media_id_string"]);
|
||||||
}
|
|
||||||
|
|
||||||
if(j.count("size") != 0){
|
|
||||||
media.size(j["size"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(j.count("expires_after_secs") != 0){
|
if (j.count("size") != 0) {
|
||||||
media.expires(j["expires_after_secs"]);
|
media.size(j["size"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(j.count("processing_info") == 0){
|
if (j.count("expires_after_secs") != 0) {
|
||||||
media.state("succeeded");
|
media.expires(j["expires_after_secs"]);
|
||||||
}else{
|
}
|
||||||
media.state(j["processing_info"]["state"]);
|
|
||||||
media.remain(j["processing_info"]["check_after_secs"].get<unsigned int>());
|
if (j.count("processing_info") == 0) {
|
||||||
|
media.state("succeeded");
|
||||||
|
} else {
|
||||||
|
media.state(j["processing_info"]["state"]);
|
||||||
|
media.remain(j["processing_info"]["check_after_secs"].get<unsigned int>());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
@@ -40,8 +40,8 @@ void MediaStore::id(const std::string _id) {
|
|||||||
id_ = _id;
|
id_ = _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaStore::size(const unsigned int _size){
|
void MediaStore::size(const unsigned int _size) {
|
||||||
size_ = _size;
|
size_ = _size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaStore::expires(const unsigned int _ex) {
|
void MediaStore::expires(const unsigned int _ex) {
|
||||||
@@ -51,8 +51,8 @@ void MediaStore::state(const std::string _state) {
|
|||||||
state_ = _state;
|
state_ = _state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaStore::remain(const unsigned int _remain){
|
void MediaStore::remain(const unsigned int _remain) {
|
||||||
remain_ = _remain;
|
remain_ = _remain;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string MediaStore::id() const {
|
const std::string MediaStore::id() const {
|
||||||
@@ -68,7 +68,7 @@ const std::string MediaStore::state() const {
|
|||||||
return state_;
|
return state_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned int MediaStore::remain() const{
|
const unsigned int MediaStore::remain() const {
|
||||||
return remain_;
|
return remain_;
|
||||||
}
|
}
|
||||||
} // namespace CocoaTweet::API::Model
|
} // namespace CocoaTweet::API::Model
|
||||||
|
|||||||
@@ -9,19 +9,21 @@ namespace CocoaTweet::API::Model {
|
|||||||
class MediaStore final {
|
class MediaStore final {
|
||||||
public:
|
public:
|
||||||
/// @brief constructor
|
/// @brief constructor
|
||||||
MediaStore() = default;
|
MediaStore() = default;
|
||||||
|
|
||||||
/// @brief copy constructor
|
/// @brief copy constructor
|
||||||
MediaStore(const MediaStore&) = default;
|
MediaStore(const MediaStore&) = default;
|
||||||
|
|
||||||
/// @brief constructor for create object from json response
|
/// @brief constructor for create object from json response
|
||||||
/// @param[in] const unsigned int _responseCode : http status code which received when post request
|
/// @param[in] const unsigned int _responseCode : http status code which received when post
|
||||||
|
/// request
|
||||||
/// @param[in] const std::string& _json : received content from twitter endpoint
|
/// @param[in] const std::string& _json : received content from twitter endpoint
|
||||||
MediaStore(const unsigned int _responseCode, const std::string& _json)
|
MediaStore(const unsigned int _responseCode, const std::string& _json)
|
||||||
: MediaStore(MediaStore::parse(_responseCode, _json)) {}
|
: MediaStore(MediaStore::parse(_responseCode, _json)) {}
|
||||||
|
|
||||||
/// @brief response parser for tweet object
|
/// @brief response parser for tweet object
|
||||||
/// @param[in] const unsigned int _responseCode : http status code which received when post request
|
/// @param[in] const unsigned int _responseCode : http status code which received when post
|
||||||
|
/// request
|
||||||
/// @param[in] const std::string& _json : received content from twitter endpoint
|
/// @param[in] const std::string& _json : received content from twitter endpoint
|
||||||
/// @param[out] CocoaTweet::API::Model::Tweet
|
/// @param[out] CocoaTweet::API::Model::Tweet
|
||||||
static MediaStore parse(const unsigned int _responseCode, const std::string& _json);
|
static MediaStore parse(const unsigned int _responseCode, const std::string& _json);
|
||||||
|
|||||||
Reference in New Issue
Block a user