I mean programmatically without using esri dijits (BasemapGallery, BasemapToggle).
I tried something like map.setBaseMap("Satellite") which works for maps other than webmaps built in AGOL /Portal.
It seems unreasonable if no API is available for such a common operation.