-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from saidone75/dev
Dev
- Loading branch information
Showing
5 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
; CRAL | ||
; Copyright (C) 2023-2024 Saidone | ||
; | ||
; This program is free software: you can redistribute it and/or modify | ||
; it under the terms of the GNU General Public License as published by | ||
; the Free Software Foundation, either version 3 of the License, or | ||
; (at your option) any later version. | ||
; | ||
; This program is distributed in the hope that it will be useful, | ||
; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
; GNU General Public License for more details. | ||
; | ||
; You should have received a copy of the GNU General Public License | ||
; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
(ns cral.api.core.queries | ||
(:require [clj-http.lite.client :as client] | ||
[cral.config :as config] | ||
[cral.utils.utils :as utils]) | ||
(:import (clojure.lang PersistentHashMap) | ||
(cral.model.auth Ticket) | ||
(cral.model.core FindNodesQueryParams))) | ||
|
||
(defn find-nodes | ||
"Gets a list of nodes that match the given search criteria. | ||
The search term is used to look for nodes that match against name, title, description, full text content or tags. | ||
The search term: | ||
- must contain a minimum of 3 alphanumeric characters | ||
- allows \"quoted term\" | ||
- can optionally use '*' for wildcard matching\n\n | ||
By default, file and folder types will be searched unless a specific type is provided as a query parameter. | ||
By default, the search will be across the repository unless a specific root node id is provided to start the search from. | ||
You can sort the result list using the **order-by** parameter in `query-params`. | ||
You can specify one or more of the following fields in the **order-by** parameter: | ||
- name | ||
- modifiedAt | ||
- createdAt\n\n | ||
More info [here](https://api-explorer.alfresco.com/api-explorer/?urls.primaryName=Core%20API#/queries/findNodes)." | ||
([^Ticket ticket ^FindNodesQueryParams query-params & [^PersistentHashMap opts]] | ||
(utils/call-rest | ||
client/get | ||
(format "%s/queries/nodes" (config/get-url 'core)) | ||
ticket | ||
{:query-params query-params} | ||
opts))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
; CRAL | ||
; Copyright (C) 2023-2024 Saidone | ||
; | ||
; This program is free software: you can redistribute it and/or modify | ||
; it under the terms of the GNU General Public License as published by | ||
; the Free Software Foundation, either version 3 of the License, or | ||
; (at your option) any later version. | ||
; | ||
; This program is distributed in the hope that it will be useful, | ||
; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
; GNU General Public License for more details. | ||
; | ||
; You should have received a copy of the GNU General Public License | ||
; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
(ns cral.queries-test | ||
(:require [clojure.test :refer :all] | ||
[cral.api.auth :as auth] | ||
[cral.api.core.queries :as queries] | ||
[cral.config :as c] | ||
[cral.fixtures :as fixtures] | ||
[cral.model.core :as model])) | ||
|
||
(use-fixtures :once fixtures/setup) | ||
|
||
(deftest find-nodes-test | ||
(let [ticket (get-in (auth/create-ticket c/user c/password) [:body :entry])] | ||
(println (->> (model/map->FindNodesQueryParams {:term "readme"}) | ||
(queries/find-nodes ticket))))) |