LassoIdWsf2DataService

## LassoIdWsf2DataService LassoIdWsf2DataService |

## Synopsis

    struct              LassoIdWsf2DataService;
    LassoIdWsf2DataService * lasso_idwsf2_data_service_new  (LassoServer *server);
    lasso_error_t       lasso_idwsf2_data_service_init_create
                                                            (LassoIdWsf2DataService *service);
    lasso_error_t       lasso_idwsf2_data_service_init_delete
                                                            (LassoIdWsf2DataService *service);
    lasso_error_t       lasso_idwsf2_data_service_init_modify
                                                            (LassoIdWsf2DataService *service);
    lasso_error_t       lasso_idwsf2_data_service_init_query
                                                            (LassoIdWsf2DataService *service);
    lasso_error_t       lasso_idwsf2_data_service_add_modify_item
                                                            (LassoIdWsf2DataService *service,
                                                             const gchar *item_query,
                                                             xmlNode *new_data,
                                                             gboolean overrideAllowed,
                                                             const gchar *item_id);
    lasso_error_t       lasso_idwsf2_data_service_add_namespace
                                                            (LassoIdWsf2DataService *data_service,
                                                             const char *prefix,
                                                             const char *href);
    lasso_error_t       lasso_idwsf2_data_service_add_query_item
                                                            (LassoIdWsf2DataService *service,
                                                             const gchar *item_query,
                                                             const gchar *item_id);
    lasso_error_t       lasso_idwsf2_data_service_build_request_msg
                                                            (LassoIdWsf2DataService *service,
                                                             const char *security_mech_id);
    lasso_error_t       lasso_idwsf2_data_service_build_response_msg
                                                            (LassoIdWsf2DataService *service);
    LassoNode *         lasso_idwsf2_data_service_get_item  (LassoIdWsf2DataService *data_service,
                                                             const char *item_id);
    LassoIdWsf2DstRefData * lasso_idwsf2_data_service_get_query_item_result
                                                            (LassoIdWsf2DataService *service,
                                                             const char *item_id);
    GList *             lasso_idwsf2_data_service_get_query_item_results
                                                            (LassoIdWsf2DataService *service);
    LassoIdWsf2DataServiceRequestType lasso_idwsf2_data_service_get_request_type
                                                            (LassoIdWsf2DataService *service);
    const char *        lasso_idwsf2_data_service_get_service_type
                                                            (LassoIdWsf2DataService *service);
    const char *        lasso_idwsf2_data_service_get_service_type_prefix
                                                            (LassoIdWsf2DataService *service);
    lasso_error_t       lasso_idwsf2_data_service_process_request_msg
                                                            (LassoIdWsf2DataService *service,
                                                             const char *msg);
    lasso_error_t       lasso_idwsf2_data_service_process_response_msg
                                                            (LassoIdWsf2DataService *service,
                                                             const char *msg);
    lasso_error_t       lasso_idwsf2_data_service_set_query_item_result
                                                            (LassoIdWsf2DataService *data_service,
                                                             const char *item_id,
                                                             xmlNode *xml_data,
                                                             gboolean add);
    char *              lasso_idwsf2_data_service_get_query_item_result_content
                                                            (LassoIdWsf2DataService *service,
                                                             const char *item_id);
    lasso_error_t       lasso_idwsf2_data_service_set_service_type
                                                            (LassoIdWsf2DataService *service,
                                                             const char *prefix,
                                                             const char *service_type);
    lasso_error_t       lasso_idwsf2_data_service_set_status_code
                                                            (LassoIdWsf2DataService *service,
                                                             const char *status_code,
                                                             const char *status_code2);
    GList *             lasso_idwsf2_data_service_get_item_ids
                                                            (LassoIdWsf2DataService *data_service);
    GList *             lasso_idwsf2_data_service_get_items (LassoIdWsf2DataService *data_service);
    LassoIdWsf2UtilStatus * lasso_idwsf2_data_service_get_response_status
                                                            (LassoIdWsf2DataService *service);
    lasso_error_t       lasso_idwsf2_data_service_validate_request
                                                            (LassoIdWsf2DataService *service);

## Description

## Details

### struct LassoIdWsf2DataService

    struct LassoIdWsf2DataService {
    	LassoIdWsf2Profile parent;
    };

### lasso_idwsf2_data_service_new ()

    LassoIdWsf2DataService * lasso_idwsf2_data_service_new  (LassoServer *server);

Create a new LassoIdWsf2DataService.

`server:(allow-none)` : | a LassoServer object, for resolving ProviderIDs
Returns : | a newly created LassoIdWsf2DataService object

### lasso_idwsf2_data_service_init_create ()

    lasso_error_t       lasso_idwsf2_data_service_init_create
                                                            (LassoIdWsf2DataService *service);

### lasso_idwsf2_data_service_init_delete ()

    lasso_error_t       lasso_idwsf2_data_service_init_delete
                                                            (LassoIdWsf2DataService *service);

