Skip to content

Commit 724ad32

Browse files
author
Simon Delisle
committed
Small fixes in various responses
Signed-off-by: Simon Delisle <delislesim@hotmail.com>
1 parent 7cdac29 commit 724ad32

File tree

6 files changed

+29
-7
lines changed

6 files changed

+29
-7
lines changed

src/models/tree.ts renamed to src/models/entry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface BasicEntry {
3131
/**
3232
* Array of entry header
3333
*/
34-
name: EntryHeader[];
34+
name: string[];
3535
}
3636

3737
/**

src/models/response/entry-response.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
********************************************************************************/
1616

1717
import { OutputDescriptor } from '../output-descriptor';
18+
import { ResponseStatus } from './responses';
1819

1920
/**
2021
* Generic entry/tree response
@@ -34,4 +35,14 @@ export interface GenericEntryResponse<T> {
3435
* Number of entries in the model
3536
*/
3637
size: number;
38+
39+
/**
40+
* Response status as described by ResponseStatus
41+
*/
42+
status: ResponseStatus;
43+
44+
/**
45+
* Message associated with the response
46+
*/
47+
statusMessage: string;
3748
}

src/models/response/timegraph-response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
********************************************************************************/
1616

17-
import { EntryHeader } from '../tree';
17+
import { EntryHeader } from '../entry';
1818
import { GenericEntryResponse } from './entry-response';
1919
import { TimeGraphEntry } from '../timegraph';
2020

src/models/response/xy-response.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616

1717
import { XYModel, Axis } from '../xy';
1818
import { GenericResponse } from './responses';
19+
import { BasicEntry, EntryHeader } from '../entry';
20+
import { GenericEntryResponse } from './entry-response';
21+
22+
23+
/**
24+
* XY specific entry response extends the GenericEntryResponse.
25+
* Type T is a BasicEntry and Type U is an EntryHeader
26+
*/
27+
export interface XYEntryResponse<T extends BasicEntry, U extends EntryHeader> extends GenericEntryResponse<T> {
28+
headers: U[];
29+
}
1930

2031
/**
2132
* XY specific model response.

src/models/timegraph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
********************************************************************************/
1616

17-
import { BasicEntry } from './tree';
17+
import { BasicEntry } from './entry';
1818

1919
/**
2020
* Entry in a time graph

src/protocol/tsp-client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
import { Query } from '../models/query';
1818
import { GenericEntryResponse } from '../models/response/entry-response';
19-
import { BasicEntry, EntryHeader } from '../models/tree';
19+
import { BasicEntry, EntryHeader } from '../models/entry';
2020
import { GenericResponse } from '../models/response/responses';
21-
import { XYModelResponse } from '../models/response/xy-response';
21+
import { XYModelResponse, XYEntryResponse } from '../models/response/xy-response';
2222
import { XYModel } from '../models/xy';
2323
import { TimeGraphEntryResponse } from '../models/response/timegraph-response';
2424
import { TimeGraphEntry, TimeGraphRow, TimeGraphArrow } from '../models/timegraph';
@@ -147,9 +147,9 @@ export class TspClient {
147147
* @param parameters Query object
148148
* @returns Generic entry response with entries of type T
149149
*/
150-
public async fetchXYTree<T extends BasicEntry>(expUUID: string, outputID: string, parameters: Query): Promise<GenericEntryResponse<T>> {
150+
public async fetchXYTree<T extends BasicEntry, U extends EntryHeader>(expUUID: string, outputID: string, parameters: Query): Promise<XYEntryResponse<T, U>> {
151151
const url = '${this.baseUrl}/experiments/${expUUID}/outputs/XY/${outputID}/tree';
152-
return await RestClient.post(url, parameters) as GenericEntryResponse<T>;
152+
return await RestClient.post(url, parameters) as XYEntryResponse<T, U>;
153153
}
154154

155155
/**

0 commit comments

Comments
 (0)