open-project-flutter-api/lib/api/versions_api.dart
2023-11-05 19:54:17 +01:00

544 lines
18 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 VersionsApi {
VersionsApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
/// Available projects for versions
///
/// Gets a list of projects in which a version can be created in. The list contains all projects in which the user issuing the request has the manage versions permissions.
///
/// Note: This method returns the HTTP [Response].
Future<Response> availableProjectsForVersionsWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions/available_projects';
// 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,
);
}
/// Available projects for versions
///
/// Gets a list of projects in which a version can be created in. The list contains all projects in which the user issuing the request has the manage versions permissions.
Future<Object?> availableProjectsForVersions() async {
final response = await availableProjectsForVersionsWithHttpInfo();
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;
}
/// Create version
///
/// Creates a new version applying the attributes provided in the body. Please note that while there is a fixed set of attributes, custom fields can extend a version's attributes and are accepted by the endpoint. You can use the form and schema to be retrieve the valid attribute values and by that be guided towards successful creation.
///
/// Note: This method returns the HTTP [Response].
Future<Response> createVersionWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Create version
///
/// Creates a new version applying the attributes provided in the body. Please note that while there is a fixed set of attributes, custom fields can extend a version's attributes and are accepted by the endpoint. You can use the form and schema to be retrieve the valid attribute values and by that be guided towards successful creation.
Future<VersionModel?> createVersion() async {
final response = await createVersionWithHttpInfo();
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), 'VersionModel',) as VersionModel;
}
return null;
}
/// Delete version
///
/// Deletes the version. Work packages associated to the version will no longer be assigned to it.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// Version id
Future<Response> deleteVersionWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions/{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,
'DELETE',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Delete version
///
/// Deletes the version. Work packages associated to the version will no longer be assigned to it.
///
/// Parameters:
///
/// * [int] id (required):
/// Version id
Future<void> deleteVersion(int id,) async {
final response = await deleteVersionWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// List versions
///
/// Returns a collection of versions. The client can choose to filter the versions similar to how work packages are filtered. In addition to the provided filters, the server will reduce the result set to only contain versions, for which the requesting client has sufficient permissions (*view_work_packages*).
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] filters:
/// JSON specifying filter conditions. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported filters are: + sharing: filters versions by how they are shared within the server (*none*, *descendants*, *hierarchy*, *tree*, *system*).
Future<Response> listVersionsWithHttpInfo({ String? filters, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (filters != null) {
queryParams.addAll(_queryParams('', 'filters', filters));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// List versions
///
/// Returns a collection of versions. The client can choose to filter the versions similar to how work packages are filtered. In addition to the provided filters, the server will reduce the result set to only contain versions, for which the requesting client has sufficient permissions (*view_work_packages*).
///
/// Parameters:
///
/// * [String] filters:
/// JSON specifying filter conditions. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported filters are: + sharing: filters versions by how they are shared within the server (*none*, *descendants*, *hierarchy*, *tree*, *system*).
Future<Object?> listVersions({ String? filters, }) async {
final response = await listVersionsWithHttpInfo( filters: filters, );
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;
}
/// List versions available in a project
///
/// This endpoint lists the versions that are *available* in a given project. Note that due to sharing this might be more than the versions *defined* by that project.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// ID of the project whose versions will be listed
Future<Response> listVersionsAvailableInAProjectWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/projects/{id}/versions'
.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,
);
}
/// List versions available in a project
///
/// This endpoint lists the versions that are *available* in a given project. Note that due to sharing this might be more than the versions *defined* by that project.
///
/// Parameters:
///
/// * [int] id (required):
/// ID of the project whose versions will be listed
Future<Object?> listVersionsAvailableInAProject(int id,) async {
final response = await listVersionsAvailableInAProjectWithHttpInfo(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), 'Object',) as Object;
}
return null;
}
/// Update Version
///
/// Updates the given version by applying the attributes provided in the body. Please note that while there is a fixed set of attributes, custom fields can extend a version's attributes and are accepted by the endpoint.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// Version id
Future<Response> updateVersionWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions/{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,
'PATCH',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Update Version
///
/// Updates the given version by applying the attributes provided in the body. Please note that while there is a fixed set of attributes, custom fields can extend a version's attributes and are accepted by the endpoint.
///
/// Parameters:
///
/// * [int] id (required):
/// Version id
Future<VersionModel?> updateVersion(int id,) async {
final response = await updateVersionWithHttpInfo(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), 'VersionModel',) as VersionModel;
}
return null;
}
/// Version create form
///
///
///
/// Note: This method returns the HTTP [Response].
Future<Response> versionCreateFormWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions/form';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Version create form
///
///
Future<void> versionCreateForm() async {
final response = await versionCreateFormWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// Version update form
///
///
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// Project id
Future<Response> versionUpdateFormWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions/{id}/form'
.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,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Version update form
///
///
///
/// Parameters:
///
/// * [int] id (required):
/// Project id
Future<void> versionUpdateForm(int id,) async {
final response = await versionUpdateFormWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// View version
///
///
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// Version id
Future<Response> viewVersionWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions/{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 version
///
///
///
/// Parameters:
///
/// * [int] id (required):
/// Version id
Future<VersionModel?> viewVersion(int id,) async {
final response = await viewVersionWithHttpInfo(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), 'VersionModel',) as VersionModel;
}
return null;
}
/// View version schema
///
///
///
/// Note: This method returns the HTTP [Response].
Future<Response> viewVersionSchemaWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/api/v3/versions/schema';
// 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 version schema
///
///
Future<Object?> viewVersionSchema() async {
final response = await viewVersionSchemaWithHttpInfo();
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;
}
}