open-project-flutter-api/lib/api/users_api.dart
2023-11-05 19:54:17 +01:00

555 lines
18 KiB
Dart

//
// 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 UsersApi {
UsersApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
/// 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.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [UserCreateModel] userCreateModel:
Future<Response> createUserWithHttpInfo({ UserCreateModel? userCreateModel, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users';
// ignore: prefer_final_locals
Object? postBody = userCreateModel;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// 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.
///
/// Parameters:
///
/// * [UserCreateModel] userCreateModel:
Future<UserModel?> createUser({ UserCreateModel? userCreateModel, }) async {
final response = await createUserWithHttpInfo( userCreateModel: userCreateModel, );
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), 'UserModel',) as UserModel;
}
return null;
}
/// Delete user
///
/// Permanently deletes the specified user account.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// User id
Future<Response> deleteUserWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users/{id}'
.replaceAll('{id}', id.toString());
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'DELETE',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Delete user
///
/// Permanently deletes the specified user account.
///
/// Parameters:
///
/// * [int] id (required):
/// User id
Future<void> deleteUser(int id,) async {
final response = await deleteUserWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// List Users
///
/// Lists users. Only administrators or users with manage_user global permission have permission to do this.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] offset:
/// Page number inside the requested collection.
///
/// * [int] pageSize:
/// Number of elements to display per page.
///
/// * [String] filters:
/// 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
///
/// * [String] sortBy:
/// JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint.
///
/// * [String] select:
/// Comma separated list of properties to include.
Future<Response> listUsersWithHttpInfo({ int? offset, int? pageSize, String? filters, String? sortBy, String? select, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (offset != null) {
queryParams.addAll(_queryParams('', 'offset', offset));
}
if (pageSize != null) {
queryParams.addAll(_queryParams('', 'pageSize', pageSize));
}
if (filters != null) {
queryParams.addAll(_queryParams('', 'filters', filters));
}
if (sortBy != null) {
queryParams.addAll(_queryParams('', 'sortBy', sortBy));
}
if (select != null) {
queryParams.addAll(_queryParams('', 'select', select));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// List Users
///
/// Lists users. Only administrators or users with manage_user global permission have permission to do this.
///
/// Parameters:
///
/// * [int] offset:
/// Page number inside the requested collection.
///
/// * [int] pageSize:
/// Number of elements to display per page.
///
/// * [String] filters:
/// 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
///
/// * [String] sortBy:
/// JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint.
///
/// * [String] select:
/// Comma separated list of properties to include.
Future<UserCollectionModel?> listUsers({ int? offset, int? pageSize, String? filters, String? sortBy, String? select, }) async {
final response = await listUsersWithHttpInfo( offset: offset, pageSize: pageSize, filters: filters, sortBy: sortBy, select: select, );
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), 'UserCollectionModel',) as UserCollectionModel;
}
return null;
}
/// Lock user
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// User id
Future<Response> lockUserWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users/{id}/lock'
.replaceAll('{id}', id.toString());
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Lock user
///
/// Parameters:
///
/// * [int] id (required):
/// User id
Future<UserModel?> lockUser(int id,) async {
final response = await lockUserWithHttpInfo(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), 'UserModel',) as UserModel;
}
return null;
}
/// Unlock user
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// User id
Future<Response> unlockUserWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users/{id}/lock'
.replaceAll('{id}', id.toString());
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'DELETE',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Unlock user
///
/// Parameters:
///
/// * [int] id (required):
/// User id
Future<UserModel?> unlockUser(int id,) async {
final response = await unlockUserWithHttpInfo(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), 'UserModel',) as UserModel;
}
return null;
}
/// 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.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// User id
///
/// * [UserCreateModel] userCreateModel:
Future<Response> updateUserWithHttpInfo(int id, { UserCreateModel? userCreateModel, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users/{id}'
.replaceAll('{id}', id.toString());
// ignore: prefer_final_locals
Object? postBody = userCreateModel;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'PATCH',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// 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.
///
/// Parameters:
///
/// * [int] id (required):
/// User id
///
/// * [UserCreateModel] userCreateModel:
Future<UserModel?> updateUser(int id, { UserCreateModel? userCreateModel, }) async {
final response = await updateUserWithHttpInfo(id, userCreateModel: userCreateModel, );
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), 'UserModel',) as UserModel;
}
return null;
}
/// User update form
///
///
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [int] id (required):
/// User id
Future<Response> userUpdateFormWithHttpInfo(int id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users/{id}/form'
.replaceAll('{id}', id.toString());
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// User update form
///
///
///
/// Parameters:
///
/// * [int] id (required):
/// User id
Future<void> userUpdateForm(int id,) async {
final response = await userUpdateFormWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// View user
///
///
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] id (required):
/// User id. Use `me` to reference current user, if any.
Future<Response> viewUserWithHttpInfo(String id,) async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users/{id}'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// View user
///
///
///
/// Parameters:
///
/// * [String] id (required):
/// User id. Use `me` to reference current user, if any.
Future<UserModel?> viewUser(String id,) async {
final response = await viewUserWithHttpInfo(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), 'UserModel',) as UserModel;
}
return null;
}
/// 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.
///
/// Note: This method returns the HTTP [Response].
Future<Response> viewUserSchemaWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/api/v3/users/schema';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// 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.
Future<Object?> viewUserSchema() async {
final response = await viewUserSchemaWithHttpInfo();
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;
}
}