diff --git a/client/js/entity.js b/client/js/entity.js index 84f407e6f..9dab58093 100644 --- a/client/js/entity.js +++ b/client/js/entity.js @@ -104,6 +104,7 @@ addAllGetter(alt.AudioOutputFrontend, alt.Enums.BaseObjectType.AUDIO_OUTPUT_FRON addAllGetter(alt.AudioOutputWorld, alt.Enums.BaseObjectType.AUDIO_OUTPUT_WORLD); addAllGetter(alt.RmlDocument, alt.Enums.BaseObjectType.RML_DOCUMENT); addAllGetter(alt.TextLabel, alt.Enums.BaseObjectType.TEXT_LABEL); +addAllGetter(alt.HttpClient, alt.Enums.BaseObjectType.HTTP_CLIENT); addAllGetter(alt.WebSocketClient, alt.Enums.BaseObjectType.WEBSOCKET_CLIENT); addAllGetter(alt.WebView, alt.Enums.BaseObjectType.WEBVIEW); diff --git a/client/js/factory.js b/client/js/factory.js index 9a8e11206..e1a55eb07 100644 --- a/client/js/factory.js +++ b/client/js/factory.js @@ -13,6 +13,7 @@ registerFactory(alt.LocalObject, alt.Enums.BaseObjectType.LOCAL_OBJECT); registerFactory(alt.RmlDocument, alt.Enums.BaseObjectType.RML_DOCUMENT); +registerFactory(alt.HttpClient, alt.Enums.BaseObjectType.HTTP_CLIENT); registerFactory(alt.WebSocketClient, alt.Enums.BaseObjectType.WEBSOCKET_CLIENT); registerFactory(alt.WebView, alt.Enums.BaseObjectType.WEBVIEW); diff --git a/client/src/factories/HttpClientFactory.cpp b/client/src/factories/HttpClientFactory.cpp new file mode 100644 index 000000000..42af872ce --- /dev/null +++ b/client/src/factories/HttpClientFactory.cpp @@ -0,0 +1,6 @@ +#include "FactoryHandler.h" + +// clang-format off +static js::FactoryHandler httpClientFactory(alt::IBaseObject::Type::HTTP_CLIENT, [](js::Object& args) -> alt::IBaseObject* { + return alt::ICore::Instance().CreateHttpClient(); +}); diff --git a/types/client/index.d.ts b/types/client/index.d.ts index 5a4dd062f..b0c2c4e12 100644 --- a/types/client/index.d.ts +++ b/types/client/index.d.ts @@ -524,6 +524,8 @@ declare module "@altv/client" { readonly extraHeaders: Record; + static create(): HttpClient; + static getByID(id: number): HttpClient | null; } diff --git a/types/client/package.json b/types/client/package.json index f860ac559..36d5efd30 100644 --- a/types/client/package.json +++ b/types/client/package.json @@ -1,6 +1,6 @@ { "name": "@altv/client", - "version": "0.0.30", + "version": "0.0.31", "description": "This package contains the type definitions for the alt:V JS module v2 client types", "types": "index.d.ts", "files": [