SwService

## SwService SwService |

## Synopsis

    enum                SwServiceError;
    #define             SW_SERVICE_ERROR
    GQuark              sw_service_error_quark              (void);
                        SwService;
    struct              SwServiceClass;
    #define             IS_CONFIGURED
    #define             CAN_VERIFY_CREDENTIALS
    #define             CREDENTIALS_VALID
    #define             CREDENTIALS_INVALID
    #define             CAN_UPDATE_STATUS
    #define             CAN_REQUEST_AVATAR
    #define             CAN_GEOTAG
    #define             CAN_UPDATE_STATUS_WITH_GEOTAG
    #define             HAS_AVATAR_IFACE
    #define             HAS_BANISHABLE_IFACE
    #define             HAS_PHOTO_UPLOAD_IFACE
    #define             HAS_QUERY_IFACE
    #define             HAS_UPDATE_STATUS_IFACE
    const char *        sw_service_get_name                 (SwService *service);
    void                sw_service_emit_capabilities_changed
                                                            (SwService *service,
                                                             const char **caps);
    void                sw_service_emit_user_changed        (SwService *service);
    gboolean            sw_service_is_uid_banned            (SwService *service,
                                                             const gchar *uid);
    gboolean            sw_service_has_cap                  (const char **caps,
                                                             const char *cap);
    void                (*SwServiceSetParamFunc)            (gpointer object,
                                                             const gchar *param_name,
                                                             const gchar *param_value);
    void                sw_service_map_params               (const ParameterNameMapping *mapping,
                                                             GHashTable *parameters,
                                                             SwServiceSetParamFunc set_param_func,
                                                             gpointer remote_call_object);

## Object Hierarchy

      GEnum
       +----SwServiceError

      GObject
       +----SwService

## Implemented Interfaces

SwService implements SwServiceIface and SwBanishableIface.

## Description

## Details

### enum SwServiceError

    typedef enum {
      SW_SERVICE_ERROR_NO_KEYS, /*< nick=NoKeys >*/
      SW_SERVICE_ERROR_INVALID_QUERY, /*< nick=InvalidQuery >*/
      SW_SERVICE_ERROR_NOT_SUPPORTED, /*< nick=NotSupported >*/
      SW_SERVICE_ERROR_REMOTE_ERROR, /*< nick=RemoteError >*/
      SW_SERVICE_ERROR_INCOMPLETE_KEY_FILE /*< nick=IncompleteKeyFile >*/
    } SwServiceError;

### SW_SERVICE_ERROR

    #define SW_SERVICE_ERROR sw_service_error_quark ()

### sw_service_error_quark ()

    GQuark              sw_service_error_quark              (void);

### SwService

    typedef struct _SwService SwService;

### struct SwServiceClass

    struct SwServiceClass {
      GObjectClass parent_class;
      /* vfuncs */
      const char *(*get_name) (SwService *service);
      const gchar ** (*get_static_caps) (SwService *service);
      const gchar ** (*get_dynamic_caps) (SwService *service);
      void (*credentials_updated) (SwService *service);
    };

### IS_CONFIGURED

    #define IS_CONFIGURED "is-configured"

### CAN_VERIFY_CREDENTIALS

    #define CAN_VERIFY_CREDENTIALS "can-verify-credentials"

### CREDENTIALS_VALID

    #define CREDENTIALS_VALID "credentials-valid"

### CREDENTIALS_INVALID

    #define CREDENTIALS_INVALID "credentials-invalid"

### CAN_UPDATE_STATUS

    #define CAN_UPDATE_STATUS "can-update-status"

### CAN_REQUEST_AVATAR

    #define CAN_REQUEST_AVATAR "can-request-avatar"

### CAN_GEOTAG

    #define CAN_GEOTAG "can-geotag"

### CAN_UPDATE_STATUS_WITH_GEOTAG

    #define CAN_UPDATE_STATUS_WITH_GEOTAG "can-update-status-with-geotag"

### HAS_AVATAR_IFACE

    #define HAS_AVATAR_IFACE "has-avatar-iface"

### HAS_BANISHABLE_IFACE

    #define HAS_BANISHABLE_IFACE "has-banishable-iface"

### HAS_PHOTO_UPLOAD_IFACE

    #define HAS_PHOTO_UPLOAD_IFACE "has-photo-upload-iface"

### HAS_QUERY_IFACE

    #define HAS_QUERY_IFACE "has-query-iface"

### HAS_UPDATE_STATUS_IFACE

    #define HAS_UPDATE_STATUS_IFACE "has-update-status-iface"

### sw_service_get_name ()

    const char *        sw_service_get_name                 (SwService *service);

### sw_service_emit_capabilities_changed ()

    void                sw_service_emit_capabilities_changed
                                                            (SwService *service,
                                                             const char **caps);

### sw_service_emit_user_changed ()

    void                sw_service_emit_user_changed        (SwService *service);

### sw_service_is_uid_banned ()

    gboolean            sw_service_is_uid_banned            (SwService *service,
                                                             const gchar *uid);

### sw_service_has_cap ()

    gboolean            sw_service_has_cap                  (const char **caps,
                                                             const char *cap);

### SwServiceSetParamFunc ()

    void                (*SwServiceSetParamFunc)            (gpointer object,
                                                             const gchar *param_name,
                                                             const gchar *param_value);

This type signature reflects a function that sets a name/value association on a given object. Functions such as g_hash_table_insert and rest_proxy_call_add_param are good examples.

`object` : | A remote call or hash object that can store key/value pairs.
`param_name` : | The parameter name.
`param_value` : | The parameter value.

### sw_service_map_params ()

    void                sw_service_map_params               (const ParameterNameMapping *mapping,
                                                             GHashTable *parameters,
                                                             SwServiceSetParamFunc set_param_func,
                                                             gpointer remote_call_object);

Re-map a group of parameters with alternative parameter names. Used for converting lsw parameter names to service-specific ones.

`mapping` : | An array of ParameterNameMapping pairs.
`parameters` : | The GHashtable of given parameters.
`set_param_func` : | A SwServiceSetParamFunc that sets a name/value association on the given object.
`remote_call_object` : | The remote call or hash table object that `set_param_func` takes as a first parameter.