fetchNewCommsUrls()
function fetchNewCommsUrls(args: FetchNewCommsUrlsArgs, options?: MigrationOptions): Promise<MigrationResult[]>;
Translates multiple Twist URLs to their equivalent Comms URLs.
URLs are processed sequentially to stay friendly to the rate-sensitive
migration endpoint. A failure on one URL does not abort the run: each result
carries either a newUrl (success) or a CommsRequestError (failure), in the
same order as the input.
Parameters
| Parameter | Type |
|---|---|
args | FetchNewCommsUrlsArgs |
options? | MigrationOptions |
Returns
Promise<MigrationResult[]>
One MigrationResult per input URL, in input order.
Example
const results = await fetchNewCommsUrls({
oldUrls: ['https://twist.com/a/1/ch/2/t/3', 'https://twist.com/bad'],
twistToken: process.env.TWIST_AUTH_TOKEN,
})
for (const result of results) {
if (result.newUrl) console.log(`${result.oldUrl} -> ${result.newUrl}`)
else console.warn(`${result.oldUrl} failed`, result.error)
}
Throws
Re-throws any error that is not a CommsRequestError.