GATE
webapis.h File Reference

Web-based service API implementations. More...

#include "gate/tech/gate_tech_api.h"
#include "gate/structs.h"
#include "gate/times.h"
#include "gate/arrays.h"
#include "gate/uris.h"
#include "gate/maps.h"
#include "gate/streams.h"
#include "gate/blobs.h"

Classes

struct  gate_tech_webapi_context_class
 
struct  gate_tech_webapi_ipwhois_request_class
 
struct  gate_tech_webapi_ipwhois_response_class
 
struct  gate_tech_webapi_newsfeed_request_class
 
struct  gate_tech_webapi_newsentry_class
 
struct  gate_tech_webapi_newsfeed_response_class
 
struct  gate_tech_webapi_weather_record_class
 
struct  gate_tech_webapi_weather_request_class
 
struct  gate_tech_webapi_weather_response_class
 
struct  gate_tech_webapi_geomaps_request_class
 
struct  gate_tech_webapi_geomaps_response_class
 

Macros

#define GATE_STRUCT_WEBAPIS_ROOT_NAME   "webapis"
 
#define GATE_STRUCT_WEBAPIS_NAME(struct_name)   (GATE_STRUCT_ROOT_NAME GATE_STRUCT_SEPARATOR GATE_STRUCT_WEBAPIS_ROOT_NAME GATE_STRUCT_SEPARATOR struct_name)
 
#define GATE_WEBAPIS_CONTEXT_NAME   GATE_STRUCT_WEBAPIS_NAME("context")
 
#define GATE_TECH_WEATHER_RECORD_TEMPERATURE_C   0x0010
 
#define GATE_TECH_WEATHER_RECORD_HUMIDITY_P   0x0020
 
#define GATE_TECH_WEATHER_RECORD_RAIN_MM   0x0040
 
#define GATE_TECH_WEATHER_RECORD_WIND_KMH   0x0080
 
#define GATE_TECH_WEATHER_RECORD_STATE   0x0100
 
#define GATE_TECH_WEATHER_STATE_CLEAR_SKY   0x0010
 
#define GATE_TECH_WEATHER_STATE_CLOUDY   0x0020
 
#define GATE_TECH_WEATHER_STATE_FOG   0x0040
 
#define GATE_TECH_WEATHER_STATE_DRIZZLE   0x0100
 
#define GATE_TECH_WEATHER_STATE_RAIN   0x0200
 
#define GATE_TECH_WEATHER_STATE_SNOW   0x0400
 
#define GATE_TECH_WEATHER_STATE_SNOWGRAINS   0x0800
 
#define GATE_TECH_WEATHER_STATE_RAINSHOWER   0x1000
 
#define GATE_TECH_WEATHER_STATE_SNOWSHOWER   0x2000
 
#define GATE_TECH_WEATHER_STATE_THUNDERSTORM   0x4000
 
#define GATE_TECH_WEATHER_STATE_INTENSITY_LOW   0x01
 
#define GATE_TECH_WEATHER_STATE_INTENSITY_MEDIUM   0x02
 
#define GATE_TECH_WEATHER_STATE_INTENSITY_HIGH   0x04
 
#define GATE_TECH_WEATHER_STATE_INTENSITY_FREEZING   0x08
 
#define GATE_TECH_GEOMAPS_TYPE_ROADMAP   1
 
#define GATE_TECH_GEOMAPS_TYPE_SATELLITEMAP   2
 
#define GATE_TECH_GEOMAPS_IMAGE_PNG   1
 
#define GATE_TECH_GEOMAPS_IMAGE_JPEG   2
 

Typedefs

typedef struct gate_tech_webapi_context_class gate_tech_webapi_context_t
 
typedef struct gate_tech_webapi_ipwhois_request_class gate_tech_webapi_ipwhois_request_t
 
typedef struct gate_tech_webapi_ipwhois_response_class gate_tech_webapi_ipwhois_response_t
 
typedef struct gate_tech_webapi_newsfeed_request_class gate_tech_webapi_newsfeed_request_t
 
