Skip to content

feat(api): manual updates #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ type Error = apierror.Error
// that the automation should be triggered after the dev container has started.
//
// This is an alias to an internal type.
type AutomationTrigge = shared.AutomationTrigge
type AutomationTrigger = shared.AutomationTrigger

// An AutomationTrigger represents a trigger for an automation action. The
// `post_environment_start` field indicates that the automation should be triggered
// after the environment has started. The `post_devcontainer_start` field indicates
// that the automation should be triggered after the dev container has started.
//
// This is an alias to an internal type.
type AutomationTriggeParam = shared.AutomationTriggeParam
type AutomationTriggerParam = shared.AutomationTriggerParam

// This is an alias to an internal type.
type EnvironmentClass = shared.EnvironmentClass
Expand Down
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Shared Params Types

- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#AutomationTriggeParam">AutomationTriggeParam</a>
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#AutomationTriggerParam">AutomationTriggerParam</a>
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#EnvironmentClassParam">EnvironmentClassParam</a>
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#FieldValueParam">FieldValueParam</a>
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#OrganizationRole">OrganizationRole</a>
Expand All @@ -13,7 +13,7 @@

# Shared Response Types

- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#AutomationTrigge">AutomationTrigge</a>
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#AutomationTrigger">AutomationTrigger</a>
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#EnvironmentClass">EnvironmentClass</a>
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#FieldValue">FieldValue</a>
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go/shared#OrganizationRole">OrganizationRole</a>
Expand Down
8 changes: 4 additions & 4 deletions environmentautomationservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ type ServiceMetadata struct {
// identify the service in user interactions (e.g. the CLI).
Reference string `json:"reference"`
// triggered_by is a list of trigger that start the service.
TriggeredBy []shared.AutomationTrigge `json:"triggeredBy"`
JSON serviceMetadataJSON `json:"-"`
TriggeredBy []shared.AutomationTrigger `json:"triggeredBy"`
JSON serviceMetadataJSON `json:"-"`
}

// serviceMetadataJSON contains the JSON metadata for the struct [ServiceMetadata]
Expand Down Expand Up @@ -372,7 +372,7 @@ type ServiceMetadataParam struct {
// identify the service in user interactions (e.g. the CLI).
Reference param.Field[string] `json:"reference"`
// triggered_by is a list of trigger that start the service.
TriggeredBy param.Field[[]shared.AutomationTriggeParam] `json:"triggeredBy"`
TriggeredBy param.Field[[]shared.AutomationTriggerParam] `json:"triggeredBy"`
}

func (r ServiceMetadataParam) MarshalJSON() (data []byte, err error) {
Expand Down Expand Up @@ -665,7 +665,7 @@ func (r EnvironmentAutomationServiceUpdateParamsMetadata) MarshalJSON() (data []
}

type EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy struct {
Trigger param.Field[[]shared.AutomationTriggeParam] `json:"trigger"`
Trigger param.Field[[]shared.AutomationTriggerParam] `json:"trigger"`
}

func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy) MarshalJSON() (data []byte, err error) {
Expand Down
4 changes: 2 additions & 2 deletions environmentautomationservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) {
Description: gitpod.F("description"),
Name: gitpod.F("x"),
Reference: gitpod.F("reference"),
TriggeredBy: gitpod.F([]shared.AutomationTriggeParam{{
TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{{
Manual: gitpod.F(true),
PostDevcontainerStart: gitpod.F(true),
PostEnvironmentStart: gitpod.F(true),
Expand Down Expand Up @@ -115,7 +115,7 @@ func TestEnvironmentAutomationServiceUpdateWithOptionalParams(t *testing.T) {
Description: gitpod.F("description"),
Name: gitpod.F("x"),
TriggeredBy: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy{
Trigger: gitpod.F([]shared.AutomationTriggeParam{{
Trigger: gitpod.F([]shared.AutomationTriggerParam{{
Manual: gitpod.F(true),
PostDevcontainerStart: gitpod.F(true),
PostEnvironmentStart: gitpod.F(true),
Expand Down
2 changes: 1 addition & 1 deletion environmentautomationtask.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (r EnvironmentAutomationTaskUpdateParamsMetadata) MarshalJSON() (data []byt
}

type EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy struct {
Trigger param.Field[[]shared.AutomationTriggeParam] `json:"trigger"`
Trigger param.Field[[]shared.AutomationTriggerParam] `json:"trigger"`
}

func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy) MarshalJSON() (data []byte, err error) {
Expand Down
4 changes: 2 additions & 2 deletions environmentautomationtask_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) {
Description: gitpod.F("description"),
Name: gitpod.F("x"),
Reference: gitpod.F("reference"),
TriggeredBy: gitpod.F([]shared.AutomationTriggeParam{{
TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{{
Manual: gitpod.F(true),
PostDevcontainerStart: gitpod.F(true),
PostEnvironmentStart: gitpod.F(true),
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestEnvironmentAutomationTaskUpdateWithOptionalParams(t *testing.T) {
Description: gitpod.F("description"),
Name: gitpod.F("x"),
TriggeredBy: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy{
Trigger: gitpod.F([]shared.AutomationTriggeParam{{
Trigger: gitpod.F([]shared.AutomationTriggerParam{{
Manual: gitpod.F(true),
PostDevcontainerStart: gitpod.F(true),
PostEnvironmentStart: gitpod.F(true),
Expand Down
30 changes: 15 additions & 15 deletions shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,42 @@ import (
// `post_environment_start` field indicates that the automation should be triggered
// after the environment has started. The `post_devcontainer_start` field indicates
// that the automation should be triggered after the dev container has started.
type AutomationTrigge struct {
Manual bool `json:"manual"`
PostDevcontainerStart bool `json:"postDevcontainerStart"`
PostEnvironmentStart bool `json:"postEnvironmentStart"`
JSON automationTriggeJSON `json:"-"`
type AutomationTrigger struct {
Manual bool `json:"manual"`
PostDevcontainerStart bool `json:"postDevcontainerStart"`
PostEnvironmentStart bool `json:"postEnvironmentStart"`
JSON automationTriggerJSON `json:"-"`
}

// automationTriggeJSON contains the JSON metadata for the struct
// [AutomationTrigge]
type automationTriggeJSON struct {
// automationTriggerJSON contains the JSON metadata for the struct
// [AutomationTrigger]
type automationTriggerJSON struct {
Manual apijson.Field
PostDevcontainerStart apijson.Field
PostEnvironmentStart apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AutomationTrigge) UnmarshalJSON(data []byte) (err error) {
func (r *AutomationTrigger) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r automationTriggeJSON) RawJSON() string {
func (r automationTriggerJSON) RawJSON() string {
return r.raw
}

// An AutomationTrigger represents a trigger for an automation action. The
// `post_environment_start` field indicates that the automation should be triggered
// after the environment has started. The `post_devcontainer_start` field indicates
// that the automation should be triggered after the dev container has started.
type AutomationTriggeParam struct {
type AutomationTriggerParam struct {
Manual param.Field[bool] `json:"manual"`
PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart"`
PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart"`
}

func (r AutomationTriggeParam) MarshalJSON() (data []byte, err error) {
func (r AutomationTriggerParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

Expand Down Expand Up @@ -924,8 +924,8 @@ type TaskMetadata struct {
// the task in user interactions (e.g. the CLI).
Reference string `json:"reference"`
// triggered_by is a list of trigger that start the task.
TriggeredBy []AutomationTrigge `json:"triggeredBy"`
JSON taskMetadataJSON `json:"-"`
TriggeredBy []AutomationTrigger `json:"triggeredBy"`
JSON taskMetadataJSON `json:"-"`
}

// taskMetadataJSON contains the JSON metadata for the struct [TaskMetadata]
Expand Down Expand Up @@ -1052,7 +1052,7 @@ type TaskMetadataParam struct {
// the task in user interactions (e.g. the CLI).
Reference param.Field[string] `json:"reference"`
// triggered_by is a list of trigger that start the task.
TriggeredBy param.Field[[]AutomationTriggeParam] `json:"triggeredBy"`
TriggeredBy param.Field[[]AutomationTriggerParam] `json:"triggeredBy"`
}

func (r TaskMetadataParam) MarshalJSON() (data []byte, err error) {
Expand Down