@@ -1351,38 +1351,97 @@ func (r DatabaseImportParamsBody) MarshalJSON() (data []byte, err error) {
1351
1351
1352
1352
func (r DatabaseImportParamsBody ) implementsDatabaseImportParamsBodyUnion () {}
1353
1353
1354
- // Satisfied by [d1.DatabaseImportParamsBodyObject ],
1355
- // [d1.DatabaseImportParamsBodyObject ], [d1.DatabaseImportParamsBodyObject ],
1354
+ // Satisfied by [d1.DatabaseImportParamsBodyInit ],
1355
+ // [d1.DatabaseImportParamsBodyIngest ], [d1.DatabaseImportParamsBodyPoll ],
1356
1356
// [DatabaseImportParamsBody].
1357
1357
type DatabaseImportParamsBodyUnion interface {
1358
1358
implementsDatabaseImportParamsBodyUnion ()
1359
1359
}
1360
1360
1361
- type DatabaseImportParamsBodyObject struct {
1361
+ type DatabaseImportParamsBodyInit struct {
1362
1362
// Indicates you have a new SQL file to upload.
1363
- Action param.Field [DatabaseImportParamsBodyObjectAction ] `json:"action,required"`
1363
+ Action param.Field [DatabaseImportParamsBodyInitAction ] `json:"action,required"`
1364
1364
// Required when action is 'init' or 'ingest'. An md5 hash of the file you're
1365
1365
// uploading. Used to check if it already exists, and validate its contents before
1366
1366
// ingesting.
1367
1367
Etag param.Field [string ] `json:"etag,required"`
1368
1368
}
1369
1369
1370
- func (r DatabaseImportParamsBodyObject ) MarshalJSON () (data []byte , err error ) {
1370
+ func (r DatabaseImportParamsBodyInit ) MarshalJSON () (data []byte , err error ) {
1371
1371
return apijson .MarshalRoot (r )
1372
1372
}
1373
1373
1374
- func (r DatabaseImportParamsBodyObject ) implementsDatabaseImportParamsBodyUnion () {}
1374
+ func (r DatabaseImportParamsBodyInit ) implementsDatabaseImportParamsBodyUnion () {}
1375
1375
1376
1376
// Indicates you have a new SQL file to upload.
1377
- type DatabaseImportParamsBodyObjectAction string
1377
+ type DatabaseImportParamsBodyInitAction string
1378
1378
1379
1379
const (
1380
- DatabaseImportParamsBodyObjectActionInit DatabaseImportParamsBodyObjectAction = "init"
1380
+ DatabaseImportParamsBodyInitActionInit DatabaseImportParamsBodyInitAction = "init"
1381
1381
)
1382
1382
1383
- func (r DatabaseImportParamsBodyObjectAction ) IsKnown () bool {
1383
+ func (r DatabaseImportParamsBodyInitAction ) IsKnown () bool {
1384
1384
switch r {
1385
- case DatabaseImportParamsBodyObjectActionInit :
1385
+ case DatabaseImportParamsBodyInitActionInit :
1386
+ return true
1387
+ }
1388
+ return false
1389
+ }
1390
+
1391
+ type DatabaseImportParamsBodyIngest struct {
1392
+ // Indicates you've finished uploading to tell the D1 to start consuming it
1393
+ Action param.Field [DatabaseImportParamsBodyIngestAction ] `json:"action,required"`
1394
+ // An md5 hash of the file you're uploading. Used to check if it already exists,
1395
+ // and validate its contents before ingesting.
1396
+ Etag param.Field [string ] `json:"etag,required"`
1397
+ // The filename you have successfully uploaded.
1398
+ Filename param.Field [string ] `json:"filename,required"`
1399
+ }
1400
+
1401
+ func (r DatabaseImportParamsBodyIngest ) MarshalJSON () (data []byte , err error ) {
1402
+ return apijson .MarshalRoot (r )
1403
+ }
1404
+
1405
+ func (r DatabaseImportParamsBodyIngest ) implementsDatabaseImportParamsBodyUnion () {}
1406
+
1407
+ // Indicates you've finished uploading to tell the D1 to start consuming it
1408
+ type DatabaseImportParamsBodyIngestAction string
1409
+
1410
+ const (
1411
+ DatabaseImportParamsBodyIngestActionIngest DatabaseImportParamsBodyIngestAction = "ingest"
1412
+ )
1413
+
1414
+ func (r DatabaseImportParamsBodyIngestAction ) IsKnown () bool {
1415
+ switch r {
1416
+ case DatabaseImportParamsBodyIngestActionIngest :
1417
+ return true
1418
+ }
1419
+ return false
1420
+ }
1421
+
1422
+ type DatabaseImportParamsBodyPoll struct {
1423
+ // Indicates you've finished uploading to tell the D1 to start consuming it
1424
+ Action param.Field [DatabaseImportParamsBodyPollAction ] `json:"action,required"`
1425
+ // This identifies the currently-running import, checking its status.
1426
+ CurrentBookmark param.Field [string ] `json:"current_bookmark,required"`
1427
+ }
1428
+
1429
+ func (r DatabaseImportParamsBodyPoll ) MarshalJSON () (data []byte , err error ) {
1430
+ return apijson .MarshalRoot (r )
1431
+ }
1432
+
1433
+ func (r DatabaseImportParamsBodyPoll ) implementsDatabaseImportParamsBodyUnion () {}
1434
+
1435
+ // Indicates you've finished uploading to tell the D1 to start consuming it
1436
+ type DatabaseImportParamsBodyPollAction string
1437
+
1438
+ const (
1439
+ DatabaseImportParamsBodyPollActionPoll DatabaseImportParamsBodyPollAction = "poll"
1440
+ )
1441
+
1442
+ func (r DatabaseImportParamsBodyPollAction ) IsKnown () bool {
1443
+ switch r {
1444
+ case DatabaseImportParamsBodyPollActionPoll :
1386
1445
return true
1387
1446
}
1388
1447
return false
0 commit comments