From 7ad077d0cf034d745a3bd31be4dd7cce0e35700a Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Mon, 2 Oct 2023 17:34:56 +0200 Subject: [PATCH] delete row & delete column & fix tables code in api base --- .../Client/Apps/Tables/OcsApiTables.cs | 10 ++++ .../Client/Apps/Tables/TablesClient.cs | 48 ++++++++++++++++++- .../Client/ClientBase.cs | 25 ---------- 3 files changed, 57 insertions(+), 26 deletions(-) diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/Tables/OcsApiTables.cs b/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/Tables/OcsApiTables.cs index ac1bdcb..64483a4 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/Tables/OcsApiTables.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/Tables/OcsApiTables.cs @@ -44,5 +44,15 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables { return Manager.MakeRequest(HttpMethod.Get, OCS_TABLES_COLUMN.FillParameters(columnId)); } + + public Row? DeleteRow(long rowId) + { + return Manager.MakeRequest(HttpMethod.Delete, OCS_TABLES_ROW.FillParameters(rowId)); + } + + public Column? DeleteColumn(long columnId) + { + return Manager.MakeRequest(HttpMethod.Delete, OCS_TABLES_COLUMN.FillParameters(columnId)); + } } } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/Tables/TablesClient.cs b/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/Tables/TablesClient.cs index 4b2fdea..d88fcd2 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/Tables/TablesClient.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/Tables/TablesClient.cs @@ -1,4 +1,5 @@ -using System; +using Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables.Model; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -11,5 +12,50 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables public TablesClient(NextcloudClient client) : base(client) { } + + public RowsSimple? GetRowsSimple(long tableId) + { + return Client.Ocs.GetApi().GetRowsSimple(tableId); + } + + public Rows? GetRows(long tableId) + { + return Client.Ocs.GetApi().GetRows(tableId); + } + + public Row? GetRow(long rowId) + { + return Client.Ocs.GetApi().GetRow(rowId); + } + + public Columns? GetColumns(long tableId) + { + return Client.Ocs.GetApi().GetColumns(tableId); + } + + public Column? GetColumn(long columnId) + { + return Client.Ocs.GetApi().GetColumn(columnId); + } + + public bool DeleteRow(long rowId) + { + return DeleteRowAdv(rowId) is not null; + } + + public Row? DeleteRowAdv(long rowId) + { + return Client.Ocs.GetApi().DeleteRow(rowId); + } + + public bool DeleteColumn(long columnId) + { + return DeleteColumnAdv(columnId) is not null; + } + + public Column? DeleteColumnAdv(long columnId) + { + return Client.Ocs.GetApi().DeleteColumn(columnId); + } } } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Client/ClientBase.cs b/Pilz.Networking.CloudProviders.Nextcloud/Client/ClientBase.cs index f1c9d9b..7c32dad 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Client/ClientBase.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Client/ClientBase.cs @@ -16,30 +16,5 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client { Client = client; } - - public RowsSimple? GetRowsSimple(long tableId) - { - return Client.Ocs.GetApi().GetRowsSimple(tableId); - } - - public Rows? GetRows(long tableId) - { - return Client.Ocs.GetApi().GetRows(tableId); - } - - public Row? GetRow(long rowId) - { - return Client.Ocs.GetApi().GetRow(rowId); - } - - public Columns? GetColumns(long tableId) - { - return Client.Ocs.GetApi().GetColumns(tableId); - } - - public Column? GetColumn(long columnId) - { - return Client.Ocs.GetApi().GetColumn(columnId); - } } }