Resolve calls the /resolve endpoint of the search service. This returns the latest version of the package that matches the version constraint.
(ctx context.Context, name, version string)
| 67 | // Resolve calls the /resolve endpoint of the search service. This returns |
| 68 | // the latest version of the package that matches the version constraint. |
| 69 | func (c *client) ResolveV2(ctx context.Context, name, version string) (*ResolveResponse, error) { |
| 70 | if name == "" { |
| 71 | return nil, redact.Errorf("name is empty") |
| 72 | } |
| 73 | if version == "" { |
| 74 | return nil, redact.Errorf("version is empty") |
| 75 | } |
| 76 | |
| 77 | endpoint, err := url.JoinPath(c.host, "v2/resolve") |
| 78 | if err != nil { |
| 79 | return nil, redact.Errorf("invalid search endpoint host %q: %w", redact.Safe(c.host), redact.Safe(err)) |
| 80 | } |
| 81 | searchURL := endpoint + |
| 82 | "?name=" + url.QueryEscape(name) + |
| 83 | "&version=" + url.QueryEscape(version) |
| 84 | |
| 85 | return execGet[ResolveResponse](ctx, searchURL) |
| 86 | } |
| 87 | |
| 88 | var userAgent = fmt.Sprintf("Devbox/%s (%s; %s)", build.Version, runtime.GOOS, runtime.GOARCH) |
| 89 |
no test coverage detected