Rename the library subdirectory to libsecret
[platform/upstream/libsecret.git] / libsecret / secret-collection.h
1 /* libsecret - GLib wrapper for Secret Service
2  *
3  * Copyright 2012 Red Hat Inc.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation; either version 2.1 of the licence or (at
8  * your option) any later version.
9  *
10  * See the included COPYING file for more information.
11  *
12  * Author: Stef Walter <stefw@gnome.org>
13  */
14
15 #if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
16 #error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
17 #endif
18
19 #ifndef __SECRET_COLLECTION_H__
20 #define __SECRET_COLLECTION_H__
21
22 #include <gio/gio.h>
23
24 #include "secret-schema.h"
25 #include "secret-types.h"
26
27 G_BEGIN_DECLS
28
29 typedef enum {
30         SECRET_COLLECTION_NONE = 0,
31         SECRET_COLLECTION_LOAD_ITEMS = 1 << 1,
32 } SecretCollectionFlags;
33
34 typedef enum {
35         SECRET_COLLECTION_CREATE_NONE = 0,
36 } SecretCollectionCreateFlags;
37
38 #define SECRET_TYPE_COLLECTION            (secret_collection_get_type ())
39 #define SECRET_COLLECTION(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_COLLECTION, SecretCollection))
40 #define SECRET_COLLECTION_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_COLLECTION, SecretCollectionClass))
41 #define SECRET_IS_COLLECTION(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_COLLECTION))
42 #define SECRET_IS_COLLECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_COLLECTION))
43 #define SECRET_COLLECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_COLLECTION, SecretCollectionClass))
44
45 typedef struct _SecretCollectionClass   SecretCollectionClass;
46 typedef struct _SecretCollectionPrivate SecretCollectionPrivate;
47
48 struct _SecretCollection {
49         GDBusProxy parent;
50
51         /*< private >*/
52         SecretCollectionPrivate *pv;
53 };
54
55 struct _SecretCollectionClass {
56         GDBusProxyClass parent_class;
57
58         /*< private >*/
59         gpointer padding[8];
60 };
61
62 GType               secret_collection_get_type                 (void) G_GNUC_CONST;
63
64 void                secret_collection_for_alias                (SecretService *service,
65                                                                 const gchar *alias,
66                                                                 GCancellable *cancellable,
67                                                                 GAsyncReadyCallback callback,
68                                                                 gpointer user_data);
69
70 SecretCollection *  secret_collection_for_alias_finish         (GAsyncResult *result,
71                                                                 GError **error);
72
73 SecretCollection *  secret_collection_for_alias_sync           (SecretService *service,
74                                                                 const gchar *alias,
75                                                                 GCancellable *cancellable,
76                                                                 GError **error);
77
78 void                secret_collection_load_items               (SecretCollection *self,
79                                                                 GCancellable *cancellable,
80                                                                 GAsyncReadyCallback callback,
81                                                                 gpointer user_data);
82
83 gboolean            secret_collection_load_items_finish        (SecretCollection *self,
84                                                                 GAsyncResult *result,
85                                                                 GError **error);
86
87 gboolean            secret_collection_load_items_sync          (SecretCollection *self,
88                                                                 GCancellable *cancellable,
89                                                                 GError **error);
90
91 void                secret_collection_refresh                  (SecretCollection *self);
92
93 void                secret_collection_create                   (SecretService *service,
94                                                                 const gchar *label,
95                                                                 const gchar *alias,
96                                                                 SecretCollectionCreateFlags flags,
97                                                                 GCancellable *cancellable,
98                                                                 GAsyncReadyCallback callback,
99                                                                 gpointer user_data);
100
101 SecretCollection *  secret_collection_create_finish            (GAsyncResult *result,
102                                                                 GError **error);
103
104 SecretCollection *  secret_collection_create_sync              (SecretService *service,
105                                                                 const gchar *label,
106                                                                 const gchar *alias,
107                                                                 SecretCollectionCreateFlags flags,
108                                                                 GCancellable *cancellable,
109                                                                 GError **error);
110
111 void                secret_collection_search                   (SecretCollection *self,
112                                                                 const SecretSchema *schema,
113                                                                 GHashTable *attributes,
114                                                                 SecretSearchFlags flags,
115                                                                 GCancellable *cancellable,
116                                                                 GAsyncReadyCallback callback,
117                                                                 gpointer user_data);
118
119 GList *             secret_collection_search_finish            (SecretCollection *self,
120                                                                 GAsyncResult *result,
121                                                                 GError **error);
122
123 GList *             secret_collection_search_sync              (SecretCollection *self,
124                                                                 const SecretSchema *schema,
125                                                                 GHashTable *attributes,
126                                                                 SecretSearchFlags flags,
127                                                                 GCancellable *cancellable,
128                                                                 GError **error);
129
130 void                secret_collection_delete                   (SecretCollection *self,
131                                                                 GCancellable *cancellable,
132                                                                 GAsyncReadyCallback callback,
133                                                                 gpointer user_data);
134
135 gboolean            secret_collection_delete_finish            (SecretCollection *self,
136                                                                 GAsyncResult *result,
137                                                                 GError **error);
138
139 gboolean            secret_collection_delete_sync              (SecretCollection *self,
140                                                                 GCancellable *cancellable,
141                                                                 GError **error);
142
143 SecretService *     secret_collection_get_service              (SecretCollection *self);
144
145 SecretCollectionFlags secret_collection_get_flags              (SecretCollection *self);
146
147 GList *             secret_collection_get_items                (SecretCollection *self);
148
149 gchar *             secret_collection_get_label                (SecretCollection *self);
150
151 void                secret_collection_set_label                (SecretCollection *self,
152                                                                 const gchar *label,
153                                                                 GCancellable *cancellable,
154                                                                 GAsyncReadyCallback callback,
155                                                                 gpointer user_data);
156
157 gboolean            secret_collection_set_label_finish         (SecretCollection *self,
158                                                                 GAsyncResult *result,
159                                                                 GError **error);
160
161 gboolean            secret_collection_set_label_sync           (SecretCollection *self,
162                                                                 const gchar *label,
163                                                                 GCancellable *cancellable,
164                                                                 GError **error);
165
166 gboolean            secret_collection_get_locked               (SecretCollection *self);
167
168 guint64             secret_collection_get_created              (SecretCollection *self);
169
170 guint64             secret_collection_get_modified             (SecretCollection *self);
171
172 G_END_DECLS
173
174 #endif /* __SECRET_COLLECTION_H___ */