typedef struct gate_tech_webapi_newsentry_class gate_tech_webapi_newsentry_t
 
typedef struct gate_tech_webapi_newsfeed_response_class gate_tech_webapi_newsfeed_response_t
 
typedef struct gate_tech_webapi_weather_record_class gate_tech_webapi_weather_record_t
 
typedef struct gate_tech_webapi_weather_request_class gate_tech_webapi_weather_request_t
 
typedef struct gate_tech_webapi_weather_response_class gate_tech_webapi_weather_response_t
 
typedef struct gate_tech_webapi_geomaps_request_class gate_tech_webapi_geomaps_request_t
 
typedef struct gate_tech_webapi_geomaps_response_class gate_tech_webapi_geomaps_response_t
 

Functions

GATE_TECH_API void gate_tech_webapi_context_init (gate_tech_webapi_context_t *context)
 Initializes a web context object with empty members.
 
GATE_TECH_API gate_result_t gate_tech_webapi_get (gate_tech_webapi_context_t *context, gate_uri_t const *url, gate_map_t const *additional_request_headers, gate_uint32_t *response_status, gate_stream_t *response_content, gate_map_t *response_headers)
 Executes a web request and returns response data.
 
GATE_TECH_API void gate_tech_webapi_ipwhois_request_init (gate_tech_webapi_ipwhois_request_t *request)
 Initializes an ip-whois request structure object.
 
GATE_TECH_API void gate_tech_webapi_ipwhois_response_init (gate_tech_webapi_ipwhois_response_t *response)
 Initializes an ip-whois response structure object.
 
GATE_TECH_API gate_result_t gate_tech_webapi_ipwhois (gate_tech_webapi_context_t *context, gate_tech_webapi_ipwhois_request_t *request, gate_tech_webapi_ipwhois_response_t *response)
 Resolves IP address data and returns owner informations.
 
GATE_TECH_API void gate_tech_webapi_newsentry_init (gate_tech_webapi_newsentry_t *entry)
 Initializes a newsentry structure object.
 
GATE_TECH_API void gate_tech_webapi_newsfeed_request_init (gate_tech_webapi_newsfeed_request_t *request)
 Initializes a newsfeed request structure object.
 
GATE_TECH_API void gate_tech_webapi_newsfeed_response_init (gate_tech_webapi_newsfeed_response_t *response)
 Initializes a newsfeed response structure object.
 
GATE_TECH_API gate_result_t gate_tech_webapi_newsfeed (gate_tech_webapi_context_t *context, gate_tech_webapi_newsfeed_request_t *request, gate_tech_webapi_newsfeed_response_t *response)
 Downloads newsfeed entries from a given feed source.
 
GATE_TECH_API void gate_tech_webapi_weather_request_init (gate_tech_webapi_weather_request_t *request)
 Initializes a weather request structure object.
 
GATE_TECH_API void gate_tech_webapi_weather_response_init (gate_tech_webapi_weather_response_t *response)
 Initializes a weather response structure object.
 
GATE_TECH_API gate_result_t gate_tech_webapi_weather (gate_tech_webapi_context_t *context, gate_tech_webapi_weather_request_t *request, gate_tech_webapi_weather_response_t *response)
 Queries the current weather states of a requested location.
 
GATE_TECH_API void gate_tech_webapi_geomaps_request_init (gate_tech_webapi_geomaps_request_t *request)
 Initializes a geomaps request structure object.
 
GATE_TECH_API void gate_tech_webapi_geomaps_response_init (gate_tech_webapi_geomaps_response_t *response)
 Initializes a geomaps response structure object.
 
GATE_TECH_API gate_result_t gate_tech_webapi_geomaps (gate_tech_webapi_context_t *context, gate_tech_webapi_geomaps_request_t *request, gate_tech_webapi_geomaps_response_t *response)
 Queries a road- or areal-map image of a requested location.
 

Detailed Description

Web-based service API implementations.

Macro Definition Documentation

◆ GATE_TECH_WEATHER_RECORD_HUMIDITY_P

