<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="SoupCutClient">
<refmeta>
<refentrytitle role="top_of_page" id="SoupCutClient.top_of_page">Convenience HTTP client API</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CUTTER Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Convenience HTTP client API</refname>
<refpurpose>API to work as HTTP client.</refpurpose>
</refnamediv>

<refsect1 id="SoupCutClient.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_return" colwidth="150px"/>
<colspec colname="functions_name"/>
<tbody>
<row><entry role="function_type"><link linkend="SoupCutClient"><returnvalue>SoupCutClient</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="soupcut-client-new">soupcut_client_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="soupcut-client-set-base">soupcut_client_set_base</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="soupcut-client-send-message">soupcut_client_send_message</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="soupcut-client-get">soupcut_client_get</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="soupcut-client-get-n-messages">soupcut_client_get_n_messages</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="SoupMessage"><returnvalue>SoupMessage</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="soupcut-client-get-latest-message">soupcut_client_get_latest_message</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GMainContext"><returnvalue>GMainContext</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="soupcut-client-get-async-context">soupcut_client_get_async_context</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="SoupCutClient.properties" role="properties">
<title role="properties.title">Properties</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="properties_type" colwidth="150px"/>
<colspec colname="properties_name" colwidth="300px"/>
<colspec colname="properties_flags" colwidth="200px"/>
<tbody>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="SoupCutClient--async">async</link></entry><entry role="property_flags">Read / Write</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="SoupCutClient.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> SoupCutClient
</screen>
</refsect1>


<refsect1 id="SoupCutClient.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="SoupCutClient"><type>SoupCutClient</type></link> works as a HTTP client. It accepts
multiple requests and responses are managed by
<link linkend="SoupCutClient"><type>SoupCutClient</type></link>. <link linkend="SoupCutClient"><type>SoupCutClient</type></link> related assertions are
also provided.</para>

</refsect1>
<refsect1 id="SoupCutClient.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="soupcut-client-new" role="function" condition="since:1.0.8">
<title>soupcut_client_new&#160;()</title>
<indexterm zone="soupcut-client-new" role="1.0.8"><primary>soupcut_client_new</primary></indexterm>
<programlisting language="C"><link linkend="SoupCutClient"><returnvalue>SoupCutClient</returnvalue></link>&#160;*
soupcut_client_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates and returns a new <link linkend="SoupCutClient"><type>SoupCutClient</type></link></para>
<refsect3 id="soupcut-client-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.8">1.0.8</link></para></refsect2>
<refsect2 id="soupcut-client-set-base" role="function" condition="since:1.0.8">
<title>soupcut_client_set_base&#160;()</title>
<indexterm zone="soupcut-client-set-base" role="1.0.8"><primary>soupcut_client_set_base</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
soupcut_client_set_base (<parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *uri</parameter>);</programlisting>
<para>Set <parameter>uri</parameter>
 as a base uri of <parameter>client</parameter>
.</para>
<refsect3 id="soupcut-client-set-base.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>client</para></entry>
<entry role="parameter_description"><para>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>uri</para></entry>
<entry role="parameter_description"><para>a base uri.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.8">1.0.8</link></para></refsect2>
<refsect2 id="soupcut-client-send-message" role="function" condition="since:1.0.8">
<title>soupcut_client_send_message&#160;()</title>
<indexterm zone="soupcut-client-send-message" role="1.0.8"><primary>soupcut_client_send_message</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
soupcut_client_send_message (<parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                             <parameter><link linkend="SoupMessage"><type>SoupMessage</type></link> *message</parameter>);</programlisting>
<para>Send <parameter>message</parameter>
 with <parameter>client</parameter>
. <parameter>client</parameter>
 remebers all the messages it sent.</para>
<refsect3 id="soupcut-client-send-message.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>client</para></entry>
<entry role="parameter_description"><para>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>message</para></entry>
<entry role="parameter_description"><para>a <link linkend="SoupMessage"><type>SoupMessage</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="soupcut-client-send-message.returns" role="returns">
<title>Returns</title>
<para> a status code of the response.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.8">1.0.8</link></para></refsect2>
<refsect2 id="soupcut-client-get" role="function" condition="since:1.0.8">
<title>soupcut_client_get&#160;()</title>
<indexterm zone="soupcut-client-get" role="1.0.8"><primary>soupcut_client_get</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
soupcut_client_get (<parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                    <parameter>const <link linkend="gchar"><type>gchar</type></link> *uri</parameter>,
                    <parameter>const <link linkend="gchar"><type>gchar</type></link> *first_query_name</parameter>,
                    <parameter>...</parameter>);</programlisting>
