Provides methods to open, close, get, update, etc. changesets on the OSM API server.
Note: this class doesn't provide a constructor. Methods and properties are "static".
// load the changeset api
var api = require("josm/api").ChangesetApi;
// create a new changeset on the server
var cs = api.open();
Name | Description |
---|---|
Methods | |
close | Closes a changeset |
get | Get a changeset from the server |
open | Creates and opens a changeset |
update | Updates a changeset |
close:Changeset
Closes a changeset
close(id)
close(aChangeset)
aChangeset
Name | Type | Description |
---|---|---|
changeset | number | the changeset to close |
var api = require("josm/api").ChangesetApi;
var util = require("josm/util");
var Changeset = org.openstreetmap.josm.data.osm.Changeset;
// closs the changeset 12345
api.close(12345);
// open a new changeset with the tags given by the supplied changeset
var cs2 = new Changeset(12345);
cs2 = api.close(cs2);
util.assert(cs2.closed); // the changeset is now closed
get:Changeset
Get a changeset from the server
get(id)
Name | Type | Description |
---|---|---|
changeset | number | the changeset to close |
var api = require("josm/api").ChangesetApi;
var Changeset = org.openstreetmap.josm.data.osm.Changeset;
// get the changeset with id 12345
var cs1 = api.get(12345);
// get the changeset with id 12345
var cs2 = new Changeset(12345);
cs2 = api.get(cs2);
open:Changeset
Creates and opens a changeset
open()
- open a new changeset with no tagsopen(aChangeset)
- open a new changeset with the tags from aChangeset
open(anObject)
- open a new changeset with the tags given by the properties of anObject
var api = require("josm/api").ChangesetApi;
var Changeset = org.openstreetmap.josm.data.osm.Changeset;
// open a new changeset with no tags
var cs1 = api.open();
// open a new changeset with the tags given by the supplied changeset
var cs2 = new Changeset();
cs2.put("comment", "a test comment");
cs2 = api.open(cs2);
// open a new changeset with the tags given by the object
var cs3 = api.open({comment: "a test comment"});
update:Changeset
Updates a changeset
update(aChangeset)
aChangeset
Name | Type | Description |
---|---|---|
changeset | Changeset | the changeset to update |
var api = require("josm/api").ChangesetApi;
var Changeset = org.openstreetmap.josm.data.osm.Changeset;
// update the comment of a changeset
var cs2 = new Changeset(12345);
cs2.put("comment", "an updated comment");
cs2 = api.update(cs2);