diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 10f3091..6b7b74c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.0" + ".": "0.3.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 296014e..21d6a3d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-f6598ab5d6827f66b642201769e92590ea32af84ebbf24b18cc32b33dee5107e.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-bef0e79f204c51c91f5dca61e621e5e31c7494dccccb200e51da0c7654340816.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index bea532e..7c3dbc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.3.0 (2025-02-18) + +Full Changelog: [v0.2.0...v0.3.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.2.0...v0.3.0) + +### Features + +* **api:** manual updates ([#38](https://github.com/gitpod-io/gitpod-sdk-go/issues/38)) ([853ae5c](https://github.com/gitpod-io/gitpod-sdk-go/commit/853ae5cf56e0d0fef0d2371166bd167b33e4ffa5)) +* **api:** manual updates ([#40](https://github.com/gitpod-io/gitpod-sdk-go/issues/40)) ([a71a350](https://github.com/gitpod-io/gitpod-sdk-go/commit/a71a350d93dc72bb856668893583195f2d22b5c5)) + ## 0.2.0 (2025-02-18) Full Changelog: [v0.1.1...v0.2.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.1.1...v0.2.0) diff --git a/README.md b/README.md index 0671e9a..e41b9f7 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.2.0' +go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.3.0' ``` diff --git a/environment.go b/environment.go index 2c39b87..972b8d9 100644 --- a/environment.go +++ b/environment.go @@ -1082,15 +1082,18 @@ type EnvironmentSpecDevcontainer struct { // ``` // this.matches('^$|^[^/].*') // ``` - DevcontainerFilePath string `json:"devcontainerFilePath"` - Session string `json:"session"` - JSON environmentSpecDevcontainerJSON `json:"-"` + DevcontainerFilePath string `json:"devcontainerFilePath"` + // Experimental: dotfiles is the dotfiles configuration of the devcontainer + Dotfiles EnvironmentSpecDevcontainerDotfiles `json:"dotfiles"` + Session string `json:"session"` + JSON environmentSpecDevcontainerJSON `json:"-"` } // environmentSpecDevcontainerJSON contains the JSON metadata for the struct // [EnvironmentSpecDevcontainer] type environmentSpecDevcontainerJSON struct { DevcontainerFilePath apijson.Field + Dotfiles apijson.Field Session apijson.Field raw string ExtraFields map[string]apijson.Field @@ -1104,6 +1107,39 @@ func (r environmentSpecDevcontainerJSON) RawJSON() string { return r.raw } +// Experimental: dotfiles is the dotfiles configuration of the devcontainer +type EnvironmentSpecDevcontainerDotfiles struct { + // URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) + Repository string `json:"repository,required" format:"uri"` + // install_command is the command to run after cloning the dotfiles repository. + // Defaults to run the first file of `install.sh`, `install`, `bootstrap.sh`, + // `bootstrap`, `setup.sh` and `setup` found in the dotfiles repository's root + // folder. + InstallCommand string `json:"installCommand"` + // target_path is the path to clone the dotfiles repository to. Defaults to + // `~/dotfiles`. + TargetPath string `json:"targetPath"` + JSON environmentSpecDevcontainerDotfilesJSON `json:"-"` +} + +// environmentSpecDevcontainerDotfilesJSON contains the JSON metadata for the +// struct [EnvironmentSpecDevcontainerDotfiles] +type environmentSpecDevcontainerDotfilesJSON struct { + Repository apijson.Field + InstallCommand apijson.Field + TargetPath apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EnvironmentSpecDevcontainerDotfiles) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r environmentSpecDevcontainerDotfilesJSON) RawJSON() string { + return r.raw +} + // machine is the machine spec of the environment type EnvironmentSpecMachine struct { // Class denotes the class of the environment we ought to start @@ -1378,13 +1414,33 @@ type EnvironmentSpecDevcontainerParam struct { // this.matches('^$|^[^/].*') // ``` DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` - Session param.Field[string] `json:"session"` + // Experimental: dotfiles is the dotfiles configuration of the devcontainer + Dotfiles param.Field[EnvironmentSpecDevcontainerDotfilesParam] `json:"dotfiles"` + Session param.Field[string] `json:"session"` } func (r EnvironmentSpecDevcontainerParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Experimental: dotfiles is the dotfiles configuration of the devcontainer +type EnvironmentSpecDevcontainerDotfilesParam struct { + // URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) + Repository param.Field[string] `json:"repository,required" format:"uri"` + // install_command is the command to run after cloning the dotfiles repository. + // Defaults to run the first file of `install.sh`, `install`, `bootstrap.sh`, + // `bootstrap`, `setup.sh` and `setup` found in the dotfiles repository's root + // folder. + InstallCommand param.Field[string] `json:"installCommand"` + // target_path is the path to clone the dotfiles repository to. Defaults to + // `~/dotfiles`. + TargetPath param.Field[string] `json:"targetPath"` +} + +func (r EnvironmentSpecDevcontainerDotfilesParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + // machine is the machine spec of the environment type EnvironmentSpecMachineParam struct { // Class denotes the class of the environment we ought to start @@ -2215,7 +2271,7 @@ func (r EnvironmentStatusSSHPublicKeysPhase) IsKnown() bool { type EnvironmentNewResponse struct { // +resource get environment - Environment Environment `json:"environment"` + Environment Environment `json:"environment,required"` JSON environmentNewResponseJSON `json:"-"` } @@ -2237,7 +2293,7 @@ func (r environmentNewResponseJSON) RawJSON() string { type EnvironmentGetResponse struct { // +resource get environment - Environment Environment `json:"environment"` + Environment Environment `json:"environment,required"` JSON environmentGetResponseJSON `json:"-"` } @@ -2263,7 +2319,7 @@ type EnvironmentDeleteResponse = interface{} type EnvironmentNewFromProjectResponse struct { // +resource get environment - Environment Environment `json:"environment"` + Environment Environment `json:"environment,required"` JSON environmentNewFromProjectResponseJSON `json:"-"` } @@ -2285,7 +2341,7 @@ func (r environmentNewFromProjectResponseJSON) RawJSON() string { type EnvironmentNewLogsTokenResponse struct { // access_token is the token that can be used to access the logs of the environment - AccessToken string `json:"accessToken"` + AccessToken string `json:"accessToken,required"` JSON environmentNewLogsTokenResponseJSON `json:"-"` } diff --git a/environment_test.go b/environment_test.go index a28c267..bd47a1f 100644 --- a/environment_test.go +++ b/environment_test.go @@ -56,7 +56,12 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) { DesiredPhase: gitpod.F(gitpod.EnvironmentPhaseUnspecified), Devcontainer: gitpod.F(gitpod.EnvironmentSpecDevcontainerParam{ DevcontainerFilePath: gitpod.F("devcontainerFilePath"), - Session: gitpod.F("session"), + Dotfiles: gitpod.F(gitpod.EnvironmentSpecDevcontainerDotfilesParam{ + Repository: gitpod.F("https://example.com"), + InstallCommand: gitpod.F("installCommand"), + TargetPath: gitpod.F("targetPath"), + }), + Session: gitpod.F("session"), }), Machine: gitpod.F(gitpod.EnvironmentSpecMachineParam{ Class: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), @@ -294,7 +299,12 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) { DesiredPhase: gitpod.F(gitpod.EnvironmentPhaseUnspecified), Devcontainer: gitpod.F(gitpod.EnvironmentSpecDevcontainerParam{ DevcontainerFilePath: gitpod.F("devcontainerFilePath"), - Session: gitpod.F("session"), + Dotfiles: gitpod.F(gitpod.EnvironmentSpecDevcontainerDotfilesParam{ + Repository: gitpod.F("https://example.com"), + InstallCommand: gitpod.F("installCommand"), + TargetPath: gitpod.F("targetPath"), + }), + Session: gitpod.F("session"), }), Machine: gitpod.F(gitpod.EnvironmentSpecMachineParam{ Class: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), diff --git a/environmentautomationservice.go b/environmentautomationservice.go index 3c0c88d..b6e3e84 100644 --- a/environmentautomationservice.go +++ b/environmentautomationservice.go @@ -784,7 +784,7 @@ func (r serviceStatusJSON) RawJSON() string { } type EnvironmentAutomationServiceNewResponse struct { - Service Service `json:"service"` + Service Service `json:"service,required"` JSON environmentAutomationServiceNewResponseJSON `json:"-"` } @@ -805,7 +805,7 @@ func (r environmentAutomationServiceNewResponseJSON) RawJSON() string { } type EnvironmentAutomationServiceGetResponse struct { - Service Service `json:"service"` + Service Service `json:"service,required"` JSON environmentAutomationServiceGetResponseJSON `json:"-"` } diff --git a/environmentautomationtask.go b/environmentautomationtask.go index 20ccb1d..02869b5 100644 --- a/environmentautomationtask.go +++ b/environmentautomationtask.go @@ -281,7 +281,7 @@ func (r *EnvironmentAutomationTaskService) Start(ctx context.Context, body Envir } type EnvironmentAutomationTaskNewResponse struct { - Task shared.Task `json:"task"` + Task shared.Task `json:"task,required"` JSON environmentAutomationTaskNewResponseJSON `json:"-"` } @@ -302,7 +302,7 @@ func (r environmentAutomationTaskNewResponseJSON) RawJSON() string { } type EnvironmentAutomationTaskGetResponse struct { - Task shared.Task `json:"task"` + Task shared.Task `json:"task,required"` JSON environmentAutomationTaskGetResponseJSON `json:"-"` } @@ -327,7 +327,7 @@ type EnvironmentAutomationTaskUpdateResponse = interface{} type EnvironmentAutomationTaskDeleteResponse = interface{} type EnvironmentAutomationTaskStartResponse struct { - TaskExecution shared.TaskExecution `json:"taskExecution"` + TaskExecution shared.TaskExecution `json:"taskExecution,required"` JSON environmentAutomationTaskStartResponseJSON `json:"-"` } diff --git a/environmentautomationtaskexecution.go b/environmentautomationtaskexecution.go index 21dc735..2f191cd 100644 --- a/environmentautomationtaskexecution.go +++ b/environmentautomationtaskexecution.go @@ -169,7 +169,7 @@ func (r *EnvironmentAutomationTaskExecutionService) Stop(ctx context.Context, bo } type EnvironmentAutomationTaskExecutionGetResponse struct { - TaskExecution shared.TaskExecution `json:"taskExecution"` + TaskExecution shared.TaskExecution `json:"taskExecution,required"` JSON environmentAutomationTaskExecutionGetResponseJSON `json:"-"` } diff --git a/internal/version.go b/internal/version.go index 774c6c4..7cb1898 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.2.0" // x-release-please-version +const PackageVersion = "0.3.0" // x-release-please-version diff --git a/runner.go b/runner.go index 7c9bd01..ff92591 100644 --- a/runner.go +++ b/runner.go @@ -661,22 +661,22 @@ func (r runnerStatusJSON) RawJSON() string { } type RunnerNewResponse struct { + Runner Runner `json:"runner,required"` // deprecated, will be removed. Use exchange_token instead. AccessToken string `json:"accessToken"` // exchange_token is a one-time use token that should be exchanged by the runner // for an access token, using the IdentityService.ExchangeToken rpc. The token // expires after 24 hours. ExchangeToken string `json:"exchangeToken"` - Runner Runner `json:"runner"` JSON runnerNewResponseJSON `json:"-"` } // runnerNewResponseJSON contains the JSON metadata for the struct // [RunnerNewResponse] type runnerNewResponseJSON struct { + Runner apijson.Field AccessToken apijson.Field ExchangeToken apijson.Field - Runner apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -690,7 +690,7 @@ func (r runnerNewResponseJSON) RawJSON() string { } type RunnerGetResponse struct { - Runner Runner `json:"runner"` + Runner Runner `json:"runner,required"` JSON runnerGetResponseJSON `json:"-"` } diff --git a/runnerconfiguration_test.go b/runnerconfiguration_test.go index 78bf252..aa0f342 100644 --- a/runnerconfiguration_test.go +++ b/runnerconfiguration_test.go @@ -29,7 +29,8 @@ func TestRunnerConfigurationValidateWithOptionalParams(t *testing.T) { ) _, err := client.Runners.Configurations.Validate(context.TODO(), gitpod.RunnerConfigurationValidateParams{ EnvironmentClass: gitpod.F(shared.EnvironmentClassParam{ - ID: gitpod.F("id"), + ID: gitpod.F("id"), + RunnerID: gitpod.F("runnerId"), Configuration: gitpod.F([]shared.FieldValueParam{{ Key: gitpod.F("key"), Value: gitpod.F("value"), @@ -37,7 +38,6 @@ func TestRunnerConfigurationValidateWithOptionalParams(t *testing.T) { Description: gitpod.F("xxx"), DisplayName: gitpod.F("xxx"), Enabled: gitpod.F(true), - RunnerID: gitpod.F("runnerId"), }), RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), ScmIntegration: gitpod.F(gitpod.RunnerConfigurationValidateParamsScmIntegration{ diff --git a/runnerconfigurationhostauthenticationtoken.go b/runnerconfigurationhostauthenticationtoken.go index 85a08da..d9a646d 100644 --- a/runnerconfigurationhostauthenticationtoken.go +++ b/runnerconfigurationhostauthenticationtoken.go @@ -92,7 +92,7 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) Delete(ctx context.C } type HostAuthenticationToken struct { - ID string `json:"id"` + ID string `json:"id,required"` // A Timestamp represents a point in time independent of any time zone or local // calendar, encoded as a count of seconds and fractions of seconds at nanosecond // resolution. The count is relative to an epoch at UTC midnight on January 1, @@ -227,7 +227,7 @@ func (r HostAuthenticationTokenSource) IsKnown() bool { } type RunnerConfigurationHostAuthenticationTokenNewResponse struct { - Token HostAuthenticationToken `json:"token"` + Token HostAuthenticationToken `json:"token,required"` JSON runnerConfigurationHostAuthenticationTokenNewResponseJSON `json:"-"` } @@ -248,7 +248,7 @@ func (r runnerConfigurationHostAuthenticationTokenNewResponseJSON) RawJSON() str } type RunnerConfigurationHostAuthenticationTokenGetResponse struct { - Token HostAuthenticationToken `json:"token"` + Token HostAuthenticationToken `json:"token,required"` JSON runnerConfigurationHostAuthenticationTokenGetResponseJSON `json:"-"` } diff --git a/runnerpolicy.go b/runnerpolicy.go index e94c221..0b59777 100644 --- a/runnerpolicy.go +++ b/runnerpolicy.go @@ -121,7 +121,7 @@ func (r RunnerRole) IsKnown() bool { } type RunnerPolicyNewResponse struct { - Policy RunnerPolicy `json:"policy"` + Policy RunnerPolicy `json:"policy,required"` JSON runnerPolicyNewResponseJSON `json:"-"` } @@ -142,7 +142,7 @@ func (r runnerPolicyNewResponseJSON) RawJSON() string { } type RunnerPolicyUpdateResponse struct { - Policy RunnerPolicy `json:"policy"` + Policy RunnerPolicy `json:"policy,required"` JSON runnerPolicyUpdateResponseJSON `json:"-"` } diff --git a/shared/shared.go b/shared/shared.go index 894d650..fbafa36 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -55,6 +55,9 @@ func (r AutomationTriggerParam) MarshalJSON() (data []byte, err error) { type EnvironmentClass struct { // id is the unique identifier of the environment class ID string `json:"id,required"` + // runner_id is the unique identifier of the runner the environment class belongs + // to + RunnerID string `json:"runnerId,required"` // configuration describes the configuration of the environment class Configuration []FieldValue `json:"configuration"` // description is a human readable description of the environment class @@ -63,22 +66,19 @@ type EnvironmentClass struct { DisplayName string `json:"displayName"` // enabled indicates whether the environment class can be used to create new // environments. - Enabled bool `json:"enabled"` - // runner_id is the unique identifier of the runner the environment class belongs - // to - RunnerID string `json:"runnerId"` - JSON environmentClassJSON `json:"-"` + Enabled bool `json:"enabled"` + JSON environmentClassJSON `json:"-"` } // environmentClassJSON contains the JSON metadata for the struct // [EnvironmentClass] type environmentClassJSON struct { ID apijson.Field + RunnerID apijson.Field Configuration apijson.Field Description apijson.Field DisplayName apijson.Field Enabled apijson.Field - RunnerID apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -94,6 +94,9 @@ func (r environmentClassJSON) RawJSON() string { type EnvironmentClassParam struct { // id is the unique identifier of the environment class ID param.Field[string] `json:"id,required"` + // runner_id is the unique identifier of the runner the environment class belongs + // to + RunnerID param.Field[string] `json:"runnerId,required"` // configuration describes the configuration of the environment class Configuration param.Field[[]FieldValueParam] `json:"configuration"` // description is a human readable description of the environment class @@ -103,9 +106,6 @@ type EnvironmentClassParam struct { // enabled indicates whether the environment class can be used to create new // environments. Enabled param.Field[bool] `json:"enabled"` - // runner_id is the unique identifier of the runner the environment class belongs - // to - RunnerID param.Field[string] `json:"runnerId"` } func (r EnvironmentClassParam) MarshalJSON() (data []byte, err error) { @@ -302,7 +302,7 @@ func (r taskJSON) RawJSON() string { } type TaskExecution struct { - ID string `json:"id" format:"uuid"` + ID string `json:"id,required" format:"uuid"` Metadata TaskExecutionMetadata `json:"metadata"` Spec TaskExecutionSpec `json:"spec"` Status TaskExecutionStatus `json:"status"` diff --git a/user.go b/user.go index 7bf5eb9..7512097 100644 --- a/user.go +++ b/user.go @@ -96,7 +96,7 @@ func (r *UserService) SetSuspended(ctx context.Context, body UserSetSuspendedPar type User struct { // id is a UUID of the user - ID string `json:"id" format:"uuid"` + ID string `json:"id,required" format:"uuid"` // avatar_url is a link to the user avatar AvatarURL string `json:"avatarUrl"` // A Timestamp represents a point in time independent of any time zone or local @@ -220,7 +220,7 @@ func (r userJSON) RawJSON() string { } type UserGetAuthenticatedUserResponse struct { - User User `json:"user"` + User User `json:"user,required"` JSON userGetAuthenticatedUserResponseJSON `json:"-"` } diff --git a/userpat.go b/userpat.go index 7b0b195..a3dc58a 100644 --- a/userpat.go +++ b/userpat.go @@ -445,7 +445,7 @@ func (r personalAccessTokenJSON) RawJSON() string { type UserPatDeleteResponse = interface{} type UserPatGetResponse struct { - Pat PersonalAccessToken `json:"pat"` + Pat PersonalAccessToken `json:"pat,required"` JSON userPatGetResponseJSON `json:"-"` }