40 lines
700 B
Plaintext
40 lines
700 B
Plaintext
{{>common/file_header}}
|
||
|
||
{{>common/imports}}
|
||
|
||
{{#parts}}
|
||
part '{{.}}';
|
||
{{/parts}}
|
||
|
||
{{{extraCode}}}
|
||
|
||
{{#docLines}}
|
||
/// {{.}}
|
||
{{/docLines}}
|
||
{{#hasRestApi}}
|
||
@RestApi(
|
||
{{#baseUrl}}baseUrl: '{{.}}',
|
||
{{/baseUrl}}parser: Parser.JsonSerializable,
|
||
)
|
||
{{/hasRestApi}}
|
||
abstract class {{className}} {
|
||
{{#hasRetrofit}}
|
||
/// 创建 API 服务实例
|
||
/// [dio] Dio 实例,可以预配置拦截器、超时等
|
||
/// [baseUrl] 可选的基础 URL,会覆盖注解中的 baseUrl
|
||
factory {{className}}(
|
||
Dio dio, {
|
||
String? baseUrl,
|
||
}) = _{{className}};
|
||
{{/hasRetrofit}}
|
||
{{^hasRetrofit}}
|
||
final Dio _dio;
|
||
{{className}}(this._dio);
|
||
{{/hasRetrofit}}
|
||
|
||
{{#methods}}
|
||
{{>api/api_method}}
|
||
|
||
{{/methods}}
|
||
}
|