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