| 123 | } |
| 124 | |
| 125 | uint64_t ServerApi06::CreateNote(ms::LatLon const & ll, std::string const & message) const |
| 126 | { |
| 127 | CHECK(!message.empty(), ("Note content should not be empty.")); |
| 128 | std::string const params = |
| 129 | "?lat=" + strings::to_string_dac(ll.m_lat, 7) + "&lon=" + strings::to_string_dac(ll.m_lon, 7) + |
| 130 | "&text=" + url::UrlEncode(message + " #CoMaps " + OMIM_OS_NAME + " " + GetPlatform().Version()); |
| 131 | OsmOAuth::Response const response = m_auth.Request("/notes" + params, "POST"); |
| 132 | if (response.first != OsmOAuth::HTTP::OK) |
| 133 | MYTHROW(ErrorAddingNote, ("Could not post a new note:", response)); |
| 134 | pugi::xml_document details; |
| 135 | if (!details.load_string(response.second.c_str())) |
| 136 | MYTHROW(CantParseServerResponse, ("Could not parse a note XML response", response)); |
| 137 | pugi::xml_node const uid = details.child("osm").child("note").child("id"); |
| 138 | if (!uid) |
| 139 | MYTHROW(CantParseServerResponse, ("Caould not find a note id", response)); |
| 140 | return uid.text().as_ullong(); |
| 141 | } |
| 142 | |
| 143 | void ServerApi06::CloseNote(uint64_t const id) const |
| 144 | { |