## LassoIdWsf2DataService

LassoIdWsf2DataService

## Functions

LassoIdWsf2DataService * | lasso_idwsf2_data_service_new ()
lasso_error_t | lasso_idwsf2_data_service_init_create ()
lasso_error_t | lasso_idwsf2_data_service_init_delete ()
lasso_error_t | lasso_idwsf2_data_service_init_modify ()
lasso_error_t | lasso_idwsf2_data_service_init_query ()
lasso_error_t | lasso_idwsf2_data_service_add_modify_item ()
lasso_error_t | lasso_idwsf2_data_service_add_namespace ()
lasso_error_t | lasso_idwsf2_data_service_add_query_item ()
lasso_error_t | lasso_idwsf2_data_service_build_request_msg ()
lasso_error_t | lasso_idwsf2_data_service_build_response_msg ()
LassoNode * | lasso_idwsf2_data_service_get_item ()
LassoIdWsf2DstRefData * | lasso_idwsf2_data_service_get_query_item_result ()
GList * | lasso_idwsf2_data_service_get_query_item_results ()
LassoIdWsf2DataServiceRequestType | lasso_idwsf2_data_service_get_request_type ()
const char * | lasso_idwsf2_data_service_get_service_type ()
const char * | lasso_idwsf2_data_service_get_service_type_prefix ()
lasso_error_t | lasso_idwsf2_data_service_process_request_msg ()
lasso_error_t | lasso_idwsf2_data_service_process_response_msg ()
lasso_error_t | lasso_idwsf2_data_service_set_query_item_result ()
char * | lasso_idwsf2_data_service_get_query_item_result_content ()
lasso_error_t | lasso_idwsf2_data_service_set_service_type ()
lasso_error_t | lasso_idwsf2_data_service_set_status_code ()
GList * | lasso_idwsf2_data_service_get_item_ids ()
GList * | lasso_idwsf2_data_service_get_items ()
LassoIdWsf2UtilStatus * | lasso_idwsf2_data_service_get_response_status ()
lasso_error_t | lasso_idwsf2_data_service_validate_request ()

## Types and Values

struct | LassoIdWsf2DataService

## Description

## Functions

### lasso_idwsf2_data_service_new ()

    LassoIdWsf2DataService *
    lasso_idwsf2_data_service_new (LassoServer *server);

Create a new LassoIdWsf2DataService.

#### Parameters

server | a LassoServer object, for resolving ProviderIDs. | [allow-none]

#### 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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

service | a LassoIdWsf2DataService |
item_query | XPATH of the item to modify |
new_data | new value for the selected item. | [allow-none]
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 | identifier of the item to modify. | [allow-none]

#### 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.

#### Parameters

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.

#### Parameters

service | a LassoIdWsf2DataService |
item_query | a query string |
item_id | identifier of the queried item, which will allow to retrieve it in the response. | [allow-none]

#### 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.

#### Parameters

service | a LassoIdWsf2DataService object |
security_mech_id | the security mechanism to employ, default is Bearer mechanism. | [allow-none]

#### 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.

#### Parameters

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.

#### Parameters

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);

#### Parameters

service | a LassoIdWsf2DataService object |
item_id | an item_id or NULL if only one data is present. | [allow-none]

#### 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);

#### Parameters

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.

#### Parameters

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

#### Parameters

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

service | a LassoIdWsf2DataService object |
item_id | target a certain QueryItem if NULL, means there is only one query item. | [allow-none]
xml_data | the data to add. | [allow-none]
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.

#### Parameters

service | a LassoIdWsf2DataService object |
item_id | the identifier of the result asked, if NULL and there is only one respone, returns it. | [allow-none]

#### 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` .

#### Parameters

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.

#### Parameters

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.

#### Parameters

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);

#### Parameters

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.

#### Parameters

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.

#### Parameters

service | a LassoIdWsf2DataService object |

#### Returns

0 if successful, or LASSO_PROFILE_ERROR_INVALID_REQUEST.

## Types and Values

### struct LassoIdWsf2DataService

    struct LassoIdWsf2DataService {
    	LassoIdWsf2Profile parent;
    };