/
webstore_widget_private.clj
61 lines (46 loc) · 2.7 KB
/
webstore_widget_private.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
(ns chromex.app.webstore-widget-private
"webstoreWidgetPrivate API.
This is a private API used to install apps via Chrome Web Store widget - for
example in Files app to install file system provider services.
* available since Chrome 44"
(:refer-clojure :only [defmacro defn apply declare meta let partial])
(:require [chromex.wrapgen :refer [gen-wrap-helper]]
[chromex.callgen :refer [gen-call-helper gen-tap-all-events-call]]))
(declare api-table)
(declare gen-call)
; -- functions --------------------------------------------------------------------------------------------------------------
(defmacro install-webstore-item
"Requests to install a webstore item. |item_id| The id of the item to install. |silentInstallation| False to show
installation prompt. True not to show. Can be set to true only for a subset of installation requests.
|item-id| - ?
|silent-installation| - ?
This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error."
([item-id silent-installation] (gen-call :function ::install-webstore-item &form item-id silent-installation)))
; -- convenience ------------------------------------------------------------------------------------------------------------
(defmacro tap-all-events
"Taps all valid non-deprecated events in chromex.app.webstore-widget-private namespace."
[chan]
(gen-tap-all-events-call api-table (meta &form) chan))
; ---------------------------------------------------------------------------------------------------------------------------
; -- API TABLE --------------------------------------------------------------------------------------------------------------
; ---------------------------------------------------------------------------------------------------------------------------
(def api-table
{:namespace "chrome.webstoreWidgetPrivate",
:since "44",
:functions
[{:id ::install-webstore-item,
:name "installWebstoreItem",
:callback? true,
:params
[{:name "item-id", :type "string"}
{:name "silent-installation", :type "boolean"}
{:name "callback", :type :callback}]}]})
; -- helpers ----------------------------------------------------------------------------------------------------------------
; code generation for native API wrapper
(defmacro gen-wrap [kind item-id config & args]
(apply gen-wrap-helper api-table kind item-id config args))
; code generation for API call-site
(def gen-call (partial gen-call-helper api-table))