diff --git a/lib/api/.openapi-generator/FILES b/lib/api/.openapi-generator/FILES index 2bef350..05f723c 100644 --- a/lib/api/.openapi-generator/FILES +++ b/lib/api/.openapi-generator/FILES @@ -33,6 +33,7 @@ doc/ExamDto.md doc/ExamType.md doc/ExamsApi.md doc/GradeDto.md +doc/InstallPluginRequest.md doc/MySchoolDto.md doc/PluginDto.md doc/PluginTaskStatus.md @@ -115,6 +116,7 @@ lib/src/model/enrol_student_command.dart lib/src/model/exam_dto.dart lib/src/model/exam_type.dart lib/src/model/grade_dto.dart +lib/src/model/install_plugin_request.dart lib/src/model/my_school_dto.dart lib/src/model/plugin_dto.dart lib/src/model/plugin_task_status.dart @@ -143,3 +145,4 @@ lib/src/model/user_class_dto.dart lib/src/model/user_state.dart lib/src/serializers.dart pubspec.yaml +test/install_plugin_request_test.dart diff --git a/lib/api/README.md b/lib/api/README.md index 9b05d90..f742c40 100644 --- a/lib/api/README.md +++ b/lib/api/README.md @@ -76,7 +76,6 @@ Class | Method | HTTP request | Description [*AgendasApi*](doc/AgendasApi.md) | [**apiAgendasSearchGet**](doc/AgendasApi.md#apiagendassearchget) | **GET** /api/Agendas/search | [*AppApi*](doc/AppApi.md) | [**apiAppGet**](doc/AppApi.md#apiappget) | **GET** /api/App | [*AppApi*](doc/AppApi.md) | [**apiAppSchoolSystemsGet**](doc/AppApi.md#apiappschoolsystemsget) | **GET** /api/App/school-systems | -[*AppApi*](doc/AppApi.md) | [**testEndpointWithAuth**](doc/AppApi.md#testendpointwithauth) | **GET** /api/App/test | [*ApplicationUsersApi*](doc/ApplicationUsersApi.md) | [**apiApplicationUsersGet**](doc/ApplicationUsersApi.md#apiapplicationusersget) | **GET** /api/ApplicationUsers | [*ApplicationUsersApi*](doc/ApplicationUsersApi.md) | [**apiApplicationUsersIdDelete**](doc/ApplicationUsersApi.md#apiapplicationusersiddelete) | **DELETE** /api/ApplicationUsers/{id} | [*ApplicationUsersApi*](doc/ApplicationUsersApi.md) | [**apiApplicationUsersIdGet**](doc/ApplicationUsersApi.md#apiapplicationusersidget) | **GET** /api/ApplicationUsers/{id} | @@ -100,6 +99,10 @@ Class | Method | HTTP request | Description [*ExamsApi*](doc/ExamsApi.md) | [**apiExamsPut**](doc/ExamsApi.md#apiexamsput) | **PUT** /api/Exams | [*ExamsApi*](doc/ExamsApi.md) | [**apiExamsSearchGet**](doc/ExamsApi.md#apiexamssearchget) | **GET** /api/Exams/search | [*PluginsApi*](doc/PluginsApi.md) | [**apiPluginsGet**](doc/PluginsApi.md#apipluginsget) | **GET** /api/Plugins | +[*PluginsApi*](doc/PluginsApi.md) | [**apiPluginsInstallPost**](doc/PluginsApi.md#apipluginsinstallpost) | **POST** /api/Plugins/install | +[*PluginsApi*](doc/PluginsApi.md) | [**apiPluginsNameDelete**](doc/PluginsApi.md#apipluginsnamedelete) | **DELETE** /api/Plugins/{name} | +[*PluginsApi*](doc/PluginsApi.md) | [**apiPluginsNameUpdatePost**](doc/PluginsApi.md#apipluginsnameupdatepost) | **POST** /api/Plugins/{name}/update | +[*PluginsApi*](doc/PluginsApi.md) | [**apiPluginsRegistryGet**](doc/PluginsApi.md#apipluginsregistryget) | **GET** /api/Plugins/registry | [*PluginsApi*](doc/PluginsApi.md) | [**apiPluginsSchedulerGet**](doc/PluginsApi.md#apipluginsschedulerget) | **GET** /api/Plugins/scheduler | [*SchoolSystemsApi*](doc/SchoolSystemsApi.md) | [**apiSchoolSystemsGet**](doc/SchoolSystemsApi.md#apischoolsystemsget) | **GET** /api/SchoolSystems | [*SchoolSystemsApi*](doc/SchoolSystemsApi.md) | [**apiSchoolSystemsIdDelete**](doc/SchoolSystemsApi.md#apischoolsystemsiddelete) | **DELETE** /api/SchoolSystems/{id} | @@ -153,6 +156,7 @@ Class | Method | HTTP request | Description - [ExamDto](doc/ExamDto.md) - [ExamType](doc/ExamType.md) - [GradeDto](doc/GradeDto.md) + - [InstallPluginRequest](doc/InstallPluginRequest.md) - [MySchoolDto](doc/MySchoolDto.md) - [PluginDto](doc/PluginDto.md) - [PluginTaskStatus](doc/PluginTaskStatus.md) @@ -189,7 +193,7 @@ Authentication schemes defined for the API: - **Type**: OAuth - **Flow**: accessCode -- **Authorization URL**: https://example.com/authorize +- **Authorization URL**: http://localhost:8080/realms/polyglot/authorize - **Scopes**: - **openid**: OpenID Connect - **profile**: User profile diff --git a/lib/api/doc/AppApi.md b/lib/api/doc/AppApi.md index e64290f..1286ebd 100644 --- a/lib/api/doc/AppApi.md +++ b/lib/api/doc/AppApi.md @@ -11,7 +11,6 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**apiAppGet**](AppApi.md#apiappget) | **GET** /api/App | [**apiAppSchoolSystemsGet**](AppApi.md#apiappschoolsystemsget) | **GET** /api/App/school-systems | -[**testEndpointWithAuth**](AppApi.md#testendpointwithauth) | **GET** /api/App/test | # **apiAppGet** @@ -92,41 +91,3 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **testEndpointWithAuth** -> testEndpointWithAuth() - - - -### Example -```dart -import 'package:schuly_api/api.dart'; -// TODO Configure OAuth2 access token for authorization: OAuth2 -//defaultApiClient.getAuthentication('OAuth2').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api = SchulyApi().getAppApi(); - -try { - api.testEndpointWithAuth(); -} catch on DioException (e) { - print('Exception when calling AppApi->testEndpointWithAuth: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/lib/api/doc/CreateClassCommand.md b/lib/api/doc/CreateClassCommand.md index 65d1234..01f3991 100644 --- a/lib/api/doc/CreateClassCommand.md +++ b/lib/api/doc/CreateClassCommand.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **String** | | **description** | **String** | | +**schoolId** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/lib/api/doc/InstallPluginRequest.md b/lib/api/doc/InstallPluginRequest.md new file mode 100644 index 0000000..0840282 --- /dev/null +++ b/lib/api/doc/InstallPluginRequest.md @@ -0,0 +1,16 @@ +# schuly_api.model.InstallPluginRequest + +## Load the model package +```dart +import 'package:schuly_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | +**version** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/lib/api/doc/PluginsApi.md b/lib/api/doc/PluginsApi.md index 8e4bbaa..d619c96 100644 --- a/lib/api/doc/PluginsApi.md +++ b/lib/api/doc/PluginsApi.md @@ -10,6 +10,10 @@ All URIs are relative to *http://localhost:5033* Method | HTTP request | Description ------------- | ------------- | ------------- [**apiPluginsGet**](PluginsApi.md#apipluginsget) | **GET** /api/Plugins | +[**apiPluginsInstallPost**](PluginsApi.md#apipluginsinstallpost) | **POST** /api/Plugins/install | +[**apiPluginsNameDelete**](PluginsApi.md#apipluginsnamedelete) | **DELETE** /api/Plugins/{name} | +[**apiPluginsNameUpdatePost**](PluginsApi.md#apipluginsnameupdatepost) | **POST** /api/Plugins/{name}/update | +[**apiPluginsRegistryGet**](PluginsApi.md#apipluginsregistryget) | **GET** /api/Plugins/registry | [**apiPluginsSchedulerGet**](PluginsApi.md#apipluginsschedulerget) | **GET** /api/Plugins/scheduler | @@ -52,6 +56,170 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **apiPluginsInstallPost** +> apiPluginsInstallPost(installPluginRequest) + + + +### Example +```dart +import 'package:schuly_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: OAuth2 +//defaultApiClient.getAuthentication('OAuth2').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = SchulyApi().getPluginsApi(); +final InstallPluginRequest installPluginRequest = ; // InstallPluginRequest | + +try { + api.apiPluginsInstallPost(installPluginRequest); +} catch on DioException (e) { + print('Exception when calling PluginsApi->apiPluginsInstallPost: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **installPluginRequest** | [**InstallPluginRequest**](InstallPluginRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json, text/json, application/*+json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **apiPluginsNameDelete** +> apiPluginsNameDelete(name) + + + +### Example +```dart +import 'package:schuly_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: OAuth2 +//defaultApiClient.getAuthentication('OAuth2').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = SchulyApi().getPluginsApi(); +final String name = name_example; // String | + +try { + api.apiPluginsNameDelete(name); +} catch on DioException (e) { + print('Exception when calling PluginsApi->apiPluginsNameDelete: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **name** | **String**| | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **apiPluginsNameUpdatePost** +> apiPluginsNameUpdatePost(name) + + + +### Example +```dart +import 'package:schuly_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: OAuth2 +//defaultApiClient.getAuthentication('OAuth2').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = SchulyApi().getPluginsApi(); +final String name = name_example; // String | + +try { + api.apiPluginsNameUpdatePost(name); +} catch on DioException (e) { + print('Exception when calling PluginsApi->apiPluginsNameUpdatePost: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **name** | **String**| | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **apiPluginsRegistryGet** +> apiPluginsRegistryGet() + + + +### Example +```dart +import 'package:schuly_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: OAuth2 +//defaultApiClient.getAuthentication('OAuth2').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = SchulyApi().getPluginsApi(); + +try { + api.apiPluginsRegistryGet(); +} catch on DioException (e) { + print('Exception when calling PluginsApi->apiPluginsRegistryGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **apiPluginsSchedulerGet** > BuiltList apiPluginsSchedulerGet() diff --git a/lib/api/lib/schuly_api.dart b/lib/api/lib/schuly_api.dart index 7e5763c..d0eaeb3 100644 --- a/lib/api/lib/schuly_api.dart +++ b/lib/api/lib/schuly_api.dart @@ -50,6 +50,7 @@ export 'package:schuly_api/src/model/enrol_student_command.dart'; export 'package:schuly_api/src/model/exam_dto.dart'; export 'package:schuly_api/src/model/exam_type.dart'; export 'package:schuly_api/src/model/grade_dto.dart'; +export 'package:schuly_api/src/model/install_plugin_request.dart'; export 'package:schuly_api/src/model/my_school_dto.dart'; export 'package:schuly_api/src/model/plugin_dto.dart'; export 'package:schuly_api/src/model/plugin_task_status.dart'; diff --git a/lib/api/lib/src/api/app_api.dart b/lib/api/lib/src/api/app_api.dart index fc558f0..9fc77c7 100644 --- a/lib/api/lib/src/api/app_api.dart +++ b/lib/api/lib/src/api/app_api.dart @@ -177,54 +177,4 @@ class AppApi { ); } - /// testEndpointWithAuth - /// - /// - /// Parameters: - /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation - /// * [headers] - Can be used to add additional headers to the request - /// * [extras] - Can be used to add flags to the request - /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response - /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress - /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress - /// - /// Returns a [Future] - /// Throws [DioException] if API call or serialization fails - Future> testEndpointWithAuth({ - CancelToken? cancelToken, - Map? headers, - Map? extra, - ValidateStatus? validateStatus, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress, - }) async { - final _path = r'/api/App/test'; - final _options = Options( - method: r'GET', - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'OAuth2', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - ); - - final _response = await _dio.request( - _path, - options: _options, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - return _response; - } - } diff --git a/lib/api/lib/src/api/plugins_api.dart b/lib/api/lib/src/api/plugins_api.dart index 3e5835b..825e91c 100644 --- a/lib/api/lib/src/api/plugins_api.dart +++ b/lib/api/lib/src/api/plugins_api.dart @@ -9,6 +9,8 @@ import 'package:built_value/serializer.dart'; import 'package:dio/dio.dart'; import 'package:built_collection/built_collection.dart'; +import 'package:schuly_api/src/api_util.dart'; +import 'package:schuly_api/src/model/install_plugin_request.dart'; import 'package:schuly_api/src/model/plugin_dto.dart'; import 'package:schuly_api/src/model/plugin_task_status.dart'; import 'package:schuly_api/src/model/problem_details.dart'; @@ -99,6 +101,232 @@ class PluginsApi { ); } + /// apiPluginsInstallPost + /// + /// + /// Parameters: + /// * [installPluginRequest] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> apiPluginsInstallPost({ + required InstallPluginRequest installPluginRequest, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/Plugins/install'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'OAuth2', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(InstallPluginRequest); + _bodyData = _serializers.serialize(installPluginRequest, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// apiPluginsNameDelete + /// + /// + /// Parameters: + /// * [name] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> apiPluginsNameDelete({ + required String name, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/Plugins/{name}'.replaceAll('{' r'name' '}', encodeQueryParameter(_serializers, name, const FullType(String)).toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'OAuth2', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// apiPluginsNameUpdatePost + /// + /// + /// Parameters: + /// * [name] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> apiPluginsNameUpdatePost({ + required String name, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/Plugins/{name}/update'.replaceAll('{' r'name' '}', encodeQueryParameter(_serializers, name, const FullType(String)).toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'OAuth2', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// apiPluginsRegistryGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> apiPluginsRegistryGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/Plugins/registry'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'OAuth2', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + /// apiPluginsSchedulerGet /// /// diff --git a/lib/api/lib/src/model/create_class_command.dart b/lib/api/lib/src/model/create_class_command.dart index db94cf0..8228eaa 100644 --- a/lib/api/lib/src/model/create_class_command.dart +++ b/lib/api/lib/src/model/create_class_command.dart @@ -13,6 +13,7 @@ part 'create_class_command.g.dart'; /// Properties: /// * [name] /// * [description] +/// * [schoolId] @BuiltValue() abstract class CreateClassCommand implements Built { @BuiltValueField(wireName: r'name') @@ -21,6 +22,9 @@ abstract class CreateClassCommand implements Built (CreateClassCommandBuilder()..update(updates))._build(); - _$CreateClassCommand._({required this.name, this.description}) : super._(); + _$CreateClassCommand._({ + required this.name, + this.description, + required this.schoolId, + }) : super._(); @override CreateClassCommand rebuild( void Function(CreateClassCommandBuilder) updates, @@ -31,7 +37,8 @@ class _$CreateClassCommand extends CreateClassCommand { if (identical(other, this)) return true; return other is CreateClassCommand && name == other.name && - description == other.description; + description == other.description && + schoolId == other.schoolId; } @override @@ -39,6 +46,7 @@ class _$CreateClassCommand extends CreateClassCommand { var _$hash = 0; _$hash = $jc(_$hash, name.hashCode); _$hash = $jc(_$hash, description.hashCode); + _$hash = $jc(_$hash, schoolId.hashCode); _$hash = $jf(_$hash); return _$hash; } @@ -47,7 +55,8 @@ class _$CreateClassCommand extends CreateClassCommand { String toString() { return (newBuiltValueToStringHelper(r'CreateClassCommand') ..add('name', name) - ..add('description', description)) + ..add('description', description) + ..add('schoolId', schoolId)) .toString(); } } @@ -64,6 +73,10 @@ class CreateClassCommandBuilder String? get description => _$this._description; set description(String? description) => _$this._description = description; + String? _schoolId; + String? get schoolId => _$this._schoolId; + set schoolId(String? schoolId) => _$this._schoolId = schoolId; + CreateClassCommandBuilder() { CreateClassCommand._defaults(this); } @@ -73,6 +86,7 @@ class CreateClassCommandBuilder if ($v != null) { _name = $v.name; _description = $v.description; + _schoolId = $v.schoolId; _$v = null; } return this; @@ -101,6 +115,11 @@ class CreateClassCommandBuilder 'name', ), description: description, + schoolId: BuiltValueNullFieldError.checkNotNull( + schoolId, + r'CreateClassCommand', + 'schoolId', + ), ); replace(_$result); return _$result; diff --git a/lib/api/lib/src/model/install_plugin_request.dart b/lib/api/lib/src/model/install_plugin_request.dart new file mode 100644 index 0000000..a2fb863 --- /dev/null +++ b/lib/api/lib/src/model/install_plugin_request.dart @@ -0,0 +1,123 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'install_plugin_request.g.dart'; + +/// InstallPluginRequest +/// +/// Properties: +/// * [name] +/// * [version] +@BuiltValue() +abstract class InstallPluginRequest implements Built { + @BuiltValueField(wireName: r'name') + String get name; + + @BuiltValueField(wireName: r'version') + String? get version; + + InstallPluginRequest._(); + + factory InstallPluginRequest([void updates(InstallPluginRequestBuilder b)]) = _$InstallPluginRequest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(InstallPluginRequestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$InstallPluginRequestSerializer(); +} + +class _$InstallPluginRequestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [InstallPluginRequest, _$InstallPluginRequest]; + + @override + final String wireName = r'InstallPluginRequest'; + + Iterable _serializeProperties( + Serializers serializers, + InstallPluginRequest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + yield r'version'; + yield object.version == null ? null : serializers.serialize( + object.version, + specifiedType: const FullType.nullable(String), + ); + } + + @override + Object serialize( + Serializers serializers, + InstallPluginRequest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required InstallPluginRequestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'version': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.version = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + InstallPluginRequest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = InstallPluginRequestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/lib/api/lib/src/model/install_plugin_request.g.dart b/lib/api/lib/src/model/install_plugin_request.g.dart new file mode 100644 index 0000000..e501059 --- /dev/null +++ b/lib/api/lib/src/model/install_plugin_request.g.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'install_plugin_request.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +class _$InstallPluginRequest extends InstallPluginRequest { + @override + final String name; + @override + final String? version; + + factory _$InstallPluginRequest([ + void Function(InstallPluginRequestBuilder)? updates, + ]) => (InstallPluginRequestBuilder()..update(updates))._build(); + + _$InstallPluginRequest._({required this.name, this.version}) : super._(); + @override + InstallPluginRequest rebuild( + void Function(InstallPluginRequestBuilder) updates, + ) => (toBuilder()..update(updates)).build(); + + @override + InstallPluginRequestBuilder toBuilder() => + InstallPluginRequestBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is InstallPluginRequest && + name == other.name && + version == other.version; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, version.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'InstallPluginRequest') + ..add('name', name) + ..add('version', version)) + .toString(); + } +} + +class InstallPluginRequestBuilder + implements Builder { + _$InstallPluginRequest? _$v; + + String? _name; + String? get name => _$this._name; + set name(String? name) => _$this._name = name; + + String? _version; + String? get version => _$this._version; + set version(String? version) => _$this._version = version; + + InstallPluginRequestBuilder() { + InstallPluginRequest._defaults(this); + } + + InstallPluginRequestBuilder get _$this { + final $v = _$v; + if ($v != null) { + _name = $v.name; + _version = $v.version; + _$v = null; + } + return this; + } + + @override + void replace(InstallPluginRequest other) { + _$v = other as _$InstallPluginRequest; + } + + @override + void update(void Function(InstallPluginRequestBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + InstallPluginRequest build() => _build(); + + _$InstallPluginRequest _build() { + final _$result = + _$v ?? + _$InstallPluginRequest._( + name: BuiltValueNullFieldError.checkNotNull( + name, + r'InstallPluginRequest', + 'name', + ), + version: version, + ); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/api/lib/src/serializers.dart b/lib/api/lib/src/serializers.dart index e17bdf7..627f009 100644 --- a/lib/api/lib/src/serializers.dart +++ b/lib/api/lib/src/serializers.dart @@ -37,6 +37,7 @@ import 'package:schuly_api/src/model/enrol_student_command.dart'; import 'package:schuly_api/src/model/exam_dto.dart'; import 'package:schuly_api/src/model/exam_type.dart'; import 'package:schuly_api/src/model/grade_dto.dart'; +import 'package:schuly_api/src/model/install_plugin_request.dart'; import 'package:schuly_api/src/model/my_school_dto.dart'; import 'package:schuly_api/src/model/plugin_dto.dart'; import 'package:schuly_api/src/model/plugin_task_status.dart'; @@ -90,6 +91,7 @@ part 'serializers.g.dart'; ExamDto, ExamType, GradeDto, + InstallPluginRequest, MySchoolDto, PluginDto, PluginTaskStatus, diff --git a/lib/api/lib/src/serializers.g.dart b/lib/api/lib/src/serializers.g.dart index 27d2ca0..9837e28 100644 --- a/lib/api/lib/src/serializers.g.dart +++ b/lib/api/lib/src/serializers.g.dart @@ -31,6 +31,7 @@ Serializers _$serializers = ..add(ExamDto.serializer) ..add(ExamType.serializer) ..add(GradeDto.serializer) + ..add(InstallPluginRequest.serializer) ..add(MySchoolDto.serializer) ..add(PluginDto.serializer) ..add(PluginTaskStatus.serializer) diff --git a/lib/api/test/install_plugin_request_test.dart b/lib/api/test/install_plugin_request_test.dart new file mode 100644 index 0000000..3a11fd2 --- /dev/null +++ b/lib/api/test/install_plugin_request_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:schuly_api/schuly_api.dart'; + +// tests for InstallPluginRequest +void main() { + final instance = InstallPluginRequestBuilder(); + // TODO add properties to the builder and call build() + + group(InstallPluginRequest, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + + // String version + test('to test the property `version`', () async { + // TODO + }); + + }); +}