Server/project/src/callbacks/WeatherCallbacks.ts

32 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-03-03 16:23:46 +01:00
import { inject, injectable } from "tsyringe";
import { WeatherController } from "@spt/controllers/WeatherController";
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
import { IWeatherData } from "@spt/models/eft/weather/IWeatherData";
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
2024-07-05 15:21:30 +02:00
import { IGetLocalWeatherResponseData } from "@spt/models/spt/weather/IGetLocalWeatherResponseData";
2023-03-03 16:23:46 +01:00
@injectable()
export class WeatherCallbacks
{
constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
2023-11-16 02:35:05 +01:00
@inject("WeatherController") protected weatherController: WeatherController,
2023-03-03 16:23:46 +01:00
)
2023-11-16 02:35:05 +01:00
{}
2023-03-03 16:23:46 +01:00
/**
* Handle client/weather
* @returns IWeatherData
*/
public getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IWeatherData>
{
return this.httpResponse.getBody(this.weatherController.generate());
}
2024-07-05 15:21:30 +02:00
public getLocalWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetLocalWeatherResponseData>
{
return this.httpResponse.getBody(this.weatherController.generateLocal(sessionID));
}
2023-11-16 02:35:05 +01:00
}