Qore HueRestClient Module Reference 1.0
Loading...
Searching...
No Matches
HueRestClient.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* HueRestClient.qm Copyright (C) 2020 - 2023 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25// minimum qore version
26
27// require type definitions everywhere
28
29// enable all warnings
30
31// don't use "$" for vars, members, and methods, assume local variable scope
32
33// do not ignore argument errors
34
35
36
81namespace HueRestClient {
83
92
93public:
95 const DefaultUrl = "rests://api.meethue.com/route/api";
96
98 const DefaultAuthUrl = "https://api.meethue.com/v2/oauth2/authorize";
99
101 const DefaultGrantType = "authorization_code";
102
104 const DefaultTokenUrl = "https://api.meethue.com/v2/oauth2/token";
105
107 const DefaultOptions = {
108 "url": DefaultUrl,
109 "oauth2_auth_url": DefaultAuthUrl,
110 "oauth2_grant_type": DefaultGrantType,
111 "oauth2_token_url": DefaultTokenUrl,
112 };
113
115 const DefaultHuePingMethod= "GET";
116
118 const DefaultHuePingHeaders = {
119 "Accept": MimeTypeJson,
120 };
121
123
136 constructor(hash<auto> opts, *softbool do_not_connect) ;
137
138
140 static hash<auto> getOptions(hash<auto> opts);
141};
142
144
154
155public:
157 const ConnectionScheme = <ConnectionSchemeInfo>{
158 "cls": Class::forName("HueRestConnection"),
159 "options": RestConnection::ConnectionScheme.options + {
160 "oauth2_auth_url": RestConnection::ConnectionScheme.options.oauth2_auth_url
161 + <ConnectionOptionInfo>{
162 "default_value": HueRestClient::DefaultAuthUrl,
163 },
164 "oauth2_grant_type": RestConnection::ConnectionScheme.options.oauth2_grant_type
165 + <ConnectionOptionInfo>{
166 "default_value": HueRestClient::DefaultGrantType,
167 },
168 "oauth2_token_url": RestConnection::ConnectionScheme.options.oauth2_token_url
169 + <ConnectionOptionInfo>{
170 "default_value": HueRestClient::DefaultTokenUrl,
171 },
172 },
173 "required_options": "token|oauth2_auth_url,oauth2_grant_type,oauth2_token_url,"
174 "oauth2_client_id,oauth2_client_secret",
175 };
176
178
188 constructor(string name, string description, string url = HueRestClient::DefaultUrl, hash<auto> attributes = {}, hash<auto> options = {})
189 ;
190
191
193 string getType();
194
195
197
202
203
205
207 DataProvider::AbstractDataProvider getDataProvider();
208
209
211protected:
213public:
214
215
217
222protected:
223 HueRestClient getImpl(bool connect = True, *hash<auto> rtopts);
224public:
225
226
228protected:
229 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
230public:
231
232};
233};
const DefaultTokenUrl
Default token request URL.
Definition: HueRestClient.qm.dox.h:104
const DefaultAuthUrl
Default authorization request URL.
Definition: HueRestClient.qm.dox.h:98
const DefaultUrl
Default Hue REST API URL.
Definition: HueRestClient.qm.dox.h:95
const DefaultGrantType
Default OAuth2 grant type.
Definition: HueRestClient.qm.dox.h:101
static hash< auto > getOptions(hash< auto > opts)
returns options for HueRestClient::HueRestClient::constructor()
constructor(hash< auto > opts, *softbool do_not_connect)
creates the object with the given options
Class for Hue REST connections; returns HueRestClient objects.
Definition: HueRestClient.qm.dox.h:153
DataProvider::AbstractDataProvider getDataProvider()
returns a data provider object for this connection
string getType()
returns "hue"
bool hasDataProvider()
returns True as this connection returns a data provider with the getDataProvider() method
setChildCapabilities()
Sets child data provider capabilities.
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
constructor(string name, string description, string url=HueRestClient::DefaultUrl, hash< auto > attributes={}, hash< auto > options={})
creates the HueRestConnection object
const ConnectionScheme
Connection entry info.
Definition: HueRestClient.qm.dox.h:157
HueRestClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a HueRestClient object
the HueRestClient namespace contains all the objects in the HueRestClient module
Definition: HueRestClient.qm.dox.h:81