TablesClient: add views api calls

This commit is contained in:
2024-01-03 09:16:03 +01:00
parent 6e6eb6b8f6
commit 942fd82ca0
2 changed files with 27 additions and 0 deletions

View File

@@ -12,8 +12,10 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables
public class OcsApiTables : OcsApiBase public class OcsApiTables : OcsApiBase
{ {
public static readonly OcsApiUrlPath OCS_TABLES_TABLE_ROWS = new("/apps/tables/api/1/tables/{0}/rows"); public static readonly OcsApiUrlPath OCS_TABLES_TABLE_ROWS = new("/apps/tables/api/1/tables/{0}/rows");
public static readonly OcsApiUrlPath OCS_TABLES_VIEW_ROWS = new("/apps/tables/api/1/views/{0}/rows");
public static readonly OcsApiUrlPath OCS_TABLES_TABLE_ROWS_SIMPLE = new("/apps/tables/api/1/tables/{0}/rows/simple"); public static readonly OcsApiUrlPath OCS_TABLES_TABLE_ROWS_SIMPLE = new("/apps/tables/api/1/tables/{0}/rows/simple");
public static readonly OcsApiUrlPath OCS_TABLES_TABLE_COLUMNS = new("/apps/tables/api/1/tables/{0}/columns"); public static readonly OcsApiUrlPath OCS_TABLES_TABLE_COLUMNS = new("/apps/tables/api/1/tables/{0}/columns");
public static readonly OcsApiUrlPath OCS_TABLES_VIEW_COLUMNS = new("/apps/tables/api/1/views/{0}/columns");
public static readonly OcsApiUrlPath OCS_TABLES_ROW = new("/apps/tables/api/1/rows/{0}"); public static readonly OcsApiUrlPath OCS_TABLES_ROW = new("/apps/tables/api/1/rows/{0}");
public static readonly OcsApiUrlPath OCS_TABLES_COLUMN = new("/apps/tables/api/1/column/{0}"); public static readonly OcsApiUrlPath OCS_TABLES_COLUMN = new("/apps/tables/api/1/column/{0}");
@@ -31,6 +33,11 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables
return Manager.MakeRequest<Rows>(HttpMethod.Get, OCS_TABLES_TABLE_ROWS.FillParameters(tableId)); return Manager.MakeRequest<Rows>(HttpMethod.Get, OCS_TABLES_TABLE_ROWS.FillParameters(tableId));
} }
public Rows? GetViewRows(long viewId)
{
return Manager.MakeRequest<Rows>(HttpMethod.Get, OCS_TABLES_VIEW_ROWS.FillParameters(viewId));
}
public Row? GetRow(long rowId) public Row? GetRow(long rowId)
{ {
return Manager.MakeRequest<Row>(HttpMethod.Get, OCS_TABLES_ROW.FillParameters(rowId)); return Manager.MakeRequest<Row>(HttpMethod.Get, OCS_TABLES_ROW.FillParameters(rowId));
@@ -41,6 +48,11 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables
return Manager.MakeRequest<Columns>(HttpMethod.Get, OCS_TABLES_TABLE_COLUMNS.FillParameters(tableId)); return Manager.MakeRequest<Columns>(HttpMethod.Get, OCS_TABLES_TABLE_COLUMNS.FillParameters(tableId));
} }
public Columns? GetViewColumns(long viewId)
{
return Manager.MakeRequest<Columns>(HttpMethod.Get, OCS_TABLES_VIEW_COLUMNS.FillParameters(viewId));
}
public Column? GetColumn(long columnId) public Column? GetColumn(long columnId)
{ {
return Manager.MakeRequest<Column>(HttpMethod.Get, OCS_TABLES_COLUMN.FillParameters(columnId)); return Manager.MakeRequest<Column>(HttpMethod.Get, OCS_TABLES_COLUMN.FillParameters(columnId));
@@ -65,5 +77,10 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables
{ {
return Manager.MakeRequest<Row>(HttpMethod.Post, OCS_TABLES_TABLE_ROWS.FillParameters(tableId), content: values); return Manager.MakeRequest<Row>(HttpMethod.Post, OCS_TABLES_TABLE_ROWS.FillParameters(tableId), content: values);
} }
public Row? CreateViewRow(long viewId, RowUpdate values)
{
return Manager.MakeRequest<Row>(HttpMethod.Post, OCS_TABLES_VIEW_ROWS.FillParameters(viewId), content: values);
}
} }
} }

View File

@@ -23,6 +23,11 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables
return Client.Ocs.GetApi<OcsApiTables>().GetRows(tableId); return Client.Ocs.GetApi<OcsApiTables>().GetRows(tableId);
} }
public Rows? GetViewRows(long viewId)
{
return Client.Ocs.GetApi<OcsApiTables>().GetViewRows(viewId);
}
public Row? GetRow(long rowId) public Row? GetRow(long rowId)
{ {
return Client.Ocs.GetApi<OcsApiTables>().GetRow(rowId); return Client.Ocs.GetApi<OcsApiTables>().GetRow(rowId);
@@ -33,6 +38,11 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps.Tables
return Client.Ocs.GetApi<OcsApiTables>().GetColumns(tableId); return Client.Ocs.GetApi<OcsApiTables>().GetColumns(tableId);
} }
public Columns? GetViewColumns(long viewId)
{
return Client.Ocs.GetApi<OcsApiTables>().GetViewColumns(viewId);
}
public Column? GetColumn(long columnId) public Column? GetColumn(long columnId)
{ {
return Client.Ocs.GetApi<OcsApiTables>().GetColumn(columnId); return Client.Ocs.GetApi<OcsApiTables>().GetColumn(columnId);