diff --git a/configuration_version.go b/configuration_version.go index fee4c3c..fc381a6 100644 --- a/configuration_version.go +++ b/configuration_version.go @@ -29,7 +29,7 @@ type configurationVersions struct { // ConfigurationStatus represents a configuration version status. type ConfigurationStatus string -//List all available configuration version statuses. +// List all available configuration version statuses. const ( ConfigurationErrored ConfigurationStatus = "errored" ConfigurationPending ConfigurationStatus = "pending" @@ -43,7 +43,8 @@ type ConfigurationVersion struct { ID string `jsonapi:"primary,configuration-versions"` Status ConfigurationStatus `jsonapi:"attr,status"` // Relations - Workspace *Workspace `jsonapi:"relation,workspace"` + Workspace *Workspace `jsonapi:"relation,workspace"` + VcsRevision *VcsRevision `jsonapi:"relation,vcs-revision,omitempty"` } // ConfigurationVersionCreateOptions represents the options for creating a @@ -94,8 +95,13 @@ func (s *configurationVersions) Read(ctx context.Context, cvID string) (*Configu return nil, errors.New("invalid value for configuration version ID") } + options := struct { + Include string `url:"include"` + }{ + Include: "vcs-revision", + } u := fmt.Sprintf("configuration-versions/%s", url.QueryEscape(cvID)) - req, err := s.client.newRequest("GET", u, nil) + req, err := s.client.newRequest("GET", u, options) if err != nil { return nil, err } diff --git a/workspace.go b/workspace.go index 9387391..4cdc632 100644 --- a/workspace.go +++ b/workspace.go @@ -93,13 +93,15 @@ type Workspace struct { VarFiles []string `jsonapi:"attr,var-files"` // Relations - CurrentRun *Run `jsonapi:"relation,current-run"` - Environment *Environment `jsonapi:"relation,environment"` - CreatedBy *User `jsonapi:"relation,created-by"` - VcsProvider *VcsProvider `jsonapi:"relation,vcs-provider"` - AgentPool *AgentPool `jsonapi:"relation,agent-pool"` - ModuleVersion *ModuleVersion `jsonapi:"relation,module-version,omitempty"` - Tags []*Tag `jsonapi:"relation,tags"` + CurrentRun *Run `jsonapi:"relation,current-run"` + Environment *Environment `jsonapi:"relation,environment"` + CreatedBy *User `jsonapi:"relation,created-by"` + VcsProvider *VcsProvider `jsonapi:"relation,vcs-provider"` + AgentPool *AgentPool `jsonapi:"relation,agent-pool"` + ModuleVersion *ModuleVersion `jsonapi:"relation,module-version,omitempty"` + ConfigurationVersion *ConfigurationVersion `jsonapi:"relation,configuration-version,omitempty"` + LatestConfigurationVersion *ConfigurationVersion `jsonapi:"relation,latest-configuration-version,omitempty"` + Tags []*Tag `jsonapi:"relation,tags"` } // Hooks contains the custom hooks field.