| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* GATE PROJECT LICENSE: | ||
| 2 | +----------------------------------------------------------------------------+ | ||
| 3 | | Copyright(c) 2018-2026, Stefan Meislinger | | ||
| 4 | | All rights reserved. | | ||
| 5 | | | | ||
| 6 | | Redistribution and use in source and binary forms, with or without | | ||
| 7 | | modification, are permitted provided that the following conditions are met:| | ||
| 8 | | | | ||
| 9 | | 1. Redistributions of source code must retain the above copyright notice, | | ||
| 10 | | this list of conditions and the following disclaimer. | | ||
| 11 | | 2. Redistributions in binary form must reproduce the above copyright | | ||
| 12 | | notice, this list of conditions and the following disclaimer in the | | ||
| 13 | | documentation and/or other materials provided with the distribution. | | ||
| 14 | | | | ||
| 15 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"| | ||
| 16 | | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | ||
| 17 | | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | ||
| 18 | | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | | ||
| 19 | | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | ||
| 20 | | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | ||
| 21 | | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | ||
| 22 | | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | ||
| 23 | | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | ||
| 24 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | | ||
| 25 | | THE POSSIBILITY OF SUCH DAMAGE. | | ||
| 26 | +----------------------------------------------------------------------------+ | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include "gate/tech/webapis.hpp" | ||
| 30 | |||
| 31 | namespace gate | ||
| 32 | { | ||
| 33 | namespace tech | ||
| 34 | { | ||
| 35 | |||
| 36 | // context infos // | ||
| 37 | |||
| 38 | 9 | static gate_result_t GATE_CALL webapi_context_init(gate_struct_t* ptr) | |
| 39 | { | ||
| 40 | 9 | gate_tech_webapi_context_init((gate_tech_webapi_context_t*)ptr); | |
| 41 | 9 | return GATE_RESULT_OK; | |
| 42 | } | ||
| 43 | |||
| 44 | 9 | WebApi::Context::Context() | |
| 45 | 9 | : struct_instance_t(&webapi_context_init) | |
| 46 | { | ||
| 47 | |||
| 48 | 9 | } | |
| 49 | |||
| 50 | ✗ | String WebApi::Context::ProxyServer() const | |
| 51 | { | ||
| 52 | ✗ | return String((*this)->proxy_server); | |
| 53 | } | ||
| 54 | 3 | void WebApi::Context::ProxyServer(String const& value) | |
| 55 | { | ||
| 56 | 3 | String::assign((*this)->proxy_server, value); | |
| 57 | 3 | } | |
| 58 | |||
| 59 | ✗ | uint16_t WebApi::Context::ProxyPort() const | |
| 60 | { | ||
| 61 | ✗ | return (*this)->proxy_port; | |
| 62 | } | ||
| 63 | 3 | void WebApi::Context::ProxyPort(uint16_t value) | |
| 64 | { | ||
| 65 | 3 | (*this)->proxy_port = value; | |
| 66 | 3 | } | |
| 67 | |||
| 68 | ✗ | bool_t WebApi::Context::NativeClient() const | |
| 69 | { | ||
| 70 | ✗ | return (*this)->native_client; | |
| 71 | } | ||
| 72 | 3 | void WebApi::Context::NativeClient(bool_t value) | |
| 73 | { | ||
| 74 | 3 | (*this)->native_client = value; | |
| 75 | 3 | } | |
| 76 | ✗ | uint32_t WebApi::Context::TimeoutMs() const | |
| 77 | { | ||
| 78 | ✗ | return (*this)->timeout_ms; | |
| 79 | } | ||
| 80 | 3 | void WebApi::Context::TimeoutMs(uint32_t value) | |
| 81 | { | ||
| 82 | 3 | (*this)->timeout_ms = value; | |
| 83 | 3 | } | |
| 84 | |||
| 85 | |||
| 86 | // Ipwhois request // | ||
| 87 | |||
| 88 | 3 | static gate_result_t GATE_CALL ipwhois_request_init(gate_struct_t* ptr) | |
| 89 | { | ||
| 90 | 3 | gate_tech_webapi_ipwhois_request_init((gate_tech_webapi_ipwhois_request_t*)ptr); | |
| 91 | 3 | return GATE_RESULT_OK; | |
| 92 | } | ||
| 93 | |||
| 94 | 3 | WebApi::IpwhoisRequest::IpwhoisRequest() | |
| 95 | 3 | : struct_instance_t(&ipwhois_request_init) | |
| 96 | { | ||
| 97 | 3 | } | |
| 98 | |||
| 99 | ✗ | String WebApi::IpwhoisRequest::IpAddress() const | |
| 100 | { | ||
| 101 | ✗ | return String::duplicate((*this)->ip_address); | |
| 102 | } | ||
| 103 | 3 | void WebApi::IpwhoisRequest::IpAddress(String const& value) | |
| 104 | { | ||
| 105 | 3 | String::assign((*this)->ip_address, value); | |
| 106 | 3 | } | |
| 107 | |||
| 108 | |||
| 109 | // Ipwhois response // | ||
| 110 | |||
| 111 | 3 | static gate_result_t GATE_CALL ipwhois_response_init(gate_struct_t* ptr) | |
| 112 | { | ||
| 113 | 3 | gate_tech_webapi_ipwhois_response_init((gate_tech_webapi_ipwhois_response_t*)ptr); | |
| 114 | 3 | return GATE_RESULT_OK; | |
| 115 | } | ||
| 116 | |||
| 117 | 3 | WebApi::IpwhoisResponse::IpwhoisResponse() | |
| 118 | 3 | : struct_instance_t(&ipwhois_response_init) | |
| 119 | { | ||
| 120 | 3 | } | |
| 121 | |||
| 122 | 3 | String WebApi::IpwhoisResponse::IpAddress() const | |
| 123 | { | ||
| 124 | 3 | return String::duplicate((*this)->ip_address); | |
| 125 | } | ||
| 126 | 3 | String WebApi::IpwhoisResponse::Range() const | |
| 127 | { | ||
| 128 | 3 | return String::duplicate((*this)->range); | |
| 129 | } | ||
| 130 | |||
| 131 | 3 | String WebApi::IpwhoisResponse::InetOrg() const | |
| 132 | { | ||
| 133 | 3 | return String::duplicate((*this)->inet_org); | |
| 134 | } | ||
| 135 | 3 | String WebApi::IpwhoisResponse::InetNetname() const | |
| 136 | { | ||
| 137 | 3 | return String::duplicate((*this)->inet_netname); | |
| 138 | } | ||
| 139 | 3 | String WebApi::IpwhoisResponse::InetDescr() const | |
| 140 | { | ||
| 141 | 3 | return String::duplicate((*this)->inet_descr); | |
| 142 | } | ||
| 143 | 3 | String WebApi::IpwhoisResponse::InetCountry() const | |
| 144 | { | ||
| 145 | 3 | return String::duplicate((*this)->inet_country); | |
| 146 | } | ||
| 147 | 3 | Time WebApi::IpwhoisResponse::InetCreated() const | |
| 148 | { | ||
| 149 | 3 | return Time((*this)->inet_created); | |
| 150 | } | ||
| 151 | 3 | Time WebApi::IpwhoisResponse::InetModified() const | |
| 152 | { | ||
| 153 | 3 | return Time((*this)->inet_modified); | |
| 154 | } | ||
| 155 | |||
| 156 | 3 | String WebApi::IpwhoisResponse::OrgName() const | |
| 157 | { | ||
| 158 | 3 | return String::duplicate((*this)->org_name); | |
| 159 | } | ||
| 160 | 3 | String WebApi::IpwhoisResponse::OrgCountry() const | |
| 161 | { | ||
| 162 | 3 | return String::duplicate((*this)->org_country); | |
| 163 | } | ||
| 164 | 3 | String WebApi::IpwhoisResponse::OrgType() const | |
| 165 | { | ||
| 166 | 3 | return String::duplicate((*this)->org_type); | |
| 167 | } | ||
| 168 | 3 | String WebApi::IpwhoisResponse::OrgAddress() const | |
| 169 | { | ||
| 170 | 3 | return String::duplicate((*this)->org_address); | |
| 171 | } | ||
| 172 | 3 | String WebApi::IpwhoisResponse::OrgPhone() const | |
| 173 | { | ||
| 174 | 3 | return String::duplicate((*this)->org_phone); | |
| 175 | } | ||
| 176 | 3 | String WebApi::IpwhoisResponse::OrgMail() const | |
| 177 | { | ||
| 178 | 3 | return String::duplicate((*this)->org_mail); | |
| 179 | } | ||
| 180 | |||
| 181 | 3 | String WebApi::IpwhoisResponse::RoleName() const | |
| 182 | { | ||
| 183 | 3 | return String::duplicate((*this)->role_name); | |
| 184 | } | ||
| 185 | 3 | String WebApi::IpwhoisResponse::RoleAddress() const | |
| 186 | { | ||
| 187 | 3 | return String::duplicate((*this)->role_address); | |
| 188 | } | ||
| 189 | 3 | String WebApi::IpwhoisResponse::RoleMail() const | |
| 190 | { | ||
| 191 | 3 | return String::duplicate((*this)->role_mail); | |
| 192 | } | ||
| 193 | 3 | String WebApi::IpwhoisResponse::RoleAdminC() const | |
| 194 | { | ||
| 195 | 3 | return String::duplicate((*this)->role_admin_c); | |
| 196 | } | ||
| 197 | 3 | String WebApi::IpwhoisResponse::RoleTechC() const | |
| 198 | { | ||
| 199 | 3 | return String::duplicate((*this)->role_tech_c); | |
| 200 | } | ||
| 201 | |||
| 202 | 3 | String WebApi::IpwhoisResponse::RouteName() const | |
| 203 | { | ||
| 204 | 3 | return String::duplicate((*this)->route_name); | |
| 205 | } | ||
| 206 | 3 | String WebApi::IpwhoisResponse::RouteDescr() const | |
| 207 | { | ||
| 208 | 3 | return String::duplicate((*this)->route_descr); | |
| 209 | } | ||
| 210 | |||
| 211 | 3 | void WebApi::loadIpwhois(Context& ctx, IpwhoisRequest& request, IpwhoisResponse& response) | |
| 212 | { | ||
| 213 | 3 | result_t result = gate_tech_webapi_ipwhois(ctx.c_instance(), request.c_instance(), response.c_instance()); | |
| 214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | GATEXX_CHECK_EXCEPTION(result); |
| 215 | 3 | } | |
| 216 | |||
| 217 | |||
| 218 | |||
| 219 | // newsfeed request // | ||
| 220 | |||
| 221 | 2 | static gate_result_t GATE_CALL newsfeed_request_init(gate_struct_t* ptr) | |
| 222 | { | ||
| 223 | 2 | gate_tech_webapi_newsfeed_request_init((gate_tech_webapi_newsfeed_request_t*)ptr); | |
| 224 | 2 | return GATE_RESULT_OK; | |
| 225 | } | ||
| 226 | |||
| 227 | 2 | WebApi::NewsfeedRequest::NewsfeedRequest() | |
| 228 | 2 | : struct_instance_t(&newsfeed_request_init) | |
| 229 | { | ||
| 230 | 2 | } | |
| 231 | |||
| 232 | 2 | String WebApi::NewsfeedRequest::RequestUrl() const | |
| 233 | { | ||
| 234 | 2 | return String::duplicate((*this)->request_url); | |
| 235 | } | ||
| 236 | 2 | void WebApi::NewsfeedRequest::RequestUrl(String const& value) | |
| 237 | { | ||
| 238 | 2 | String::assign((*this)->request_url, value); | |
| 239 | 2 | } | |
| 240 | |||
| 241 | |||
| 242 | // newsfeed entry // | ||
| 243 | |||
| 244 | ✗ | static gate_result_t GATE_CALL newsfeed_entry_init(gate_struct_t* ptr) | |
| 245 | { | ||
| 246 | ✗ | gate_tech_webapi_newsentry_init((gate_tech_webapi_newsentry_t*)ptr); | |
| 247 | ✗ | return GATE_RESULT_OK; | |
| 248 | } | ||
| 249 | |||
| 250 | ✗ | WebApi::NewsfeedEntry::NewsfeedEntry() | |
| 251 | ✗ | : struct_instance_t(&newsfeed_entry_init) | |
| 252 | { | ||
| 253 | ✗ | } | |
| 254 | 40 | WebApi::NewsfeedEntry::NewsfeedEntry(gate_tech_webapi_newsentry_t const& src) | |
| 255 | 40 | : struct_instance_t(src) | |
| 256 | { | ||
| 257 | 40 | } | |
| 258 | |||
| 259 | |||
| 260 | 40 | String WebApi::NewsfeedEntry::Uid() const | |
| 261 | { | ||
| 262 | 40 | return String::duplicate((*this)->uid); | |
| 263 | } | ||
| 264 | 40 | String WebApi::NewsfeedEntry::Title() const | |
| 265 | { | ||
| 266 | 40 | return String::duplicate((*this)->title); | |
| 267 | } | ||
| 268 | 40 | String WebApi::NewsfeedEntry::Link() const | |
| 269 | { | ||
| 270 | 40 | return String::duplicate((*this)->link); | |
| 271 | } | ||
| 272 | 40 | Time WebApi::NewsfeedEntry::UpdateTime() const | |
| 273 | { | ||
| 274 | 40 | return Time((*this)->update_time); | |
| 275 | } | ||
| 276 | 40 | String WebApi::NewsfeedEntry::Author() const | |
| 277 | { | ||
| 278 | 40 | return String::duplicate((*this)->author); | |
| 279 | } | ||
| 280 | 40 | String WebApi::NewsfeedEntry::Category() const | |
| 281 | { | ||
| 282 | 40 | return String::duplicate((*this)->category); | |
| 283 | } | ||
| 284 | 40 | String WebApi::NewsfeedEntry::Summary() const | |
| 285 | { | ||
| 286 | 40 | return String::duplicate((*this)->summary); | |
| 287 | } | ||
| 288 | |||
| 289 | 40 | String WebApi::NewsfeedEntry::Content() const | |
| 290 | { | ||
| 291 | 40 | return String::duplicate((*this)->content); | |
| 292 | } | ||
| 293 | |||
| 294 | |||
| 295 | // newsfeed response // | ||
| 296 | |||
| 297 | 2 | static gate_result_t GATE_CALL newsfeed_response_init(gate_struct_t* ptr) | |
| 298 | { | ||
| 299 | 2 | gate_tech_webapi_newsfeed_response_init((gate_tech_webapi_newsfeed_response_t*)ptr); | |
| 300 | 2 | return GATE_RESULT_OK; | |
| 301 | } | ||
| 302 | |||
| 303 | 2 | WebApi::NewsfeedResponse::NewsfeedResponse() | |
| 304 | 2 | : struct_instance_t(&newsfeed_response_init) | |
| 305 | { | ||
| 306 | 2 | } | |
| 307 | |||
| 308 | 2 | String WebApi::NewsfeedResponse::RequestUrl() const | |
| 309 | { | ||
| 310 | 2 | return String::duplicate((*this)->request_url); | |
| 311 | } | ||
| 312 | 2 | String WebApi::NewsfeedResponse::Uid() const | |
| 313 | { | ||
| 314 | 2 | return String::duplicate((*this)->uid); | |
| 315 | } | ||
| 316 | 2 | String WebApi::NewsfeedResponse::Title() const | |
| 317 | { | ||
| 318 | 2 | return String::duplicate((*this)->title); | |
| 319 | } | ||
| 320 | 2 | String WebApi::NewsfeedResponse::Link() const | |
| 321 | { | ||
| 322 | 2 | return String::duplicate((*this)->link); | |
| 323 | } | ||
| 324 | 2 | Time WebApi::NewsfeedResponse::UpdateTime() const | |
| 325 | { | ||
| 326 | 2 | return Time((*this)->update_time); | |
| 327 | } | ||
| 328 | |||
| 329 | 2 | String WebApi::NewsfeedResponse::Description() const | |
| 330 | { | ||
| 331 | 2 | return String::duplicate((*this)->description); | |
| 332 | } | ||
| 333 | 2 | String WebApi::NewsfeedResponse::Language() const | |
| 334 | { | ||
| 335 | 2 | return String::duplicate((*this)->language); | |
| 336 | } | ||
| 337 | 2 | String WebApi::NewsfeedResponse::Publisher() const | |
| 338 | { | ||
| 339 | 2 | return String::duplicate((*this)->publisher); | |
| 340 | } | ||
| 341 | 2 | String WebApi::NewsfeedResponse::Contact() const | |
| 342 | { | ||
| 343 | 2 | return String::duplicate((*this)->contact); | |
| 344 | } | ||
| 345 | 2 | String WebApi::NewsfeedResponse::Image() const | |
| 346 | { | ||
| 347 | 2 | return String::duplicate((*this)->image); | |
| 348 | } | ||
| 349 | |||
| 350 | 2 | Array<WebApi::NewsfeedEntry> WebApi::NewsfeedResponse::Entries() const | |
| 351 | { | ||
| 352 | 2 | gate_enumerator_t enumerator = GATE_INIT_EMPTY; | |
| 353 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | ArrayList<NewsfeedEntry> ret; |
| 354 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
|
2 | if (NULL == gate_arraylist_enumerate((*this)->entries, &enumerator)) |
| 355 | { | ||
| 356 | ✗ | GATEXX_RAISE_ERROR(results::OutOfMemory); | |
| 357 | } | ||
| 358 |
3/4✓ Branch 1 taken 42 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
✓ Branch 4 taken 2 times.
|
42 | while (gate_enumerator_valid(&enumerator)) |
| 359 | { | ||
| 360 | gate_tech_webapi_newsentry_t const* ptr_entry | ||
| 361 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | = (gate_tech_webapi_newsentry_t const*)gate_enumerator_get(&enumerator); |
| 362 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
80 | NewsfeedEntry entry(*ptr_entry); |
| 363 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | ret.add(entry); |
| 364 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | gate_enumerator_next(&enumerator); |
| 365 | } | ||
| 366 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | return ret.toArray(); |
| 367 | } | ||
| 368 | |||
| 369 | 2 | void WebApi::loadNewsfeed(Context& ctx, NewsfeedRequest& request, NewsfeedResponse& response) | |
| 370 | { | ||
| 371 | 2 | result_t result = gate_tech_webapi_newsfeed(ctx.c_instance(), request.c_instance(), response.c_instance()); | |
| 372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | GATEXX_CHECK_EXCEPTION(result); |
| 373 | 2 | } | |
| 374 | |||
| 375 | |||
| 376 | 9 | static gate_result_t GATE_CALL weather_request_init(gate_struct_t* ptr) | |
| 377 | { | ||
| 378 | 9 | gate_tech_webapi_weather_request_init((gate_tech_webapi_weather_request_t*)ptr); | |
| 379 | 9 | return GATE_RESULT_OK; | |
| 380 | } | ||
| 381 | |||
| 382 | 9 | WebApi::WeatherRequest::WeatherRequest() | |
| 383 | 9 | : struct_instance_t(&weather_request_init) | |
| 384 | { | ||
| 385 | 9 | } | |
| 386 | |||
| 387 | 9 | void WebApi::WeatherRequest::Provider(String const& value) | |
| 388 | { | ||
| 389 | 9 | String::assign(this->instance.provider, value); | |
| 390 | 9 | } | |
| 391 | 9 | String WebApi::WeatherRequest::Provider() const | |
| 392 | { | ||
| 393 | 9 | return String((*this)->provider); | |
| 394 | } | ||
| 395 | |||
| 396 | 9 | void WebApi::WeatherRequest::Latitude(real32_t value) | |
| 397 | { | ||
| 398 | 9 | this->instance.latitude = value; | |
| 399 | 9 | } | |
| 400 | 9 | real32_t WebApi::WeatherRequest::Latitude() const | |
| 401 | { | ||
| 402 | 9 | return (*this)->latitude; | |
| 403 | } | ||
| 404 | |||
| 405 | |||
| 406 | 9 | void WebApi::WeatherRequest::Longitude(real32_t value) | |
| 407 | { | ||
| 408 | 9 | this->instance.longitude = value; | |
| 409 | 9 | } | |
| 410 | 9 | real32_t WebApi::WeatherRequest::Longitude() const | |
| 411 | { | ||
| 412 | 9 | return (*this)->longitude; | |
| 413 | } | ||
| 414 | |||
| 415 | 9 | void WebApi::WeatherRequest::Location(String const& value) | |
| 416 | { | ||
| 417 | 9 | String::assign(this->instance.location, value); | |
| 418 | 9 | } | |
| 419 | 9 | String WebApi::WeatherRequest::Location() const | |
| 420 | { | ||
| 421 | 9 | return String((*this)->location); | |
| 422 | } | ||
| 423 | |||
| 424 | 9 | void WebApi::WeatherRequest::RecordTime(Time const& value) | |
| 425 | { | ||
| 426 | 9 | this->instance.record_time = value; | |
| 427 | 9 | } | |
| 428 | 9 | Time WebApi::WeatherRequest::RecordTime() const | |
| 429 | { | ||
| 430 | 9 | return Time((*this)->record_time); | |
| 431 | } | ||
| 432 | |||
| 433 | |||
| 434 | |||
| 435 | 9 | static gate_result_t GATE_CALL weather_response_init(gate_struct_t* ptr) | |
| 436 | { | ||
| 437 | 9 | gate_tech_webapi_weather_response_init((gate_tech_webapi_weather_response_t*)ptr); | |
| 438 | 9 | return GATE_RESULT_OK; | |
| 439 | } | ||
| 440 | |||
| 441 | 9 | WebApi::WeatherResponse::WeatherResponse() | |
| 442 | 9 | : struct_instance_t(&weather_response_init) | |
| 443 | { | ||
| 444 | 9 | } | |
| 445 | 9 | real32_t WebApi::WeatherResponse::Latitude() const | |
| 446 | { | ||
| 447 | 9 | return (*this)->latitude; | |
| 448 | } | ||
| 449 | 9 | real32_t WebApi::WeatherResponse::Longitude() const | |
| 450 | { | ||
| 451 | 9 | return (*this)->longitude; | |
| 452 | } | ||
| 453 | 9 | String WebApi::WeatherResponse::Location() const | |
| 454 | { | ||
| 455 | 9 | return String((*this)->location); | |
| 456 | } | ||
| 457 | 9 | Array<WebApi::WeatherRecord> WebApi::WeatherResponse::Records() const | |
| 458 | { | ||
| 459 |
1/2✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
|
18 | ArrayList<WeatherRecord> tmp; |
| 460 |
2/4✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | tmp.importFrom<WeatherRecord>((*this)->records); |
| 461 |
1/2✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
|
18 | return tmp.toArray(); |
| 462 | } | ||
| 463 | |||
| 464 | |||
| 465 | 9 | void WebApi::loadWeatherRecord(Context& ctx, WeatherRequest& request, WeatherResponse& response) | |
| 466 | { | ||
| 467 | 9 | result_t result = gate_tech_webapi_weather(ctx.c_instance(), request.c_instance(), response.c_instance()); | |
| 468 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | GATEXX_CHECK_EXCEPTION(result); |
| 469 | 9 | } | |
| 470 | |||
| 471 | |||
| 472 | |||
| 473 | 1 | static gate_result_t GATE_CALL geomaps_request_init(gate_struct_t* ptr) | |
| 474 | { | ||
| 475 | 1 | gate_tech_webapi_geomaps_request_init((gate_tech_webapi_geomaps_request_t*)ptr); | |
| 476 | 1 | return GATE_RESULT_OK; | |
| 477 | } | ||
| 478 | |||
| 479 | 1 | WebApi::GeomapRequest::GeomapRequest() | |
| 480 | 1 | : struct_instance_t(&geomaps_request_init) | |
| 481 | { | ||
| 482 | 1 | } | |
| 483 | |||
| 484 | ✗ | void WebApi::GeomapRequest::Provider(String const& value) | |
| 485 | { | ||
| 486 | ✗ | String::assign(this->instance.provider, value); | |
| 487 | ✗ | } | |
| 488 | ✗ | String WebApi::GeomapRequest::Provider() const | |
| 489 | { | ||
| 490 | ✗ | return String(this->instance.provider); | |
| 491 | } | ||
| 492 | |||
| 493 | 1 | void WebApi::GeomapRequest::ImageWidth(uint32_t const& value) | |
| 494 | { | ||
| 495 | 1 | this->instance.image_width = value; | |
| 496 | 1 | } | |
| 497 | 1 | uint32_t WebApi::GeomapRequest::ImageWidth() const | |
| 498 | { | ||
| 499 | 1 | return this->instance.image_width; | |
| 500 | } | ||
| 501 | |||
| 502 | 1 | void WebApi::GeomapRequest::ImageHeight(uint32_t const& value) | |
| 503 | { | ||
| 504 | 1 | this->instance.image_height = value; | |
| 505 | 1 | } | |
| 506 | 1 | uint32_t WebApi::GeomapRequest::ImageHeight() const | |
| 507 | { | ||
| 508 | 1 | return this->instance.image_height; | |
| 509 | } | ||
| 510 | |||
| 511 | 1 | void WebApi::GeomapRequest::CenterLatitude(real32_t value) | |
| 512 | { | ||
| 513 | 1 | this->instance.center_latitude = value; | |
| 514 | 1 | } | |
| 515 | 1 | real32_t WebApi::GeomapRequest::CenterLatitude() const | |
| 516 | { | ||
| 517 | 1 | return this->instance.center_latitude; | |
| 518 | } | ||
| 519 | |||
| 520 | 1 | void WebApi::GeomapRequest::CenterLongitude(real32_t value) | |
| 521 | { | ||
| 522 | 1 | this->instance.center_longitude = value; | |
| 523 | 1 | } | |
| 524 | 1 | real32_t WebApi::GeomapRequest::CenterLongitude() const | |
| 525 | { | ||
| 526 | 1 | return this->instance.center_longitude; | |
| 527 | } | ||
| 528 | |||
| 529 | 1 | void WebApi::GeomapRequest::RadiusMeters(real32_t value) | |
| 530 | { | ||
| 531 | 1 | this->instance.radius_meters = value; | |
| 532 | 1 | } | |
| 533 | 1 | real64_t WebApi::GeomapRequest::RadiusMeters() const | |
| 534 | { | ||
| 535 | 1 | return this->instance.radius_meters; | |
| 536 | } | ||
| 537 | |||
| 538 | 3 | void WebApi::GeomapRequest::ImageType(ImageTypeEnum value) | |
| 539 | { | ||
| 540 | 3 | this->instance.image_type = (gate_int16_t)value; | |
| 541 | 3 | } | |
| 542 | 1 | WebApi::ImageTypeEnum WebApi::GeomapRequest::ImageType() const | |
| 543 | { | ||
| 544 | 1 | return (ImageTypeEnum)this->instance.image_type; | |
| 545 | } | ||
| 546 | |||
| 547 | |||
| 548 | |||
| 549 | |||
| 550 | 3 | static gate_result_t GATE_CALL geomaps_response_init(gate_struct_t* ptr) | |
| 551 | { | ||
| 552 | 3 | gate_tech_webapi_geomaps_response_init((gate_tech_webapi_geomaps_response_t*)ptr); | |
| 553 | 3 | return GATE_RESULT_OK; | |
| 554 | } | ||
| 555 | |||
| 556 | 3 | WebApi::GeomapResponse::GeomapResponse() | |
| 557 | 3 | : struct_instance_t(&geomaps_response_init) | |
| 558 | { | ||
| 559 | 3 | } | |
| 560 | |||
| 561 | 3 | void WebApi::GeomapResponse::ImageWidth(uint32_t const& value) | |
| 562 | { | ||
| 563 | 3 | this->instance.image_width = value; | |
| 564 | 3 | } | |
| 565 | 3 | uint32_t WebApi::GeomapResponse::ImageWidth() const | |
| 566 | { | ||
| 567 | 3 | return this->instance.image_width; | |
| 568 | } | ||
| 569 | |||
| 570 | 3 | void WebApi::GeomapResponse::ImageHeight(uint32_t const& value) | |
| 571 | { | ||
| 572 | 3 | this->instance.image_height = value; | |
| 573 | 3 | } | |
| 574 | 3 | uint32_t WebApi::GeomapResponse::ImageHeight() const | |
| 575 | { | ||
| 576 | 3 | return this->instance.image_height; | |
| 577 | } | ||
| 578 | |||
| 579 | 3 | void WebApi::GeomapResponse::CenterLatitude(real32_t value) | |
| 580 | { | ||
| 581 | 3 | this->instance.center_latitude = value; | |
| 582 | 3 | } | |
| 583 | 3 | real32_t WebApi::GeomapResponse::CenterLatitude() const | |
| 584 | { | ||
| 585 | 3 | return this->instance.center_latitude; | |
| 586 | } | ||
| 587 | |||
| 588 | 3 | void WebApi::GeomapResponse::CenterLongitude(real32_t value) | |
| 589 | { | ||
| 590 | 3 | this->instance.center_longitude = value; | |
| 591 | 3 | } | |
| 592 | 3 | real32_t WebApi::GeomapResponse::CenterLongitude() const | |
| 593 | { | ||
| 594 | 3 | return this->instance.center_longitude; | |
| 595 | } | ||
| 596 | |||
| 597 | 12 | void WebApi::GeomapResponse::MinLatitude(real32_t value) | |
| 598 | { | ||
| 599 | 12 | this->instance.min_latitude = value; | |
| 600 | 12 | } | |
| 601 | 12 | real32_t WebApi::GeomapResponse::MinLatitude() const | |
| 602 | { | ||
| 603 | 12 | return this->instance.min_latitude; | |
| 604 | } | ||
| 605 | 3 | void WebApi::GeomapResponse::MinLongitude(real32_t value) | |
| 606 | { | ||
| 607 | 3 | this->instance.min_longitude = value; | |
| 608 | 3 | } | |
| 609 | 3 | real32_t WebApi::GeomapResponse::MinLongitude() const | |
| 610 | { | ||
| 611 | 3 | return this->instance.min_longitude; | |
| 612 | } | ||
| 613 | |||
| 614 | 3 | void WebApi::GeomapResponse::MaxLatitude(real32_t value) | |
| 615 | { | ||
| 616 | 3 | this->instance.max_latitude = value; | |
| 617 | 3 | } | |
| 618 | 3 | real32_t WebApi::GeomapResponse::MaxLatitude() const | |
| 619 | { | ||
| 620 | 3 | return this->instance.max_latitude; | |
| 621 | } | ||
| 622 | 3 | void WebApi::GeomapResponse::MaxLongitude(real32_t value) | |
| 623 | { | ||
| 624 | 3 | this->instance.max_longitude = value; | |
| 625 | 3 | } | |
| 626 | 3 | real32_t WebApi::GeomapResponse::MaxLongitude() const | |
| 627 | { | ||
| 628 | 3 | return this->instance.max_longitude; | |
| 629 | } | ||
| 630 | |||
| 631 | 3 | void WebApi::GeomapResponse::ImageType(ImageTypeEnum value) | |
| 632 | { | ||
| 633 | 3 | this->instance.image_type = (gate_int16_t)value; | |
| 634 | 3 | } | |
| 635 | 3 | WebApi::ImageTypeEnum WebApi::GeomapResponse::ImageType() const | |
| 636 | { | ||
| 637 | 3 | return (ImageTypeEnum)this->instance.image_type; | |
| 638 | } | ||
| 639 | |||
| 640 | 3 | void WebApi::GeomapResponse::ImageFormat(ImageFormatEnum value) | |
| 641 | { | ||
| 642 | 3 | this->instance.image_format = (gate_int16_t)value; | |
| 643 | 3 | } | |
| 644 | 3 | WebApi::ImageFormatEnum WebApi::GeomapResponse::ImageFormat() const | |
| 645 | { | ||
| 646 | 3 | return (WebApi::ImageFormatEnum)this->instance.image_format; | |
| 647 | } | ||
| 648 | |||
| 649 | ✗ | void WebApi::GeomapResponse::ImageData(Blob const& value) | |
| 650 | { | ||
| 651 | ✗ | Blob::assign(this->instance.image_data, value); | |
| 652 | ✗ | } | |
| 653 | 3 | Blob WebApi::GeomapResponse::ImageData() const | |
| 654 | { | ||
| 655 | 3 | return Blob(this->instance.image_data); | |
| 656 | } | ||
| 657 | |||
| 658 | 3 | void WebApi::loadGeoMap(Context& ctx, GeomapRequest& request, GeomapResponse& response) | |
| 659 | { | ||
| 660 | 3 | result_t result = gate_tech_webapi_geomaps(ctx.c_instance(), request.c_instance(), response.c_instance()); | |
| 661 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | GATEXX_CHECK_EXCEPTION(result); |
| 662 | 3 | } | |
| 663 | |||
| 664 | |||
| 665 | |||
| 666 | } // end of namespace tech | ||
| 667 | } // end of namespace gate | ||
| 668 |