Move Vercel /v2/user fetch to pkg/connector/vercel.go → Migrate connector settings callers to generic

- Move Vercel /v2/user fetch to pkg/connector/vercel.go
- Authorize NeedsConfiguration and SelectedOrganization
- Add coredata.ConnectorSettings[T] generic helper
- Migrate connector settings callers to generic

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-05-17 17:22:49 +02:00
parent caec9f1ad5
commit 8917b46541
8 changed files with 154 additions and 72 deletions

View File

@@ -250,3 +250,16 @@ func (c *Connector) unmarshalSettings(v any) error {
}
return nil
}
// ConnectorSettings unmarshals the connector's RawSettings into the
// requested settings struct. Empty or null RawSettings yields the zero
// value with no error. Use as:
//
// settings, err := coredata.ConnectorSettings[coredata.GitHubConnectorSettings](dbConnector)
func ConnectorSettings[T any](c *Connector) (T, error) {
var s T
if err := c.unmarshalSettings(&s); err != nil {
return s, err
}
return s, nil
}