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

3.4 KiB

openapi.api.RolesApi

Load the API package

import 'package:openapi/api.dart';

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

Method HTTP request Description
listRoles GET /api/v3/roles List roles
viewRole GET /api/v3/roles/{id} View role

listRoles

Object listRoles(filters)

List roles

List all defined roles. This includes built in roles like 'Anonymous' and 'Non member'.

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 = RolesApi();
final filters = [{ "unit": { "operator": "=", "values": ["system"] }" }]; // 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:  + grantable: filters roles based on whether they are selectable for a membership  + unit: filters roles based on the unit ('project' or 'system') for which they are selectable for a membership

try {
    final result = api_instance.listRoles(filters);
    print(result);
} catch (e) {
    print('Exception when calling RolesApi->listRoles: $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: + grantable: filters roles based on whether they are selectable for a membership + unit: filters roles based on the unit ('project' or 'system') for which they are selectable for a membership [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]

viewRole

RoleModel viewRole(id)

View role

Fetch an individual role.

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

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

Parameters

Name Type Description Notes
id int Role id

Return type

RoleModel

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]