Skip to content

Commit e2267e2

Browse files
chore(internal): codegen related update
1 parent daada19 commit e2267e2

20 files changed

+63
-190
lines changed

client_test.go

+21-21
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ func TestRetryAfter(t *testing.T) {
6262
},
6363
}),
6464
)
65-
res, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{
65+
_, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{
6666
ConnectProtocolVersion: gitpod.F(gitpod.RunnerNewParamsConnectProtocolVersion1),
6767
})
68-
if err == nil || res != nil {
69-
t.Error("Expected there to be a cancel error and for the response to be nil")
68+
if err == nil {
69+
t.Error("Expected there to be a cancel error")
7070
}
7171

7272
attempts := len(retryCountHeaders)
@@ -98,11 +98,11 @@ func TestDeleteRetryCountHeader(t *testing.T) {
9898
}),
9999
option.WithHeaderDel("X-Stainless-Retry-Count"),
100100
)
101-
res, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{
101+
_, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{
102102
ConnectProtocolVersion: gitpod.F(gitpod.RunnerNewParamsConnectProtocolVersion1),
103103
})
104-
if err == nil || res != nil {
105-
t.Error("Expected there to be a cancel error and for the response to be nil")
104+
if err == nil {
105+
t.Error("Expected there to be a cancel error")
106106
}
107107

108108
expectedRetryCountHeaders := []string{"", "", ""}
@@ -129,11 +129,11 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
129129
}),
130130
option.WithHeader("X-Stainless-Retry-Count", "42"),
131131
)
132-
res, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{
132+
_, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{
133133
ConnectProtocolVersion: gitpod.F(gitpod.RunnerNewParamsConnectProtocolVersion1),
134134
})
135-
if err == nil || res != nil {
136-
t.Error("Expected there to be a cancel error and for the response to be nil")
135+
if err == nil {
136+
t.Error("Expected there to be a cancel error")
137137
}
138138

139139
expectedRetryCountHeaders := []string{"42", "42", "42"}
@@ -159,11 +159,11 @@ func TestRetryAfterMs(t *testing.T) {
159159
},
160160
}),
161161
)
162-
res, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{
162+
_, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{
163163
ConnectProtocolVersion: gitpod.F(gitpod.RunnerNewParamsConnectProtocolVersion1),
164164
})
165-
if err == nil || res != nil {
166-
t.Error("Expected there to be a cancel error and for the response to be nil")
165+
if err == nil {
166+
t.Error("Expected there to be a cancel error")
167167
}
168168
if want := 3; attempts != want {
169169
t.Errorf("Expected %d attempts, got %d", want, attempts)
@@ -183,11 +183,11 @@ func TestContextCancel(t *testing.T) {
183183
)
184184
cancelCtx, cancel := context.WithCancel(context.Background())
185185
cancel()
186-
res, err := client.Runners.New(cancelCtx, gitpod.RunnerNewParams{
186+
_, err := client.Runners.New(cancelCtx, gitpod.RunnerNewParams{
187187
ConnectProtocolVersion: gitpod.F(gitpod.RunnerNewParamsConnectProtocolVersion1),
188188
})
189-
if err == nil || res != nil {
190-
t.Error("Expected there to be a cancel error and for the response to be nil")
189+
if err == nil {
190+
t.Error("Expected there to be a cancel error")
191191
}
192192
}
193193

@@ -204,11 +204,11 @@ func TestContextCancelDelay(t *testing.T) {
204204
)
205205
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
206206
defer cancel()
207-
res, err := client.Runners.New(cancelCtx, gitpod.RunnerNewParams{
207+
_, err := client.Runners.New(cancelCtx, gitpod.RunnerNewParams{
208208
ConnectProtocolVersion: gitpod.F(gitpod.RunnerNewParamsConnectProtocolVersion1),
209209
})
210-
if err == nil || res != nil {
211-
t.Error("expected there to be a cancel error and for the response to be nil")
210+
if err == nil {
211+
t.Error("expected there to be a cancel error")
212212
}
213213
}
214214

@@ -231,11 +231,11 @@ func TestContextDeadline(t *testing.T) {
231231
},
232232
}),
233233
)
234-
res, err := client.Runners.New(deadlineCtx, gitpod.RunnerNewParams{
234+
_, err := client.Runners.New(deadlineCtx, gitpod.RunnerNewParams{
235235
ConnectProtocolVersion: gitpod.F(gitpod.RunnerNewParamsConnectProtocolVersion1),
236236
})
237-
if err == nil || res != nil {
238-
t.Error("expected there to be a deadline error and for the response to be nil")
237+
if err == nil {
238+
t.Error("expected there to be a deadline error")
239239
}
240240
close(testDone)
241241
}()

environment_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func TestEnvironmentListWithOptionalParams(t *testing.T) {
126126
OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
127127
Pagination: gitpod.F(gitpod.EnvironmentListParamsPagination{
128128
Token: gitpod.F("token"),
129-
PageSize: gitpod.F(int64(0)),
129+
PageSize: gitpod.F(int64(100)),
130130
}),
131131
ConnectTimeoutMs: gitpod.F(0.000000),
132132
})

environmentautomation.go

+11-25
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ func (r EnvironmentAutomationUpsertParamsAutomationsFile) MarshalJSON() (data []
125125
}
126126

127127
type EnvironmentAutomationUpsertParamsAutomationsFileServices struct {
128-
Commands param.Field[EnvironmentAutomationUpsertParamsAutomationsFileServicesCommands] `json:"commands"`
129-
Description param.Field[string] `json:"description"`
130-
Name param.Field[string] `json:"name"`
131-
RunsOn param.Field[EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnUnion] `json:"runsOn"`
132-
TriggeredBy param.Field[[]string] `json:"triggeredBy"`
128+
Commands param.Field[EnvironmentAutomationUpsertParamsAutomationsFileServicesCommands] `json:"commands"`
129+
Description param.Field[string] `json:"description"`
130+
Name param.Field[string] `json:"name"`
131+
RunsOn param.Field[interface{}] `json:"runsOn"`
132+
TriggeredBy param.Field[[]string] `json:"triggeredBy"`
133133
}
134134

135135
func (r EnvironmentAutomationUpsertParamsAutomationsFileServices) MarshalJSON() (data []byte, err error) {
@@ -166,29 +166,15 @@ func (r EnvironmentAutomationUpsertParamsAutomationsFileServicesCommands) Marsha
166166
return apijson.MarshalRoot(r)
167167
}
168168

169-
// Satisfied by
170-
// [EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnUnknown],
171-
// [EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnUnknown].
172-
type EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnUnion interface {
173-
implementsEnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnUnion()
174-
}
175-
176169
type EnvironmentAutomationUpsertParamsAutomationsFileTasks struct {
177-
Command param.Field[string] `json:"command"`
178-
DependsOn param.Field[[]string] `json:"dependsOn"`
179-
Description param.Field[string] `json:"description"`
180-
Name param.Field[string] `json:"name"`
181-
RunsOn param.Field[EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnUnion] `json:"runsOn"`
182-
TriggeredBy param.Field[[]string] `json:"triggeredBy"`
170+
Command param.Field[string] `json:"command"`
171+
DependsOn param.Field[[]string] `json:"dependsOn"`
172+
Description param.Field[string] `json:"description"`
173+
Name param.Field[string] `json:"name"`
174+
RunsOn param.Field[interface{}] `json:"runsOn"`
175+
TriggeredBy param.Field[[]string] `json:"triggeredBy"`
183176
}
184177

185178
func (r EnvironmentAutomationUpsertParamsAutomationsFileTasks) MarshalJSON() (data []byte, err error) {
186179
return apijson.MarshalRoot(r)
187180
}
188-
189-
// Satisfied by
190-
// [EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnUnknown],
191-
// [EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnUnknown].
192-
type EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnUnion interface {
193-
implementsEnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnUnion()
194-
}

environmentautomation_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) {
3737
}),
3838
Description: gitpod.F("description"),
3939
Name: gitpod.F("x"),
40-
RunsOn: gitpod.F[gitpod.EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnUnion](gitpod.EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnUnknown(map[string]interface{}{})),
40+
RunsOn: gitpod.F[any](map[string]interface{}{}),
4141
TriggeredBy: gitpod.F([]string{"string"}),
4242
},
4343
}),
@@ -47,7 +47,7 @@ func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) {
4747
DependsOn: gitpod.F([]string{"string"}),
4848
Description: gitpod.F("description"),
4949
Name: gitpod.F("x"),
50-
RunsOn: gitpod.F[gitpod.EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnUnion](gitpod.EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnUnknown(map[string]interface{}{})),
50+
RunsOn: gitpod.F[any](map[string]interface{}{}),
5151
TriggeredBy: gitpod.F([]string{"string"}),
5252
},
5353
}),

