// // 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 RelationsApi { RelationsApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; /// Delete Relation /// /// Deletes the relation. /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [int] id (required): /// Relation ID Future deleteRelationWithHttpInfo(int id,) async { // ignore: prefer_const_declarations final path = r'/api/v3/relations/{id}' .replaceAll('{id}', id.toString()); // ignore: prefer_final_locals Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = []; return apiClient.invokeAPI( path, 'DELETE', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, ); } /// Delete Relation /// /// Deletes the relation. /// /// Parameters: /// /// * [int] id (required): /// Relation ID Future deleteRelation(int id,) async { final response = await deleteRelationWithHttpInfo(id,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } } /// Edit Relation /// /// When calling this endpoint the client provides a single object, containing the properties and links that it wants to change, in the body. It is only allowed to provide properties or links supporting the **write** operation. Note that changing the `type` of a relation invariably also changes the respective `reverseType` as well as the \"name\" of it. The returned Relation object will reflect that change. For instance if you change a Relation's `type` to \"follows\" then the `reverseType` will be changed to `precedes`. /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [int] id (required): /// Relation ID Future editRelationWithHttpInfo(int id,) async { // ignore: prefer_const_declarations final path = r'/api/v3/relations/{id}' .replaceAll('{id}', id.toString()); // ignore: prefer_final_locals Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = []; return apiClient.invokeAPI( path, 'PATCH', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, ); } /// Edit Relation /// /// When calling this endpoint the client provides a single object, containing the properties and links that it wants to change, in the body. It is only allowed to provide properties or links supporting the **write** operation. Note that changing the `type` of a relation invariably also changes the respective `reverseType` as well as the \"name\" of it. The returned Relation object will reflect that change. For instance if you change a Relation's `type` to \"follows\" then the `reverseType` will be changed to `precedes`. /// /// Parameters: /// /// * [int] id (required): /// Relation ID Future editRelation(int id,) async { final response = await editRelationWithHttpInfo(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), 'RelationModel',) as RelationModel; } return null; } /// List Relations /// /// Lists all relations according to the given (optional, logically conjunctive) filters and ordered by ID. The response only includes relations between work packages which the user is allowed to see. /// /// 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. Valid fields to filter by are: + id - ID of relation + from - ID of work package from which the filtered relations emanates. + to - ID of work package to which this related points. + involved - ID of either the `from` or the `to` work package. + type - The type of relation to filter by, e.g. \"follows\". /// /// * [String] sortBy: /// JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Future listRelationsWithHttpInfo({ String? filters, String? sortBy, }) async { // ignore: prefer_const_declarations final path = r'/api/v3/relations'; // ignore: prefer_final_locals Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; if (filters != null) { queryParams.addAll(_queryParams('', 'filters', filters)); } if (sortBy != null) { queryParams.addAll(_queryParams('', 'sortBy', sortBy)); } const contentTypes = []; return apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, ); } /// List Relations /// /// Lists all relations according to the given (optional, logically conjunctive) filters and ordered by ID. The response only includes relations between work packages which the user is allowed to see. /// /// 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. Valid fields to filter by are: + id - ID of relation + from - ID of work package from which the filtered relations emanates. + to - ID of work package to which this related points. + involved - ID of either the `from` or the `to` work package. + type - The type of relation to filter by, e.g. \"follows\". /// /// * [String] sortBy: /// JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Future listRelations({ String? filters, String? sortBy, }) async { final response = await listRelationsWithHttpInfo( filters: filters, 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; } /// Relation edit form /// /// /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [int] id (required): /// ID of the relation being modified Future relationEditFormWithHttpInfo(int id,) async { // ignore: prefer_const_declarations final path = r'/api/v3/relations/{id}/form' .replaceAll('{id}', id.toString()); // ignore: prefer_final_locals Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = []; return apiClient.invokeAPI( path, 'POST', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, ); } /// Relation edit form /// /// /// /// Parameters: /// /// * [int] id (required): /// ID of the relation being modified Future relationEditForm(int id,) async { final response = await relationEditFormWithHttpInfo(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; } /// View Relation /// /// /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [int] id (required): /// Relation id Future viewRelationWithHttpInfo(int id,) async { // ignore: prefer_const_declarations final path = r'/api/v3/relations/{id}' .replaceAll('{id}', id.toString()); // ignore: prefer_final_locals Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = []; return apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, ); } /// View Relation /// /// /// /// Parameters: /// /// * [int] id (required): /// Relation id Future viewRelation(int id,) async { final response = await viewRelationWithHttpInfo(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), 'RelationModel',) as RelationModel; } return null; } /// View relation schema /// /// /// /// Note: This method returns the HTTP [Response]. Future viewRelationSchemaWithHttpInfo() async { // ignore: prefer_const_declarations final path = r'/api/v3/relations/schema'; // ignore: prefer_final_locals Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = []; return apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, ); } /// View relation schema /// /// Future viewRelationSchema() async { final response = await viewRelationSchemaWithHttpInfo(); 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 relation schema for type /// /// /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] type (required): /// Type of the schema Future viewRelationSchemaForTypeWithHttpInfo(String type,) async { // ignore: prefer_const_declarations final path = r'/api/v3/relations/schema/{type}' .replaceAll('{type}', type); // ignore: prefer_final_locals Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = []; return apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, ); } /// View relation schema for type /// /// /// /// Parameters: /// /// * [String] type (required): /// Type of the schema Future viewRelationSchemaForType(String type,) async { final response = await viewRelationSchemaForTypeWithHttpInfo(type,); 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; } }