diff --git a/api/index.ts b/api/index.ts index c8510b7..b3e96ac 100644 --- a/api/index.ts +++ b/api/index.ts @@ -1,4 +1,71 @@ -import { AxiosInstance } from "axios"; +import { AxiosInstance, AxiosRequestConfig } from "axios"; + +export interface ExtendedAxios { + /** + * Triggers an HTTP GET request and does not wait for the response (fire-and-forget). + * Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects. + */ + getAndForget: ( + url: string, + config?: AxiosRequestConfig + ) => void; + + /** + * Triggers an HTTP PUT request and does not wait for the response (fire-and-forget). + * Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects. + */ + putAndForget: ( + url: string, + data?: D, + config?: AxiosRequestConfig + ) => void; + + /** + * Triggers an HTTP POST request and does not wait for the response (fire-and-forget). + * Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects. + */ + postAndForget: ( + url: string, + data?: D, + config?: AxiosRequestConfig + ) => void; + + /** + * Triggers an HTTP DELETE request and does not wait for the response (fire-and-forget). + * Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects. + */ + deleteAndForget: ( + url: string, + config?: AxiosRequestConfig + ) => void; + + /** + * Triggers an HTTP HEAD request and does not wait for the response (fire-and-forget). + * Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects. + */ + headAndForget: ( + url: string, + config?: AxiosRequestConfig + ) => void; + + /** + * Triggers an HTTP PATCH request and does not wait for the response (fire-and-forget). + * Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects. + */ + patchAndForget: ( + url: string, + data?: D, + config?: AxiosRequestConfig + ) => void; + + /** + * Triggers an HTTP REQUEST and does not wait for the response (fire-and-forget). + * Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects. + */ + requestAndForget: ( + config: AxiosRequestConfig + ) => void; +} /** * Response returned by JFrog platform API @@ -81,7 +148,7 @@ export interface PlatformClients { /** * HTTP client (axios) to perform requests to the outside */ - axios: Pick; + axios: Pick & ExtendedAxios; } export interface PlatformSecrets {