GDataYouTubeService

## GDataYouTubeService GDataYouTubeService — GData YouTube service object |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <gdata/services/youtube/gdata-youtube-service.h>

                        GDataYouTubeService;
                        GDataYouTubeServiceClass;
    enum                GDataYouTubeServiceError;
    enum                GDataYouTubeStandardFeedType;
    GDataYouTubeService * gdata_youtube_service_new         (const gchar *developer_key,
                                                             GDataAuthorizer *authorizer);
    GDataAuthorizationDomain * gdata_youtube_service_get_primary_authorization_domain
                                                            (void);
    GDataFeed *         gdata_youtube_service_query_videos  (GDataYouTubeService *self,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GError **error);
    void                gdata_youtube_service_query_videos_async
                                                            (GDataYouTubeService *self,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GDestroyNotify destroy_progress_user_data,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GDataFeed *         gdata_youtube_service_query_related (GDataYouTubeService *self,
                                                             GDataYouTubeVideo *video,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GError **error);
    void                gdata_youtube_service_query_related_async
                                                            (GDataYouTubeService *self,
                                                             GDataYouTubeVideo *video,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GDestroyNotify destroy_progress_user_data,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GDataFeed *         gdata_youtube_service_query_standard_feed
                                                            (GDataYouTubeService *self,
                                                             GDataYouTubeStandardFeedType feed_type,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GError **error);
    void                gdata_youtube_service_query_standard_feed_async
                                                            (GDataYouTubeService *self,
                                                             GDataYouTubeStandardFeedType feed_type,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GDestroyNotify destroy_progress_user_data,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GDataUploadStream * gdata_youtube_service_upload_video  (GDataYouTubeService *self,
                                                             GDataYouTubeVideo *video,
                                                             const gchar *slug,
                                                             const gchar *content_type,
                                                             GCancellable *cancellable,
                                                             GError **error);
    GDataYouTubeVideo * gdata_youtube_service_finish_video_upload
                                                            (GDataYouTubeService *self,
                                                             GDataUploadStream *upload_stream,
                                                             GError **error);
    GDataAPPCategories * gdata_youtube_service_get_categories
                                                            (GDataYouTubeService *self,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                gdata_youtube_service_get_categories_async
                                                            (GDataYouTubeService *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GDataAPPCategories * gdata_youtube_service_get_categories_finish
                                                            (GDataYouTubeService *self,
                                                             GAsyncResult *async_result,
                                                             GError **error);
    const gchar *       gdata_youtube_service_get_developer_key
                                                            (GDataYouTubeService *self);

## Object Hierarchy

      GObject
       +----GDataService
             +----GDataYouTubeService

      GEnum
       +----GDataYouTubeServiceError

      GEnum
       +----GDataYouTubeStandardFeedType

## Implemented Interfaces

GDataYouTubeService implements GDataBatchable.

## Properties

      "developer-key"            gchar*                : Read / Write / Construct Only

## Description

GDataYouTubeService is a subclass of GDataService for communicating with the GData API of YouTube. It supports querying for and uploading videos.

For more details of YouTube's GData API, see the online documentation.

Example 10. Getting a Localized List of YouTube Categories

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    GDataYouTubeService *service;
    GDataAPPCategories *app_categories;
    GList *categories, *i;

    /* Create a service and set its locale to Italian, which localizes the categories to Italian */
    service = create_youtube_service ();
    gdata_service_set_locale (GDATA_SERVICE (service), "it");

    /* Query the server for the current list of YouTube categories (in Italian) */
    app_categories = gdata_youtube_service_get_categories (service, NULL, NULL);
    categories = gdata_app_categories_get_categories (app_categories);

    /* Iterate through the categories */
    for (i = categories; i != NULL; i = i->next) {
        GDataYouTubeCategory *category = GDATA_YOUTUBE_CATEGORY (i->data);

        if (gdata_youtube_category_is_deprecated (category) == FALSE && gdata_youtube_category_is_browsable (category, "IT") == TRUE) {
            /* Do something with the category here, as it's not deprecated, and is browsable in the given region */
            add_to_ui (gdata_category_get_term (GDATA_CATEGORY (category)), gdata_category_get_label (GDATA_CATEGORY (category)));
        }
    }

    g_object_unref (app_categories);
    g_object_unref (service);

Example 11. Uploading a Video from Disk

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    GDataYouTubeService *service;
    GDataYouTubeVideo *video, *uploaded_video;
    GDataMediaCategory *category;
    const gchar * const tags[] = { "tag1", "tag2", NULL };
    GFile *video_file;
    GFileInfo *file_info;
    const gchar *slug, *content_type;
    GFileInputStream *file_stream;
    GDataUploadStream *upload_stream;
    GError *error = NULL;

    /* Create a service */
    service = create_youtube_service ();

    /* Get the video file to upload */
    video_file = g_file_new_for_path ("sample.ogg");

    /* Get the file's display name and content type */
    file_info = g_file_query_info (video_file, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
                                   G_FILE_QUERY_INFO_NONE, NULL, &error);

    if (error != NULL) {
        g_error ("Error getting video file information: %s", error->message);
        g_error_free (error);
        g_object_unref (video_file);
        g_object_unref (service);
        return;
    }

    slug = g_file_info_get_display_name (file_info);
    content_type = g_file_info_get_content_type (file_info);

    /* Get an input stream for the file */
    file_stream = g_file_read (video_file, NULL, &error);

    g_object_unref (video_file);

    if (error != NULL) {
        g_error ("Error getting video file stream: %s", error->message);
        g_error_free (error);
        g_object_unref (file_info);
        g_object_unref (service);
        return;
    }

    /* Create the video to upload */
    video = gdata_youtube_video_new (NULL);

    gdata_entry_set_title (GDATA_ENTRY (video), "Video Title");
    gdata_youtube_video_set_description (video, "Video description.");
    gdata_youtube_video_set_keywords (video, video_tags);

    category = gdata_media_category_new ("People", "http://gdata.youtube.com/schemas/2007/categories.cat", NULL);
    gdata_youtube_video_set_category (video, category);
    g_object_unref (category);

    /* Get an upload stream for the video */
    upload_stream = gdata_youtube_service_upload_video (service, video, slug, content_type, NULL, &error);

    g_object_unref (video);
    g_object_unref (file_info);

    if (error != NULL) {
        g_error ("Error getting upload stream: %s", error->message);
        g_error_free (error);
        g_object_unref (file_stream);
        g_object_unref (service);
        return;
    }

    /* Upload the video. This is a blocking operation, and should normally be done asynchronously. */
    g_output_stream_splice (G_OUTPUT_STREAM (upload_stream), G_INPUT_STREAM (file_stream),
                            G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, NULL, &error);

    g_object_unref (file_stream);

    if (error != NULL) {
        g_error ("Error splicing streams: %s", error->message);
        g_error_free (error);
        g_object_unref (upload_stream);
        g_object_unref (service);
        return;
    }

    /* Finish off the upload by parsing the returned updated video entry */
    uploaded_video = gdata_youtube_service_finish_video_upload (service, upload_stream, &error);

    g_object_unref (upload_stream);
    g_object_unref (service);

    if (error != NULL) {
        g_error ("Error uploading video: %s", error->message);
        g_error_free (error);
        return;
    }

    /* Do something with the uploaded video */

    g_object_unref (uploaded_video);

Example 12. Querying for Videos from a Standard Feed

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    GDataYouTubeService *service;
    GDataFeed *feed;
    GList *i;
    GError *error = NULL;

    /* Create a service */
    service = create_youtube_service ();

    /* Query for the top page of videos in the most popular feed */
    feed = gdata_youtube_service_query_standard_feed (service, GDATA_YOUTUBE_MOST_POPULAR_FEED, NULL, NULL, NULL, NULL, &error);

    g_object_unref (service);

    if (error != NULL) {
        g_error ("Error querying for most popular videos: %s", error->message);
        g_error_free (error);
        return;
    }

    /* Iterate through the videos */
    for (i = gdata_feed_get_entries (feed); i != NULL; i = i->next) {
        GDataYouTubeVideo *video = GDATA_YOUTUBE_VIDEO (i->data);

        /* Do something with the video, like insert it into the UI */
    }

    g_object_unref (feed);

Example 13. Querying for Videos using Search Terms

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    GDataYouTubeService *service;
    GDataYouTubeQuery *query;
    GDataFeed *feed;
    GList *i;
    GError *error = NULL;

    /* Create a service */
    service = create_youtube_service ();

    /* Build a query with the given search terms, also matching only videos which are CC-licensed */
    query = gdata_youtube_query_new (my_space_separated_search_terms);
    gdata_youtube_query_set_license (query, GDATA_YOUTUBE_LICENSE_CC);

    /* Query for the videos matching the query parameters */
    feed = gdata_youtube_service_query_videos (service, query, NULL, NULL, NULL, &error);

    g_object_unref (query);
    g_object_unref (service);

    if (error != NULL) {
        g_error ("Error querying for videos matching search terms ‘%s’: %s", my_space_separated_search_terms, error->message);
        g_error_free (error);
        return;
    }

    /* Iterate through the videos */
    for (i = gdata_feed_get_entries (feed); i != NULL; i = i->next) {
        GDataYouTubeVideo *video = GDATA_YOUTUBE_VIDEO (i->data);

        /* Do something with the video, like insert it into the UI */
    }

    g_object_unref (feed);

## Details

### GDataYouTubeService

    typedef struct _GDataYouTubeService GDataYouTubeService;

All the fields in the GDataYouTubeService structure are private and should never be accessed directly.

### GDataYouTubeServiceClass

    typedef struct {
    } GDataYouTubeServiceClass;

All the fields in the GDataYouTubeServiceClass structure are private and should never be accessed directly.

### enum GDataYouTubeServiceError

    typedef enum {
    	GDATA_YOUTUBE_SERVICE_ERROR_API_QUOTA_EXCEEDED,
    	GDATA_YOUTUBE_SERVICE_ERROR_ENTRY_QUOTA_EXCEEDED
    } GDataYouTubeServiceError;

Error codes for GDataYouTubeService operations.

`GDATA_YOUTUBE_SERVICE_ERROR_API_QUOTA_EXCEEDED` | the API request quota for this developer account has been exceeded
`GDATA_YOUTUBE_SERVICE_ERROR_ENTRY_QUOTA_EXCEEDED` | the entry (e.g. video) quota for this user account has been exceeded

### enum GDataYouTubeStandardFeedType

    typedef enum {
    	GDATA_YOUTUBE_TOP_RATED_FEED,
    	GDATA_YOUTUBE_TOP_FAVORITES_FEED,
    	GDATA_YOUTUBE_MOST_VIEWED_FEED,
    	GDATA_YOUTUBE_MOST_POPULAR_FEED,
    	GDATA_YOUTUBE_MOST_RECENT_FEED,
    	GDATA_YOUTUBE_MOST_DISCUSSED_FEED,
    	GDATA_YOUTUBE_MOST_LINKED_FEED,
    	GDATA_YOUTUBE_MOST_RESPONDED_FEED,
    	GDATA_YOUTUBE_RECENTLY_FEATURED_FEED,
    	GDATA_YOUTUBE_WATCH_ON_MOBILE_FEED
    } GDataYouTubeStandardFeedType;

Standard feed types for standard feed queries with `gdata_youtube_service_query_standard_feed()`. For more information, see the online documentation.

`GDATA_YOUTUBE_TOP_RATED_FEED` | This feed contains the most highly rated YouTube videos.
`GDATA_YOUTUBE_TOP_FAVORITES_FEED` | This feed contains videos most frequently flagged as favorite videos.
`GDATA_YOUTUBE_MOST_VIEWED_FEED` | This feed contains the most frequently watched YouTube videos.
`GDATA_YOUTUBE_MOST_POPULAR_FEED` | This feed contains the most popular YouTube videos, selected using an algorithm that combines many different signals to determine overall popularity.
`GDATA_YOUTUBE_MOST_RECENT_FEED` | This feed contains the videos most recently submitted to YouTube.
`GDATA_YOUTUBE_MOST_DISCUSSED_FEED` | This feed contains the YouTube videos that have received the most comments.
`GDATA_YOUTUBE_MOST_LINKED_FEED` | This feed contains the YouTube videos that receive the most links from other websites.
`GDATA_YOUTUBE_MOST_RESPONDED_FEED` | This feed contains YouTube videos that receive the most video responses.
`GDATA_YOUTUBE_RECENTLY_FEATURED_FEED` | This feed contains videos recently featured on the YouTube home page or featured videos tab.
`GDATA_YOUTUBE_WATCH_ON_MOBILE_FEED` | This feed contains videos suitable for playback on mobile devices.

### gdata_youtube_service_new ()

    GDataYouTubeService * gdata_youtube_service_new         (const gchar *developer_key,
                                                             GDataAuthorizer *authorizer);

Creates a new GDataYouTubeService using the given GDataAuthorizer. If `authorizer` is `NULL`, all requests are made as an unauthenticated user. The `developer_key` must be unique for your application, and as registered with Google.

`developer_key` : | your application's developer API key
`authorizer` : | a GDataAuthorizer to authorize the service's requests, or `NULL`. [allow-none]
Returns : | a new GDataYouTubeService, or `NULL`; unref with `g_object_unref()`

Since 0.9.0

### gdata_youtube_service_get_primary_authorization_domain ()

    GDataAuthorizationDomain * gdata_youtube_service_get_primary_authorization_domain
                                                            (void);

The primary GDataAuthorizationDomain for interacting with YouTube. This will not normally need to be used, as it's used internally by the GDataYouTubeService methods. However, if using the plain GDataService methods to implement custom queries or requests which libgdata does not support natively, then this domain may be needed to authorize the requests.

The domain never changes, and is interned so that pointer comparison can be used to differentiate it from other authorization domains.

Returns : | the service's authorization domain. [transfer none]

Since 0.9.0

### gdata_youtube_service_query_videos ()

    GDataFeed *         gdata_youtube_service_query_videos  (GDataYouTubeService *self,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GError **error);

Queries the service for videos matching the parameters set on the GDataQuery. This searches site-wide, and imposes no other restrictions or parameters on the query.

Parameters and errors are as for `gdata_service_query()`.

`self` : | a GDataYouTubeService
`query` : | a GDataQuery with the query parameters, or `NULL`. [allow-none]
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`progress_callback` : | a GDataQueryProgressCallback to call when an entry is loaded, or `NULL`. [allow-none][scope call][closure progress_user_data]
`progress_user_data` : | data to pass to the `progress_callback` function. [closure]
`error` : | a GError, or `NULL`
Returns : | a GDataFeed of query results, or `NULL`; unref with `g_object_unref()`. [transfer full]

### gdata_youtube_service_query_videos_async ()

    void                gdata_youtube_service_query_videos_async
                                                            (GDataYouTubeService *self,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GDestroyNotify destroy_progress_user_data,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Queries the service for videos matching the parameters set on the GDataQuery. This searches site-wide, and imposes no other restrictions or parameters on the query. `self` and `query` are both reffed when this function is called, so can safely be freed after this function returns.

For more details, see `gdata_youtube_service_query_videos()`, which is the synchronous version of this function.

When the operation is finished, `callback` will be called. You can then call `gdata_service_query_finish()` to get the results of the operation.

`self` : | a GDataService
`query` : | a GDataQuery with the query parameters, or `NULL`. [allow-none]
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`progress_callback` : | a GDataQueryProgressCallback to call when an entry is loaded, or `NULL`. [allow-none][closure progress_user_data]
`progress_user_data` : | data to pass to the `progress_callback` function. [closure]
`destroy_progress_user_data` : | the function to call when `progress_callback` will not be called any more, or `NULL`. This function will be called with `progress_user_data` as a parameter and can be used to free any memory allocated for it. [allow-none]
`callback` : | a GAsyncReadyCallback to call when authentication is finished
`user_data` : | data to pass to the `callback` function. [closure]

Since 0.9.1

### gdata_youtube_service_query_related ()

    GDataFeed *         gdata_youtube_service_query_related (GDataYouTubeService *self,
                                                             GDataYouTubeVideo *video,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GError **error);

Queries the service for videos related to `video`. The algorithm determining which videos are related is on the server side.

If `video` does not have a link with rel value `http://gdata.youtube.com/schemas/2007video.related`, a `GDATA_SERVICE_ERROR_PROTOCOL_ERROR` error will be thrown. Parameters and other errors are as for `gdata_service_query()`.

`self` : | a GDataYouTubeService
`video` : | a GDataYouTubeVideo for which to find related videos
`query` : | a GDataQuery with the query parameters, or `NULL`. [allow-none]
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`progress_callback` : | a GDataQueryProgressCallback to call when an entry is loaded, or `NULL`. [allow-none][scope call][closure progress_user_data]
`progress_user_data` : | data to pass to the `progress_callback` function. [closure]
`error` : | a GError, or `NULL`
Returns : | a GDataFeed of query results; unref with `g_object_unref()`. [transfer full]

### gdata_youtube_service_query_related_async ()

    void                gdata_youtube_service_query_related_async
                                                            (GDataYouTubeService *self,
                                                             GDataYouTubeVideo *video,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GDestroyNotify destroy_progress_user_data,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Queries the service for videos related to `video`. The algorithm determining which videos are related is on the server side. `self` and `query` are both reffed when this function is called, so can safely be freed after this function returns.

For more details, see `gdata_youtube_service_query_related()`, which is the synchronous version of this function.

When the operation is finished, `callback` will be called. You can then call `gdata_service_query_finish()` to get the results of the operation.

`self` : | a GDataService
`video` : | a GDataYouTubeVideo for which to find related videos
`query` : | a GDataQuery with the query parameters, or `NULL`. [allow-none]
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`progress_callback` : | a GDataQueryProgressCallback to call when an entry is loaded, or `NULL`. [allow-none][closure progress_user_data]
`progress_user_data` : | data to pass to the `progress_callback` function. [closure]
`destroy_progress_user_data` : | the function to call when `progress_callback` will not be called any more, or `NULL`. This function will be called with `progress_user_data` as a parameter and can be used to free any memory allocated for it. [allow-none]
`callback` : | a GAsyncReadyCallback to call when authentication is finished
`user_data` : | data to pass to the `callback` function. [closure]

Since 0.9.1

### gdata_youtube_service_query_standard_feed ()

    GDataFeed *         gdata_youtube_service_query_standard_feed
                                                            (GDataYouTubeService *self,
                                                             GDataYouTubeStandardFeedType feed_type,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GError **error);

Queries the service's standard `feed_type` feed to build a GDataFeed.

Parameters and errors are as for `gdata_service_query()`.

`self` : | a GDataYouTubeService
`feed_type` : | the feed type to query, from GDataYouTubeStandardFeedType
`query` : | a GDataQuery with the query parameters, or `NULL`. [allow-none]
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`progress_callback` : | a GDataQueryProgressCallback to call when an entry is loaded, or `NULL`. [allow-none][scope call][closure progress_user_data]
`progress_user_data` : | data to pass to the `progress_callback` function. [closure]
`error` : | a GError, or `NULL`
Returns : | a GDataFeed of query results, or `NULL`; unref with `g_object_unref()`. [transfer full]

### gdata_youtube_service_query_standard_feed_async ()

    void                gdata_youtube_service_query_standard_feed_async
                                                            (GDataYouTubeService *self,
                                                             GDataYouTubeStandardFeedType feed_type,
                                                             GDataQuery *query,
                                                             GCancellable *cancellable,
                                                             GDataQueryProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GDestroyNotify destroy_progress_user_data,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Queries the service's standard `feed_type` feed to build a GDataFeed. `self` and `query` are both reffed when this function is called, so can safely be freed after this function returns.

For more details, see `gdata_youtube_service_query_standard_feed()`, which is the synchronous version of this function.

When the operation is finished, `callback` will be called. You can then call `gdata_service_query_finish()` to get the results of the operation.

`self` : | a GDataService
`feed_type` : | the feed type to query, from GDataYouTubeStandardFeedType
`query` : | a GDataQuery with the query parameters, or `NULL`. [allow-none]
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`progress_callback` : | a GDataQueryProgressCallback to call when an entry is loaded, or `NULL`. [allow-none][closure progress_user_data]
`progress_user_data` : | data to pass to the `progress_callback` function. [closure]
`destroy_progress_user_data` : | the function to call when `progress_callback` will not be called any more, or `NULL`. This function will be called with `progress_user_data` as a parameter and can be used to free any memory allocated for it. [allow-none]
`callback` : | a GAsyncReadyCallback to call when authentication is finished
`user_data` : | data to pass to the `callback` function. [closure]

Since 0.9.1

### gdata_youtube_service_upload_video ()

    GDataUploadStream * gdata_youtube_service_upload_video  (GDataYouTubeService *self,
                                                             GDataYouTubeVideo *video,
                                                             const gchar *slug,
                                                             const gchar *content_type,
                                                             GCancellable *cancellable,
                                                             GError **error);

Uploads a video to YouTube, using the properties from `video` and the file data written to the resulting GDataUploadStream.

If `video` has already been inserted, a `GDATA_SERVICE_ERROR_ENTRY_ALREADY_INSERTED` error will be returned. If no user is authenticated with the service, `GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED` will be returned.

The stream returned by this function should be written to using the standard GOutputStream methods, asychronously or synchronously. Once the stream is closed (using `g_output_stream_close()`), `gdata_youtube_service_finish_video_upload()` should be called on it to parse and return the updated GDataYouTubeVideo for the uploaded video. This must be done, as `video` isn't updated in-place.

In order to cancel the upload, a GCancellable passed in to `cancellable` must be cancelled using `g_cancellable_cancel()`. Cancelling the individual GOutputStream operations on the GDataUploadStream will not cancel the entire upload; merely the write or close operation in question. See the "cancellable" for more details.

Any upload errors will be thrown by the stream methods, and may come from the GDataServiceError domain.

`self` : | a GDataYouTubeService
`video` : | a GDataYouTubeVideo to insert
`slug` : | the filename to give to the uploaded file
`content_type` : | the content type of the uploaded data
`cancellable` : | a GCancellable for the entire upload stream, or `NULL`. [allow-none]
`error` : | a GError, or `NULL`
Returns : | a GDataUploadStream to write the video data to, or `NULL`; unref with `g_object_unref()`. [transfer full]

Since 0.8.0

### gdata_youtube_service_finish_video_upload ()

    GDataYouTubeVideo * gdata_youtube_service_finish_video_upload
                                                            (GDataYouTubeService *self,
                                                             GDataUploadStream *upload_stream,
                                                             GError **error);

Finish off a video upload operation started by `gdata_youtube_service_upload_video()`, parsing the result and returning the new GDataYouTubeVideo.

If an error occurred during the upload operation, it will have been returned during the operation (e.g. by `g_output_stream_splice()` or one of the other stream methods). In such a case, `NULL` will be returned but `error` will remain unset. `error` is only set in the case that the server indicates that the operation was successful, but an error is encountered in parsing the result sent by the server.

`self` : | a GDataYouTubeService
`upload_stream` : | the GDataUploadStream from the operation
`error` : | a GError, or `NULL`
Returns : | the new GDataYouTubeVideo, or `NULL`; unref with `g_object_unref()`. [transfer full]

Since 0.8.0

### gdata_youtube_service_get_categories ()

    GDataAPPCategories * gdata_youtube_service_get_categories
                                                            (GDataYouTubeService *self,
                                                             GCancellable *cancellable,
                                                             GError **error);

Gets a list of the categories currently in use on YouTube. The returned GDataAPPCategories contains a list of GDataYouTubeCategorys which enumerate the current YouTube categories.

The category labels ("label") are localised based on the value of "locale".

`self` : | a GDataYouTubeService
`cancellable` : | a GCancellable, or `NULL`. [allow-none]
`error` : | a GError, or `NULL`
Returns : | a GDataAPPCategories, or `NULL`; unref with `g_object_unref()`. [transfer full]

Since 0.7.0

### gdata_youtube_service_get_categories_async ()

    void                gdata_youtube_service_get_categories_async
                                                            (GDataYouTubeService *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Gets a list of the categories currently in use on YouTube. `self` is reffed when this function is called, so can safely be unreffed after this function returns.

For more details, see `gdata_youtube_service_get_categories()`, which is the synchronous version of this function.

When the operation is finished, `callback` will be called. You can then call `gdata_youtube_service_get_categories_finish()` to get the results of the operation.

`self` : | a GDataYouTubeService
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is finished
`user_data` : | data to pass to the `callback` function. [closure]

Since 0.7.0

### gdata_youtube_service_get_categories_finish ()

    GDataAPPCategories * gdata_youtube_service_get_categories_finish
                                                            (GDataYouTubeService *self,
                                                             GAsyncResult *async_result,
                                                             GError **error);

Finishes an asynchronous request for a list of categories on YouTube, as started with `gdata_youtube_service_get_categories_async()`.

`self` : | a GDataYouTubeService
`async_result` : | a GAsyncResult
`error` : | a GError, or `NULL`
Returns : | a GDataAPPCategories, or `NULL`; unref with `g_object_unref()`. [transfer full]

Since 0.7.0

### gdata_youtube_service_get_developer_key ()

    const gchar *       gdata_youtube_service_get_developer_key
                                                            (GDataYouTubeService *self);

Gets the "developer-key" property from the GDataYouTubeService.

`self` : | a GDataYouTubeService
Returns : | the developer key property

## Property Details

### The `"developer-key"` property

      "developer-key"            gchar*                : Read / Write / Construct Only

The developer key your application has registered with the YouTube API. For more information, see the online documentation.

Default value: NULL