// // AUTO-GENERATED FILE, DO NOT MODIFY! // import 'dart:async'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; import 'package:dio/dio.dart'; import 'package:holzleitner_api/src/api_util.dart'; import 'package:holzleitner_api/src/model/delivered_belegnummern_response.dart'; import 'package:holzleitner_api/src/model/import_summary.dart'; import 'package:holzleitner_api/src/model/mark_mail_sent_request.dart'; import 'package:holzleitner_api/src/model/mark_mail_sent_response.dart'; class AdminApi { final Dio _dio; final Serializers _serializers; const AdminApi(this._dio, this._serializers); /// Liefert die Belegnummern ausgelieferter (abgeschlossener) Lieferungen, **deren Liefermail noch nicht versendet wurde** (`mail_sent_at IS NULL`). „Ausgeliefert\" = es existiert ein Abschluss. Mit `day` (DD-MM-YYYY) nur Abschlüsse dieses Berliner Kalendertages; **ohne `day` alle offenen** (über alle Tage) — so bleiben Belege über Mitternacht nicht hängen. /// /// /// Parameters: /// * [day] - Tag DD-MM-YYYY; ohne Angabe ALLE offenen Belege /// * [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] containing a [Response] with a [DeliveredBelegnummernResponse] as data /// Throws [DioException] if API call or serialization fails Future> deliveredBelegnummern({ String? day, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/admin/delivered-belegnummern'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'admin_api_key', 'keyName': 'X-Admin-Api-Key', 'where': 'header', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { if (day != null) r'day': encodeQueryParameter(_serializers, day, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); DeliveredBelegnummernResponse? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(DeliveredBelegnummernResponse), ) as DeliveredBelegnummernResponse; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, requestOptions: _response.requestOptions, redirects: _response.redirects, statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, ); } /// Stößt den ERP-Import für ein Datum an und liefert die Zusammenfassung. /// /// /// Parameters: /// * [date] - Ziel-Tourdatum YYYY-MM-DD (Default: heute) /// * [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] containing a [Response] with a [ImportSummary] as data /// Throws [DioException] if API call or serialization fails Future> importErp({ String? date, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/admin/import-erp'; final _options = Options( method: r'POST', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'admin_api_key', 'keyName': 'X-Admin-Api-Key', 'where': 'header', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { if (date != null) r'date': encodeQueryParameter(_serializers, date, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); ImportSummary? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(ImportSummary), ) as ImportSummary; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, requestOptions: _response.requestOptions, redirects: _response.redirects, statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, ); } /// Markiert die Liefermails der angegebenen Belegnummern als **versendet** (`mail_sent_at = now()`, nur wo noch offen). Vom Mailclient aufzurufen, NACHDEM ERPframe die Mails erfolgreich verschickt hat — danach erscheinen die Belege nicht mehr in `GET /admin/delivered-belegnummern`. /// /// /// Parameters: /// * [markMailSentRequest] /// * [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] containing a [Response] with a [MarkMailSentResponse] as data /// Throws [DioException] if API call or serialization fails Future> markMailSent({ required MarkMailSentRequest markMailSentRequest, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/admin/mark-mail-sent'; final _options = Options( method: r'POST', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'admin_api_key', 'keyName': 'X-Admin-Api-Key', 'where': 'header', }, ], ...?extra, }, contentType: 'application/json', validateStatus: validateStatus, ); dynamic _bodyData; try { const _type = FullType(MarkMailSentRequest); _bodyData = _serializers.serialize(markMailSentRequest, 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, ); MarkMailSentResponse? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(MarkMailSentResponse), ) as MarkMailSentResponse; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, requestOptions: _response.requestOptions, redirects: _response.redirects, statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, ); } /// Stößt das ERP-Rückschreiben eines bereits lokal abgeschlossenen Lieferabschlusses erneut an (idempotenter Retry, falls der automatische Push beim Abschluss fehlschlug). /// /// /// Parameters: /// * [deliveryId] - UUID der abgeschlossenen Lieferung /// * [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> pushCompletion({ required String deliveryId, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/admin/push-completion'; final _options = Options( method: r'POST', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'admin_api_key', 'keyName': 'X-Admin-Api-Key', 'where': 'header', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'delivery_id': encodeQueryParameter(_serializers, deliveryId, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); return _response; } }