Line |
Branch |
Exec |
Source |
1 |
|
|
/* cc-snapd-client.h |
2 |
|
|
* |
3 |
|
|
* Copyright 2023 Canonical Ltd. |
4 |
|
|
* |
5 |
|
|
* This program is free software: you can redistribute it and/or modify |
6 |
|
|
* it under the terms of the GNU General Public License as published by |
7 |
|
|
* the Free Software Foundation, either version 3 of the License, or |
8 |
|
|
* (at your option) any later version. |
9 |
|
|
* |
10 |
|
|
* This program is distributed in the hope that it will be useful, |
11 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
|
|
* GNU General Public License for more details. |
14 |
|
|
* |
15 |
|
|
* You should have received a copy of the GNU General Public License |
16 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 |
|
|
* |
18 |
|
|
* SPDX-License-Identifier: GPL-3.0-or-later |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#pragma once |
22 |
|
|
|
23 |
|
|
#include <json-glib/json-glib.h> |
24 |
|
|
|
25 |
|
|
G_BEGIN_DECLS |
26 |
|
|
|
27 |
|
|
#define CC_TYPE_SNAPD_CLIENT (cc_snapd_client_get_type()) |
28 |
|
✗ |
G_DECLARE_FINAL_TYPE (CcSnapdClient, cc_snapd_client, CC, SNAPD_CLIENT, GObject) |
29 |
|
|
|
30 |
|
|
// Creates a client to contact snapd. |
31 |
|
|
CcSnapdClient *cc_snapd_client_new (void); |
32 |
|
|
|
33 |
|
|
// Get information on an installed snap. |
34 |
|
|
JsonObject *cc_snapd_client_get_snap_sync (CcSnapdClient *client, |
35 |
|
|
const gchar *name, |
36 |
|
|
GCancellable *cancellable, |
37 |
|
|
GError **error); |
38 |
|
|
|
39 |
|
|
// Get information on a snap change. |
40 |
|
|
JsonObject *cc_snapd_client_get_change_sync (CcSnapdClient *client, |
41 |
|
|
const gchar *change_id, |
42 |
|
|
GCancellable *cancellable, |
43 |
|
|
GError **error); |
44 |
|
|
|
45 |
|
|
// Get the state of the snap interface connections. |
46 |
|
|
gboolean cc_snapd_client_get_all_connections_sync (CcSnapdClient *client, |
47 |
|
|
JsonArray **plugs, |
48 |
|
|
JsonArray **slots, |
49 |
|
|
GCancellable *cancellable, |
50 |
|
|
GError **error); |
51 |
|
|
|
52 |
|
|
// Connect a plug to a slot. Returns the change ID to monitor for completion of this task. |
53 |
|
|
gchar *cc_snapd_client_connect_interface_sync (CcSnapdClient *client, |
54 |
|
|
const gchar *plug_snap, |
55 |
|
|
const gchar *plug_name, |
56 |
|
|
const gchar *slot_snap, |
57 |
|
|
const gchar *slot_name, |
58 |
|
|
GCancellable *cancellable, |
59 |
|
|
GError **error); |
60 |
|
|
|
61 |
|
|
// Disconnect a plug to a slot. Returns the change ID to monitor for completion of this task. |
62 |
|
|
gchar *cc_snapd_client_disconnect_interface_sync (CcSnapdClient *client, |
63 |
|
|
const gchar *plug_snap, |
64 |
|
|
const gchar *plug_name, |
65 |
|
|
const gchar *slot_snap, |
66 |
|
|
const gchar *slot_name, |
67 |
|
|
GCancellable *cancellable, |
68 |
|
|
GError **error); |
69 |
|
|
|
70 |
|
|
G_END_DECLS |
71 |
|
|
|