aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/utils/api-urls.js
blob: b2748b67bb1bef38fd2c0a7c05c31edc2f28e40f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import config from '../config/environment';

export const urls = {  
  packageInfoUrl : function(packageId) {
    return config.APP.staticUrlPrefix+"/"+packageId+"/"+config.APP.haskellCodeExplorerDirectory+"/packageInfo.json";
  },
  fileUrl : function(packageId,filePath) {
    return config.APP.staticUrlPrefix+"/"+packageId+"/"+filePath;
  },  
  haskellModuleUrl : function (packageId,filePath) {
    return config.APP.staticUrlPrefix+"/"+packageId+"/"+config.APP.haskellCodeExplorerDirectory+"/"+encodeURIComponent(encodeURIComponent(filePath))+ ".json";
  },
  packagesUrl : config.APP.apiUrlPrefix + "/packages",
  identifierDefinitionSiteUrl : function(packageId,moduleName,componentId,entity,name) {
    return config.APP.apiUrlPrefix + "/definitionSite/" + packageId+"/"+componentId+"/"+moduleName+"/"+entity+"/"+encodeURIComponent(name).replace(/\./g, '%2E');
  },
  modulePathUrl : function (packageId,moduleName,componentId) {
    return config.APP.apiUrlPrefix + "/modulePath/"+packageId+"/"+componentId+"/"+moduleName;
  },
  expressionsUrl : function (packageId,modulePath,lineStart,columnStart,lineEnd,columnEnd) {
    return config.APP.apiUrlPrefix + "/expressions/"+packageId+"/"+encodeURIComponent(modulePath) +"/"+lineStart+"/"+columnStart+"/"+lineEnd+"/"+columnEnd;
  },
  referencesUrl : function (packageId,externalId) {
    return config.APP.apiUrlPrefix + "/references/"+packageId+"/"+encodeURIComponent(externalId);
  },
  identifierSearchUrl : function (packageId,query) {
    return config.APP.apiUrlPrefix + "/identifiers/"+packageId+"/"+encodeURIComponent(query).replace(/\./g, '%2E');
  }
}