Donald Trump has secured the release of an American hostage after more than a year in captivity in Afghanistan after he was kidnapped by the Taliban.