package com.microservices.zone.utils;

import com.microservices.common.httpClient.domain.GitLinkRequestUrl;


/**
 * @author xjy
 */
public class ZoneGitLinkRequestUrl extends GitLinkRequestUrl {

    /**
     * 创建项目
     */
    public static GitLinkRequestUrl PROJECT_LANGUAGES() {
        return getOpenGitLinkRequestUrl("/api/project_languages.json", "project_languages");
    }

    /**
     * 搜索项目列表
     */
    public static GitLinkRequestUrl PROJECTS(String query) {
        return getOpenGitLinkRequestUrl(String.format("/api/projects.json%s", query));
    }


    /**
     * 获取项目贡献者
     */
    public static String CONTRIBUTORS(String fullName) {
        return String.format("/api/%s/contributors.json", fullName);
    }

    /**
     * 数据集详情
     */
    public static GitLinkRequestUrl DATASET(String fullName, Integer page, Integer limit) {
        return getOpenGitLinkRequestUrl(String.format("/api/v1/%s/dataset?page=%d&limit=%d", fullName, page, limit));
    }

    /**
     * 数据集详情
     */
    public static GitLinkRequestUrl PROJECT_DATASETS(String ids) {
        return getOpenGitLinkRequestUrl(String.format("/api/v1/project_datasets.json?ids=%s", ids));
    }

    /**
     * 获取项目详情
     */
    public static GitLinkRequestUrl PROJECT_DETAIL(String fullName) {
        return getOpenGitLinkRequestUrl(String.format("/api/%s/detail.json", fullName));
    }

    /**
     * 发送通知
     */
    public static GitLinkRequestUrl SEND_NOTICES() {
        return getOpenGitLinkRequestUrl(String.format("/api/notices.json"));
    }

    public static GitLinkRequestUrl CHECK_PROJECT_KEYWORDS() {
        String path = "/api/accounts/check_keywords";
        return getOpenGitLinkRequestUrl(path);
    }
}
