diff options
author | crupest <crupest@outlook.com> | 2020-12-19 21:17:05 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-12-19 21:17:05 +0800 |
commit | 74adab3f16848b1f0f00c981dfe1759ed2159180 (patch) | |
tree | 8863039fa4ca2d8a4e0b7107a6ea4ff772c9196d /FrontEnd/src/app/http/timeline.ts | |
parent | d228666d81cefaa12e1323849878f2585479ae4b (diff) | |
download | timeline-74adab3f16848b1f0f00c981dfe1759ed2159180.tar.gz timeline-74adab3f16848b1f0f00c981dfe1759ed2159180.tar.bz2 timeline-74adab3f16848b1f0f00c981dfe1759ed2159180.zip |
feat: Add highlight timeline http client.
Diffstat (limited to 'FrontEnd/src/app/http/timeline.ts')
-rw-r--r-- | FrontEnd/src/app/http/timeline.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/FrontEnd/src/app/http/timeline.ts b/FrontEnd/src/app/http/timeline.ts index 71c49852..6be0a183 100644 --- a/FrontEnd/src/app/http/timeline.ts +++ b/FrontEnd/src/app/http/timeline.ts @@ -121,7 +121,7 @@ export class HttpTimelineNameConflictError extends Error { //-------------------- begin: internal model -------------------- -interface RawTimelineInfo { +export interface RawHttpTimelineInfo { uniqueId: string; title: string; name: string; @@ -188,7 +188,9 @@ interface RawTimelinePostPostRequest { //-------------------- end: internal model -------------------- -function processRawTimelineInfo(raw: RawTimelineInfo): HttpTimelineInfo { +export function processRawTimelineInfo( + raw: RawHttpTimelineInfo +): HttpTimelineInfo { return { ...raw, lastModified: new Date(raw.lastModified), @@ -293,7 +295,7 @@ export interface IHttpTimelineClient { export class HttpTimelineClient implements IHttpTimelineClient { listTimeline(query: HttpTimelineListQuery): Promise<HttpTimelineInfo[]> { return axios - .get<RawTimelineInfo[]>( + .get<RawHttpTimelineInfo[]>( applyQueryParameters(`${apiBaseUrl}/timelines`, query) ) .then(extractResponseData) @@ -323,7 +325,7 @@ export class HttpTimelineClient implements IHttpTimelineClient { } ): Promise<HttpTimelineInfo | NotModified> { return axios - .get<RawTimelineInfo>( + .get<RawHttpTimelineInfo>( applyQueryParameters(`${apiBaseUrl}/timelines/${timelineName}`, query) ) .then((res) => { @@ -342,7 +344,7 @@ export class HttpTimelineClient implements IHttpTimelineClient { token: string ): Promise<HttpTimelineInfo> { return axios - .post<RawTimelineInfo>(`${apiBaseUrl}/timelines?token=${token}`, req) + .post<RawHttpTimelineInfo>(`${apiBaseUrl}/timelines?token=${token}`, req) .then(extractResponseData) .then(processRawTimelineInfo) .catch(convertToIfErrorCodeIs(11040101, HttpTimelineNameConflictError)) @@ -355,7 +357,7 @@ export class HttpTimelineClient implements IHttpTimelineClient { token: string ): Promise<HttpTimelineInfo> { return axios - .patch<RawTimelineInfo>( + .patch<RawHttpTimelineInfo>( `${apiBaseUrl}/timelines/${timelineName}?token=${token}`, req ) |