open-project-flutter-api/doc/RelationsApi.md
2023-11-05 19:54:17 +01:00

11 KiB

openapi.api.RelationsApi

Load the API package

import 'package:openapi/api.dart';

All URIs are relative to https://community.openproject.org

Method HTTP request Description
deleteRelation DELETE /api/v3/relations/{id} Delete Relation
editRelation PATCH /api/v3/relations/{id} Edit Relation
listRelations GET /api/v3/relations List Relations
relationEditForm POST /api/v3/relations/{id}/form Relation edit form
viewRelation GET /api/v3/relations/{id} View Relation
viewRelationSchema GET /api/v3/relations/schema View relation schema
viewRelationSchemaForType GET /api/v3/relations/schema/{type} View relation schema for type

deleteRelation

deleteRelation(id)

Delete Relation

Deletes the relation.

Example

import 'package:openapi/api.dart';
// TODO Configure HTTP basic authorization: BasicAuth
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').password = 'YOUR_PASSWORD';

final api_instance = RelationsApi();
final id = 1; // int | Relation ID

try {
    api_instance.deleteRelation(id);
} catch (e) {
    print('Exception when calling RelationsApi->deleteRelation: $e\n');
}

Parameters

Name Type Description Notes
id int Relation ID

Return type

void (empty response body)

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, text/plain

[Back to top] [Back to API list] [Back to Model list] [Back to README]

editRelation

RelationModel editRelation(id)

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.

Example

import 'package:openapi/api.dart';
// TODO Configure HTTP basic authorization: BasicAuth
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').password = 'YOUR_PASSWORD';

final api_instance = RelationsApi();
final id = 1; // int | Relation ID

try {
    final result = api_instance.editRelation(id);
    print(result);
} catch (e) {
    print('Exception when calling RelationsApi->editRelation: $e\n');
}

Parameters

Name Type Description Notes
id int Relation ID

Return type

RelationModel

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, text/plain

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listRelations

Object listRelations(filters, sortBy)

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.

Example

import 'package:openapi/api.dart';
// TODO Configure HTTP basic authorization: BasicAuth
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').password = 'YOUR_PASSWORD';

final api_instance = RelationsApi();
final filters = [{ "from": { "operator": "=", "values": 42 }" }]; // String | 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\".
final sortBy = [["type", "asc"]]; // String | JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint.

try {
    final result = api_instance.listRelations(filters, sortBy);
    print(result);
} catch (e) {
    print('Exception when calling RelationsApi->listRelations: $e\n');
}

Parameters

Name Type Description Notes
filters String JSON specifying filter conditions. Accepts the same format as returned by the 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". [optional]
sortBy String JSON specifying sort criteria. Accepts the same format as returned by the queries endpoint. [optional]

Return type

Object

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

relationEditForm

Object relationEditForm(id)

Relation edit form

Example

import 'package:openapi/api.dart';
// TODO Configure HTTP basic authorization: BasicAuth
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').password = 'YOUR_PASSWORD';

final api_instance = RelationsApi();
final id = 1; // int | ID of the relation being modified

try {
    final result = api_instance.relationEditForm(id);
    print(result);
} catch (e) {
    print('Exception when calling RelationsApi->relationEditForm: $e\n');
}

Parameters

Name Type Description Notes
id int ID of the relation being modified

Return type

Object

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

viewRelation

RelationModel viewRelation(id)

View Relation

Example

import 'package:openapi/api.dart';
// TODO Configure HTTP basic authorization: BasicAuth
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').password = 'YOUR_PASSWORD';

final api_instance = RelationsApi();
final id = 1; // int | Relation id

try {
    final result = api_instance.viewRelation(id);
    print(result);
} catch (e) {
    print('Exception when calling RelationsApi->viewRelation: $e\n');
}

Parameters

Name Type Description Notes
id int Relation id

Return type

RelationModel

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

viewRelationSchema

Object viewRelationSchema()

View relation schema

Example

import 'package:openapi/api.dart';
// TODO Configure HTTP basic authorization: BasicAuth
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').password = 'YOUR_PASSWORD';

final api_instance = RelationsApi();

try {
    final result = api_instance.viewRelationSchema();
    print(result);
} catch (e) {
    print('Exception when calling RelationsApi->viewRelationSchema: $e\n');
}

Parameters

This endpoint does not need any parameter.

Return type

Object

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

viewRelationSchemaForType

Object viewRelationSchemaForType(type)

View relation schema for type

Example

import 'package:openapi/api.dart';
// TODO Configure HTTP basic authorization: BasicAuth
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('BasicAuth').password = 'YOUR_PASSWORD';

final api_instance = RelationsApi();
final type = follows; // String | Type of the schema

try {
    final result = api_instance.viewRelationSchemaForType(type);
    print(result);
} catch (e) {
    print('Exception when calling RelationsApi->viewRelationSchemaForType: $e\n');
}

Parameters

Name Type Description Notes
type String Type of the schema

Return type

Object

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]