* Extracts the user ID from an Evernote developer token. * Token format: "S=s1:U=12345:..." where 12345 is the user ID.
(token: string)
| 35 | * Token format: "S=s1:U=12345:..." where 12345 is the user ID. |
| 36 | */ |
| 37 | function extractUserId(token: string): string { |
| 38 | const match = token.match(/:U=(\d+)/) |
| 39 | if (!match) { |
| 40 | throw new Error('Invalid Evernote token format: cannot extract user ID') |
| 41 | } |
| 42 | return match[1] |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Returns the Evernote API host based on the token type. |