From 69b225a173de5102070259eadef5cc283b2487bc Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 25 Sep 2022 01:21:19 +0200 Subject: [PATCH] specs,nextcloud: Add news API versions operation --- .../nextcloud/lib/src/nextcloud.openapi.dart | 35 +++++++++++++++++++ .../lib/src/nextcloud.openapi.g.dart | 8 +++++ .../nextcloud/lib/src/nextcloud.openapi.json | 28 +++++++++++++++ specs/news.json | 28 +++++++++++++++ 4 files changed, 99 insertions(+) diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 2579d12f..a9312f59 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -1485,6 +1485,17 @@ class CoreClient { } } +@JsonSerializable() +class GetSupportedApiVersions { + GetSupportedApiVersions({this.apiLevels}); + + factory GetSupportedApiVersions.fromJson(Map json) => _$GetSupportedApiVersionsFromJson(json); + + final List? apiLevels; + + Map toJson() => _$GetSupportedApiVersionsToJson(this); +} + @JsonSerializable() class NewsArticle { NewsArticle({ @@ -1673,6 +1684,23 @@ class NewsClient { final Client rootClient; + Future getSupportedApiVersions() async { + var path = '/apps/news/api'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return GetSupportedApiVersions.fromJson(json.decode(utf8.decode(response.body)) as Map); + } + throw ApiException.fromResponse(response); + } + Future listFolders() async { var path = '/apps/news/api/v1-2/folders'; final queryParameters = {}; @@ -3894,6 +3922,10 @@ final _deserializers = { List: (final data) => (data as List) .map((final e) => CoreLoginFlowResult.fromJson(e as Map)) .toList(), + GetSupportedApiVersions: (final data) => GetSupportedApiVersions.fromJson(data as Map), + List: (final data) => (data as List) + .map((final e) => GetSupportedApiVersions.fromJson(e as Map)) + .toList(), NewsListFolders: (final data) => NewsListFolders.fromJson(data as Map), List: (final data) => (data as List).map((final e) => NewsListFolders.fromJson(e as Map)).toList(), @@ -4376,6 +4408,9 @@ final _serializers = { CoreLoginFlowResult: (final data) => (data as CoreLoginFlowResult).toJson(), List: (final data) => (data as List).map((final e) => (e as CoreLoginFlowResult).toJson()).toList(), + GetSupportedApiVersions: (final data) => (data as GetSupportedApiVersions).toJson(), + List: (final data) => + (data as List).map((final e) => (e as GetSupportedApiVersions).toJson()).toList(), NewsListFolders: (final data) => (data as NewsListFolders).toJson(), List: (final data) => (data as List).map((final e) => (e as NewsListFolders).toJson()).toList(), diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.g.dart b/packages/nextcloud/lib/src/nextcloud.openapi.g.dart index 84e60386..f3a750b3 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.g.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.g.dart @@ -1036,6 +1036,14 @@ Map _$CoreLoginFlowResultToJson(CoreLoginFlowResult instance) = 'appPassword': instance.appPassword, }; +GetSupportedApiVersions _$GetSupportedApiVersionsFromJson(Map json) => GetSupportedApiVersions( + apiLevels: (json['apiLevels'] as List?)?.map((e) => e as String).toList(), + ); + +Map _$GetSupportedApiVersionsToJson(GetSupportedApiVersions instance) => { + 'apiLevels': instance.apiLevels, + }; + NewsArticle _$NewsArticleFromJson(Map json) => NewsArticle( id: json['id'] as int?, guid: json['guid'] as String?, diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.json b/packages/nextcloud/lib/src/nextcloud.openapi.json index 1249ec74..2cbdb43f 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.json +++ b/packages/nextcloud/lib/src/nextcloud.openapi.json @@ -1819,6 +1819,34 @@ } } }, + "/apps/news/api": { + "get": { + "operationId": "get-supported-api-versions", + "tags": [ + "news" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "apiLevels": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, "/apps/news/api/v1-2/folders": { "get": { "operationId": "list-folders", diff --git a/specs/news.json b/specs/news.json index d384bcef..f27d15bd 100644 --- a/specs/news.json +++ b/specs/news.json @@ -236,6 +236,34 @@ } }, "paths": { + "/apps/news/api": { + "get": { + "operationId": "get-supported-api-versions", + "tags": [ + "news" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "apiLevels": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, "/apps/news/api/v1-2/folders": { "get": { "operationId": "list-folders",