-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
126 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
import { GetEventsRequest, GetEventsResponse } from '../../types/event.types' | ||
import { APIClient } from '../../core/client' | ||
import { ClientResponse } from '../../types/index.types' | ||
import { parseResponse } from '../../core/response-parser' | ||
|
||
const baseUrl = '' | ||
export default class EventController { | ||
private static apiClient = new APIClient(baseUrl) | ||
private apiClient: APIClient | ||
|
||
static async getEvents( | ||
constructor(private readonly backendUrl: string) { | ||
this.apiClient = new APIClient(this.backendUrl) | ||
} | ||
|
||
async getEvents( | ||
request: GetEventsRequest, | ||
headers?: Record<string, string> | ||
): Promise<GetEventsResponse> { | ||
return this.apiClient.get( | ||
): Promise<ClientResponse<GetEventsResponse>> { | ||
const response = await this.apiClient.get( | ||
`/api/event/${request.workspaceId}?source=${request.source}`, | ||
headers | ||
) | ||
return await parseResponse<GetEventsResponse>(response) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters