Common API

Common API — Utility API

Synopsis

#define             TWITTER_ERROR
enum                TwitterError;
TwitterError        twitter_error_from_status           (guint status);

gchar *             twitter_http_date_from_time_t       (time_t time_);
gchar *             twitter_http_date_from_delta        (gint seconds);
time_t              twitter_http_date_to_time_t         (const gchar *date);
gint                twitter_http_date_to_delta          (const gchar *date);
gboolean            twitter_date_to_time_val            (const gchar *date,
                                                         GTimeVal *time_);

Description

Various utility API for users of Twitter-GLib.

Details

TWITTER_ERROR

#define TWITTER_ERROR   (twitter_error_quark ())

Twitter-GLib error domain.


enum TwitterError

typedef enum {
  TWITTER_ERROR_HOST_NOT_FOUND,
  TWITTER_ERROR_CANCELLED,
  TWITTER_ERROR_PERMISSION_DENIED,
  TWITTER_ERROR_NOT_FOUND,
  TWITTER_ERROR_TIMED_OUT,
  TWITTER_ERROR_FAILED,
  TWITTER_ERROR_NOT_MODIFIED,
  TWITTER_ERROR_PARSE_ERROR
} TwitterError;

Twitter error enumeration.

TWITTER_ERROR_HOST_NOT_FOUND

Host not found

TWITTER_ERROR_CANCELLED

Cancelled

TWITTER_ERROR_PERMISSION_DENIED

Permission denied

TWITTER_ERROR_NOT_FOUND

Operation not found

TWITTER_ERROR_TIMED_OUT

Operation timed out

TWITTER_ERROR_FAILED

Operation failed

TWITTER_ERROR_NOT_MODIFIED

The result of the operation hasn't been modified since the last query

TWITTER_ERROR_PARSE_ERROR

Unable to parse the JSON data coming from the provider

twitter_error_from_status ()

TwitterError        twitter_error_from_status           (guint status);

Converts an HTTP status code coming from Libsoup into a TwitterError

status :

a Libsoup HTTP status code

Returns :

a TwitterError

twitter_http_date_from_time_t ()

gchar *             twitter_http_date_from_time_t       (time_t time_);

Converts a Unix time into an HTTP date

time_ :

timestamp, expressed in seconds from the epoch

Returns :

a newly allocated string containing the HTTP date. Use g_free() when done

twitter_http_date_from_delta ()

gchar *             twitter_http_date_from_delta        (gint seconds);

Creates an HTTP representation of a timestamp seconds from now

seconds :

seconds from now

Returns :

a newly allocated string containing the HTTP date. Use g_free() when done

twitter_http_date_to_time_t ()

time_t              twitter_http_date_to_time_t         (const gchar *date);

Converts a timestamp in HTTP format into a Unix timestamp

date :

a HTTP date string

Returns :

the Unix timestamp equivalent to the HTTP one

twitter_http_date_to_delta ()

gint                twitter_http_date_to_delta          (const gchar *date);

Converts a timestamp in HTTP into seconds from the current time

date :

a HTTP date string

Returns :

seconds from the current time

twitter_date_to_time_val ()

gboolean            twitter_date_to_time_val            (const gchar *date,
                                                         GTimeVal *time_);

Converts a Twitter date into a GTimeVal. The timestamp is relative to UTC.

date :

a timestamp coming from Twitter

time_ :

return location for a GTimeVal

Returns :

TRUE if the conversion was successful