[couchdb-glib] Added body argument to send_message_and_parse helper function



commit 103726e186e10b090db364c6c431a6b0b27e7fa5
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Thu Jun 18 13:59:39 2009 +0200

    Added body argument to send_message_and_parse helper function

 couchdb-glib/Makefile.am        |    2 ++
 couchdb-glib/couchdb-document.c |    8 +++++++-
 couchdb-glib/couchdb-glib.h     |    1 +
 couchdb-glib/couchdb.c          |   10 +++++-----
 couchdb-glib/utils.c            |    6 +++++-
 couchdb-glib/utils.h            |    1 +
 debian/changelog                |    2 +-
 7 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/couchdb-glib/Makefile.am b/couchdb-glib/Makefile.am
index efd5262..a8e66dc 100644
--- a/couchdb-glib/Makefile.am
+++ b/couchdb-glib/Makefile.am
@@ -10,6 +10,8 @@ libcouchdb_glib_1_0_la_SOURCES =	\
 	couchdb-types.c			\
 	utils.c				\
 	utils.h
+libcouchdb_glib_1_0_la_LIBADD =		\
+	$(COUCHDB_GLIB_LIBS)
 
 hdir = $(includedir)/couchdb-glib-1.0
 h_DATA = 				\
diff --git a/couchdb-glib/couchdb-document.c b/couchdb-glib/couchdb-document.c
index 8884f18..58113ae 100644
--- a/couchdb-glib/couchdb-document.c
+++ b/couchdb-glib/couchdb-document.c
@@ -83,7 +83,7 @@ couchdb_document_get (CouchDB *couchdb,
 	g_return_val_if_fail (docid != NULL, NULL);
 
 	url = g_strdup_printf ("http://%s/%s/%s";, couchdb->hostname, dbname, docid);
-	parser = send_message_and_parse (couchdb, SOUP_METHOD_GET, url, error);
+	parser = send_message_and_parse (couchdb, SOUP_METHOD_GET, url, NULL, error);
 	if (parser) {
 		document = g_object_new (COUCHDB_TYPE_DOCUMENT, NULL);
 		document->couchdb = couchdb;
@@ -98,6 +98,12 @@ couchdb_document_get (CouchDB *couchdb,
 	return document;
 }
 
+gboolean
+couchdb_document_put (CouchDBDocument *document)
+{
+	g_return_val_if_fail (COUCHDB_IS_DOCUMENT (document), FALSE);
+}
+
 const char *
 couchdb_document_get_id (CouchDBDocument *document)
 {
diff --git a/couchdb-glib/couchdb-glib.h b/couchdb-glib/couchdb-glib.h
index 2cdf590..c87e083 100644
--- a/couchdb-glib/couchdb-glib.h
+++ b/couchdb-glib/couchdb-glib.h
@@ -76,6 +76,7 @@ CouchDBDocument *couchdb_document_get (CouchDB *couchdb,
 				       const char *dbname,
 				       const char *docid,
 				       GError **error);
+gboolean         couchdb_document_put (CouchDBDocument *document);
 const char      *couchdb_document_get_id (CouchDBDocument *document);
 void             couchdb_document_set_id (CouchDBDocument *document, const char *id);
 
diff --git a/couchdb-glib/couchdb.c b/couchdb-glib/couchdb.c
index 8e0a829..d93f076 100644
--- a/couchdb-glib/couchdb.c
+++ b/couchdb-glib/couchdb.c
@@ -77,7 +77,7 @@ couchdb_list_databases (CouchDB *couchdb, GError **error)
 
 	/* Prepare request */
 	url = g_strdup_printf ("http://%s/_all_dbs";, couchdb->hostname);
-	parser = send_message_and_parse (couchdb, SOUP_METHOD_GET, url, error);
+	parser = send_message_and_parse (couchdb, SOUP_METHOD_GET, url, NULL, error);
 	if (parser) {
 		JsonNode *root_node;
 
@@ -113,7 +113,7 @@ couchdb_get_database_info (CouchDB *couchdb, const char *dbname, GError **error)
 	g_return_val_if_fail (dbname != NULL, NULL);
 
 	url = g_strdup_printf ("http://%s/%s/";, couchdb->hostname, dbname);
-	parser = send_message_and_parse (couchdb, SOUP_METHOD_GET, url, error);
+	parser = send_message_and_parse (couchdb, SOUP_METHOD_GET, url, NULL, error);
 	if (parser) {
 		JsonNode *root_node;
 
@@ -146,7 +146,7 @@ couchdb_create_database (CouchDB *couchdb, const char *dbname, GError **error)
 	g_return_val_if_fail (dbname != NULL, FALSE);
 
 	url = g_strdup_printf ("http://%s/%s/";, couchdb->hostname, dbname);
-	parser = send_message_and_parse (couchdb, SOUP_METHOD_PUT, url, error);
+	parser = send_message_and_parse (couchdb, SOUP_METHOD_PUT, url, NULL, error);
 	if (parser) {
 		JsonNode *root_node;
 
@@ -174,7 +174,7 @@ couchdb_delete_database (CouchDB *couchdb, const char *dbname, GError **error)
 	g_return_val_if_fail (dbname != NULL, FALSE);
 
 	url = g_strdup_printf ("http://%s/%s/";, couchdb->hostname, dbname);
-	parser = send_message_and_parse (couchdb, SOUP_METHOD_DELETE, url, error);
+	parser = send_message_and_parse (couchdb, SOUP_METHOD_DELETE, url, NULL, error);
 	if (parser) {
 		JsonNode *root_node;
 
@@ -211,7 +211,7 @@ couchdb_list_documents (CouchDB *couchdb, const char *dbname, GError **error)
 	g_return_val_if_fail (dbname != NULL, NULL);
 
 	url = g_strdup_printf ("http://%s/%s/_all_docs";, couchdb->hostname, dbname);
-	parser = send_message_and_parse (couchdb, SOUP_METHOD_GET, url, error);
+	parser = send_message_and_parse (couchdb, SOUP_METHOD_GET, url, NULL, error);
 	if (parser) {
 		JsonNode *root_node;
 
diff --git a/couchdb-glib/utils.c b/couchdb-glib/utils.c
index 7ba7bff..23ec721 100644
--- a/couchdb-glib/utils.c
+++ b/couchdb-glib/utils.c
@@ -63,13 +63,17 @@ set_error_from_soup (GError **error, guint status)
 }
 
 JsonParser *
-send_message_and_parse (CouchDB *couchdb, const char *method, const char *url, GError **error)
+send_message_and_parse (CouchDB *couchdb, const char *method, const char *url, const char *body, GError **error)
 {
 	SoupMessage *http_message;
 	guint status;
 	JsonParser *parser = NULL;
 
 	http_message = soup_message_new (method, url);
+	if (body != NULL) {
+		/* Set the body of the HTTP request */
+		
+	}
 
 	g_debug ("Sending %s to %s...", method, url);
 	status = soup_session_send_message (couchdb->http_session, http_message);
diff --git a/couchdb-glib/utils.h b/couchdb-glib/utils.h
index 82c49b2..cc5b0ba 100644
--- a/couchdb-glib/utils.h
+++ b/couchdb-glib/utils.h
@@ -82,6 +82,7 @@ CouchDBStructField *couchdb_struct_field_new_from_json_object (JsonObject *json_
 JsonParser *send_message_and_parse (CouchDB *couchdb,
 				    const char *method,
 				    const char *url,
+				    const char *body,
 				    GError **error);
 
 #endif
diff --git a/debian/changelog b/debian/changelog
index 0d56e79..720410f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-couchdb-glib (0.1) jaunty; urgency=low
+couchdb-glib (0.2) jaunty; urgency=low
 
   * First version of the package
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]