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

22 KiB

openapi.api.ProjectsApi

Load the API package

import 'package:openapi/api.dart';

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

Method HTTP request Description
createProject POST /api/v3/projects Create project
createProjectCopy POST /api/v3/projects/{id}/copy Create project copy
deleteProject DELETE /api/v3/projects/{id} Delete Project
listAvailableParentProjectCandidates GET /api/v3/projects/available_parent_projects List available parent project candidates
listProjects GET /api/v3/projects List projects
listProjectsWithVersion GET /api/v3/versions/{id}/projects List projects having version
projectCopyForm POST /api/v3/projects/{id}/copy/form Project copy form
projectCreateForm POST /api/v3/projects/form Project create form
projectUpdateForm POST /api/v3/projects/{id}/form Project update form
updateProject PATCH /api/v3/projects/{id} Update Project
viewProject GET /api/v3/projects/{id} View project
viewProjectSchema GET /api/v3/projects/schema View project schema
viewProjectStatus GET /api/v3/project_statuses/{id} View project status

createProject

ProjectModel createProject(body)

Create project

Creates a new project, applying the attributes provided in the body. You can use the form and schema to be retrieve the valid attribute values and by that be guided towards successful creation.

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 = ProjectsApi();
final body = Object(); // Object | 

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

Parameters

Name Type Description Notes
body Object [optional]

Return type

ProjectModel

Authorization

BasicAuth

HTTP request headers

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

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

createProjectCopy

createProjectCopy(id)

Create project copy

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 = ProjectsApi();
final id = 1; // int | Project id

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

Parameters

Name Type Description Notes
id int Project 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]

deleteProject

deleteProject(id)

Delete Project

Deletes the project permanently. As this is a lengthy process, the actual deletion is carried out asynchronously. So the project might exist well after the request has returned successfully. To prevent unwanted changes to the project scheduled for deletion, it is archived at once.

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 = ProjectsApi();
final id = 1; // int | Project id

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

Parameters

Name Type Description Notes
id int Project 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]

listAvailableParentProjectCandidates

Object listAvailableParentProjectCandidates(filters, of_, sortBy)

List available parent project candidates

