(input: string)
| 7 | } |
| 8 | |
| 9 | export function parseInvitationUid(input: string): { |
| 10 | isForPhotos: boolean; |
| 11 | uid: string; |
| 12 | } { |
| 13 | if (input.startsWith('drive~')) { |
| 14 | return { |
| 15 | isForPhotos: false, |
| 16 | uid: input.slice('drive~'.length), |
| 17 | }; |
| 18 | } else if (input.startsWith('photos~')) { |
| 19 | return { |
| 20 | isForPhotos: true, |
| 21 | uid: input.slice('photos~'.length), |
| 22 | }; |
| 23 | } |
| 24 | throw new ValidationError(`Invalid invitation UID: ${input}`); |
| 25 | } |