ZpjSkydrive: Zapojit Reference Manual

## ZpjSkydrive ZpjSkydrive — Skydrive service object. |

## Functions

ZpjSkydrive * | zpj_skydrive_new ()
gboolean | zpj_skydrive_create_folder ()
gboolean | zpj_skydrive_create_folder_from_name ()
gboolean | zpj_skydrive_delete_entry_id ()
GInputStream * | zpj_skydrive_download_file_id_to_stream ()
void | zpj_skydrive_download_file_id_to_stream_async ()
GInputStream * | zpj_skydrive_download_file_id_to_stream_finish ()
GInputStream * | zpj_skydrive_download_file_to_stream ()
void | zpj_skydrive_download_file_to_stream_async ()
GInputStream * | zpj_skydrive_download_file_to_stream_finish ()
gboolean | zpj_skydrive_download_file_id_to_path ()
gboolean | zpj_skydrive_download_file_to_path ()
GList * | zpj_skydrive_list_folder ()
GList * | zpj_skydrive_list_folder_id ()
void | zpj_skydrive_list_folder_id_async ()
GList * | zpj_skydrive_list_folder_id_finish ()
ZpjAuthorizer * | zpj_skydrive_get_authorizer ()
ZpjSkydriveEntry * | zpj_skydrive_query_info_from_id ()
void | zpj_skydrive_query_info_from_id_async ()
ZpjSkydriveEntry * | zpj_skydrive_query_info_from_id_finish ()
void | zpj_skydrive_set_authorizer ()
GInputStream * | zpj_skydrive_thumbnail_file_id_to_stream ()
gboolean | zpj_skydrive_upload_path_to_folder ()
gboolean | zpj_skydrive_upload_path_to_folder_id ()

## Properties

ZpjAuthorizer * | authorizer | Read / Write / Construct

## Types and Values

enum | ZpjThumbnailSize
struct | ZpjSkydrive
struct | ZpjSkydriveClass

## Object Hierarchy

        GObject
        ╰── ZpjSkydrive

## Includes

    #include <zpj/zpj.h>

## Description

ZpjSkydrive represents the

Skydrive file hosting service. It has to be used with an

implementation of ZpjAuthorizer.

Currently it supports the following operations:

- Deleting a file, folder or photo.

- Listing the contents of a folder.

- Reading the properties of a file, folder or photo.

- Uploading files and photos.

## Functions

### zpj_skydrive_new ()

    ZpjSkydrive *
    zpj_skydrive_new (ZpjAuthorizer *authorizer);

Creates a new ZpjSkydrive using the given `authorizer` .

#### Parameters

authorizer | A ZpjAuthorizer to authorize the service's requests. |

#### Returns

A new ZpjSkydrive. Free the returned object with `g_object_unref()`.

[transfer full]

### zpj_skydrive_create_folder ()

    gboolean
    zpj_skydrive_create_folder (ZpjSkydrive *self,
                                ZpjSkydriveFolder *folder,
                                GCancellable *cancellable,
                                GError **error);

### zpj_skydrive_create_folder_from_name ()

    gboolean
    zpj_skydrive_create_folder_from_name (ZpjSkydrive *self,
                                          const gchar *name,
                                          const gchar *parent_id,
                                          GCancellable *cancellable,
                                          GError **error);

### zpj_skydrive_delete_entry_id ()

    gboolean
    zpj_skydrive_delete_entry_id (ZpjSkydrive *self,
                                  const gchar *entry_id,
                                  GCancellable *cancellable,
                                  GError **error);

Synchronously deletes the entry corresponding to `entry_id` from

Skydrive.

#### Parameters

self | A ZpjSkydrive. |
entry_id | The ID of the ZpjSkydriveEntry to be deleted. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

`TRUE` if the ZpjSkydriveEntry was deleted successfully.

### zpj_skydrive_download_file_id_to_stream ()

    GInputStream *
    zpj_skydrive_download_file_id_to_stream
                                   (ZpjSkydrive *self,
                                    const gchar *file_id,
                                    GCancellable *cancellable,
                                    GError **error);

Synchronously returns a stream for downloading the file corresponding to `file_id` from

Skydrive. See

zpj_skydrive_download_file_id_to_stream_async() for the asynchronous version of this call.

#### Parameters