#define GATE_TECH_WEATHER_RECORD_HUMIDITY_P   0x0020

relative humidity in percent

◆ GATE_TECH_WEATHER_RECORD_RAIN_MM

#define GATE_TECH_WEATHER_RECORD_RAIN_MM   0x0040

rain in millimeters

◆ GATE_TECH_WEATHER_RECORD_STATE

#define GATE_TECH_WEATHER_RECORD_STATE   0x0100

weather interpretation state code, combination of GATE_TECH_WEATHER_STATE_* flags

◆ GATE_TECH_WEATHER_RECORD_TEMPERATURE_C

#define GATE_TECH_WEATHER_RECORD_TEMPERATURE_C   0x0010

temperature in degree Celsius

◆ GATE_TECH_WEATHER_RECORD_WIND_KMH

#define GATE_TECH_WEATHER_RECORD_WIND_KMH   0x0080

wind speed in km/h

◆ GATE_TECH_WEATHER_STATE_INTENSITY_FREEZING

#define GATE_TECH_WEATHER_STATE_INTENSITY_FREEZING   0x08

flag-bit indicating a freezing weather state

◆ GATE_TECH_WEATHER_STATE_INTENSITY_HIGH

#define GATE_TECH_WEATHER_STATE_INTENSITY_HIGH   0x04

flag-bit indicating a high intensity of a weather state

◆ GATE_TECH_WEATHER_STATE_INTENSITY_LOW

#define GATE_TECH_WEATHER_STATE_INTENSITY_LOW   0x01

flag-bit indicating a low intensity of a weather state

◆ GATE_TECH_WEATHER_STATE_INTENSITY_MEDIUM

#define GATE_TECH_WEATHER_STATE_INTENSITY_MEDIUM   0x02

flag-bit indicating a moderate intensity of a weather state

Function Documentation

◆ gate_tech_webapi_context_init()

GATE_TECH_API void gate_tech_webapi_context_init ( gate_tech_webapi_context_t * context)

Initializes a web context object with empty members.

Instance can be released by gate_struct_release()

Parameters
[out]contextpointer to structure to be initialized

◆ gate_tech_webapi_geomaps()

GATE_TECH_API gate_result_t gate_tech_webapi_geomaps ( gate_tech_webapi_context_t * context,
gate_tech_webapi_geomaps_request_t * request,
gate_tech_webapi_geomaps_response_t * response )

Queries a road- or areal-map image of a requested location.

Parameters
[in]contextpointer to information context to be used by web connection
[in]requestpointer to geomaps request object
[in,out]responsepointer to initialized geomaps response object, which will be updated
Returns
GATE_RESULT_* result code

◆ gate_tech_webapi_geomaps_request_init()

GATE_TECH_API void gate_tech_webapi_geomaps_request_init ( gate_tech_webapi_geomaps_request_t * request)

Initializes a geomaps request structure object.

Instance can be released by gate_struct_release()

Parameters
[out]requestpointer to structure to be initialized with empty values

◆ gate_tech_webapi_geomaps_response_init()

GATE_TECH_API void gate_tech_webapi_geomaps_response_init ( gate_tech_webapi_geomaps_response_t * response)

Initializes a geomaps response structure object.

Instance can be released by gate_struct_release()

Parameters
[out]responsepointer to structure to be initialized with empty values

◆ gate_tech_webapi_get()

GATE_TECH_API gate_result_t gate_tech_webapi_get ( gate_tech_webapi_context_t * context,
gate_uri_t const * url,
gate_map_t const * additional_request_headers,
gate_uint32_t * response_status,
gate_stream_t * response_content,
gate_map_t * response_headers )

Executes a web request and returns response data.

Parameters
[in]contextpointer to information context to be used by web connection
[in]urlurl to web resource to be queried
[in]additional_request_headersmap (gate_string -> gate_string) with additional HTTP request headers
[out]response_statuspointer to output HTTP status integer to be filled with response code
[in]response_contentpointer to output stream, where web response is written to
[out]response_headersoptional pointer to uninitialized map to be initialized with a (string->string) map with response header entries
Returns
GATE_RESULT_* result code

