mirror of
https://github.com/gosticks/open-project-flutter-api.git
synced 2026-01-30 05:17:30 +00:00
158 lines
4.9 KiB
Dart
158 lines
4.9 KiB
Dart
//
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
//
|
|
// @dart=2.12
|
|
|
|
// ignore_for_file: unused_element, unused_import
|
|
// ignore_for_file: always_put_required_named_parameters_first
|
|
// ignore_for_file: constant_identifier_names
|
|
// ignore_for_file: lines_longer_than_80_chars
|
|
|
|
part of openapi.api;
|
|
|
|
|
|
class DocumentsApi {
|
|
DocumentsApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
|
|
|
final ApiClient apiClient;
|
|
|
|
/// List Documents
|
|
///
|
|
/// The documents returned depend on the provided parameters and also on the requesting user's permissions.
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [int] offset:
|
|
/// Page number inside the requested collection.
|
|
///
|
|
/// * [int] pageSize:
|
|
/// Number of elements to display per page.
|
|
///
|
|
/// * [String] sortBy:
|
|
/// JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported sorts are: + id: Sort by primary key + created_at: Sort by document creation datetime
|
|
Future<Response> listDocumentsWithHttpInfo({ int? offset, int? pageSize, String? sortBy, }) async {
|
|
// ignore: prefer_const_declarations
|
|
final path = r'/api/v3/documents';
|
|
|
|
// ignore: prefer_final_locals
|
|
Object? postBody;
|
|
|
|
final queryParams = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
if (offset != null) {
|
|
queryParams.addAll(_queryParams('', 'offset', offset));
|
|
}
|
|
if (pageSize != null) {
|
|
queryParams.addAll(_queryParams('', 'pageSize', pageSize));
|
|
}
|
|
if (sortBy != null) {
|
|
queryParams.addAll(_queryParams('', 'sortBy', sortBy));
|
|
}
|
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
return apiClient.invokeAPI(
|
|
path,
|
|
'GET',
|
|
queryParams,
|
|
postBody,
|
|
headerParams,
|
|
formParams,
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
);
|
|
}
|
|
|
|
/// List Documents
|
|
///
|
|
/// The documents returned depend on the provided parameters and also on the requesting user's permissions.
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [int] offset:
|
|
/// Page number inside the requested collection.
|
|
///
|
|
/// * [int] pageSize:
|
|
/// Number of elements to display per page.
|
|
///
|
|
/// * [String] sortBy:
|
|
/// JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported sorts are: + id: Sort by primary key + created_at: Sort by document creation datetime
|
|
Future<Object?> listDocuments({ int? offset, int? pageSize, String? sortBy, }) async {
|
|
final response = await listDocumentsWithHttpInfo( offset: offset, pageSize: pageSize, sortBy: sortBy, );
|
|
if (response.statusCode >= HttpStatus.badRequest) {
|
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
|
}
|
|
// When a remote server returns no body with a status of 204, we shall not decode it.
|
|
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
|
// FormatException when trying to decode an empty string.
|
|
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
|
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
|
|
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/// View document
|
|
///
|
|
///
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [int] id (required):
|
|
/// Document id
|
|
Future<Response> viewDocumentWithHttpInfo(int id,) async {
|
|
// ignore: prefer_const_declarations
|
|
final path = r'/api/v3/documents/{id}'
|
|
.replaceAll('{id}', id.toString());
|
|
|
|
// ignore: prefer_final_locals
|
|
Object? postBody;
|
|
|
|
final queryParams = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
return apiClient.invokeAPI(
|
|
path,
|
|
'GET',
|
|
queryParams,
|
|
postBody,
|
|
headerParams,
|
|
formParams,
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
);
|
|
}
|
|
|
|
/// View document
|
|
///
|
|
///
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [int] id (required):
|
|
/// Document id
|
|
Future<DocumentModel?> viewDocument(int id,) async {
|
|
final response = await viewDocumentWithHttpInfo(id,);
|
|
if (response.statusCode >= HttpStatus.badRequest) {
|
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
|
}
|
|
// When a remote server returns no body with a status of 204, we shall not decode it.
|
|
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
|
// FormatException when trying to decode an empty string.
|
|
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
|
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'DocumentModel',) as DocumentModel;
|
|
|
|
}
|
|
return null;
|
|
}
|
|
}
|