Browse Source

specs,nextcloud: Add news API versions operation

pull/62/head
jld3103 2 years ago
parent
commit
69b225a173
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 35
      packages/nextcloud/lib/src/nextcloud.openapi.dart
  2. 8
      packages/nextcloud/lib/src/nextcloud.openapi.g.dart
  3. 28
      packages/nextcloud/lib/src/nextcloud.openapi.json
  4. 28
      specs/news.json

35
packages/nextcloud/lib/src/nextcloud.openapi.dart

@ -1485,6 +1485,17 @@ class CoreClient {
}
}
@JsonSerializable()
class GetSupportedApiVersions {
GetSupportedApiVersions({this.apiLevels});
factory GetSupportedApiVersions.fromJson(Map<String, dynamic> json) => _$GetSupportedApiVersionsFromJson(json);
final List<String>? apiLevels;
Map<String, dynamic> toJson() => _$GetSupportedApiVersionsToJson(this);
}
@JsonSerializable()
class NewsArticle {
NewsArticle({
@ -1673,6 +1684,23 @@ class NewsClient {
final Client rootClient;
Future<GetSupportedApiVersions> getSupportedApiVersions() async {
var path = '/apps/news/api';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
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<String, dynamic>);
}
throw ApiException.fromResponse(response);
}
Future<NewsListFolders> listFolders() async {
var path = '/apps/news/api/v1-2/folders';
final queryParameters = <String, dynamic>{};
@ -3894,6 +3922,10 @@ final _deserializers = <Type, dynamic Function(dynamic)>{
List<CoreLoginFlowResult>: (final data) => (data as List)
.map<CoreLoginFlowResult>((final e) => CoreLoginFlowResult.fromJson(e as Map<String, dynamic>))
.toList(),
GetSupportedApiVersions: (final data) => GetSupportedApiVersions.fromJson(data as Map<String, dynamic>),
List<GetSupportedApiVersions>: (final data) => (data as List)
.map<GetSupportedApiVersions>((final e) => GetSupportedApiVersions.fromJson(e as Map<String, dynamic>))
.toList(),
NewsListFolders: (final data) => NewsListFolders.fromJson(data as Map<String, dynamic>),
List<NewsListFolders>: (final data) =>
(data as List).map<NewsListFolders>((final e) => NewsListFolders.fromJson(e as Map<String, dynamic>)).toList(),
@ -4376,6 +4408,9 @@ final _serializers = <Type, dynamic Function(dynamic)>{
CoreLoginFlowResult: (final data) => (data as CoreLoginFlowResult).toJson(),
List<CoreLoginFlowResult>: (final data) =>
(data as List<CoreLoginFlowResult>).map((final e) => (e as CoreLoginFlowResult).toJson()).toList(),
GetSupportedApiVersions: (final data) => (data as GetSupportedApiVersions).toJson(),
List<GetSupportedApiVersions>: (final data) =>
(data as List<GetSupportedApiVersions>).map((final e) => (e as GetSupportedApiVersions).toJson()).toList(),
NewsListFolders: (final data) => (data as NewsListFolders).toJson(),
List<NewsListFolders>: (final data) =>
(data as List<NewsListFolders>).map((final e) => (e as NewsListFolders).toJson()).toList(),

8
packages/nextcloud/lib/src/nextcloud.openapi.g.dart

@ -1036,6 +1036,14 @@ Map<String, dynamic> _$CoreLoginFlowResultToJson(CoreLoginFlowResult instance) =
'appPassword': instance.appPassword,
};
GetSupportedApiVersions _$GetSupportedApiVersionsFromJson(Map<String, dynamic> json) => GetSupportedApiVersions(
apiLevels: (json['apiLevels'] as List<dynamic>?)?.map((e) => e as String).toList(),
);
Map<String, dynamic> _$GetSupportedApiVersionsToJson(GetSupportedApiVersions instance) => <String, dynamic>{
'apiLevels': instance.apiLevels,
};
NewsArticle _$NewsArticleFromJson(Map<String, dynamic> json) => NewsArticle(
id: json['id'] as int?,
guid: json['guid'] as String?,

28
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",

28
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",

Loading…
Cancel
Save