Skip to content

Commit 467f38f

Browse files
fix(config): Diagnostic errors
1 parent 5cb2db9 commit 467f38f

File tree

3 files changed

+73
-14
lines changed

3 files changed

+73
-14
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1752
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-87cffcb2b7a8c40e24da5ed6c357445c8eb7acdb63152243fd2f1a3f4dba688c.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-628b27476dcb24be6d178f13e44068933c1e4cf67895b708a62fc182ae35a83a.yml
33
openapi_spec_hash: 5d8aa29e0696dfd71cc1e27c3d520f2e
4-
config_hash: a1b7c5aaad1e2019b29cef1b1da689fc
4+
config_hash: 8f5aab183b4a8e0f4a9ec9c0293b54f1

d1/database.go

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,38 +1351,97 @@ func (r DatabaseImportParamsBody) MarshalJSON() (data []byte, err error) {
13511351

13521352
func (r DatabaseImportParamsBody) implementsDatabaseImportParamsBodyUnion() {}
13531353

1354-
// Satisfied by [d1.DatabaseImportParamsBodyObject],
1355-
// [d1.DatabaseImportParamsBodyObject], [d1.DatabaseImportParamsBodyObject],
1354+
// Satisfied by [d1.DatabaseImportParamsBodyInit],
1355+
// [d1.DatabaseImportParamsBodyIngest], [d1.DatabaseImportParamsBodyPoll],
13561356
// [DatabaseImportParamsBody].
13571357
type DatabaseImportParamsBodyUnion interface {
13581358
implementsDatabaseImportParamsBodyUnion()
13591359
}
13601360

1361-
type DatabaseImportParamsBodyObject struct {
1361+
type DatabaseImportParamsBodyInit struct {
13621362
// 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"`
13641364
// Required when action is 'init' or 'ingest'. An md5 hash of the file you're
13651365
// uploading. Used to check if it already exists, and validate its contents before
13661366
// ingesting.
13671367
Etag param.Field[string] `json:"etag,required"`
13681368
}
13691369

1370-
func (r DatabaseImportParamsBodyObject) MarshalJSON() (data []byte, err error) {
1370+
func (r DatabaseImportParamsBodyInit) MarshalJSON() (data []byte, err error) {
13711371
return apijson.MarshalRoot(r)
13721372
}
13731373

1374-
func (r DatabaseImportParamsBodyObject) implementsDatabaseImportParamsBodyUnion() {}
1374+
func (r DatabaseImportParamsBodyInit) implementsDatabaseImportParamsBodyUnion() {}
13751375

13761376
// Indicates you have a new SQL file to upload.
1377-
type DatabaseImportParamsBodyObjectAction string
1377+
type DatabaseImportParamsBodyInitAction string
13781378

13791379
const (
1380-
DatabaseImportParamsBodyObjectActionInit DatabaseImportParamsBodyObjectAction = "init"
1380+
DatabaseImportParamsBodyInitActionInit DatabaseImportParamsBodyInitAction = "init"
13811381
)
13821382

1383-
func (r DatabaseImportParamsBodyObjectAction) IsKnown() bool {
1383+
func (r DatabaseImportParamsBodyInitAction) IsKnown() bool {
13841384
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:
13861445
return true
13871446
}
13881447
return false

d1/database_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ func TestDatabaseImport(t *testing.T) {
245245
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
246246
d1.DatabaseImportParams{
247247
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
248-
Body: d1.DatabaseImportParamsBodyObject{
249-
Action: cloudflare.F(d1.DatabaseImportParamsBodyObjectActionInit),
248+
Body: d1.DatabaseImportParamsBodyInit{
249+
Action: cloudflare.F(d1.DatabaseImportParamsBodyInitActionInit),
250250
Etag: cloudflare.F("etag"),
251251
},
252252
},

0 commit comments

Comments
 (0)