aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/utils/api-urls.js
blob: 2eb2e7c63d5e41785c143f27943a2af336fc7eaf (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
30
31
32
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');
  },
  globalReferencesUrl : function (externalId) {
    return config.APP.apiUrlPrefix + "/globalReferences/"+encodeURIComponent(externalId);
  }
}