UNPKG

@google-cloud/storage

Version:
69 lines (68 loc) • 2.32 kB
import { Gaxios, GaxiosError, GaxiosInterceptor, GaxiosOptions, GaxiosOptionsPrepared, GaxiosResponse } from 'gaxios'; import { AuthClient, GoogleAuth, GoogleAuthOptions } from 'google-auth-library'; import { GCCL_GCS_CMD_KEY } from './nodejs-common/util.js'; import { RetryOptions } from './storage.js'; export interface StandardStorageQueryParams { alt?: 'json' | 'media'; callback?: string; fields?: string; key?: string; prettyPrint?: boolean; quotaUser?: string; userProject?: string; } export interface StorageQueryParameters extends StandardStorageQueryParams { [key: string]: string | number | boolean | undefined; } export interface StorageRequestOptions extends GaxiosOptions { [GCCL_GCS_CMD_KEY]?: string; invocationId?: string; interceptors?: GaxiosInterceptor<GaxiosOptionsPrepared>[]; autoPaginate?: boolean; autoPaginateVal?: boolean; maxRetries?: number; objectMode?: boolean; projectId?: string; queryParameters?: StorageQueryParameters; shouldReturnStream?: boolean; hasPrecondition?: boolean; } interface TransportParameters extends Omit<GoogleAuthOptions, 'authClient'> { apiEndpoint: string; authClient?: GoogleAuth | AuthClient; baseUrl: string; customEndpoint?: boolean; email?: string; packageJson: PackageJson; retryOptions: RetryOptions; scopes: string | string[]; timeout?: number; token?: string; useAuthWithCustomEndpoint?: boolean; userAgent?: string; gaxiosInstance?: Gaxios; interceptors?: GaxiosInterceptor<GaxiosOptionsPrepared>[]; } interface PackageJson { name: string; version: string; } export interface StorageTransportCallback<T> { (err: GaxiosError | null, data?: T | null, fullResponse?: GaxiosResponse): void; } export declare class StorageTransport { #private; authClient: GoogleAuth<AuthClient>; private providedUserAgent?; private packageJson; private retryOptions; private baseUrl; private timeout?; private projectId?; private useAuthWithCustomEndpoint?; gaxiosInstance: Gaxios; private sharedInterceptors?; constructor(options: TransportParameters); makeRequest<T>(reqOpts: StorageRequestOptions, callback?: StorageTransportCallback<T>): Promise<GaxiosResponse<T>>; } export {};