environmentautomationservice.go

+1-15
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"context"
77
"fmt"
88
"net/http"
9-
"reflect"
109
"time"
1110

1211
"github.com/stainless-sdks/gitpod-go/internal/apijson"
@@ -404,7 +403,7 @@ type EnvironmentAutomationServiceListResponseServicesSpec struct {
404403
// service.
405404
DesiredPhase EnvironmentAutomationServiceListResponseServicesSpecDesiredPhase `json:"desiredPhase"`
406405
// runs_on specifies the environment the service should run on.
407-
RunsOn EnvironmentAutomationServiceListResponseServicesSpecRunsOnUnion `json:"runsOn"`
406+
RunsOn interface{} `json:"runsOn"`
408407
// session should be changed to trigger a restart of the service. If a service
409408
// exits it will
410409
//
@@ -507,19 +506,6 @@ func (r EnvironmentAutomationServiceListResponseServicesSpecDesiredPhase) IsKnow
507506
return false
508507
}
509508

510-
// runs_on specifies the environment the service should run on.
511-
//
512-
// Union satisfied by
513-
// [EnvironmentAutomationServiceListResponseServicesSpecRunsOnUnknown] or
514-
// [EnvironmentAutomationServiceListResponseServicesSpecRunsOnUnknown].
515-
type EnvironmentAutomationServiceListResponseServicesSpecRunsOnUnion interface {
516-
implementsEnvironmentAutomationServiceListResponseServicesSpecRunsOnUnion()
517-
}
518-
519-
func init() {
520-
apijson.RegisterUnion(reflect.TypeOf((*EnvironmentAutomationServiceListResponseServicesSpecRunsOnUnion)(nil)).Elem(), "")
521-
}
522-
523509
type EnvironmentAutomationServiceListResponseServicesStatus struct {
524510
// failure_message summarises why the service failed to operate. If this is
525511
// non-empty

environmentautomationservice_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestEnvironmentAutomationServiceListWithOptionalParams(t *testing.T) {
6363
}),
6464
Pagination: gitpod.F(gitpod.EnvironmentAutomationServiceListParamsPagination{
6565
Token: gitpod.F("token"),
66-
PageSize: gitpod.F(int64(0)),
66+
PageSize: gitpod.F(int64(100)),
6767
}),
6868
ConnectTimeoutMs: gitpod.F(0.000000),
6969
})

