// {{folder_name}} API 函数
// Generated by apifox-flow, do not edit manually

import ajax from '@/lib/axios';
import { apifoxRequest } from '@/lib/apifox';
{{#if types}}
import { {{#each types}}{{name}}{{#unless @last}}, {{/unless}}{{/each}} } from './types';
{{/if}}

{{#each methods}}
// {{summary}}
export const {{method_name}} = ({{#if parameters}}{{#each parameters}}{{name}}{{#unless required}}?{{/unless}}: {{type_}}{{#unless @last}}, {{/unless}}{{/each}}{{/if}}): Promise<{{response_type}}> => {
  {{#if is_get}}
  {{#if has_query_params}}
  return ajax.{{http_method_lower}}('{{path}}', { params: { {{#each parameters}}{{#if is_query_param}}{{name}}{{#unless @last}}, {{/unless}}{{/if}}{{/each}} } });
  {{else}}
  return ajax.{{http_method_lower}}('{{path}}');
  {{/if}}
  {{else}}
  {{#if has_body}}
  return ajax.{{http_method_lower}}('{{path}}', {{#each parameters}}{{#if is_body_param}}{{name}}{{/if}}{{/each}});
  {{else}}
  return ajax.{{http_method_lower}}('{{path}}');
  {{/if}}
  {{/if}}
};

// {{summary}} (Mock)
export const {{method_name}}Mock = ({{#if parameters}}{{#each parameters}}{{name}}{{#unless required}}?{{/unless}}: {{type_}}{{#unless @last}}, {{/unless}}{{/each}}{{/if}}): Promise<{{response_type}}> => {
  {{#if is_get}}
  {{#if has_query_params}}
  return apifoxRequest.{{http_method_lower}}('{{path}}', { params: { {{#each parameters}}{{#if is_query_param}}{{name}}{{#unless @last}}, {{/unless}}{{/if}}{{/each}} } });
  {{else}}
  return apifoxRequest.{{http_method_lower}}('{{path}}');
  {{/if}}
  {{else}}
  {{#if has_body}}
  return apifoxRequest.{{http_method_lower}}('{{path}}', {{#each parameters}}{{#if is_body_param}}{{name}}{{/if}}{{/each}});
  {{else}}
  return apifoxRequest.{{http_method_lower}}('{{path}}');
  {{/if}}
  {{/if}}
};

{{/each}}
