github.com/nektos/act@v0.2.63-0.20240520024548-8acde99bfa9c/pkg/runner/testdata/actions/node12/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      readBodyBuffer?(): Promise<Buffer>;
    55  }
    56  export declare function isHttps(requestUrl: string): boolean;
    57  export declare class HttpClient {
    58      userAgent: string | undefined;
    59      handlers: ifm.RequestHandler[];
    60      requestOptions: ifm.RequestOptions | undefined;
    61      private _ignoreSslError;
    62      private _socketTimeout;
    63      private _allowRedirects;
    64      private _allowRedirectDowngrade;
    65      private _maxRedirects;
    66      private _allowRetries;
    67      private _maxRetries;
    68      private _agent;
    69      private _proxyAgent;
    70      private _keepAlive;
    71      private _disposed;
    72      constructor(userAgent?: string, handlers?: ifm.RequestHandler[], requestOptions?: ifm.RequestOptions);
    73      options(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    74      get(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    75      del(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    76      post(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    77      patch(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    78      put(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    79      head(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    80      sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    81      /**
    82       * Gets a typed object from an endpoint
    83       * Be aware that not found returns a null.  Other errors (4xx, 5xx) reject the promise
    84       */
    85      getJson<T>(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
    86      postJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
    87      putJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
    88      patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
    89      /**
    90       * Makes a raw http request.
    91       * All other methods such as get, post, patch, and request ultimately call this.
    92       * Prefer get, del, post and patch
    93       */
    94      request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream | null, headers?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
    95      /**
    96       * Needs to be called if keepAlive is set to true in request options.
    97       */
    98      dispose(): void;
    99      /**
   100       * Raw request.
   101       * @param info
   102       * @param data
   103       */
   104      requestRaw(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null): Promise<HttpClientResponse>;
   105      /**
   106       * Raw request with callback.
   107       * @param info
   108       * @param data
   109       * @param onResult
   110       */
   111      requestRawWithCallback(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null, onResult: (err?: Error, res?: HttpClientResponse) => void): void;
   112      /**
   113       * Gets an http agent. This function is useful when you need an http agent that handles
   114       * routing through a proxy server - depending upon the url and proxy environment variables.
   115       * @param serverUrl  The server URL where the request will be sent. For example, https://api.github.com
   116       */
   117      getAgent(serverUrl: string): http.Agent;
   118      private _prepareRequest;
   119      private _mergeHeaders;
   120      private _getExistingOrDefaultHeader;
   121      private _getAgent;
   122      private _performExponentialBackoff;
   123      private _processResponse;
   124  }