(row: FoldrRow | null)
| 185 | } |
| 186 | |
| 187 | private async initIfNeeded(row: FoldrRow | null): Promise<void> { |
| 188 | if (this.wasNonExistent) { |
| 189 | this.wasNonExistent = false; |
| 190 | this.wasEmpty = false; |
| 191 | if (row) { |
| 192 | row.row = 2; |
| 193 | await this.postInitCsv( |
| 194 | '#url', |
| 195 | '#title', |
| 196 | `/${this.id}.1`, |
| 197 | 'Sheet1', |
| 198 | row.link, |
| 199 | row.title, |
| 200 | ); |
| 201 | } else { |
| 202 | await this.postRawCsv('#url', '#title', `/${this.id}.1`, 'Sheet1'); |
| 203 | } |
| 204 | return; |
| 205 | } |
| 206 | if (this.wasEmpty) { |
| 207 | this.wasEmpty = false; |
| 208 | if (row) { |
| 209 | row.row = 2; |
| 210 | await this.postRawCsv(`/${this.id}.1`, 'Sheet1', row.link, row.title); |
| 211 | } else { |
| 212 | await this.postCsv(`/${this.id}.1`, 'Sheet1'); |
| 213 | } |
| 214 | return; |
| 215 | } |
| 216 | // Nothing to do. |
| 217 | } |
| 218 | |
| 219 | /** Single-row CSV POST (used for incremental `push` on an existing sheet). */ |
| 220 | async postCsv(a = '', b = ''): Promise<FoldrPushResponse | null> { |
no test coverage detected