Lists projects which can become parent to another project. Only sound candidates are returned. For instance a project cannot become parent of itself or it's children. To specify the project for which a parent is queried for, the of parameter can be provided. If no of parameter is provided, a new project is assumed. Then, the check for the hierarchy is omitted as a new project cannot be part of a hierarchy yet. Candidates can be filtered. Most commonly one will want to filter by name or identifier. You can do this through the filters parameter which works just like the work package index. For instance to find all parent candidates with "rollout" in their name: ?filters=[{\"name_and_identifier\":{\"operator\":\"~\",\"values\":[\"rollout\"]}}]

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 = ProjectsApi();
final filters = [{ "ancestor": { "operator": "=", "values": ['1'] }" }]; // String | JSON specifying filter conditions.
final of_ = 123; // String | The id or identifier of the project the parent candidate is determined for
final sortBy = [["id", "asc"]]; // String | JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint and allows all the filters and sortBy supported by the project list end point.

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

Parameters

Name Type Description Notes
filters String JSON specifying filter conditions. [optional]
of_ String The id or identifier of the project the parent candidate is determined for [optional]
sortBy String JSON specifying sort criteria. Accepts the same format as returned by the queries endpoint and allows all the filters and sortBy supported by the project list end point. [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]

listProjects

Object listProjects(filters, sortBy, select)

List projects

Returns a collection of projects. The collection can be filtered via query parameters similar to how work packages are filtered. In addition to the provided filter, the result set is always limited to only contain projects the client 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 = ProjectsApi();
final filters = [{ "ancestor": { "operator": "=", "values": ['1'] }" }]; // String | 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:  + active: based on the active property of the project  + ancestor: filters projects by their ancestor. A project is not considered to be it's own ancestor.  + created_at: based on the time the project was created  + latest_activity_at: based on the time the last activity was registered on a project.  + name_and_identifier: based on both the name and the identifier.  + parent_id: filters projects by their parent.  + principal: based on members of the project.  + type_id: based on the types active in a project.  + user_action: based on the actions the current user has in the project.  + id: based on projects' id.  + visible: based on the visibility for the user (id) provided as the filter value. This filter is useful for admins to identify the projects visible to a user. There might also be additional filters based on the custom fields that have been configured.
final sortBy = [["id", "asc"]]; // String | JSON specifying sort criteria. Currently supported orders are:  + id  + name  + typeahead (sorting by hierarchy and name)  + created_at  + public  + latest_activity_at  + required_disk_space There might also be additional orders based on the custom fields that have been configured.
final select = total,elements/identifier,elements/name; // String | Comma separated list of properties to include.

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

Parameters

Name Type Description Notes
filters String JSON specifying filter conditions. Accepts the same format as returned by the queries endpoint. Currently supported filters are: + active: based on the active property of the project + ancestor: filters projects by their ancestor. A project is not considered to be it's own ancestor. + created_at: based on the time the project was created + latest_activity_at: based on the time the last activity was registered on a project. + name_and_identifier: based on both the name and the identifier. + parent_id: filters projects by their parent. + principal: based on members of the project. + type_id: based on the types active in a project. + user_action: based on the actions the current user has in the project. + id: based on projects' id. + visible: based on the visibility for the user (id) provided as the filter value. This filter is useful for admins to identify the projects visible to a user. There might also be additional filters based on the custom fields that have been configured. [optional]
sortBy String JSON specifying sort criteria. Currently supported orders are: + id + name + typeahead (sorting by hierarchy and name) + created_at + public + latest_activity_at + required_disk_space There might also be additional orders based on the custom fields that have been configured. [optional]
select String Comma separated list of properties to include. [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]

listProjectsWithVersion

Object listProjectsWithVersion(id)

List projects having version

This endpoint lists the projects where the given version is available. The projects returned depend on the sharing settings of the given version, but are also limited to the projects that the current 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 = ProjectsApi();
final id = 1; // int | Version id

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

Parameters

Name Type Description Notes
id int Version id

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]

projectCopyForm

projectCopyForm(id)

Project copy 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 = ProjectsApi();
final id = 1; // int | Project id

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

Parameters

Name Type Description Notes
id int Project 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]

projectCreateForm

Object projectCreateForm(body)

Project create 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 = ProjectsApi();
final body = Object(); // Object | 

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

Parameters

Name Type Description Notes
body Object [optional]

Return type

Object

Authorization

BasicAuth

HTTP request headers

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

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

projectUpdateForm

projectUpdateForm(id, body)

Project update 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 = ProjectsApi();
final id = 1; // int | Project id
final body = Object(); // Object | 

try {
    api_instance.projectUpdateForm(id, body);
} catch (e) {
    print('Exception when calling ProjectsApi->projectUpdateForm: $e\n');
}

Parameters

Name Type Description Notes
id int Project id
body Object [optional]

Return type

void (empty response body)

Authorization

BasicAuth

HTTP request headers

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

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

updateProject

ProjectModel updateProject(id, body)

Update Project

Updates the given project by applying the attributes provided in the body.

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 = ProjectsApi();
final id = 1; // int | Project id
final body = Object(); // Object | 

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

Parameters

Name Type Description Notes
id int Project id
body Object [optional]

Return type

ProjectModel

Authorization

BasicAuth

HTTP request headers

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

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

viewProject

ProjectModel viewProject(id)

View project

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 = ProjectsApi();
final id = 1; // int | Project id

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

Parameters

Name Type Description Notes
id int Project id

Return type

ProjectModel

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]

viewProjectSchema

Object viewProjectSchema()

View project 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 = ProjectsApi();

try {
    final result = api_instance.viewProjectSchema();
    print(result);
} catch (e) {
    print('Exception when calling ProjectsApi->viewProjectSchema: $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]

viewProjectStatus

Object viewProjectStatus(id)

View project status

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 = ProjectsApi();
final id = on_track; // String | Project status id

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

Parameters

Name Type Description Notes
id String Project status id

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]