### lasso_idwsf2_data_service_init_modify ()

    lasso_error_t       lasso_idwsf2_data_service_init_modify
                                                            (LassoIdWsf2DataService *service);

Initialise an ID-WSF 2.0 DataService modify request.

`service` : | a LassoIdWsf2DataService
Returns : | 0 on success; or a negative value otherwise.

### lasso_idwsf2_data_service_init_query ()

    lasso_error_t       lasso_idwsf2_data_service_init_query
                                                            (LassoIdWsf2DataService *service);

Initialise an ID-WSF 2.0 DataService query request.

`service` : | a LassoIdWsf2DataService
Returns : | 0 on success; or a negative value otherwise.

### lasso_idwsf2_data_service_add_modify_item ()

    lasso_error_t       lasso_idwsf2_data_service_add_modify_item
                                                            (LassoIdWsf2DataService *service,
                                                             const gchar *item_query,
                                                             xmlNode *new_data,
                                                             gboolean overrideAllowed,
                                                             const gchar *item_id);

Add an item in the modification request.

`service` : | a LassoIdWsf2DataService
`item_query` : | XPATH of the item to modify
`new_data:(allow-none)` : | new value for the selected item
`overrideAllowed` : | FALSE means only allowing to create a new item, but not modify existing one, TRUE means allowing to modify existing item. [allow-none][default FALSE]
`item_id:(allow-none)` : | identifier of the item to modify
Returns : | 0 on success; or a negative value otherwise.

### lasso_idwsf2_data_service_add_namespace ()

    lasso_error_t       lasso_idwsf2_data_service_add_namespace
                                                            (LassoIdWsf2DataService *data_service,
                                                             const char *prefix,
                                                             const char *href);

Add a new namespace to use for example in XPath elements or in Data or NewData objects.

`service` : | a LassoIdWsf2DataService object
Returns : | 0 if successful, an error code otherwise.

### lasso_idwsf2_data_service_add_query_item ()

    lasso_error_t       lasso_idwsf2_data_service_add_query_item
                                                            (LassoIdWsf2DataService *service,
                                                             const gchar *item_query,
                                                             const gchar *item_id);

Add an item in the query request.

`service` : | a LassoIdWsf2DataService
`item_query` : | a query string
`item_id:(allow-none)` : | identifier of the queried item, which will allow to retrieve it in the response
Returns : | 0 on success; or a negative value otherwise.

### lasso_idwsf2_data_service_build_request_msg ()

    lasso_error_t       lasso_idwsf2_data_service_build_request_msg
                                                            (LassoIdWsf2DataService *service,
                                                             const char *security_mech_id);

Build the request message.

`service` : | a LassoIdWsf2DataService object
`security_mech_id:(allow-none)` : | the security mechanism to employ, default is Bearer mechanism.
Returns : | 0 if successful, an error code otherwise.

### lasso_idwsf2_data_service_build_response_msg ()

    lasso_error_t       lasso_idwsf2_data_service_build_response_msg
                                                            (LassoIdWsf2DataService *service);

Build the response message corresponding to the current request.

`service` : | a LassoIdWsf2DataService object
Returns : | 0 if successfull, an error code otherwise.

### lasso_idwsf2_data_service_get_item ()

    LassoNode *         lasso_idwsf2_data_service_get_item  (LassoIdWsf2DataService *data_service,
                                                             const char *item_id);

Retrieve a specific item from a request.

`service` : | a LassoIdWsf2DataService object
`item_id` : | the itemID of the item to return, if NULL try to get the only one item (if there is more than one, it returns NULL).
Returns : | a LassoIdWsf2DstRefQueryItem or a LassoIdWsf2DstRefModifyItem object, or NULL if no item for the given item_id exists. [transfer none][allow-none]

### lasso_idwsf2_data_service_get_query_item_result ()

    LassoIdWsf2DstRefData * lasso_idwsf2_data_service_get_query_item_result
                                                            (LassoIdWsf2DataService *service,
                                                             const char *item_id);

`service` : | a LassoIdWsf2DataService object
`item_id:(allow-none)` : | an item_id or NULL if only one data is present
Returns : | a LassoIdWsf2DstRefData or NULL if none is found. [allow-none][transfer none]

### lasso_idwsf2_data_service_get_query_item_results ()

    GList *             lasso_idwsf2_data_service_get_query_item_results
                                                            (LassoIdWsf2DataService *service);

`service` : | a LassoIdWsf2DataService object
Returns : | the list of LassoIdWsf2DstRefData or NULL if none is found. [allow-none][transfer none][element-type LassoIdWsf2DstRefData]

### lasso_idwsf2_data_service_get_request_type ()

    LassoIdWsf2DataServiceRequestType lasso_idwsf2_data_service_get_request_type
                                                            (LassoIdWsf2DataService *service);

Return the type of the currently handled request.

`service` : | a LassoIdWsf2DataService object

