dart.libraries.dio.api.mustache Maven / Gradle / Ivy
{{>header}}
import 'dart:async';
{{#includeLibraryTemplate}}api/imports{{/includeLibraryTemplate}}
import 'package:dio/dio.dart';
{{#operations}}
{{#imports}}import '{{.}}';
{{/imports}}
class {{classname}} {
final Dio _dio;
{{#includeLibraryTemplate}}api/constructor{{/includeLibraryTemplate}}
{{#operation}}
/// {{summary}}{{^summary}}{{nickname}}{{/summary}}
/// {{notes}}
///
/// Parameters:
{{#allParams}}
/// * [{{paramName}}] {{#description}}- {{{.}}}{{/description}}
{{/allParams}}
/// * [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]{{#returnType}} containing a [Response] with a [{{{.}}}] as data{{/returnType}}
/// Throws [DioException] if API call or serialization fails
{{#externalDocs}}
/// {{description}}
/// Also see [{{summary}} Documentation]({{url}})
{{/externalDocs}}
{{#isDeprecated}}
@Deprecated('This operation has been deprecated')
{{/isDeprecated}}
Future> {{nickname}}({ {{#allParams}}{{#isPathParam}}
{{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}required {{{dataType}}} {{paramName}},{{/isPathParam}}{{#isQueryParam}}
{{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isQueryParam}}{{#isHeaderParam}}
{{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isHeaderParam}}{{#isBodyParam}}
{{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isBodyParam}}{{#isFormParam}}
{{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isFormParam}}{{/allParams}}
CancelToken? cancelToken,
Map? headers,
Map? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{{baseName}}}' '}', {{#includeLibraryTemplate}}api/query_param{{/includeLibraryTemplate}}.toString()){{/pathParams}};
final _options = Options(
method: r'{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}',
{{#isResponseFile}}
responseType: ResponseType.bytes,
{{/isResponseFile}}
headers: {
{{#httpUserAgent}}
r'User-Agent': r'{{{.}}}',
{{/httpUserAgent}}
{{#headerParams}}
{{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}},
{{/headerParams}}
...?headers,
},
extra: {
'secure':
© 2015 - 2024 Weber Informatics LLC | Privacy Policy