From e235463cdba408797d7dbb6cefe4d2f9557cf923 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 10 May 2017 15:00:43 -0600 Subject: [PATCH 1/3] * Added constructor function to the Storage class. --- types/google-cloud__storage/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index e97249be24..eaf1177950 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -301,6 +301,21 @@ declare module "@google-cloud/storage/storage" { updated?: string; } + interface Credentials { + client_email?: string; + private_key?: string; + } + + interface ConfigurationObject { + autoRetry?: boolean; + credentials?: Credentials; + email?: string; + keyFilename?: string; + maxRetries?: number; + projectId?: string; + promise?: Function; + } + /** * The options when downloading a file. */ @@ -343,6 +358,7 @@ declare module "@google-cloud/storage/storage" { * The Storage class allows you interact with Google Cloud Storage. */ class Storage { + constructor(options?: ConfigurationObject); acl: Acl; bucket(name: string|Bucket): Bucket; channel(id: string, resourceId: string): Channel; From c3d08f7d2e4473b36cae15ebfa82cd442ce1e0fa Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 10 May 2017 15:26:01 -0600 Subject: [PATCH 2/3] Fixed declaration to pass test. --- types/google-cloud__storage/google-cloud__storage-tests.ts | 2 +- types/google-cloud__storage/index.d.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/google-cloud__storage/google-cloud__storage-tests.ts b/types/google-cloud__storage/google-cloud__storage-tests.ts index e701fe5681..a301aa063c 100644 --- a/types/google-cloud__storage/google-cloud__storage-tests.ts +++ b/types/google-cloud__storage/google-cloud__storage-tests.ts @@ -38,7 +38,7 @@ export class TestStorage { }; // import Storage class - static gcs: Storage; + static gcs: Storage = new Storage(); // the bucket private buckets: Bucket[] = []; diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index eaf1177950..c87a2cc606 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -313,7 +313,7 @@ declare module "@google-cloud/storage/storage" { keyFilename?: string; maxRetries?: number; projectId?: string; - promise?: Function; + promise?: PromiseLibrary; } /** @@ -366,4 +366,6 @@ declare module "@google-cloud/storage/storage" { getBuckets(query?: BucketQuery): Promise<[Bucket[]]>; getBucketsStream(query?: BucketQuery): Promise<[ReadStream]>; } + + type PromiseLibrary = () => PromiseLike; } From 4b994c6e211079dfdaeb2942a9c0b886e1a83740 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 10 May 2017 16:33:04 -0600 Subject: [PATCH 3/3] Updated header. --- types/google-cloud__storage/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index c87a2cc606..88743b8af8 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for @google-cloud/storage 0.6 +// Type definitions for @google-cloud/storage v1.1.0 // Project: https://github.com/GoogleCloudPlatform/google-cloud-node/tree/master/packages/storage -// Definitions by: Brian Love +// Definitions by: Brian Love // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped ///