~mhr3/unity-scopes-api/merge-trunk

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#
# Copyright (C) 2013 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

-----------------------------------------------------------------------------
This document describes data structures that are serialized and exchanged by
middleware.
-----------------------------------------------------------------------------

Result (returned by serialize()):
=================================
'attrs' : {
    'uri' : string
    'title' : string
    'art' : string
    'dnd_uri' : string
    + any custom key-value attribute added by scope author.
},
'internal' : {
    'result' : dictionary (serialized Result), optional
    'flags'  : integer, optional (activation/preview flags defined by ResultImpl::Flags enum)
    'origin' : string (scope id)
}

CategorisedResult (returned by serialize()):
=======================================
'attrs' : {
    // all Result's attributes
},
'internal' : {
    'cat_id' : string
    + all Result's internal values
}

Category (returned by serialize()):
=====================================
 'id' : string
 'title' : string
 'icon' : string
 'renderer_template' : string

Department (returned by serialize()):
=====================================
  'query'       : dictionary (serialized Query)
  'label'       : string
  'alt_label'   : string, optional
  'departments' : array of dictionaries (serialized Departments), optional
  'has_subdepartments' : bool (optional)

ScopeMetadata (returned by serialize()):
=====================================
 'scope_id'              : string
 'proxy'                 : dictionary
    'identity'           : string
    'endpoint'           : string
 'display_name'          : string
 'description'           : string
 'scope_dir'             : string, optional
 'art'                   : string, optional
 'icon'                  : string, optional
 'search_hint'           : string, optional
 'hot_key'               : string, optional
 'invisible'             : bool, optional
 'appearance_attributes' : dictionary, optional
 'results_ttl_type'      : int, optional
 'settings_definitions'  : dictionary, optional
 'location_data_needed'  : bool, optional

Query (returned by serialize())
===============================
 'scope'         : string
 'query_string'  : string
 'department_id' : string
 'filter_state'  : dictionary (serialized FilterState)
 
Link (returned by serialize())
==============================
 'label'      : string
 'query'      : Query
 
Annotation (returned by serialize())
====================================
 'type'       : string
 'label'      : string, optional
 'icon'       : string, optional
 'links'      : array of Links

FilterState (returned by serialize())
=====================================
  filter_id   : Variant (arbitrary, depends on filter type)

FilterOption
============
 'id'     : string
 'label'  : string

OptionSelectorFilter
====================
 'id'           : string
 'filter_type'  : string
 'display_hints': int, optional

OptionSelectorFilter (FilterBase)
=================================
 'id'           : string
 'filter_type'  : "option_selector"
 'label'        : string
 'multi_select' : bool
 'options'      : array of FilterOption

RangeInputFilter
================
 'id'           : string
 'start_label'  : string
 'end_label'    : string
 'unit_label'   : string

Filters + FilterState
=====================
 'filter'       : array of filters (implementations of FilterBase)
 'filter_state' : FilterState

PreviewResult (returned by serialize())
=======================================
 'id'         : string
 'type'       : string
 'attributes' : dict
 'components' : dict

PushRequest (capnproto structure)
=================================
 result : dictionary with:
                "category" and/or
                "result" or
                "annotation" or
                "departments" and "current_department" or
                "columns"
                key and
  serialized Category / CategorisedResult / Annotation / DepartmentList / ColumnLayoutList respectively.

ActivationResponse (returned by serialize())
============================================
 'status'      : int (corresponds to ActivationResponse::Status enum)
 'scope_data'  : variant