{"size": 1473, "ext": "js", "max_stars_repo_path": "docs/services/Doc.js", "max_stars_repo_name": "tianyingchun/docs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "docs/services/Doc.js", "max_issues_repo_name": "tianyingchun/docs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "docs/services/Doc.js", "max_forks_repo_name": "tianyingchun/docs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.9661016949, "max_line_length": 67, "alphanum_fraction": 0.571622539}
import axios from 'axios';
import WebAPI from '../../utils/WebAPI';

class Doc extends WebAPI {

  /**
   * Load doc details
   * @param  {Object} query doc query condictions
   * @return {Object<Doc>}       doc detail information
   */
  loadDocDetail = (query) => {
    console.log('service: loadDocDetail query:', query);
    return axios.get(this.getApiUrl('/api/docs/react/guideinfo'), {
      params: query
    }).then(function (result) {
      return result.data;
    }).catch(function (err) {
      return err;
    });
  }

  /**
   * Search docs
   * @param  {Object} query the search docs query conditions
   * @return {Array<Doc>}       results
   */
  searchDocs = (query) => {
    console.log('service: searchDocs query:', query);
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve([{
          guide: 'the is guide',
          code: 'this is coce'
        }, {
          guide: 'the is guide',
          code: 'this is coce'
        }]);
      }, query.timeout || 0);
    });
  }
  /**
   * Load current doc catalogs.
   * @param  {Object} query doc catalogs
   * @return {Array<DocCatalogItem>}
   */
  loadDocCatalogs = (query) => {
    console.log('service: loadDocCatalogs query:', query);
    return axios.get(this.getApiUrl('/api/docs/react/dockmenus'), {
      params: query
    }).then(function (result) {
      return result.data;
    }).catch(function (err) {
      return err;
    });
  }
}

export default Doc;