self | A ZpjSkydrive. |
file_id | The ID of the ZpjSkydriveFile to be downloaded. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

A GInputStream to read the file data from. Free the returned object with `g_object_unref()`.

[transfer full]

### zpj_skydrive_download_file_id_to_stream_async ()

    void
    zpj_skydrive_download_file_id_to_stream_async
                                   (ZpjSkydrive *self,
                                    const gchar *file_id,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Asynchronously returns a stream for downloading the file corresponding to `file_id` from

Skydrive. See `zpj_skydrive_download_file_id_to_stream()` for

the synchronous version of this call.

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

#### Parameters

self | A ZpjSkydrive. |
file_id | The ID of the ZpjSkydriveFile to be downloaded. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied. | [scope async]
user_data | The data to pass to `callback` . | [closure]

### zpj_skydrive_download_file_id_to_stream_finish ()

    GInputStream *
    zpj_skydrive_download_file_id_to_stream_finish
                                   (ZpjSkydrive *self,
                                    GAsyncResult *res,
                                    GError **error);

Finishes an asynchronous operation started with `zpj_skydrive_download_file_id_to_stream_async()`.

#### Parameters

self | A ZpjSkydrive. |
res | A GAsyncResult. |
error | An optional GError, or `NULL`. | [allow-none]

#### Returns

A GInputStream to read the file data from. Free the returned object with `g_object_unref()`.

[transfer full]

### zpj_skydrive_download_file_to_stream ()

    GInputStream *
    zpj_skydrive_download_file_to_stream (ZpjSkydrive *self,
                                          ZpjSkydriveFile *file,
                                          GCancellable *cancellable,
                                          GError **error);

Synchronously returns a stream for downloading `file` from

Skydrive. See `zpj_skydrive_download_file_to_stream_async()`

for the asynchronous version of this call.

#### Parameters

self | A ZpjSkydrive. |
file | The ZpjSkydriveFile to be downloaded. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

A GInputStream to read the file data from. Free the returned object with `g_object_unref()`.

[transfer full]

### zpj_skydrive_download_file_to_stream_async ()

    void
    zpj_skydrive_download_file_to_stream_async
                                   (ZpjSkydrive *self,
                                    ZpjSkydriveFile *file,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Asynchronously returns a stream for downloading `file` from

Skydrive. See `zpj_skydrive_download_file_to_stream()` for the

synchronous version of this call.

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

#### Parameters

self | A ZpjSkydrive. |
file | The ZpjSkydriveFile to be downloaded. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied. | [scope async]
user_data | The data to pass to `callback` . | [closure]

### zpj_skydrive_download_file_to_stream_finish ()

    GInputStream *
    zpj_skydrive_download_file_to_stream_finish
                                   (ZpjSkydrive *self,
                                    GAsyncResult *res,
                                    GError **error);

Finishes an asynchronous operation started with `zpj_skydrive_download_file_to_stream_async()`.

#### Parameters

self | A ZpjSkydrive. |
res | A GAsyncResult. |
error | An optional GError, or `NULL`. | [allow-none]

#### Returns

A GInputStream to read the file data from. Free the returned object with `g_object_unref()`.

[transfer full]

### zpj_skydrive_download_file_id_to_path ()

    gboolean
    zpj_skydrive_download_file_id_to_path (ZpjSkydrive *self,
                                           const gchar *file_id,
                                           const gchar *path,
                                           GCancellable *cancellable,
                                           GError **error);

Synchronously downloads the file corresponding to `file_id` from

Skydrive and saves it in `path`. The file is temporarily

saved in the preferred directory for temporary files (as returned by `g_get_tmp_dir()`) while the download is going on, and then moved to `path` .

#### Parameters

self | A ZpjSkydrive. |
file_id | The ID of the ZpjSkydriveFile to be downloaded. |
path | The destination. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

`TRUE` if the ZpjSkydriveFile was downloaded successfully.

### zpj_skydrive_download_file_to_path ()

    gboolean
    zpj_skydrive_download_file_to_path (ZpjSkydrive *self,
                                        ZpjSkydriveFile *file,
                                        const gchar *path,
                                        GCancellable *cancellable,
                                        GError **error);

Synchronously downloads `file` from

Skydrive and saves it in `path`. The file is temporarily

saved in the preferred directory for temporary files (as returned by `g_get_tmp_dir()`) while the download is going on, and then moved to `path` .

#### Parameters

self | A ZpjSkydrive. |
file | The ZpjSkydriveFile to be downloaded. |
path | The destination. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

`TRUE` if the ZpjSkydriveFile was downloaded successfully.

### zpj_skydrive_list_folder ()

    GList *
    zpj_skydrive_list_folder (ZpjSkydrive *self,
                              ZpjSkydriveFolder *folder,
                              GCancellable *cancellable,
                              GError **error);

Synchronously lists the contents of `folder_id` from

Skydrive.

#### Parameters

self | A ZpjSkydrive. |
folder | The ZpjSkydriveFolder to be listed. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

A list of the ZpjSkydrive entries within the ZpjSkydriveFolder. Free the returned list with `g_list_free()` after each element has been freed with `g_object_unref()`.

[transfer full][element-type ZpjSkydriveEntry]

### zpj_skydrive_list_folder_id ()

    GList *
    zpj_skydrive_list_folder_id (ZpjSkydrive *self,
                                 const gchar *folder_id,
                                 GCancellable *cancellable,
                                 GError **error);

Synchronously lists the contents of the folder corresponding to `folder_id` from

Skydrive.

#### Parameters

self | A ZpjSkydrive. |
folder_id | The ID of the ZpjSkydriveFolder to be listed. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

A list of the ZpjSkydrive entries within the ZpjSkydriveFolder, or `NULL` on error. Free the returned list with `g_list_free()` after each element has been freed with `g_object_unref()`.

[transfer full][element-type ZpjSkydriveEntry]

### zpj_skydrive_list_folder_id_async ()

    void
    zpj_skydrive_list_folder_id_async (ZpjSkydrive *self,
                                       const gchar *folder_id,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

Asynchronously lists the contents of the folder corresponding to `folder_id` from

Skydrive. See `zpj_skydrive_list_folder_id()` for the

synchronous version of this call.

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

#### Parameters

self | A ZpjSkydrive. |
folder_id | The ID of the ZpjSkydriveFolder to be listed. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied. | [scope async]
user_data | The data to pass to `callback` . | [closure]

### zpj_skydrive_list_folder_id_finish ()

    GList *
    zpj_skydrive_list_folder_id_finish (ZpjSkydrive *self,
                                        GAsyncResult *res,
                                        GError **error);

Finishes an asynchronous operation started with `zpj_skydrive_list_folder_id_async()`.

#### Parameters

self | A ZpjSkydrive. |
res | A GAsyncResult. |
error | An optional GError, or `NULL`. | [allow-none]

#### Returns

A list of the ZpjSkydrive entries within the ZpjSkydriveFolder, or `NULL` on error. Free the returned list with `g_list_free()` after each element has been freed with `g_object_unref()`.

[transfer full][element-type ZpjSkydriveEntry]

### zpj_skydrive_get_authorizer ()

    ZpjAuthorizer *
    zpj_skydrive_get_authorizer (ZpjSkydrive *self);

Gets the authorizer used to authorize requests to `self` .

#### Parameters

self | A ZpjSkydrive. |

#### Returns

A ZpjAuthorizer. The returned object is owned by ZpjSkydrive and should not be modified or freed.

[transfer none]

### zpj_skydrive_query_info_from_id ()

    ZpjSkydriveEntry *
    zpj_skydrive_query_info_from_id (ZpjSkydrive *self,
                                     const gchar *id,
                                     GCancellable *cancellable,
                                     GError **error);

Synchronously reads the properties of the entry corresponding to `id` from

Skydrive. See `zpj_skydrive_query_info_from_id_async()` for

the asynchronous version of this call.

#### Parameters

self | A ZpjSkydrive. |
id | An ID to be queried. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

A new ZpjSkydriveEntry. Free the returned object with `g_object_unref()`.

[transfer full]

### zpj_skydrive_query_info_from_id_async ()

    void
    zpj_skydrive_query_info_from_id_async (ZpjSkydrive *self,
                                           const gchar *id,
                                           GCancellable *cancellable,
                                           GAsyncReadyCallback callback,
                                           gpointer user_data);

Asynchronously reads the properties of the entry corresponding to `id` from

Skydrive. See `zpj_skydrive_query_info_from_id()` for the

synchronous version of this call.

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

#### Parameters

self | A ZpjSkydrive. |
id | The ID to be queried. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied. | [scope async]
user_data | The data to pass to `callback` . | [closure]

### zpj_skydrive_query_info_from_id_finish ()

    ZpjSkydriveEntry *
    zpj_skydrive_query_info_from_id_finish
                                   (ZpjSkydrive *self,
                                    GAsyncResult *res,
                                    GError **error);

Finishes an asynchronous operation started with `zpj_skydrive_query_info_from_id_async()`.

#### Parameters

self | A ZpjSkydrive. |
res | A GAsyncResult. |
error | An optional GError, or `NULL`. | [allow-none]

#### Returns

A new ZpjSkydriveEntry. Free the returned object with `g_object_unref()`.

[transfer full]

### zpj_skydrive_set_authorizer ()

    void
    zpj_skydrive_set_authorizer (ZpjSkydrive *self,
                                 ZpjAuthorizer *authorizer);

Uses the new `authorizer` to replace the old one that was used to authorize requests to `self` .

#### Parameters

self | A ZpjSkydrive. |
authorizer | A new ZpjAuthorizer. |

### zpj_skydrive_thumbnail_file_id_to_stream ()

    GInputStream *
    zpj_skydrive_thumbnail_file_id_to_stream
                                   (ZpjSkydrive *self,
                                    const gchar *file_id,
                                    ZpjThumbnailSize size,
                                    GCancellable *cancellable,
                                    GError **error);

Synchronously returns a stream for downloading the thumbnail of the file corresponding to `file_id` from

Skydrive. See

zpj_skydrive_thumbnail_file_id_to_stream_async() for the asynchronous version of this call.

Thumbnails are only available for ZpjSkydrivePhoto and ZpjSkydriveVideo objects. If `file_id` refers to some other kind of ZpjSkydriveFile, the error `ZPJ_ERROR_REQUEST_URL_INVALID` will be returned.

#### Parameters

self | A ZpjSkydrive. |
file_id | The ID of the ZpjSkydriveFile to be thumbnailed. |
size | The thumbnail size. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

A GInputStream to read the thumbnail data from. Free the returned object with `g_object_unref()`.

[transfer full]

### zpj_skydrive_upload_path_to_folder ()

    gboolean
    zpj_skydrive_upload_path_to_folder (ZpjSkydrive *self,
                                        const gchar *path,
                                        ZpjSkydriveFolder *folder,
                                        GCancellable *cancellable,
                                        GError **error);

Synchronously uploads the file at `path` to

Skydrive and places it under `folder`.

#### Parameters

self | A ZpjSkydrive. |
path | The source. |
folder | The destination ZpjSkydriveFolder. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

`TRUE` if the file was uploaded successfully.

### zpj_skydrive_upload_path_to_folder_id ()

    gboolean
    zpj_skydrive_upload_path_to_folder_id (ZpjSkydrive *self,
                                           const gchar *path,
                                           const gchar *folder_id,
                                           GCancellable *cancellable,
                                           GError **error);

Synchronously uploads the file at `path` to

Skydrive and places it under the folder corresponding to

`folder_id` .

#### Parameters

self | A ZpjSkydrive. |
path | The source. |
folder_id | The ID of the destination ZpjSkydriveFolder. |
cancellable | An optional GCancellable object, or `NULL`. | [allow-none]
error | An optional `GError` or `NULL`. | [allow-none]

#### Returns

`TRUE` if the file was uploaded successfully.

## Types and Values

### enum ZpjThumbnailSize

Different

thumbnail sizes offered by SkyDrive.

This enumeration can be expanded at a later date.

#### Members

ZPJ_THUMBNAIL_SIZE_SMALL | Smallest possible size. |
ZPJ_THUMBNAIL_SIZE_NORMAL | The default. |

### struct ZpjSkydrive

    struct ZpjSkydrive;

The ZpjSkydrive structure contains only private data and should only be accessed using the provided API.

### struct ZpjSkydriveClass

    struct ZpjSkydriveClass {
      GObjectClass parent_class;
    };

Class structure for ZpjSkydrive.

#### Members

## Property Details

### The `“authorizer”` property

      “authorizer”               ZpjAuthorizer *

An authorizer object to provide an access token for each request.

Owner: ZpjSkydrive

Flags: Read / Write / Construct