| 41 | ServerApi06::ServerApi06(OsmOAuth const & auth) : m_auth(auth) {} |
| 42 | |
| 43 | uint64_t ServerApi06::CreateChangeSet(KeyValueTags const & kvTags) const |
| 44 | { |
| 45 | if (!m_auth.IsAuthorized()) |
| 46 | MYTHROW(NotAuthorized, ("Not authorized.")); |
| 47 | |
| 48 | OsmOAuth::Response const response = m_auth.Request("/changeset/create", "PUT", KeyValueTagsToXML(kvTags)); |
| 49 | if (response.first != OsmOAuth::HTTP::OK) |
| 50 | MYTHROW(CreateChangeSetHasFailed, ("CreateChangeSet request has failed:", response)); |
| 51 | |
| 52 | uint64_t id; |
| 53 | if (!strings::to_uint64(response.second, id)) |
| 54 | MYTHROW(CantParseServerResponse, ("Can't parse changeset ID from server response.")); |
| 55 | return id; |
| 56 | } |
| 57 | |
| 58 | uint64_t ServerApi06::CreateElement(editor::XMLFeature const & element) const |
| 59 | { |