/
entities.clj
35 lines (31 loc) · 1.08 KB
/
entities.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(ns happygapi.kgsearch.entities
"Knowledge Graph Search API: entities.
Searches the Google Knowledge Graph for entities.
See: https://developers.google.com/knowledge-graph/api/reference/rest/v1/entities"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn search$
"https://developers.google.com/knowledge-graph/api/reference/rest/v1/entities/search
Required parameters: none
Optional parameters: ids, limit, prefix, query, types, indent, languages
Searches Knowledge Graph for entities that match the constraints.
A list of matched entities will be returned in response, which will be in
JSON-LD format and compatible with http://schema.org"
{:scopes nil}
[auth parameters]
{:pre [(util/has-keys? parameters #{})]}
(util/get-response
(http/get
(util/get-url
"https://kgsearch.googleapis.com/"
"v1/entities:search"
#{}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))