/** * gdata_tasks_service_query_tasks: * @self: a #GDataTasksService * @tasklist: a #GDataTasksTasklist * @query: (allow-none): a #GDataQuery with the query parameters, or %NULL * @cancellable: (allow-none): optional #GCancellable object, or %NULL * @progress_callback: (allow-none) (scope call) (closure progress_user_data): a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL * @progress_user_data: (closure): data to pass to the @progress_callback function * @error: (allow-none): a #GError, or %NULL * * Queries the service to return a list of tasks in the given @tasklist, which match @query. * * For more details, see gdata_service_query(). * * Return value: (transfer full): a #GDataFeed of query results; unref with g_object_unref() * * Since: 0.15.0 */ GDataFeed * gdata_tasks_service_query_tasks (GDataTasksService *self, GDataTasksTasklist *tasklist, GDataQuery *query, GCancellable *cancellable, GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error) { gchar* request_uri; GDataFeed *feed; 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 (gdata_entry_get_id (GDATA_ENTRY (tasklist)) != NULL, NULL); g_return_val_if_fail (query == NULL || GDATA_IS_QUERY (query), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); /* Ensure we're authenticated first */ if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)), get_tasks_authorization_domain ()) == FALSE) { g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED, _("You must be authenticated to query your own tasks.")); return NULL; } /* Should add /tasks as requested by API */ request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.googleapis.com/tasks/v1/lists/", gdata_entry_get_id (GDATA_ENTRY (tasklist)), "/tasks", NULL); /* Execute the query */ feed = gdata_service_query (GDATA_SERVICE (self), get_tasks_authorization_domain (), request_uri, query, GDATA_TYPE_TASKS_TASK, cancellable, progress_callback, progress_user_data, error); g_free (request_uri); return feed; }
/** * gdata_calendar_service_query_events: * @self: a #GDataCalendarService * @calendar: a #GDataCalendarCalendar * @query: a #GDataQuery with the query parameters, or %NULL * @cancellable: optional #GCancellable object, or %NULL * @progress_callback: a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL * @progress_user_data: data to pass to the @progress_callback function * @error: a #GError, or %NULL * * Queries the service to return a list of events in the given @calendar, which match @query. * * For more details, see gdata_service_query(). * * Return value: a #GDataFeed of query results; unref with g_object_unref() **/ GDataFeed * gdata_calendar_service_query_events (GDataCalendarService *self, GDataCalendarCalendar *calendar, GDataQuery *query, GCancellable *cancellable, GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error) { /* TODO: Async variant */ const gchar *uri; /* Ensure we're authenticated first */ if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) { g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED, _("You must be authenticated to query your own calendars.")); return NULL; } /* Use the calendar's content src */ uri = gdata_entry_get_content (GDATA_ENTRY (calendar)); if (uri == NULL) { /* Erroring out is probably the safest thing to do */ g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR, _("The calendar did not have a content source.")); return NULL; } /* Execute the query */ return gdata_service_query (GDATA_SERVICE (self), uri, query, GDATA_TYPE_CALENDAR_EVENT, cancellable, progress_callback, progress_user_data, error); }
/** * gdata_contacts_service_query_groups: * @self: a #GDataContactsService * @query: (allow-none): a #GDataQuery with the query parameters, or %NULL * @cancellable: (allow-none): optional #GCancellable object, or %NULL * @progress_callback: (allow-none) (scope call) (closure progress_user_data): a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL * @progress_user_data: (closure): data to pass to the @progress_callback function * @error: a #GError, or %NULL * * Queries the service to return a list of groups matching the given @query. * * For more details, see gdata_service_query(). * * Return value: (transfer full): a #GDataFeed of query results; unref with g_object_unref() * * Since: 0.7.0 **/ GDataFeed * gdata_contacts_service_query_groups (GDataContactsService *self, GDataQuery *query, GCancellable *cancellable, GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error) { GDataFeed *feed; gchar *request_uri; g_return_val_if_fail (GDATA_IS_CONTACTS_SERVICE (self), NULL); g_return_val_if_fail (query == NULL || GDATA_IS_QUERY (query), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); /* Ensure we're authenticated first */ 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 query contact groups.")); return NULL; } request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/m8/feeds/groups/default/full", NULL); feed = gdata_service_query (GDATA_SERVICE (self), get_contacts_authorization_domain (), request_uri, GDATA_QUERY (query), GDATA_TYPE_CONTACTS_GROUP, cancellable, progress_callback, progress_user_data, error); g_free (request_uri); return feed; }
/** * gdata_calendar_service_query_events: * @self: a #GDataCalendarService * @calendar: a #GDataCalendarCalendar * @query: (allow-none): a #GDataQuery with the query parameters, or %NULL * @cancellable: (allow-none): optional #GCancellable object, or %NULL * @progress_callback: (allow-none) (scope call) (closure progress_user_data): a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL * @progress_user_data: (closure): data to pass to the @progress_callback function * @error: a #GError, or %NULL * * Queries the service to return a list of events in the given @calendar, which match @query. * * For more details, see gdata_service_query(). * * Return value: (transfer full): a #GDataFeed of query results; unref with g_object_unref() */ GDataFeed * gdata_calendar_service_query_events (GDataCalendarService *self, GDataCalendarCalendar *calendar, GDataQuery *query, GCancellable *cancellable, GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error) { gchar *request_uri; GDataFeed *feed; 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 (query == NULL || GDATA_IS_QUERY (query), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); /* Ensure we're authenticated first */ if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)), get_calendar_authorization_domain ()) == FALSE) { g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED, _("You must be authenticated to query your own calendars.")); return NULL; } /* Execute the query. */ request_uri = build_events_uri (calendar); feed = gdata_service_query (GDATA_SERVICE (self), get_calendar_authorization_domain (), request_uri, query, GDATA_TYPE_CALENDAR_EVENT, cancellable, progress_callback, progress_user_data, error); g_free (request_uri); return feed; }
/** * gdata_calendar_service_query_own_calendars: * @self: a #GDataCalendarService * @query: (allow-none): a #GDataQuery with the query parameters, or %NULL * @cancellable: (allow-none): optional #GCancellable object, or %NULL * @progress_callback: (allow-none) (scope call) (closure progress_user_data): a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL * @progress_user_data: (closure): data to pass to the @progress_callback function * @error: a #GError, or %NULL * * Queries the service to return a list of calendars from the authenticated account which match the given * @query, and the authenticated user owns. (i.e. They have full read/write access to the calendar, as well * as the ability to set permissions on the calendar.) * * For more details, see gdata_service_query(). * * Return value: (transfer full): a #GDataFeed of query results; unref with g_object_unref() */ GDataFeed * gdata_calendar_service_query_own_calendars (GDataCalendarService *self, GDataQuery *query, GCancellable *cancellable, GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error) { GDataFeed *feed; gchar *request_uri; g_return_val_if_fail (GDATA_IS_CALENDAR_SERVICE (self), NULL); g_return_val_if_fail (query == NULL || GDATA_IS_QUERY (query), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); /* Ensure we're authenticated first */ if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)), get_calendar_authorization_domain ()) == FALSE) { g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED, _("You must be authenticated to query your own calendars.")); return NULL; } request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.googleapis.com/calendar/v3/users/me/calendarList?minAccessRole=owner", NULL); feed = gdata_service_query (GDATA_SERVICE (self), get_calendar_authorization_domain (), request_uri, query, GDATA_TYPE_CALENDAR_CALENDAR, cancellable, progress_callback, progress_user_data, error); g_free (request_uri); return feed; }
/** * gdata_calendar_service_query_all_calendars: * @self: a #GDataCalendarService * @query: a #GDataQuery with the query parameters, or %NULL * @cancellable: optional #GCancellable object, or %NULL * @progress_callback: a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL * @progress_user_data: data to pass to the @progress_callback function * @error: a #GError, or %NULL * * Queries the service to return a list of all calendars from the authenticated account which match the given * @query. It will return all calendars the user has read access to, including primary, secondary and imported * calendars. * * For more details, see gdata_service_query(). * * Return value: a #GDataFeed of query results; unref with g_object_unref() **/ GDataFeed * gdata_calendar_service_query_all_calendars (GDataCalendarService *self, GDataQuery *query, GCancellable *cancellable, GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error) { /* Ensure we're authenticated first */ if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) { g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED, _("You must be authenticated to query all calendars.")); return NULL; } return gdata_service_query (GDATA_SERVICE (self), "http://www.google.com/calendar/feeds/default/allcalendars/full", query, GDATA_TYPE_CALENDAR_CALENDAR, cancellable, progress_callback, progress_user_data, error); }