// Author: fengshengxiong
// Date: 2024/6/18
// Description: TikUsTokApi

import 'package:tone_snap/data/models/base_model.dart';
import 'package:tone_snap/data/network/dio_client.dart';
import 'package:tone_snap/data/models/isocode_model.dart';

class TikUsTokApi {
  static const String baseUrl = 'https://api.tikustok.com/';

  /// 获取所在区域
  static Future<BaseModel<IsoCodeModel>?> getIsoCode() async {
    BaseModel<IsoCodeModel>? baseModel;
    await DioClient(baseUrl: baseUrl).request<BaseModel<IsoCodeModel>>(
      'app/common/getIPInfo',
      requestMethod: RequestMethod.get,
      formJson: (json) => BaseModel<IsoCodeModel>.fromMap(json, IsoCodeModel.fromMap),
      success: (model) => baseModel = model,
    );
    return baseModel;
  }
}
