Skip to content

Commit 65e5e09

Browse files
rhyskoedijkRhys Koedijk
andauthored
Add record_ecosystem_meta API support (#407)
* Add `record_ecosystem_meta` API support * Use omit empty for nullable fields * Fix linting --------- Co-authored-by: Rhys Koedijk <rhys@koedijk.co.nz>
1 parent 30f3e61 commit 65e5e09

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

internal/model/update.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ type RecordEcosystemVersions struct {
5555
EcosystemVersions map[string]any `json:"ecosystem_versions" yaml:"ecosystem_versions"`
5656
}
5757

58+
type RecordEcosystemMeta struct {
59+
Ecosystem Ecosystem `json:"ecosystem" yaml:"ecosystem"`
60+
}
61+
5862
type RecordUpdateJobError struct {
5963
ErrorType string `json:"error-type" yaml:"error-type"`
6064
ErrorDetails map[string]any `json:"error-details" yaml:"error-details"`
@@ -69,3 +73,16 @@ type IncrementMetric struct {
6973
Metric string `json:"metric" yaml:"metric"`
7074
Tags map[string]any `json:"tags" yaml:"tags"`
7175
}
76+
77+
type Ecosystem struct {
78+
Name string `json:"name" yaml:"name"`
79+
PackageManager VersionManager `json:"package_manager,omitempty" yaml:"package_manager,omitempty"`
80+
Language VersionManager `json:"language,omitempty" yaml:"language,omitempty"`
81+
}
82+
83+
type VersionManager struct {
84+
Name string `json:"name" yaml:"name"`
85+
Version string `json:"version" yaml:"version"`
86+
RawVersion string `json:"raw_version" yaml:"raw_version"`
87+
Requirement map[string]any `json:"requirement,omitempty" yaml:"requirement,omitempty"`
88+
}

internal/server/api.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ func decodeWrapper(kind string, data []byte) (actual *model.UpdateWrapper, err e
235235
actual.Data, err = decode[model.MarkAsProcessed](data)
236236
case "record_ecosystem_versions":
237237
actual.Data, err = decode[model.RecordEcosystemVersions](data)
238+
case "record_ecosystem_meta":
239+
actual.Data, err = decode[[]model.RecordEcosystemMeta](data)
238240
case "record_update_job_error":
239241
actual.Data, err = decode[model.RecordUpdateJobError](data)
240242
case "record_update_job_unknown_error":

0 commit comments

Comments
 (0)