Bump version number
[platform/upstream/libsecret.git] / libsecret / secret-item.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_ITEM_H__
20 #define __SECRET_ITEM_H__
21
22 #include <gio/gio.h>
23
24 #include "secret-item.h"
25 #include "secret-service.h"
26 #include "secret-value.h"
27
28 G_BEGIN_DECLS
29
30 typedef enum {
31         SECRET_ITEM_NONE,
32         SECRET_ITEM_LOAD_SECRET = 1 << 1
33 } SecretItemFlags;
34
35 typedef enum {
36         SECRET_ITEM_CREATE_NONE = 0,
37         SECRET_ITEM_CREATE_REPLACE = 1 << 1
38 } SecretItemCreateFlags;
39
40 #define SECRET_TYPE_ITEM            (secret_item_get_type ())
41 #define SECRET_ITEM(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_ITEM, SecretItem))
42 #define SECRET_ITEM_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_ITEM, SecretItemClass))
43 #define SECRET_IS_ITEM(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_ITEM))
44 #define SECRET_IS_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_ITEM))
45 #define SECRET_ITEM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_ITEM, SecretItemClass))
46
47 typedef struct _SecretItemClass   SecretItemClass;
48 typedef struct _SecretItemPrivate   SecretItemPrivate;
49
50 struct _SecretItem {
51         GDBusProxy parent_instance;
52
53         /*< private >*/
54         SecretItemPrivate *pv;
55 };
56
57 struct _SecretItemClass {
58         GDBusProxyClass parent_class;
59
60         /*< private >*/
61         gpointer padding[4];
62 };
63
64 GType               secret_item_get_type                   (void) G_GNUC_CONST;
65
66 void                secret_item_refresh                    (SecretItem *self);
67
68 void                secret_item_create                     (SecretCollection *collection,
69                                                             const SecretSchema *schema,
70                                                             GHashTable *attributes,
71                                                             const gchar *label,
72                                                             SecretValue *value,
73                                                             SecretItemCreateFlags flags,
74                                                             GCancellable *cancellable,
75                                                             GAsyncReadyCallback callback,
76                                                             gpointer user_data);
77
78 SecretItem *        secret_item_create_finish              (GAsyncResult *result,
79                                                             GError **error);
80
81 SecretItem *        secret_item_create_sync                (SecretCollection *collection,
82                                                             const SecretSchema *schema,
83                                                             GHashTable *attributes,
84                                                             const gchar *label,
85                                                             SecretValue *value,
86                                                             SecretItemCreateFlags flags,
87                                                             GCancellable *cancellable,
88                                                             GError **error);
89
90 void                secret_item_delete                     (SecretItem *self,
91                                                             GCancellable *cancellable,
92                                                             GAsyncReadyCallback callback,
93                                                             gpointer user_data);
94
95 gboolean            secret_item_delete_finish              (SecretItem *self,
96                                                             GAsyncResult *result,
97                                                             GError **error);
98
99 gboolean            secret_item_delete_sync                (SecretItem *self,
100                                                             GCancellable *cancellable,
101                                                             GError **error);
102
103 SecretItemFlags     secret_item_get_flags                  (SecretItem *self);
104
105 SecretService *     secret_item_get_service                (SecretItem *self);
106
107 SecretValue *       secret_item_get_secret                 (SecretItem *self);
108
109 void                secret_item_load_secret                (SecretItem *self,
110                                                             GCancellable *cancellable,
111                                                             GAsyncReadyCallback callback,
112                                                             gpointer user_data);
113
114 gboolean            secret_item_load_secret_finish         (SecretItem *self,
115                                                             GAsyncResult *result,
116                                                             GError **error);
117
118 gboolean            secret_item_load_secret_sync           (SecretItem *self,
119                                                             GCancellable *cancellable,
120                                                             GError **error);
121
122 void                secret_item_load_secrets               (GList *items,
123                                                             GCancellable *cancellable,
124                                                             GAsyncReadyCallback callback,
125                                                             gpointer user_data);
126
127 gboolean            secret_item_load_secrets_finish        (GAsyncResult *result,
128                                                             GError **error);
129
130 gboolean            secret_item_load_secrets_sync          (GList *items,
131                                                             GCancellable *cancellable,
132                                                             GError **error);
133
134 void                secret_item_set_secret                 (SecretItem *self,
135                                                             SecretValue *value,
136                                                             GCancellable *cancellable,
137                                                             GAsyncReadyCallback callback,
138                                                             gpointer user_data);
139
140 gboolean            secret_item_set_secret_finish          (SecretItem *self,
141                                                             GAsyncResult *result,
142                                                             GError **error);
143
144 gboolean            secret_item_set_secret_sync            (SecretItem *self,
145                                                             SecretValue *value,
146                                                             GCancellable *cancellable,
147                                                             GError **error);
148
149 gchar *             secret_item_get_schema_name            (SecretItem *self);
150
151 GHashTable*         secret_item_get_attributes             (SecretItem *self);
152
153 void                secret_item_set_attributes             (SecretItem *self,
154                                                             const SecretSchema *schema,
155                                                             GHashTable *attributes,
156                                                             GCancellable *cancellable,
157                                                             GAsyncReadyCallback callback,
158                                                             gpointer user_data);
159
160 gboolean            secret_item_set_attributes_finish      (SecretItem *self,
161                                                             GAsyncResult *result,
162                                                             GError **error);
163
164 gboolean            secret_item_set_attributes_sync        (SecretItem *self,
165                                                             const SecretSchema *schema,
166                                                             GHashTable *attributes,
167                                                             GCancellable *cancellable,
168                                                             GError **error);
169
170 gchar *             secret_item_get_label                  (SecretItem *self);
171
172 void                secret_item_set_label                  (SecretItem *self,
173                                                             const gchar *label,
174                                                             GCancellable *cancellable,
175                                                             GAsyncReadyCallback callback,
176                                                             gpointer user_data);
177
178 gboolean            secret_item_set_label_finish           (SecretItem *self,
179                                                             GAsyncResult *result,
180                                                             GError **error);
181
182 gboolean            secret_item_set_label_sync             (SecretItem *self,
183                                                             const gchar *label,
184                                                             GCancellable *cancellable,
185                                                             GError **error);
186
187 gboolean            secret_item_get_locked                 (SecretItem *self);
188
189 guint64             secret_item_get_created                (SecretItem *self);
190
191 guint64             secret_item_get_modified               (SecretItem *self);
192
193 G_END_DECLS
194
195 #endif /* __SECRET_ITEM_H___ */