(spreadsheetId: string, driveId?: string)
| 130 | * When driveId is omitted, uses /me/drive/items/{itemId} (personal OneDrive). |
| 131 | */ |
| 132 | export function getItemBasePath(spreadsheetId: string, driveId?: string): string { |
| 133 | const spreadsheetValidation = validatePathSegment(spreadsheetId, { |
| 134 | paramName: 'spreadsheetId', |
| 135 | customPattern: GRAPH_ID_PATTERN, |
| 136 | }) |
| 137 | if (!spreadsheetValidation.isValid) { |
| 138 | throw new Error(spreadsheetValidation.error) |
| 139 | } |
| 140 | |
| 141 | if (driveId) { |
| 142 | const driveValidation = validatePathSegment(driveId, { |
| 143 | paramName: 'driveId', |
| 144 | customPattern: GRAPH_ID_PATTERN, |
| 145 | }) |
| 146 | if (!driveValidation.isValid) { |
| 147 | throw new Error(driveValidation.error) |
| 148 | } |
| 149 | return `https://graph.microsoft.com/v1.0/drives/${driveId}/items/${spreadsheetId}` |
| 150 | } |
| 151 | return `https://graph.microsoft.com/v1.0/me/drive/items/${spreadsheetId}` |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Resolves a worksheet name and cell address from either an explicit sheet name |
no test coverage detected