### lasso_idwsf2_data_service_get_service_type ()

    const char *        lasso_idwsf2_data_service_get_service_type
                                                            (LassoIdWsf2DataService *service);

Return the service type of the received request

`service` : | a LassoIdWsf2DataService object
Returns : | the URI of the service type or NULL. [allow-none][transfer none]

### lasso_idwsf2_data_service_get_service_type_prefix ()

    const char *        lasso_idwsf2_data_service_get_service_type_prefix
                                                            (LassoIdWsf2DataService *service);

Return the service type prefix of the received request

`service` : | a LassoIdWsf2DataService object
Returns : | the URI of the service type prefix or NULL. [allow-none][transfer none]

### lasso_idwsf2_data_service_process_request_msg ()

    lasso_error_t       lasso_idwsf2_data_service_process_request_msg
                                                            (LassoIdWsf2DataService *service,
                                                             const char *msg);

Process a newly received requests.

`service` : | a LassoIdWsf2DataService object
`msg` : | the message string

### lasso_idwsf2_data_service_process_response_msg ()

    lasso_error_t       lasso_idwsf2_data_service_process_response_msg
                                                            (LassoIdWsf2DataService *service,
                                                             const char *msg);

Process a received SOAP message response.

`service` : | a LassoIdWsf2DataService object
`msg` : | the message content. [allow-none]
Returns : | 0 if successful, an error code otherwise.

### lasso_idwsf2_data_service_set_query_item_result ()

    lasso_error_t       lasso_idwsf2_data_service_set_query_item_result
                                                            (LassoIdWsf2DataService *data_service,
                                                             const char *item_id,
                                                             xmlNode *xml_data,
                                                             gboolean add);

Set result data for a certain query-item.

`service` : | a LassoIdWsf2DataService object
`item_id:(allow-none)` : | target a certain QueryItem if NULL, means there is only one query item
`xml_data:(allow-none)` : | the data to add
`add` : | add data to existing datas. [allow-none][default FALSE]

### lasso_idwsf2_data_service_get_query_item_result_content ()

    char *              lasso_idwsf2_data_service_get_query_item_result_content
                                                            (LassoIdWsf2DataService *service,
                                                             const char *item_id);

Returns the text content of the query item result identified by `item_id` or the only query item result if `item_id` is NULL.

If `item_id` is NULL and there is multiple results, returns NULL.

`service` : | a LassoIdWsf2DataService object
`item_id:(allow-none)` : | the identifier of the result asked, if NULL and there is only one respone, returns it.
Returns : | the text content of the query item result. [transfer full]

### lasso_idwsf2_data_service_set_service_type ()

    lasso_error_t       lasso_idwsf2_data_service_set_service_type
                                                            (LassoIdWsf2DataService *service,
                                                             const char *prefix,
                                                             const char *service_type);

Fix a service type for this `service`.

`service` : | a LassoIdWsf2DataService object
`prefix` : | a prefix to use in producing XML documents
`service_type` : | the service type URI

### lasso_idwsf2_data_service_set_status_code ()

    lasso_error_t       lasso_idwsf2_data_service_set_status_code
                                                            (LassoIdWsf2DataService *service,
                                                             const char *status_code,
                                                             const char *status_code2);

Set the status code for the current response, if no response exists, it starts one using `lasso_idwsf2_data_service_validate_request()`, if it fails, report a SOAP Fault.

`service` : | a LassoIdWsf2DataService
`status_code` : | a first level status code
`status_code2` : | a second level status code

### lasso_idwsf2_data_service_get_item_ids ()

    GList *             lasso_idwsf2_data_service_get_item_ids
                                                            (LassoIdWsf2DataService *data_service);

Return the list of items ids for the currently handled request.

`service` : | a LassoIdWsf2DataService object
Returns : | a list of string ids, or NULL if none is found. The caller must free the return value. [element-type utf8][transfer full]

### lasso_idwsf2_data_service_get_items ()

    GList *             lasso_idwsf2_data_service_get_items (LassoIdWsf2DataService *data_service);

`service` : | a LassoIdWsf2DataService object
Returns : | a list of Query or Modify items, or NULL if none is found. [element-type LassoNode][transfer none]

### lasso_idwsf2_data_service_get_response_status ()

    LassoIdWsf2UtilStatus * lasso_idwsf2_data_service_get_response_status
                                                            (LassoIdWsf2DataService *service);

Return the status from the current response.

`service` : | a LassoIdWsf2UtilStatus object
Returns : | a LassoIdWsf2UtilStatus object, or NULL. [transfer none][allow-none]

### lasso_idwsf2_data_service_validate_request ()

    lasso_error_t       lasso_idwsf2_data_service_validate_request
                                                            (LassoIdWsf2DataService *service);

Initialize a new response object corresponding to the current request. If not request if found or the request is invalid, a failure response is created.

`service` : | a LassoIdWsf2DataService object
Returns : | 0 if successful, or LASSO_PROFILE_ERROR_INVALID_REQUEST.