style: auto-fix lint and format

This commit is contained in:
manuel-rw authored and github-actions[bot] committed 2026-07-01 09:05:27 +00:00
1 parent 629f3b0955
commit 973baedfcb
4 files changed
+72 -72

No files matched your search

@@ -1,53 +1,52 @@
import {fetchWithTrustedCertificatesAsync} from "@homarr/core/infrastructure/http";
import {ResponseError} from "@homarr/common/server";
import {Integration, IntegrationInput, IntegrationTestingInput} from "../base/integration";
import {dawarichPlacesSchema, dawarichStatisticsSchema} from "./dawarich-schemas";
import {z} from "zod/v4";
import {TestingResult} from "../base/test-connection/test-connection-service";
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
import { ResponseError } from "@homarr/common/server";
import type { IntegrationInput, IntegrationTestingInput } from "../base/integration";
import { Integration } from "../base/integration";
import { dawarichPlacesSchema, dawarichStatisticsSchema } from "./dawarich-schemas";
import type { z } from "zod/v4";
import type { TestingResult } from "../base/test-connection/test-connection-service";
import { TestConnectionError } from "../base/test-connection/test-connection-error";
export class DawarichIntegration extends Integration {
constructor(integration: IntegrationInput) {
super(integration);
constructor(integration: IntegrationInput) {
super(integration);
}
protected async testingAsync(input: IntegrationTestingInput): Promise<TestingResult> {
const response = await fetchWithTrustedCertificatesAsync(this.url(`/api/v1/users/me`), {
headers: { Authorization: `Bearer ${this.getSecretValue("apiKey")}` },
});
if (response.status === 200) {
return { success: true };
}
protected async testingAsync(input: IntegrationTestingInput): Promise<TestingResult> {
const response = await fetchWithTrustedCertificatesAsync(this.url(`/api/v1/users/me`), {
headers: {Authorization: `Bearer ${this.getSecretValue('apiKey')}`},
});
return TestConnectionError.StatusResult(response);
}
if (response.status === 200) {
return { success: true };
}
async getStatisticsAsync(): Promise<{
totalDistanceKm: number;
totalPointsTracked: number;
totalReverseGeocodedPoints: number;
totalCountriesVisited: number;
totalCitiesVisited: number;
}> {
const response = await fetchWithTrustedCertificatesAsync(this.url("/api/v1/stats"), {
headers: { Authorization: `Bearer ${this.getSecretValue("apiKey")}` },
});
return TestConnectionError.StatusResult(response);
}
if (!response.ok) throw new ResponseError(response);
async getStatisticsAsync(): Promise<{
totalDistanceKm: number,
totalPointsTracked: number,
totalReverseGeocodedPoints: number,
totalCountriesVisited: number,
totalCitiesVisited: number
}> {
const response = await fetchWithTrustedCertificatesAsync(this.url('/api/v1/stats'), {
headers: {Authorization: `Bearer ${this.getSecretValue('apiKey')}`},
});
return dawarichStatisticsSchema.parseAsync(await response.json());
}
if (!response.ok)
throw new ResponseError(response);
async getPlacesAsync(): Promise<z.infer<typeof dawarichPlacesSchema>> {
const response = await fetchWithTrustedCertificatesAsync(this.url("/api/v1/places"), {
headers: { Authorization: `Bearer ${this.getSecretValue("apiKey")}` },
});
return dawarichStatisticsSchema.parseAsync(await response.json());
}
if (!response.ok) throw new ResponseError(response);
async getPlacesAsync(): Promise<z.infer<typeof dawarichPlacesSchema>> {
const response = await fetchWithTrustedCertificatesAsync(this.url('/api/v1/places'), {
headers: {Authorization: `Bearer ${this.getSecretValue('apiKey')}`},
});
if (!response.ok)
throw new ResponseError(response);
return dawarichPlacesSchema.parseAsync(await response.json());
}
}
return dawarichPlacesSchema.parseAsync(await response.json());
}
}