[MM-41290] Add Endpoint to complete onboarding (#19435)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a733fb840d
Коммит
321b19e3db
@@ -66,6 +66,16 @@ func (c *Client) GetPlugins(request *model.MarketplacePluginFilter) ([]*model.Ba
|
||||
}
|
||||
|
||||
func (c *Client) GetPlugin(filter *model.MarketplacePluginFilter, pluginVersion string) (*model.BaseMarketplacePlugin, error) {
|
||||
filter.ReturnAllVersions = true
|
||||
|
||||
if filter.PluginId == "" {
|
||||
return nil, errors.New("missing pluginID")
|
||||
}
|
||||
|
||||
if pluginVersion == "" {
|
||||
return nil, errors.New("missing pluginVersion")
|
||||
}
|
||||
|
||||
plugins, err := c.GetPlugins(filter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -78,6 +88,29 @@ func (c *Client) GetPlugin(filter *model.MarketplacePluginFilter, pluginVersion
|
||||
return nil, errors.New("plugin not found")
|
||||
}
|
||||
|
||||
func (c *Client) GetLatestPlugin(filter *model.MarketplacePluginFilter) (*model.BaseMarketplacePlugin, error) {
|
||||
filter.ReturnAllVersions = false
|
||||
|
||||
if filter.PluginId == "" {
|
||||
return nil, errors.New("no pluginID provided")
|
||||
}
|
||||
|
||||
plugins, err := c.GetPlugins(filter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(plugins) == 0 {
|
||||
return nil, errors.New("plugin not found")
|
||||
}
|
||||
|
||||
if len(plugins) > 1 {
|
||||
return nil, errors.Errorf("unexpectedly more then one plugin was returned from the marketplace")
|
||||
}
|
||||
|
||||
return plugins[0], nil
|
||||
}
|
||||
|
||||
// closeBody ensures the Body of an http.Response is properly closed.
|
||||
func closeBody(r *http.Response) {
|
||||
if r.Body != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user