Convenience HTTP client API

## Convenience HTTP client API Convenience HTTP client API — API to work as HTTP client. |

## Synopsis

                        SoupCutClient;
                        SoupCutClientClass;
    SoupCutClient *     soupcut_client_new                  (void);
    void                soupcut_client_set_base             (SoupCutClient *client,
                                                             const gchar *uri);
    guint               soupcut_client_send_message         (SoupCutClient *client,
                                                             SoupMessage *message);
    guint               soupcut_client_get                  (SoupCutClient *client,
                                                             const gchar *uri,
                                                             const gchar *first_query_name,
                                                             ...);
    guint               soupcut_client_get_n_messages       (SoupCutClient *client);
    SoupMessage *       soupcut_client_get_latest_message   (SoupCutClient *client);
    GMainContext *      soupcut_client_get_async_context    (SoupCutClient *client);

## Object Hierarchy

      GObject
       +----SoupCutClient

## Properties

      "async"                    gboolean              : Read / Write

## Description

SoupCutClient works as a HTTP client. It accepts multiple requests and responses are managed by SoupCutClient. SoupCutClient related assertions are also provided.

## Details

### SoupCutClient

    typedef struct _SoupCutClient SoupCutClient;

### SoupCutClientClass

    typedef struct {
        GObjectClass parent_class;
    } SoupCutClientClass;

### soupcut_client_new ()

    SoupCutClient *     soupcut_client_new                  (void);

Creates and returns a new SoupCutClient

Returns : | a new SoupCutClient.

Since 1.0.8

### soupcut_client_set_base ()

    void                soupcut_client_set_base             (SoupCutClient *client,
                                                             const gchar *uri);

Set `uri` as a base uri of `client`.

`client` : | a SoupCutClient.
`uri` : | a base uri.

Since 1.0.8

### soupcut_client_send_message ()

    guint               soupcut_client_send_message         (SoupCutClient *client,
                                                             SoupMessage *message);

Send `message` with `client`. `client` remebers all the messages it sent.

`client` : | a SoupCutClient.
`message` : | a SoupMessage.
Returns : | a status code of the response.

Since 1.0.8

### soupcut_client_get ()

    guint               soupcut_client_get                  (SoupCutClient *client,
                                                             const gchar *uri,
                                                             const gchar *first_query_name,
                                                             ...);

Send a GET request to `uri` with queries. If the base URI of `client` is set by `soupcut_client_set_base()`, the destination URI is composed of the base URI and `uri`. If not, `uri` must be a fully qualified URI.

`client` : | a SoupCutClient.
`uri` : | an URI string.
`first_query_name` : | the name of the first query parameter.
`...` : | pairs of query parameter names and values, starting with `first_query_name`, terminated by `NULL`
Returns : | a status code of the response.

Since 1.0.8

### soupcut_client_get_n_messages ()

    guint               soupcut_client_get_n_messages       (SoupCutClient *client);

Returns the number of messages `client` sent.

`client` : | a SoupCutClient.
Returns : | the number of messages.

Since 1.0.8

### soupcut_client_get_latest_message ()

    SoupMessage *       soupcut_client_get_latest_message   (SoupCutClient *client);

Returns the latest SoupMessage `client` sent.

`client` : | a SoupCutClient.
Returns : | the latest SoupMessage.

Since 1.0.8

### soupcut_client_get_async_context ()

    GMainContext *      soupcut_client_get_async_context    (SoupCutClient *client);

Returns the asynch_context of `client`.

`client` : | a SoupCutClient.
Returns : | a GMainContext of `client`, which may be `NULL`.

Since 1.0.8

## Property Details

### The `"async"` property

      "async"                    gboolean              : Read / Write

True if the session is asynchronous.

Default value: FALSE

## See Also

Assertions for HTTP client and server