💾 Archived View for gmi.noulin.net › gitRepositories › git-off › file › src › node_modules › aws-sdk… captured on 2023-01-29 at 11:58:05. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

git-off

Log

Files

Refs

README

request.d.ts (9009B)

     1 /// <reference types="node" />
     2 
     3 import * as stream from 'stream';
     4 import {Service} from './service';
     5 import {Response} from './response';
     6 import {HttpRequest} from './http_request';
     7 import {AWSError} from './error';
     8 export class Request<D, E> {
     9     /**
    10      * Creates a request for an operation on a given service with a set of input parameters.
    11      * 
    12      * @param {AWS.Service} service - The service to perform the operation on.
    13      * @param {string} operation - The operation to perform on the service.
    14      * @param {object} params - Parameters to send to the operation.
    15      */
    16     constructor(service: Service, operation: string, params?: any);
    17     /**
    18      * Aborts a request, emitting the error and complete events.
    19      * This feature is not supported in the browser environment of the SDK.
    20      */
    21     abort(): void;
    22     /**
    23      * Converts the request object into a readable stream that can be read from or piped into a writable stream.
    24      * The data read from a readable stream contains only the raw HTTP body contents.
    25      * This feature is not supported in the browser environment of the SDK.
    26      */
    27     createReadStream(): stream.Readable;
    28     /**
    29      * Iterates over each page of results given a pageable request, calling the provided callback with each page of data.
    30      * After all pages have been retrieved, the callback is called with null data.
    31      * 
    32      * @param {eachPage} callback - The callback that handles the response.
    33      */
    34     eachPage(callback: (err: E, data: D, doneCallback?: () => void) => boolean): void;
    35     /**
    36      * Returns whether the operation can return multiple pages of response data.
    37      */
    38     isPageable(): boolean;
    39     /**
    40      * Sends the request object.
    41      * If a callback is supplied, it is called when a response is returned from the service.
    42      */
    43     send(callback?: (err: E, data: D) => void): void;
    44     /**
    45      * Adds a listener that is triggered when a request emits the specified event.
    46      * 
    47      * @param {string} event - 'Name of a request event.'
    48      * @param {function} listener - Callback to run when the event is triggered on the request.
    49      */
    50     on(event: string, listener: () => void): Request<D, E>;
    51     /**
    52      * Adds a listener that is triggered when a request is being validated.
    53      * 
    54      * @param {string} event - validate: triggered when a request is being validated.
    55      * @param {function} listener - Callback to run when the request is being validated.
    56      */
    57     on(event: "validate", listener: (request: Request<D, E>) => void): Request<D, E>;
    58     /**
    59      * Adds a listener that is triggered when the request payload is being built.
    60      * 
    61      * @param {string} event - build: triggered when the request payload is being built.
    62      * @param {function} listener - Callback to run when the request's payload is being built.
    63      */
    64     on(event: "build", listener: (request: Request<D, E>) => void): Request<D, E>;
    65     /**
    66      * Adds a listener that is triggered when a request is being signed.
    67      * 
    68      * @param {string} event - sign: triggered when a request is being signed.
    69      * @param {function} listener - Callback to run when the request is being signed.
    70      */
    71     on(event: "sign", listener: (request: Request<D, E>) => void): Request<D, E>;
    72     /**
    73      * Adds a listener that is triggered when a request is ready to be sent.
    74      * 
    75      * @param {string} event - send: triggered when a request is ready to be sent.
    76      * @param {function} listener - Callback to run when the request is ready to be sent.
    77      */
    78     on(event: "send", listener: (response: Response<D, E>) => void): Request<D, E>;
    79     /**
    80      * Adds a listener that is triggered when a request failed and might need to be retried or redirected.
    81      * 
    82      * @param {string} event - retry: triggered when a request failed and might need to be retried or redirected.
    83      * @param {function} listener - Callback to run when the request failed and may be retried.
    84      */
    85     on(event: "retry", listener: (response: Response<D, E>) => void): Request<D, E>;
    86     /**
    87      * Adds a listener that is triggered on all non-2xx requests so that listeners can extract error details from the response body.
    88      * 
    89      * @param {string} event - extractError: triggered on all non-2xx requests so that listeners can extract error details from the response body.
    90      * @param {function} listener - Callback to run when the request failed.
    91      */
    92     on(event: "extractError", listener: (response: Response<D, E>) => void): Request<D, E>;
    93     /**
    94      * Adds a listener that is triggered in successful requests to allow listeners to de-serialize the response body into response.data.
    95      * 
    96      * @param {string} event - extractData: triggered in successful requests to allow listeners to de-serialize the response body into response.data.
    97      * @param {function} listener - Callback to run when the request succeeded.
    98      */
    99     on(event: "extractData", listener: (response: Response<D, E>) => void): Request<D, E>;
   100     /**
   101      * Adds a listener that is triggered when the request completed successfully.
   102      * 
   103      * @param {string} event - success: triggered when the request completed successfully.
   104      * @param {function} listener - Callback to run when the request completed successfully.
   105      */
   106     on(event: "success", listener: (response: Response<D, E>) => void): Request<D, E>;
   107     /**
   108      * Adds a listener that is triggered when an error occurs at any point during the request.
   109      * 
   110      * @param {string} event - error: triggered when an error occurs at any point during the request.
   111      * @param {function} listener - Callback to run when the request errors at any point.
   112      */
   113     on(event: "error", listener: (err: AWSError, response: Response<D, E>) => void): Request<D, E>;
   114     /**
   115      * Adds a listener that is triggered whenever a request cycle completes.
   116      * 
   117      * @param {string} event - complete: triggered whenever a request cycle completes.
   118      * @param {function} listener - Callback to run when the request cycle completes.
   119      */
   120     on(event: "complete", listener: (response: Response<D, E>) => void): Request<D, E>;
   121     /**
   122      * Adds a listener that is triggered when headers are sent by the remote server.
   123      * 
   124      * @param {string} event - httpHeaders: triggered when headers are sent by the remote server.
   125      * @param {function} listener - Callback to run when the headers are sent by the remote server.
   126      */
   127     on(event: "httpHeaders", listener: (statusCode: number, headers: {[key: string]: string}, response: Response<D, E>) => void): Request<D, E>;
   128     /**
   129      * Adds a listener that is triggered when data is sent by the remote server.
   130      * 
   131      * @param {string} event - httpData: triggered when data is sent by the remote server.
   132      * @param {function} listener - Callback to run when data is sent by the remote server.
   133      */
   134     on(event: "httpData", listener: (chunk: Buffer|Uint8Array, response: Response<D, E>) => void): Request<D, E>;
   135     /**
   136      * Adds a listener that is triggered when the HTTP request has uploaded more data.
   137      * 
   138      * @param {string} event - httpUploadProgress: triggered when the HTTP request has uploaded more data.
   139      * @param {function} listener - Callback to run when the HTTP request has uploaded more data.
   140      */
   141     on(event: "httpUploadProgress", listener: (progress: Progress, response: Response<D, E>) => void): Request<D, E>;
   142     /**
   143      * Adds a listener that is triggered when the HTTP request has downloaded more data.
   144      * 
   145      * @param {string} event - httpDownloadProgress: triggered when the HTTP request has downloaded more data.
   146      * @param {function} listener - Callback to run when the HTTP request has downloaded more data.
   147      */
   148     on(event: "httpDownloadProgress", listener: (progress: Progress, response: Response<D, E>) => void): Request<D, E>;
   149     /**
   150      * Adds a listener that is triggered when the HTTP request failed.
   151      * 
   152      * @param {string} event - httpError: triggered when the HTTP request failed.
   153      * @param {function} listener - Callback to run when the HTTP request failed.
   154      */
   155     on(event: "httpError", listener: (err: Error, response: Response<D, E>) => void): Request<D, E>;
   156     /**
   157      * Adds a listener that is triggered when the server is finished sending data.
   158      * 
   159      * @param {string} event - httpDone: triggered when the server is finished sending data.
   160      * @param {function} listener - Callback to run when the server is finished sending data.
   161      */
   162     on(event: "httpDone", listener: (response: Response<D, E>) => void): Request<D, E>;
   163     /**
   164      * Returns a 'thenable' promise.
   165      */
   166     promise(): Promise<D>
   167     /**
   168      * The time that the request started.
   169      */
   170     startTime: Date;
   171     /**
   172      * The raw HTTP request object containing request headers and body information sent by the service.
   173      */
   174     httpRequest: HttpRequest;
   175 
   176 }
   177 
   178 interface Progress {
   179     loaded: number;
   180     total: number;
   181 ```