| 113 | } |
| 114 | |
| 115 | export class GanterAPI { |
| 116 | |
| 117 | |
| 118 | constructor(private baseURL: string = null) { |
| 119 | if (this.baseURL == null) { |
| 120 | this.baseURL = URLHandler.basicURL(); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | |
| 125 | allProjects(): Promise<API_AllProject> { |
| 126 | return d3.json(this.baseURL + '/api/all_projects') |
| 127 | } |
| 128 | |
| 129 | ablationChannels(project: string, |
| 130 | layer = "layer2"): Promise<API_Channels> { |
| 131 | return d3.json(this.baseURL + `/api/channels?project=${project}&layer=${layer}`) |
| 132 | } |
| 133 | |
| 134 | recipes(project: string): Promise<API_Recipes> { |
| 135 | return d3.json(this.baseURL + `/api/recipes?project=${project}`) |
| 136 | } |
| 137 | |
| 138 | rankings(project: string, layer: string): Promise<API_Rankings> { |
| 139 | return d3.json(this.baseURL + `/api/rankings?project=${project}&layer=${layer}`) |
| 140 | } |
| 141 | |
| 142 | |
| 143 | levels(project: string, layer: string, q: number = 0.99): Promise<API_Levels> { |
| 144 | //../api/levels?project=churchoutdoor&layer=layer4&quantiles=0.99 |
| 145 | return d3.json(this.baseURL + `/api/levels?project=${project}&layer=${layer}&quantiles=${q}`) |
| 146 | |
| 147 | } |
| 148 | |
| 149 | |
| 150 | generateImgs(project: string, |
| 151 | ids: number[], |
| 152 | wantz = 0, |
| 153 | ablations: AblationUpload[] = []): Promise<API_generate> { |
| 154 | return d3.json(this.baseURL + '/api/generate', { |
| 155 | method: "POST", |
| 156 | body: JSON.stringify({ |
| 157 | "ablations": ablations, |
| 158 | "project": project, |
| 159 | "ids": ids, |
| 160 | "wantz": wantz |
| 161 | }), |
| 162 | headers: { |
| 163 | "Content-type": "application/json; charset=UTF-8" |
| 164 | } |
| 165 | }); |
| 166 | } |
| 167 | |
| 168 | generateImgsWithRmCp(project: string, |
| 169 | ids: number[], |
| 170 | wantz = 0, |
| 171 | ablation_rm: AblationUpload[] = [], |
| 172 | ablation_cp: AblationUpload[] = [], |
nothing calls this directly
no outgoing calls
no test coverage detected