ZpjSkydrive

ZpjSkydrive — Skydrive service object.

Synopsis

#include <zpj/zpj.h>

struct              ZpjSkydrive;
struct              ZpjSkydriveClass;
gboolean            zpj_skydrive_create_folder          (ZpjSkydrive *self,
                                                         ZpjSkydriveFolder *folder,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            zpj_skydrive_create_folder_from_name
                                                        (ZpjSkydrive *self,
                                                         const gchar *name,
                                                         const gchar *parent_id,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            zpj_skydrive_delete_entry_id        (ZpjSkydrive *self,
                                                         const gchar *entry_id,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            zpj_skydrive_download_file_id_to_path
                                                        (ZpjSkydrive *self,
                                                         const gchar *file_id,
                                                         const gchar *path,
                                                         GCancellable *cancellable,
                                                         GError **error);
GInputStream *      zpj_skydrive_download_file_id_to_stream
                                                        (ZpjSkydrive *self,
                                                         const gchar *file_id,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                zpj_skydrive_download_file_id_to_stream_async
                                                        (ZpjSkydrive *self,
                                                         const gchar *file_id,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
GInputStream *      zpj_skydrive_download_file_id_to_stream_finish
                                                        (ZpjSkydrive *self,
                                                         GAsyncResult *res,
                                                         GError **error);
gboolean            zpj_skydrive_download_file_to_path  (ZpjSkydrive *self,
                                                         ZpjSkydriveFile *file,
                                                         const gchar *path,
                                                         GCancellable *cancellable,
                                                         GError **error);
GInputStream *      zpj_skydrive_download_file_to_stream
                                                        (ZpjSkydrive *self,
                                                         ZpjSkydriveFile *file,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                zpj_skydrive_download_file_to_stream_async
                                                        (ZpjSkydrive *self,
                                                         ZpjSkydriveFile *file,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
GInputStream *      zpj_skydrive_download_file_to_stream_finish
                                                        (ZpjSkydrive *self,
                                                         GAsyncResult *res,
                                                         GError **error);
ZpjAuthorizer *     zpj_skydrive_get_authorizer         (ZpjSkydrive *self);
GList *             zpj_skydrive_list_folder            (ZpjSkydrive *self,
                                                         ZpjSkydriveFolder *folder,
                                                         GCancellable *cancellable,
                                                         GError **error);
GList *             zpj_skydrive_list_folder_id         (ZpjSkydrive *self,
                                                         const gchar *folder_id,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                zpj_skydrive_list_folder_id_async   (ZpjSkydrive *self,
                                                         const gchar *folder_id,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
GList *             zpj_skydrive_list_folder_id_finish  (ZpjSkydrive *self,
                                                         GAsyncResult *res,
                                                         GError **error);
ZpjSkydrive *       zpj_skydrive_new                    (ZpjAuthorizer *authorizer);
ZpjSkydriveEntry *  zpj_skydrive_query_info_from_id     (ZpjSkydrive *self,
                                                         const gchar *id,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                zpj_skydrive_query_info_from_id_async
                                                        (ZpjSkydrive *self,
                                                         const gchar *id,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
ZpjSkydriveEntry *  zpj_skydrive_query_info_from_id_finish
                                                        (ZpjSkydrive *self,
                                                         GAsyncResult *res,
                                                         GError **error);
void                zpj_skydrive_set_authorizer         (ZpjSkydrive *self,
                                                         ZpjAuthorizer *authorizer);
gboolean            zpj_skydrive_upload_path_to_folder  (ZpjSkydrive *self,
                                                         const gchar *path,
                                                         ZpjSkydriveFolder *folder,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            zpj_skydrive_upload_path_to_folder_id
                                                        (ZpjSkydrive *self,
                                                         const gchar *path,
                                                         const gchar *folder_id,
                                                         GCancellable *cancellable,
                                                         GError **error);

Object Hierarchy

  GObject
   +----ZpjSkydrive

Properties

  "authorizer"               ZpjAuthorizer*        : Read / Write / Construct

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.

Details

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.

GObjectClass parent_class;

The parent class.

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.

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_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.

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_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.

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.

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().

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_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.

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_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.

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.

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().

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_get_authorizer ()

ZpjAuthorizer *     zpj_skydrive_get_authorizer         (ZpjSkydrive *self);

Gets the authorizer used to authorize requests to self.

self :

A ZpjSkydrive.

Returns :

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

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.

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.

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.

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().

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_new ()

ZpjSkydrive *       zpj_skydrive_new                    (ZpjAuthorizer *authorizer);

Creates a new ZpjSkydrive using the given authorizer.

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_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.

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.

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().

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.

self :

A ZpjSkydrive.

authorizer :

A new ZpjAuthorizer.

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.

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.

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.

Property Details

The "authorizer" property

  "authorizer"               ZpjAuthorizer*        : Read / Write / Construct

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