<para>Send a GET request to <parameter>uri</parameter>
 with queries. If the base URI of <parameter>client</parameter>

is set by <link linkend="soupcut-client-set-base"><function>soupcut_client_set_base()</function></link>, the destination URI is composed of the base URI and <parameter>uri</parameter>
. If not, <parameter>uri</parameter>
 must be a fully qualified URI.</para>
<refsect3 id="soupcut-client-get.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>client</para></entry>
<entry role="parameter_description"><para>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>uri</para></entry>
<entry role="parameter_description"><para>an URI string.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>first_query_name</para></entry>
<entry role="parameter_description"><para>the name of the first query parameter.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>pairs of query parameter names and values, starting with <parameter>first_query_name</parameter>
, terminated by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="soupcut-client-get.returns" role="returns">
<title>Returns</title>
<para> a status code of the response.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.8">1.0.8</link></para></refsect2>
<refsect2 id="soupcut-client-get-n-messages" role="function" condition="since:1.0.8">
<title>soupcut_client_get_n_messages&#160;()</title>
<indexterm zone="soupcut-client-get-n-messages" role="1.0.8"><primary>soupcut_client_get_n_messages</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
soupcut_client_get_n_messages (<parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>);</programlisting>
<para>Returns the number of messages <parameter>client</parameter>
 sent.</para>
<refsect3 id="soupcut-client-get-n-messages.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>client</para></entry>
<entry role="parameter_description"><para>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="soupcut-client-get-n-messages.returns" role="returns">
<title>Returns</title>
<para> the number of messages.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.8">1.0.8</link></para></refsect2>
<refsect2 id="soupcut-client-get-latest-message" role="function" condition="since:1.0.8">
<title>soupcut_client_get_latest_message&#160;()</title>
<indexterm zone="soupcut-client-get-latest-message" role="1.0.8"><primary>soupcut_client_get_latest_message</primary></indexterm>
<programlisting language="C"><link linkend="SoupMessage"><returnvalue>SoupMessage</returnvalue></link>&#160;*
soupcut_client_get_latest_message (<parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>);</programlisting>
<para>Returns the latest <link linkend="SoupMessage"><type>SoupMessage</type></link> <parameter>client</parameter>
 sent.</para>
<refsect3 id="soupcut-client-get-latest-message.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>client</para></entry>
<entry role="parameter_description"><para>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="soupcut-client-get-latest-message.returns" role="returns">
<title>Returns</title>
<para> the latest <link linkend="SoupMessage"><type>SoupMessage</type></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.8">1.0.8</link></para></refsect2>
<refsect2 id="soupcut-client-get-async-context" role="function" condition="since:1.0.8">
<title>soupcut_client_get_async_context&#160;()</title>
<indexterm zone="soupcut-client-get-async-context" role="1.0.8"><primary>soupcut_client_get_async_context</primary></indexterm>
<programlisting language="C"><link linkend="GMainContext"><returnvalue>GMainContext</returnvalue></link>&#160;*
soupcut_client_get_async_context (<parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>);</programlisting>
<para>Returns the asynch_context of <parameter>client</parameter>
.</para>
<refsect3 id="soupcut-client-get-async-context.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>client</para></entry>
<entry role="parameter_description"><para>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="soupcut-client-get-async-context.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="GMainContext"><type>GMainContext</type></link> of <parameter>client</parameter>
, which may be <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.8">1.0.8</link></para></refsect2>

</refsect1>
<refsect1 id="SoupCutClient.other_details" role="details">
<title role="details.title">Types and Values</title>

</refsect1>
<refsect1 id="SoupCutClient.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="SoupCutClient--async" role="property"><title>The <literal>“async”</literal> property</title>
<indexterm zone="SoupCutClient--async"><primary>SoupCutClient:async</primary></indexterm>
<programlisting>  “async”                    <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>True if the session is asynchronous.</para><para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>

</refsect1>
<refsect1 id="SoupCutClient.see-also">
<title>See Also</title>
<para><link
           linkend="cutter-Assertions-for-HTTP-client-and-server">
           Assertions for HTTP client and server</link></para>

</refsect1>

</refentry>
