summaryrefslogtreecommitdiff
path: root/gdata
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2010-08-26 09:37:44 +0100
committerPhilip Withnall <philip@tecnocode.co.uk>2010-08-26 09:37:44 +0100
commit2e26e1a0ca6ce6ac25f621b9ad057a65b71dc286 (patch)
tree698cb27c4259f7ee441ce14fcb9c619822350151 /gdata
parent730a8d66e9a38cbf50b07ffd4f01b0c629c9afe9 (diff)
downloadlibgdata-2e26e1a0ca6ce6ac25f621b9ad057a65b71dc286.tar.gz
contacts: Use "default" instead of the user's username in request URIs
Just like with the Calendar service, this magically fixes batch operations so that the contact's ID can be used in them, rather than its self URI.
Diffstat (limited to 'gdata')
-rw-r--r--gdata/services/contacts/gdata-contacts-service.c2
-rw-r--r--gdata/tests/contacts.c16
2 files changed, 4 insertions, 14 deletions
diff --git a/gdata/services/contacts/gdata-contacts-service.c b/gdata/services/contacts/gdata-contacts-service.c
index 7d72a989..b450eaee 100644
--- a/gdata/services/contacts/gdata-contacts-service.c
+++ b/gdata/services/contacts/gdata-contacts-service.c
@@ -196,7 +196,7 @@ gdata_contacts_service_insert_contact (GDataContactsService *self, GDataContacts
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- uri = _gdata_service_build_uri (FALSE, "http://www.google.com/m8/feeds/contacts/%s/full", gdata_service_get_username (GDATA_SERVICE (self)));
+ uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/m8/feeds/contacts/default/full", NULL);
entry = gdata_service_insert_entry (GDATA_SERVICE (self), uri, GDATA_ENTRY (contact), cancellable, error);
g_free (uri);
diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c
index f819f538..698c2cc3 100644
--- a/gdata/tests/contacts.c
+++ b/gdata/tests/contacts.c
@@ -1236,7 +1236,6 @@ test_batch (gconstpointer service)
GDataService *service2;
GDataContactsContact *contact, *contact2, *contact3;
GDataEntry *inserted_entry, *inserted_entry2, *inserted_entry3;
- GDataLink *self_link;
gchar *feed_uri;
guint op_id, op_id2, op_id3;
GError *error = NULL, *entry_error = NULL;
@@ -1275,12 +1274,9 @@ test_batch (gconstpointer service)
contact2 = gdata_contacts_contact_new (NULL);
gdata_entry_set_title (GDATA_ENTRY (contact2), "Brian");
- /* The contacts API is weird in that you can't do a GET on a contact's ID URI — you have to use their self link URI instead */
- self_link = gdata_entry_look_up_link (inserted_entry, GDATA_LINK_SELF);
-
operation = gdata_batchable_create_operation (GDATA_BATCHABLE (service), "http://www.google.com/m8/feeds/contacts/default/full/batch");
op_id = gdata_test_batch_operation_insertion (operation, GDATA_ENTRY (contact2), &inserted_entry2, NULL);
- op_id2 = gdata_test_batch_operation_query (operation, gdata_link_get_uri (self_link), GDATA_TYPE_CONTACTS_CONTACT, inserted_entry, NULL,
+ op_id2 = gdata_test_batch_operation_query (operation, gdata_entry_get_id (inserted_entry), GDATA_TYPE_CONTACTS_CONTACT, inserted_entry, NULL,
NULL);
g_assert_cmpuint (op_id, !=, op_id2);
@@ -1377,15 +1373,12 @@ static void
test_batch_async (BatchAsyncData *data, gconstpointer service)
{
GDataBatchOperation *operation;
- GDataLink *self_link;
guint op_id;
GMainLoop *main_loop;
/* Run an async query operation on the contact */
- self_link = gdata_entry_look_up_link (GDATA_ENTRY (data->new_contact), GDATA_LINK_SELF);
-
operation = gdata_batchable_create_operation (GDATA_BATCHABLE (service), "http://www.google.com/m8/feeds/contacts/default/full/batch");
- op_id = gdata_test_batch_operation_query (operation, gdata_link_get_uri (self_link), GDATA_TYPE_CONTACTS_CONTACT,
+ op_id = gdata_test_batch_operation_query (operation, gdata_entry_get_id (GDATA_ENTRY (data->new_contact)), GDATA_TYPE_CONTACTS_CONTACT,
GDATA_ENTRY (data->new_contact), NULL, NULL);
main_loop = g_main_loop_new (NULL, TRUE);
@@ -1412,16 +1405,13 @@ static void
test_batch_async_cancellation (BatchAsyncData *data, gconstpointer service)
{
GDataBatchOperation *operation;
- GDataLink *self_link;
guint op_id;
GMainLoop *main_loop;
GCancellable *cancellable;
/* Run an async query operation on the contact */
- self_link = gdata_entry_look_up_link (GDATA_ENTRY (data->new_contact), GDATA_LINK_SELF);
-
operation = gdata_batchable_create_operation (GDATA_BATCHABLE (service), "http://www.google.com/m8/feeds/contacts/default/full/batch");
- op_id = gdata_test_batch_operation_query (operation, gdata_link_get_uri (self_link), GDATA_TYPE_CONTACTS_CONTACT,
+ op_id = gdata_test_batch_operation_query (operation, gdata_entry_get_id (GDATA_ENTRY (data->new_contact)), GDATA_TYPE_CONTACTS_CONTACT,
GDATA_ENTRY (data->new_contact), NULL, NULL);
main_loop = g_main_loop_new (NULL, TRUE);