github.com/jfrog/frogbot@v1.1.1-0.20231221090046-821a26f50338/action/node_modules/@actions/http-client/lib/index.d.ts (about) 1 /// <reference types="node" /> 2 import * as http from 'http'; 3 import * as ifm from './interfaces'; 4 export declare enum HttpCodes { 5 OK = 200, 6 MultipleChoices = 300, 7 MovedPermanently = 301, 8 ResourceMoved = 302, 9 SeeOther = 303, 10 NotModified = 304, 11 UseProxy = 305, 12 SwitchProxy = 306, 13 TemporaryRedirect = 307, 14 PermanentRedirect = 308, 15 BadRequest = 400, 16 Unauthorized = 401, 17 PaymentRequired = 402, 18 Forbidden = 403, 19 NotFound = 404, 20 MethodNotAllowed = 405, 21 NotAcceptable = 406, 22 ProxyAuthenticationRequired = 407, 23 RequestTimeout = 408, 24 Conflict = 409, 25 Gone = 410, 26 TooManyRequests = 429, 27 InternalServerError = 500, 28 NotImplemented = 501, 29 BadGateway = 502, 30 ServiceUnavailable = 503, 31 GatewayTimeout = 504 32 } 33 export declare enum Headers { 34 Accept = "accept", 35 ContentType = "content-type" 36 } 37 export declare enum MediaTypes { 38 ApplicationJson = "application/json" 39 } 40 /** 41 * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 42 * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 43 */ 44 export declare function getProxyUrl(serverUrl: string): string; 45 export declare class HttpClientError extends Error { 46 constructor(message: string, statusCode: number); 47 statusCode: number; 48 result?: any; 49 } 50 export declare class HttpClientResponse { 51 constructor(message: http.IncomingMessage); 52 message: http.IncomingMessage; 53 readBody(): Promise<string>; 54 } 55 export declare function isHttps(requestUrl: string): boolean; 56 export declare class HttpClient { 57 userAgent: string | undefined; 58 handlers: ifm.RequestHandler[]; 59 requestOptions: ifm.RequestOptions | undefined; 60 private _ignoreSslError; 61 private _socketTimeout; 62 private _allowRedirects; 63 private _allowRedirectDowngrade; 64 private _maxRedirects; 65 private _allowRetries; 66 private _maxRetries; 67 private _agent; 68 private _proxyAgent; 69 private _keepAlive; 70 private _disposed; 71 constructor(userAgent?: string, handlers?: ifm.RequestHandler[], requestOptions?: ifm.RequestOptions); 72 options(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 73 get(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 74 del(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 75 post(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 76 patch(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 77 put(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 78 head(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 79 sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 80 /** 81 * Gets a typed object from an endpoint 82 * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 83 */ 84 getJson<T>(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>; 85 postJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>; 86 putJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>; 87 patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>; 88 /** 89 * Makes a raw http request. 90 * All other methods such as get, post, patch, and request ultimately call this. 91 * Prefer get, del, post and patch 92 */ 93 request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream | null, headers?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>; 94 /** 95 * Needs to be called if keepAlive is set to true in request options. 96 */ 97 dispose(): void; 98 /** 99 * Raw request. 100 * @param info 101 * @param data 102 */ 103 requestRaw(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null): Promise<HttpClientResponse>; 104 /** 105 * Raw request with callback. 106 * @param info 107 * @param data 108 * @param onResult 109 */ 110 requestRawWithCallback(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null, onResult: (err?: Error, res?: HttpClientResponse) => void): void; 111 /** 112 * Gets an http agent. This function is useful when you need an http agent that handles 113 * routing through a proxy server - depending upon the url and proxy environment variables. 114 * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 115 */ 116 getAgent(serverUrl: string): http.Agent; 117 private _prepareRequest; 118 private _mergeHeaders; 119 private _getExistingOrDefaultHeader; 120 private _getAgent; 121 private _performExponentialBackoff; 122 private _processResponse; 123 }