/** * gdata_contacts_service_insert_group: * @self: a #GDataContactsService * @group: a #GDataContactsGroup to create on the server * @cancellable: (allow-none): optional #GCancellable object, or %NULL * @error: a #GError, or %NULL * * Inserts a new contact group described by @group. The user must be authenticated to use this function. * * Return value: (transfer full): the inserted #GDataContactsGroup; unref with g_object_unref() * * Since: 0.7.0 **/ GDataContactsGroup * gdata_contacts_service_insert_group (GDataContactsService *self, GDataContactsGroup *group, GCancellable *cancellable, GError **error) { gchar *request_uri; GDataEntry *new_group; g_return_val_if_fail (GDATA_IS_CONTACTS_SERVICE (self), NULL); g_return_val_if_fail (GDATA_IS_CONTACTS_GROUP (group), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); if (gdata_entry_is_inserted (GDATA_ENTRY (group)) == TRUE) { g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_ENTRY_ALREADY_INSERTED, _("The group has already been inserted.")); return NULL; } if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)), get_contacts_authorization_domain ()) == FALSE) { g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED, _("You must be authenticated to insert a group.")); return NULL; } request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/m8/feeds/groups/default/full", NULL); new_group = gdata_service_insert_entry (GDATA_SERVICE (self), get_contacts_authorization_domain (), request_uri, GDATA_ENTRY (group), cancellable, error); g_free (request_uri); return GDATA_CONTACTS_GROUP (new_group); }
/** * gdata_calendar_service_insert_calendar_event: * @self: a #GDataCalendarService * @calendar: the #GDataCalendarCalendar to insert the event into * @event: the #GDataCalendarEvent to insert * @cancellable: (allow-none): optional #GCancellable object, or %NULL * @error: a #GError, or %NULL * * Inserts @event by uploading it to the online calendar service, adding it to * the specified @calendar. * * For more details, see gdata_service_insert_entry(). * * Return value: (transfer full): an updated #GDataCalendarEvent, or %NULL; * unref with g_object_unref() * * Since: 0.17.2 */ GDataCalendarEvent * gdata_calendar_service_insert_calendar_event (GDataCalendarService *self, GDataCalendarCalendar *calendar, GDataCalendarEvent *event, GCancellable *cancellable, GError **error) { gchar *uri; GDataEntry *entry; g_return_val_if_fail (GDATA_IS_CALENDAR_SERVICE (self), NULL); g_return_val_if_fail (GDATA_IS_CALENDAR_CALENDAR (calendar), NULL); g_return_val_if_fail (GDATA_IS_CALENDAR_EVENT (event), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); uri = build_events_uri (calendar); entry = gdata_service_insert_entry (GDATA_SERVICE (self), get_calendar_authorization_domain (), uri, GDATA_ENTRY (event), cancellable, error); g_free (uri); return GDATA_CALENDAR_EVENT (entry); }
/** * gdata_tasks_service_insert_tasklist: * @self: a #GDataTasksService * @tasklist: #GDataTasksTasklist to insert * @cancellable: (allow-none): optional #GCancellable object, or %NULL * @error: (allow-none): a #GError, or %NULL * * Inserts @tasklist by uploading it to the online tasks service. * * For more details, see gdata_service_insert_entry(). * * Return value: (transfer full): an updated #GDataTasksTasklist, or %NULL; unref with g_object_unref() * * Since: 0.15.0 */ GDataTasksTasklist * gdata_tasks_service_insert_tasklist (GDataTasksService *self, GDataTasksTasklist *tasklist, GCancellable *cancellable, GError **error) { gchar *request_uri; GDataEntry *entry; g_return_val_if_fail (GDATA_IS_TASKS_SERVICE (self), NULL); g_return_val_if_fail (GDATA_IS_TASKS_TASKLIST (tasklist), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.googleapis.com/tasks/v1/users/@me/lists", NULL); entry = gdata_service_insert_entry (GDATA_SERVICE (self), get_tasks_authorization_domain (), request_uri, GDATA_ENTRY (tasklist), cancellable, error); g_free (request_uri); return GDATA_TASKS_TASKLIST (entry); }
/** * gdata_calendar_service_insert_event: * @self: a #GDataCalendarService * @event: the #GDataCalendarEvent to insert * @cancellable: optional #GCancellable object, or %NULL * @error: a #GError, or %NULL * * Inserts @event by uploading it to the online calendar service. * * For more details, see gdata_service_insert_entry(). * * Return value: an updated #GDataCalendarEvent, or %NULL * * Since: 0.2.0 **/ GDataCalendarEvent * gdata_calendar_service_insert_event (GDataCalendarService *self, GDataCalendarEvent *event, GCancellable *cancellable, GError **error) { /* TODO: Async variant */ /* TODO: How do we choose which calendar? */ gchar *uri; GDataEntry *entry; g_return_val_if_fail (GDATA_IS_CALENDAR_SERVICE (self), NULL); g_return_val_if_fail (GDATA_IS_CALENDAR_EVENT (event), NULL); uri = g_strdup_printf ("http://www.google.com/calendar/feeds/%s/private/full", gdata_service_get_username (GDATA_SERVICE (self))); entry = gdata_service_insert_entry (GDATA_SERVICE (self), uri, GDATA_ENTRY (event), cancellable, error); g_free (uri); return GDATA_CALENDAR_EVENT (entry); }
/** * gdata_contacts_service_insert_contact: * @self: a #GDataContactsService * @contact: the #GDataContactsContact to insert * @cancellable: (allow-none): optional #GCancellable object, or %NULL * @error: a #GError, or %NULL * * Inserts @contact by uploading it to the online contacts service. * * For more details, see gdata_service_insert_entry(). * * Return value: (transfer full): an updated #GDataContactsContact, or %NULL; unref with g_object_unref() * * Since: 0.2.0 **/ GDataContactsContact * gdata_contacts_service_insert_contact (GDataContactsService *self, GDataContactsContact *contact, GCancellable *cancellable, GError **error) { gchar *uri; GDataEntry *entry; g_return_val_if_fail (GDATA_IS_CONTACTS_SERVICE (self), NULL); g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (contact), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/m8/feeds/contacts/default/full", NULL); entry = gdata_service_insert_entry (GDATA_SERVICE (self), get_contacts_authorization_domain (), uri, GDATA_ENTRY (contact), cancellable, error); g_free (uri); return GDATA_CONTACTS_CONTACT (entry); }