(msTranscript: string)
| 49 | * @returns Microsoft transcript api url. |
| 50 | */ |
| 51 | export function getMsTranscriptApiUrl(msTranscript: string) { |
| 52 | try { |
| 53 | const url = new URL(msTranscript); |
| 54 | const transcriptUrlRegex = /\/transcript\/([^/]+)\/?/; |
| 55 | const id = transcriptUrlRegex.exec(url.pathname)?.[1]; |
| 56 | if (!id) { |
| 57 | return { error: `Invalid transcript URL: ${msTranscript}`, data: null }; |
| 58 | } |
| 59 | return { |
| 60 | error: null, |
| 61 | data: `https://learn.microsoft.com/api/profiles/transcript/share/${id}` |
| 62 | }; |
| 63 | } catch (e) { |
| 64 | return { |
| 65 | error: `Invalid transcript URL: ${msTranscript}\n${JSON.stringify(e)}`, |
| 66 | data: null |
| 67 | }; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Wrapper for endpoints related to user account management, |
no outgoing calls
no test coverage detected