//
// 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';

class AttachmentsApi {

  final Dio _dio;

  final Serializers _serializers;

  const AttachmentsApi(this._dio, this._serializers);

  /// Liefert ein gerendertes Vorschaubild des Attachments (Bytes), geladen aus DOCUframe. Auflösung/Format über Query-Parameter steuerbar (&#x60;?w&#x3D;&amp;h&#x3D;&amp;q&#x3D;&amp;ext&#x3D;&amp;page&#x3D;&#x60;).
  /// 
  ///
  /// Parameters:
  /// * [id] - Attachment-Id (unsere UUID)
  /// * [w] - Breite in Pixeln (Default 1024)
  /// * [h] - Höhe in Pixeln (Default 1024)
  /// * [q] - Qualität 0–100 (Default 85)
  /// * [ext] - png|jpeg|jpg|webp|tiff (Default jpeg)
  /// * [page] - Seitennummer (Default 1)
  /// * [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<Response<void>> getAttachment({ 
    required String id,
    int? w,
    int? h,
    int? q,
    String? ext,
    String? page,
    CancelToken? cancelToken,
    Map<String, dynamic>? headers,
    Map<String, dynamic>? extra,
    ValidateStatus? validateStatus,
    ProgressCallback? onSendProgress,
    ProgressCallback? onReceiveProgress,
  }) async {
    final _path = r'/attachments/{id}'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString());
    final _options = Options(
      method: r'GET',
      headers: <String, dynamic>{
        ...?headers,
      },
      extra: <String, dynamic>{
        'secure': <Map<String, String>>[
          {
            'type': 'http',
            'scheme': 'bearer',
            'name': 'bearer_auth',
          },
        ],
        ...?extra,
      },
      validateStatus: validateStatus,
    );

    final _queryParameters = <String, dynamic>{
      if (w != null) r'w': encodeQueryParameter(_serializers, w, const FullType(int)),
      if (h != null) r'h': encodeQueryParameter(_serializers, h, const FullType(int)),
      if (q != null) r'q': encodeQueryParameter(_serializers, q, const FullType(int)),
      if (ext != null) r'ext': encodeQueryParameter(_serializers, ext, const FullType(String)),
      if (page != null) r'page': encodeQueryParameter(_serializers, page, const FullType(String)),
    };

    final _response = await _dio.request<Object>(
      _path,
      options: _options,
      queryParameters: _queryParameters,
      cancelToken: cancelToken,
      onSendProgress: onSendProgress,
      onReceiveProgress: onReceiveProgress,
    );

    return _response;
  }

}
