in src/commands/collection/add-root.ts [19:35]
async run() {
const { args } = await this.parse(CollectionAddRoot)
const profile = this.profile!
const http = this.http!
const serviceDiscovery = await new ServiceDiscovery(http, profile.mediaApiHost).discover()
const collectionsRoot = serviceDiscovery.getLink('collections')
if (!collectionsRoot) {
this.error('collections link not found', { exit: 1 })
}
const url = new URL(`${collectionsRoot!.href.toString()}/collections`)
const newCollection = await http.post(url, JSON.stringify({ data: args.name })).then(_ => _.json())
this.log(JSON.stringify(newCollection))
}