environmentautomationtask.go

+7-52
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"context"
77
"fmt"
88
"net/http"
9-
"reflect"
109
"time"
1110

1211
"github.com/stainless-sdks/gitpod-go/internal/apijson"
@@ -378,8 +377,8 @@ type EnvironmentAutomationTaskNewResponseTaskSpec struct {
378377
// command contains the command the task should execute
379378
Command string `json:"command"`
380379
// runs_on specifies the environment the task should run on.
381-
RunsOn EnvironmentAutomationTaskNewResponseTaskSpecRunsOnUnion `json:"runsOn"`
382-
JSON environmentAutomationTaskNewResponseTaskSpecJSON `json:"-"`
380+
RunsOn interface{} `json:"runsOn"`
381+
JSON environmentAutomationTaskNewResponseTaskSpecJSON `json:"-"`
383382
}
384383

385384
// environmentAutomationTaskNewResponseTaskSpecJSON contains the JSON metadata for
@@ -399,18 +398,6 @@ func (r environmentAutomationTaskNewResponseTaskSpecJSON) RawJSON() string {
399398
return r.raw
400399
}
401400

402-
// runs_on specifies the environment the task should run on.
403-
//
404-
// Union satisfied by [EnvironmentAutomationTaskNewResponseTaskSpecRunsOnUnknown]
405-
// or [EnvironmentAutomationTaskNewResponseTaskSpecRunsOnUnknown].
406-
type EnvironmentAutomationTaskNewResponseTaskSpecRunsOnUnion interface {
407-
implementsEnvironmentAutomationTaskNewResponseTaskSpecRunsOnUnion()
408-
}
409-
410-
func init() {
411-
apijson.RegisterUnion(reflect.TypeOf((*EnvironmentAutomationTaskNewResponseTaskSpecRunsOnUnion)(nil)).Elem(), "")
412-
}
413-
414401
type EnvironmentAutomationTaskGetResponse struct {
415402
Task EnvironmentAutomationTaskGetResponseTask `json:"task"`
416403
JSON environmentAutomationTaskGetResponseJSON `json:"-"`
@@ -670,8 +657,8 @@ type EnvironmentAutomationTaskGetResponseTaskSpec struct {
670657
// command contains the command the task should execute
671658
Command string `json:"command"`
672659
// runs_on specifies the environment the task should run on.
673-
RunsOn EnvironmentAutomationTaskGetResponseTaskSpecRunsOnUnion `json:"runsOn"`
674-
JSON environmentAutomationTaskGetResponseTaskSpecJSON `json:"-"`
660+
RunsOn interface{} `json:"runsOn"`
661+
JSON environmentAutomationTaskGetResponseTaskSpecJSON `json:"-"`
675662
}
676663

677664
// environmentAutomationTaskGetResponseTaskSpecJSON contains the JSON metadata for
@@ -691,18 +678,6 @@ func (r environmentAutomationTaskGetResponseTaskSpecJSON) RawJSON() string {
691678
return r.raw
692679
}
693680

694-
// runs_on specifies the environment the task should run on.
695-
//
696-
// Union satisfied by [EnvironmentAutomationTaskGetResponseTaskSpecRunsOnUnknown]
697-
// or [EnvironmentAutomationTaskGetResponseTaskSpecRunsOnUnknown].
698-
type EnvironmentAutomationTaskGetResponseTaskSpecRunsOnUnion interface {
699-
implementsEnvironmentAutomationTaskGetResponseTaskSpecRunsOnUnion()
700-
}
701-
702-
func init() {
703-
apijson.RegisterUnion(reflect.TypeOf((*EnvironmentAutomationTaskGetResponseTaskSpecRunsOnUnion)(nil)).Elem(), "")
704-
}
705-
706681
type EnvironmentAutomationTaskUpdateResponse = interface{}
707682

708683
type EnvironmentAutomationTaskListResponse struct {
@@ -990,8 +965,8 @@ type EnvironmentAutomationTaskListResponseTasksSpec struct {
990965
// command contains the command the task should execute
991966
Command string `json:"command"`
992967
// runs_on specifies the environment the task should run on.
993-
RunsOn EnvironmentAutomationTaskListResponseTasksSpecRunsOnUnion `json:"runsOn"`
994-
JSON environmentAutomationTaskListResponseTasksSpecJSON `json:"-"`
968+
RunsOn interface{} `json:"runsOn"`
969+
JSON environmentAutomationTaskListResponseTasksSpecJSON `json:"-"`
995970
}
996971

997972
// environmentAutomationTaskListResponseTasksSpecJSON contains the JSON metadata
@@ -1011,18 +986,6 @@ func (r environmentAutomationTaskListResponseTasksSpecJSON) RawJSON() string {
1011986
return r.raw
1012987
}
1013988

1014-
// runs_on specifies the environment the task should run on.
1015-
//
1016-
// Union satisfied by [EnvironmentAutomationTaskListResponseTasksSpecRunsOnUnknown]
1017-
// or [EnvironmentAutomationTaskListResponseTasksSpecRunsOnUnknown].
1018-
type EnvironmentAutomationTaskListResponseTasksSpecRunsOnUnion interface {
1019-
implementsEnvironmentAutomationTaskListResponseTasksSpecRunsOnUnion()
1020-
}
1021-
1022-
func init() {
1023-
apijson.RegisterUnion(reflect.TypeOf((*EnvironmentAutomationTaskListResponseTasksSpecRunsOnUnion)(nil)).Elem(), "")
1024-
}
1025-
1026989
type EnvironmentAutomationTaskDeleteResponse = interface{}
1027990

1028991
type EnvironmentAutomationTaskStartResponse struct {
@@ -1830,21 +1793,13 @@ type EnvironmentAutomationTaskNewParamsSpec struct {
18301793
// command contains the command the task should execute
18311794
Command param.Field[string] `json:"command"`
18321795
// runs_on specifies the environment the task should run on.
1833-
RunsOn param.Field[EnvironmentAutomationTaskNewParamsSpecRunsOnUnion] `json:"runsOn"`
1796+
RunsOn param.Field[interface{}] `json:"runsOn"`
18341797
}
18351798

18361799
func (r EnvironmentAutomationTaskNewParamsSpec) MarshalJSON() (data []byte, err error) {
18371800
return apijson.MarshalRoot(r)
18381801
}
18391802

1840-
// runs_on specifies the environment the task should run on.
1841-
//
1842-
// Satisfied by [EnvironmentAutomationTaskNewParamsSpecRunsOnUnknown],
1843-
// [EnvironmentAutomationTaskNewParamsSpecRunsOnUnknown].
1844-
type EnvironmentAutomationTaskNewParamsSpecRunsOnUnion interface {
1845-
implementsEnvironmentAutomationTaskNewParamsSpecRunsOnUnion()
1846-
}
1847-
18481803
type EnvironmentAutomationTaskGetParams struct {
18491804
// Define the version of the Connect protocol
18501805
ConnectProtocolVersion param.Field[EnvironmentAutomationTaskGetParamsConnectProtocolVersion] `header:"Connect-Protocol-Version,required"`

environmentautomationtask_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) {
4343
}),
4444
Spec: gitpod.F(gitpod.EnvironmentAutomationTaskNewParamsSpec{
4545
Command: gitpod.F("command"),
46-
RunsOn: gitpod.F[gitpod.EnvironmentAutomationTaskNewParamsSpecRunsOnUnion](gitpod.EnvironmentAutomationTaskNewParamsSpecRunsOnUnknown(map[string]interface{}{})),
46+
RunsOn: gitpod.F[any](map[string]interface{}{}),
4747
}),
4848
ConnectTimeoutMs: gitpod.F(0.000000),
4949
})
@@ -132,7 +132,7 @@ func TestEnvironmentAutomationTaskListWithOptionalParams(t *testing.T) {
132132
}),
133133
Pagination: gitpod.F(gitpod.EnvironmentAutomationTaskListParamsPagination{
134134
Token: gitpod.F("token"),
135-
PageSize: gitpod.F(int64(0)),
135+
PageSize: gitpod.F(int64(100)),
136136
}),
137137
ConnectTimeoutMs: gitpod.F(0.000000),
138138
})

environmentautomationtaskexecution_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestEnvironmentAutomationTaskExecutionListWithOptionalParams(t *testing.T)
6161
}),
6262
Pagination: gitpod.F(gitpod.EnvironmentAutomationTaskExecutionListParamsPagination{
6363
Token: gitpod.F("token"),
64-
PageSize: gitpod.F(int64(0)),
64+
PageSize: gitpod.F(int64(100)),
6565
}),
6666
ConnectTimeoutMs: gitpod.F(0.000000),
6767
})

0 commit comments

Comments
 (0)