async makeCodeRequest()

in src/Service.ts [283:320]


  async makeCodeRequest(requestData) {
    const { apiMeta, paramsValue, product, version, endpoint, regionId } = requestData;
    const newParamsValue = getFormatValues(paramsValue, apiMeta?.parameters);
    const security = apiMeta?.ext?.security;
    const defaultCredentialType =
      security?.length > 0
        ? security.indexOf("AK") < 0
          ? security.indexOf("BearerToken") < 0
            ? "anonymous"
            : "bearer"
          : "ak"
        : "ak";
    const body = {
      apiName: apiMeta?.name,
      apiVersion: version,
      product: product,
      sdkType: "dara",
      params: newParamsValue || {},
      regionId: regionId,
      endpoint: endpoint,
      credential: { type: defaultCredentialType },
      runtimeOptions: {},
      useCommon: false,
    };
    const resStr = await fetch(
      `https://api.aliyun.com/api/product/makeCode${getCurrentLang() === "en_US" ? "?language=EN_US" : ""}`,
      {
        method: "post",
        body: JSON.stringify(body),
        headers: {
          "Content-Type": "application/json",
          "User-Agent": getUserAgent(),
        },
      },
    ).then((res) => res.text());
    const res = JSON.parse(resStr);
    return res;
  }