14 KiB
openapi.api.UsersApi
Load the API package
import 'package:openapi/api.dart';
All URIs are relative to https://community.openproject.org
| Method | HTTP request | Description |
|---|---|---|
| createUser | POST /api/v3/users | Create User |
| deleteUser | DELETE /api/v3/users/{id} | Delete user |
| listUsers | GET /api/v3/users | List Users |
| lockUser | POST /api/v3/users/{id}/lock | Lock user |
| unlockUser | DELETE /api/v3/users/{id}/lock | Unlock user |
| updateUser | PATCH /api/v3/users/{id} | Update user |
| userUpdateForm | POST /api/v3/users/{id}/form | User update form |
| viewUser | GET /api/v3/users/{id} | View user |
| viewUserSchema | GET /api/v3/users/schema | View user schema |
createUser
UserModel createUser(userCreateModel)
Create User
Creates a new user. Only administrators and users with manage_user global permission are allowed to do so. When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body. Valid values for status: 1) "active" - In this case a password has to be provided in addition to the other attributes. 2) "invited" - In this case nothing but the email address is required. The rest is optional. An invitation will be sent to the user.
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 = UsersApi();
final userCreateModel = UserCreateModel(); // UserCreateModel |
try {
final result = api_instance.createUser(userCreateModel);
print(result);
} catch (e) {
print('Exception when calling UsersApi->createUser: $e\n');
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| userCreateModel | UserCreateModel | [optional] |
Return type
Authorization
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]
deleteUser
deleteUser(id)
Delete user
Permanently deletes the specified user account.
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 = UsersApi();
final id = 1; // int | User id
try {
api_instance.deleteUser(id);
} catch (e) {
print('Exception when calling UsersApi->deleteUser: $e\n');
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | int | User id |
Return type
void (empty response body)
Authorization
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]
listUsers
UserCollectionModel listUsers(offset, pageSize, filters, sortBy, select)
List Users
Lists users. Only administrators or users with manage_user global permission have permission to do this.
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 = UsersApi();
final offset = 25; // int | Page number inside the requested collection.
final pageSize = 25; // int | Number of elements to display per page.
final filters = [{ "status": { "operator": "=", "values": ["invited"] } }, { "group": { "operator": "=", "values": ["1"] } }, { "name": { "operator": "=", "values": ["h.wurst@openproject.com"] } }]; // 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: + status: Status the user has + group: Name of the group in which to-be-listed users are members. + name: Filter users in whose first or last names, or email addresses the given string occurs. + login: User's login
final sortBy = [["status", "asc"]]; // String | JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint.
final select = total,elements/name,elements/self,self; // String | Comma separated list of properties to include.
try {
final result = api_instance.listUsers(offset, pageSize, filters, sortBy, select);
print(result);
} catch (e) {
print('Exception when calling UsersApi->listUsers: $e\n');
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| offset | int | Page number inside the requested collection. | [optional] [default to 1] |
| pageSize | int | Number of elements to display per page. | [optional] |
| filters | String | JSON specifying filter conditions. Accepts the same format as returned by the queries endpoint. Currently supported filters are: + status: Status the user has + group: Name of the group in which to-be-listed users are members. + name: Filter users in whose first or last names, or email addresses the given string occurs. + login: User's login | [optional] |
| sortBy | String | JSON specifying sort criteria. Accepts the same format as returned by the queries endpoint. | [optional] |
| select | String | Comma separated list of properties to include. | [optional] |
Return type
Authorization
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]
lockUser
UserModel lockUser(id)
Lock user
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 = UsersApi();
final id = 1; // int | User id
try {
final result = api_instance.lockUser(id);
print(result);
} catch (e) {
print('Exception when calling UsersApi->lockUser: $e\n');
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | int | User id |
Return type
Authorization
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]
unlockUser
UserModel unlockUser(id)
Unlock user
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 = UsersApi();
final id = 1; // int | User id
try {
final result = api_instance.unlockUser(id);
print(result);
} catch (e) {
print('Exception when calling UsersApi->unlockUser: $e\n');
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | int | User id |
Return type
Authorization
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]
updateUser
UserModel updateUser(id, userCreateModel)
Update user
Updates the user's writable attributes. When calling this endpoint the client provides a single object, containing at least the properties and links that are required, 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 = UsersApi();
final id = 1; // int | User id
final userCreateModel = UserCreateModel(); // UserCreateModel |
try {
final result = api_instance.updateUser(id, userCreateModel);
print(result);
} catch (e) {
print('Exception when calling UsersApi->updateUser: $e\n');
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | int | User id | |
| userCreateModel | UserCreateModel | [optional] |
Return type
Authorization
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]
userUpdateForm
userUpdateForm(id)
User 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 = UsersApi();
final id = 1; // int | User id
try {
api_instance.userUpdateForm(id);
} catch (e) {
print('Exception when calling UsersApi->userUpdateForm: $e\n');
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | int | User id |
Return type
void (empty response body)
Authorization
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]
viewUser
UserModel viewUser(id)
View user
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 = UsersApi();
final id = 1; // String | User id. Use `me` to reference current user, if any.
try {
final result = api_instance.viewUser(id);
print(result);
} catch (e) {
print('Exception when calling UsersApi->viewUser: $e\n');
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | String | User id. Use me to reference current user, if any. |
Return type
Authorization
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]
viewUserSchema
Object viewUserSchema()
View user schema
The schema response use two exemplary custom fields that extend the schema response. Depending on your instance and custom field configuration, the response will look somewhat different.
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 = UsersApi();
try {
final result = api_instance.viewUserSchema();
print(result);
} catch (e) {
print('Exception when calling UsersApi->viewUserSchema: $e\n');
}
Parameters
This endpoint does not need any parameter.
Return type
Authorization
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]