GDataDocumentsText

## GDataDocumentsText GDataDocumentsText — GData Documents text object |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <gdata/services/documents/gdata-documents-text.h>

                        GDataDocumentsText;
                        GDataDocumentsTextClass;
    enum                GDataDocumentsTextFormat;
    GDataDocumentsText * gdata_documents_text_new           (const gchar *id);
    GFile *             gdata_documents_text_download_document
                                                            (GDataDocumentsText *self,
                                                             GDataDocumentsService *service,
                                                             gchar **content_type,
                                                             GDataDocumentsTextFormat export_format,
                                                             GFile *destination_file,
                                                             gboolean replace_file_if_exists,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gchar *             gdata_documents_text_get_download_uri
                                                            (GDataDocumentsText *self,
                                                             GDataDocumentsTextFormat export_format);

## Object Hierarchy

      GObject
       +----GDataParsable
             +----GDataEntry
                   +----GDataDocumentsEntry
                         +----GDataDocumentsText

## Implemented Interfaces

GDataDocumentsText implements GDataAccessHandler.

## Description

GDataDocumentsText is a subclass of GDataDocumentsEntry to represent a text document from Google Documents.

For more details of Google Documents' GData API, see the online documentation.

## Details

### GDataDocumentsText

    typedef struct _GDataDocumentsText GDataDocumentsText;

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

Since 0.4.0

### GDataDocumentsTextClass

    typedef struct {
    } GDataDocumentsTextClass;

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

Since 0.4.0

### enum GDataDocumentsTextFormat

    typedef enum {
    	GDATA_DOCUMENTS_TEXT_DOC = 0,
    	GDATA_DOCUMENTS_TEXT_HTML,
    	GDATA_DOCUMENTS_TEXT_ODT,
    	GDATA_DOCUMENTS_TEXT_PDF,
    	GDATA_DOCUMENTS_TEXT_PNG,
    	GDATA_DOCUMENTS_TEXT_RTF,
    	GDATA_DOCUMENTS_TEXT_TXT,
    	GDATA_DOCUMENTS_TEXT_ZIP,
    } GDataDocumentsTextFormat;

The different available download formats for text documents.

`GDATA_DOCUMENTS_TEXT_DOC` | Microsoft Word (DOC) format
`GDATA_DOCUMENTS_TEXT_HTML` | HyperText Markup Language (HTML) format
`GDATA_DOCUMENTS_TEXT_ODT` | OpenDocument Text (ODT) format
`GDATA_DOCUMENTS_TEXT_PDF` | Portable Document Format (PDF)
`GDATA_DOCUMENTS_TEXT_PNG` | Portable Network Graphics (PNG) image format
`GDATA_DOCUMENTS_TEXT_RTF` | Rich Text Format (RTF)
`GDATA_DOCUMENTS_TEXT_TXT` | plain text format
`GDATA_DOCUMENTS_TEXT_ZIP` | ZIP archive containing images and exported HTML

Since 0.4.0

### gdata_documents_text_new ()

    GDataDocumentsText * gdata_documents_text_new           (const gchar *id);

Creates a new GDataDocumentsText with the given entry ID ("id").

`id` : | the entry's ID (not the document ID of the text document), or `NULL`. [allow-none]
Returns : | a new GDataDocumentsText, or `NULL`; unref with `g_object_unref()`

Since 0.4.0

### gdata_documents_text_download_document ()

    GFile *             gdata_documents_text_download_document
                                                            (GDataDocumentsText *self,
                                                             GDataDocumentsService *service,
                                                             gchar **content_type,
                                                             GDataDocumentsTextFormat export_format,
                                                             GFile *destination_file,
                                                             gboolean replace_file_if_exists,
                                                             GCancellable *cancellable,
                                                             GError **error);

Downloads and returns the text document file represented by the GDataDocumentsText. If the document doesn't exist, `NULL` is returned, but no error is set in `error`. TODO: What?

If `cancellable` is not `NULL`, then the operation can be cancelled by triggering the `cancellable` object from another thread. If the operation was cancelled, the error `G_IO_ERROR_CANCELLED` will be returned.

If `destination_file` is a directory, then the file will be downloaded in this directory with the "title" with the apropriate extension as name.

If there is an error getting the document, a `GDATA_SERVICE_ERROR_PROTOCOL_ERROR` error will be returned.

`self` : | a GDataDocumentsText
`service` : | a GDataDocumentsService
`content_type` : | return location for the document's content type, or `NULL`; free with `g_free()`. [out callee-allocates][transfer full][allow-none]
`export_format` : | the format in which the text document should be exported
`destination_file` : | the GFile into which the text file should be saved
`replace_file_if_exists` : | `TRUE` if the file should be replaced if it already exists, `FALSE` otherwise
`cancellable` : | optional GCancellable object, or `NULL`
`error` : | a GError, or `NULL`
Returns : | the document's data, or `NULL`; unref with `g_object_unref()`. [transfer full]

Since 0.4.0

### gdata_documents_text_get_download_uri ()

    gchar *             gdata_documents_text_get_download_uri
                                                            (GDataDocumentsText *self,
                                                             GDataDocumentsTextFormat export_format);

Builds and returns the download URI for the given GDataDocumentsText in the desired format. Note that directly downloading the document using this URI isn't possible, as authentication is required. You should instead use `gdata_download_stream_new()` with the URI, and use the resulting GInputStream.

`self` : | a GDataDocumentsText
`export_format` : | the format in which the document should be exported when downloaded
Returns : | the download URI; free with `g_free()`

Since 0.5.0