func()

in pkg/client/nexus/repository.go [28:53]


func (s *RepoClient) Get(ctx context.Context, id, format, repoType string) (interface{}, error) {
	res := map[string]interface{}{}

	resp, err := s.r(ctx).
		SetPathParams(map[string]string{
			"id":     id,
			"format": format,
			"type":   repoType,
		}).
		SetResult(&res).
		Get("/service/rest/v1/repositories/{format}/{type}/{id}")

	if err != nil {
		return nil, fmt.Errorf("failed to get repository: %w", err)
	}

	if resp.IsError() {
		if resp.StatusCode() == http.StatusNotFound {
			return nil, fmt.Errorf("repository %s %w: %s", id, ErrNotFound, resp.String())
		}

		return nil, fmt.Errorf("failed to get repository: %s", resp.String())
	}

	return res, nil
}