TuitioAuthenticationResult type

master
Tudor Stanciu 2023-02-11 02:21:30 +02:00
parent 6b3385af6a
commit 8b28ec10eb
1 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,9 @@ async function request(url: string, method: string) {
} }
} }
export type TuitioToken = { raw: string; validFrom: Date; validUntil: Date };
export type TuitioAuthenticationResult = { token: TuitioToken; status: string };
class TuitioClient { class TuitioClient {
baseUrl: string; baseUrl: string;
@ -29,7 +32,7 @@ class TuitioClient {
this.baseUrl = baseUrl; this.baseUrl = baseUrl;
} }
async authenticate(userName: string, password: string) { async authenticate(userName: string, password: string): Promise<TuitioAuthenticationResult> {
const templates = getUrlTemplates(this.baseUrl); const templates = getUrlTemplates(this.baseUrl);
const url = templates.authentication.replace("{username}", userName).replace("{password}", password); const url = templates.authentication.replace("{username}", userName).replace("{password}", password);