Convenience HTTP client API: Cutter Reference Manual

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

## Functions

SoupCutClient * | soupcut_client_new ()
void | soupcut_client_set_base ()
guint | soupcut_client_send_message ()
guint | soupcut_client_get ()
guint | soupcut_client_get_n_messages ()
SoupMessage * | soupcut_client_get_latest_message ()
GMainContext * | soupcut_client_get_async_context ()

## Properties

gboolean | async | Read / Write

## Object Hierarchy

        GObject
        ╰── SoupCutClient

## Description

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

## Functions

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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

#### Parameters

client | a SoupCutClient. |

#### Returns

a GMainContext of `client` , which may be `NULL`.

Since: 1.0.8

## Property Details

### The `“async”` property

      “async”                    gboolean

True if the session is asynchronous.

Owner: SoupCutClient

Flags: Read / Write

Default value: FALSE

## See Also

Assertions for HTTP client and server