◆ gate_tech_webapi_ipwhois()

GATE_TECH_API gate_result_t gate_tech_webapi_ipwhois ( gate_tech_webapi_context_t * context,
gate_tech_webapi_ipwhois_request_t * request,
gate_tech_webapi_ipwhois_response_t * response )

Resolves IP address data and returns owner informations.

Parameters
[in]contextpointer to information context to be used by web connection
[in]requestpointer to be filled out ip-whois request object
[in,out]responsepointer to initialized ip-whois response object, which will be updated
Returns
GATE_RESULT_* result code

◆ gate_tech_webapi_ipwhois_request_init()

GATE_TECH_API void gate_tech_webapi_ipwhois_request_init ( gate_tech_webapi_ipwhois_request_t * request)

Initializes an ip-whois request structure object.

Instance can be released by gate_struct_release()

Parameters
[out]responsepointer to structure to be initialized

◆ gate_tech_webapi_ipwhois_response_init()

GATE_TECH_API void gate_tech_webapi_ipwhois_response_init ( gate_tech_webapi_ipwhois_response_t * response)

Initializes an ip-whois response structure object.

Instance can be released by gate_struct_release()

Parameters
[out]responsepointer to structure to be initialized

◆ gate_tech_webapi_newsentry_init()

GATE_TECH_API void gate_tech_webapi_newsentry_init ( gate_tech_webapi_newsentry_t * entry)

Initializes a newsentry structure object.

Instance can be released by gate_struct_release()

Parameters
[out]entrypointer to structure to be initialized with empty values

◆ gate_tech_webapi_newsfeed()

GATE_TECH_API gate_result_t gate_tech_webapi_newsfeed ( gate_tech_webapi_context_t * context,
gate_tech_webapi_newsfeed_request_t * request,
gate_tech_webapi_newsfeed_response_t * response )

Downloads newsfeed entries from a given feed source.

Parameters
[in]contextpointer to information context to be used by web connection
[in]requestpointer to newsfeed request object
[in,out]responsepointer to initialized newsfeed response object, which will be updated
Returns
GATE_RESULT_* result code

◆ gate_tech_webapi_newsfeed_request_init()

GATE_TECH_API void gate_tech_webapi_newsfeed_request_init ( gate_tech_webapi_newsfeed_request_t * request)

Initializes a newsfeed request structure object.

Instance can be released by gate_struct_release()

Parameters
[out]requestpointer to structure to be initialized with empty values

◆ gate_tech_webapi_newsfeed_response_init()

GATE_TECH_API void gate_tech_webapi_newsfeed_response_init ( gate_tech_webapi_newsfeed_response_t * response)

Initializes a newsfeed response structure object.

Instance can be released by gate_struct_release()

Parameters
[out]responsepointer to structure to be initialized with empty values

◆ gate_tech_webapi_weather()

GATE_TECH_API gate_result_t gate_tech_webapi_weather ( gate_tech_webapi_context_t * context,
gate_tech_webapi_weather_request_t * request,
gate_tech_webapi_weather_response_t * response )

Queries the current weather states of a requested location.

Parameters
[in]contextpointer to information context to be used by web connection
[in]requestpointer to weather request object
[in,out]responsepointer to initialized weather response object, which will be updated
Returns
GATE_RESULT_* result code

◆ gate_tech_webapi_weather_request_init()

GATE_TECH_API void gate_tech_webapi_weather_request_init ( gate_tech_webapi_weather_request_t * request)

Initializes a weather request structure object.

Instance can be released by gate_struct_release()

Parameters
[out]requestpointer to structure to be initialized with empty values

◆ gate_tech_webapi_weather_response_init()

GATE_TECH_API void gate_tech_webapi_weather_response_init ( gate_tech_webapi_weather_response_t * response)

Initializes a weather response structure object.

Instance can be released by gate_struct_release()

Parameters
[out]responsepointer to structure to be initialized with empty values