RestParams

## RestParams RestParams — Container for call parameters |

## Synopsis

                        RestParams;
    typedef             RestParamsIter;
    RestParams *        rest_params_new                     (void);
    void                rest_params_free                    (RestParams *params);
    void                rest_params_add                     (RestParams *params,
                                                             RestParam *param);
    RestParam *         rest_params_get                     (RestParams *params,
                                                             const char *name);
    void                rest_params_remove                  (RestParams *params,
                                                             const char *name);
    gboolean            rest_params_are_strings             (RestParams *params);
    GHashTable *        rest_params_as_string_hash_table    (RestParams *params);
    void                rest_params_iter_init               (RestParamsIter *iter,
                                                             RestParams *params);
    gboolean            rest_params_iter_next               (RestParamsIter *iter,
                                                             const char **name,
                                                             RestParam **param);

## Description

## Details

### RestParams

    typedef struct _RestParams RestParams;

### RestParamsIter

    typedef struct _GHashTableIter RestParamsIter;

### rest_params_new ()

    RestParams *        rest_params_new                     (void);

Create a new RestParams.

Returns : | A empty RestParams.

### rest_params_free ()

    void                rest_params_free                    (RestParams *params);

Destroy the RestParams and the RestParam objects that it contains.

`params` : | a valid RestParams

### rest_params_add ()

    void                rest_params_add                     (RestParams *params,
                                                             RestParam *param);

Add `param` to `params`.

`params` : | a valid RestParams
`param` : | a valid RestParam

### rest_params_get ()

    RestParam *         rest_params_get                     (RestParams *params,
                                                             const char *name);

Return the RestParam called `name`, or `NULL` if it doesn't exist.

`params` : | a valid RestParams
`name` : | a parameter name
Returns : | a RestParam or `NULL` if the name doesn't exist

### rest_params_remove ()

    void                rest_params_remove                  (RestParams *params,
                                                             const char *name);

Remove the RestParam called `name`.

`params` : | a valid RestParams
`name` : | a parameter name

### rest_params_are_strings ()

    gboolean            rest_params_are_strings             (RestParams *params);

Checks if the parameters are all simple strings (have a content type of "text/plain").

`params` : | a valid RestParams
Returns : | `TRUE` if all of the parameters are simple strings, `FALSE` otherwise.

### rest_params_as_string_hash_table ()

    GHashTable *        rest_params_as_string_hash_table    (RestParams *params);

Create a new GHashTable which contains the name and value of all string (content type of text/plain) parameters.

The values are owned by the RestParams, so don't destroy the RestParams before the hash table.

`params` : | a valid RestParams
Returns : | a new GHashTable. [element-type utf8 Rest.Param][transfer container]

### rest_params_iter_init ()

    void                rest_params_iter_init               (RestParamsIter *iter,
                                                             RestParams *params);

Initialize a parameter iterator over `params`. Modifying `params` after calling this function invalidates the returned iterator.

    1
    2
    3
    4
    5
    6
    7
    8
    RestParamsIter iter;
    const char *name;
    RestParam *param;

    rest_params_iter_init (&iter, params);
    while (rest_params_iter_next (&iter, &name, &param)) {
      /* do something with name and param */
    }

`iter` : | an uninitialized RestParamsIter
`params` : | a valid RestParams

### rest_params_iter_next ()

    gboolean            rest_params_iter_next               (RestParamsIter *iter,
                                                             const char **name,
                                                             RestParam **param);

Advances `iter` and retrieves the name and/or parameter that are now pointed at as a result of this advancement. If FALSE is returned, `name` and `param` are not set and the iterator becomes invalid.

`iter` : | an initialized RestParamsIter
`name` : | a location to store the name, or `NULL`
`param` : | a location to store the RestParam, or `NULL`
Returns : | `FALSE` if the end of the RestParams has been reached, `TRUE` otherwise.

## See Also

RestParam, RestProxyCall.