From 84dde640903e7a517db716c978399b7877933ab2 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 26 Apr 2023 11:13:00 +0200 Subject: [PATCH] specs,nextcloud: Add endpoint for deleting app password --- .../nextcloud/lib/src/nextcloud.openapi.dart | 24 +++++++++++++++++++ .../nextcloud/lib/src/nextcloud.openapi.json | 20 ++++++++++++++++ specs/core.json | 20 ++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index ef49897d..db9e6912 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -433,6 +433,30 @@ class NextcloudCoreClient { } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } + + Future deleteAppPassword() async { + const path = '/ocs/v2.php/core/apppassword'; + final queryParameters = {}; + final headers = { + 'Accept': 'application/json', + }; + Uint8List? body; + if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { + headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); + } else { + throw Exception('Missing authentication for basic_auth'); + } + final response = await rootClient.doRequest( + 'delete', + Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw NextcloudApiException.fromResponse(response); // coverage:ignore-line + } } class NextcloudNewsClient { diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.json b/packages/nextcloud/lib/src/nextcloud.openapi.json index f41dcb88..3b7e4a4f 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.json +++ b/packages/nextcloud/lib/src/nextcloud.openapi.json @@ -2343,6 +2343,26 @@ } } }, + "/ocs/v2.php/core/apppassword": { + "delete": { + "tags": [ + "core" + ], + "operationId": "delete-app-password", + "responses": { + "200": { + "description": "App password deleted successfully", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, "/index.php/apps/news/api": { "get": { "operationId": "get-supported-api-versions", diff --git a/specs/core.json b/specs/core.json index a88c14d2..6ed8a375 100644 --- a/specs/core.json +++ b/specs/core.json @@ -1318,6 +1318,26 @@ } } } + }, + "/ocs/v2.php/core/apppassword": { + "delete": { + "tags": [ + "core" + ], + "operationId": "delete-app-password", + "responses": { + "200": { + "description": "App password deleted successfully", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } } } }