import axios from "./axios";

export default {
  getVersions: () =>
    axios.get(
      "https://gitcode.net/api/v4/projects/weixin_43881430%2Fquicker/releases"
    ),
  getPlugins: path =>
    axios.get(
      `https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/tree?ref=master&path=${path}`
    ),
  getMenu: () =>
    axios.get(
      "https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/tree?path=plugins&ref=master"
    ),
  getLogo: plugin =>
    `https://gitlab.com/layyback/quicker-market/-/raw/master/${plugin.path}/${plugin.logo}`,

  getReadme: plugin =>
    axios.get(
      `https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/files/${plugin.path}%2F${plugin.detail}/raw?ref=master`
    ),
  getDownloadUrl: pluginPath =>
    `https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/archive.zip?path=${pluginPath}`,
  getPluginDetail: pluginPath =>
    axios.get(
      `https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/files/${pluginPath}%2Fplugin.json/raw?ref=master`
    )
};
