Skip to content

Commit

Permalink
fix: use pagination types from gax (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fenster committed Nov 14, 2019
1 parent b3cd11f commit d5d5b0b
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 75 deletions.
2 changes: 1 addition & 1 deletion templates/typescript_gapic/package.json.njk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ limitations under the License.
"test": "mocha build/test"
},
"dependencies": {
"google-gax": "^1.10.0"
"google-gax": "^1.11.0"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
Expand Down
24 changes: 4 additions & 20 deletions templates/typescript_gapic/src/$version/$service_client.ts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ limitations under the License.
{% import "../../_util.njk" as util -%}

import * as gax from 'google-gax';
{% if service.longRunning.length > 0 -%}
import {APICallback, Callback, CallOptions, LROperation, Descriptors, ClientOptions} from 'google-gax';
{%- else -%}
import {APICallback, Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
{%- endif %}
import {APICallback, Callback, CallOptions, Descriptors, ClientOptions
{%- if service.longRunning.length > 0 %}, LROperation{%- endif -%}
{%- if service.paging.length > 0 %}, PaginationCallback, PaginationResponse{%- endif -%}
} from 'google-gax';
import * as path from 'path';
{% if (service.paging.length > 0) %}
import { Transform } from 'stream';
Expand All @@ -34,21 +33,6 @@ import * as gapicConfig from './{{ service.name.toSnakeCase() }}_client_config.j

const version = require('../../../package.json').version;

{% if (service.paging.length > 0) %}
export interface PaginationCallback<
RequestObject, ResponseObject, ResponseType> {
(err: Error|null, values?: ResponseType[], nextPageRequest?: RequestObject,
rawResponse?: ResponseObject): void;
}

export interface PaginationResponse<
RequestObject, ResponseObject, ResponseType> {
values?: ResponseType[];
nextPageRequest?: RequestObject;
rawResponse?: ResponseObject;
}
{% endif %}

/**
{{- util.printCommentsForService(service) }}
* @class
Expand Down
2 changes: 1 addition & 1 deletion typescript/test/testdata/keymanager/package.json.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test": "mocha build/test"
},
"dependencies": {
"google-gax": "^1.10.0"
"google-gax": "^1.11.0"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// ** All changes to this file may be overwritten. **

import * as gax from 'google-gax';
import {APICallback, Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
import {APICallback, Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, PaginationResponse} from 'google-gax';
import * as path from 'path';

import { Transform } from 'stream';
Expand All @@ -26,21 +26,6 @@ import * as gapicConfig from './key_management_service_client_config.json';

const version = require('../../../package.json').version;


export interface PaginationCallback<
RequestObject, ResponseObject, ResponseType> {
(err: Error|null, values?: ResponseType[], nextPageRequest?: RequestObject,
rawResponse?: ResponseObject): void;
}

export interface PaginationResponse<
RequestObject, ResponseObject, ResponseType> {
values?: ResponseType[];
nextPageRequest?: RequestObject;
rawResponse?: ResponseObject;
}


/**
* Google Cloud Key Management Service
*
Expand Down
2 changes: 1 addition & 1 deletion typescript/test/testdata/showcase/package.json.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test": "mocha build/test"
},
"dependencies": {
"google-gax": "^1.10.0"
"google-gax": "^1.11.0"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// ** All changes to this file may be overwritten. **

import * as gax from 'google-gax';
import {APICallback, Callback, CallOptions, LROperation, Descriptors, ClientOptions} from 'google-gax';
import {APICallback, Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, PaginationResponse} from 'google-gax';
import * as path from 'path';

import { Transform } from 'stream';
Expand All @@ -26,21 +26,6 @@ import * as gapicConfig from './echo_client_config.json';

const version = require('../../../package.json').version;


export interface PaginationCallback<
RequestObject, ResponseObject, ResponseType> {
(err: Error|null, values?: ResponseType[], nextPageRequest?: RequestObject,
rawResponse?: ResponseObject): void;
}

export interface PaginationResponse<
RequestObject, ResponseObject, ResponseType> {
values?: ResponseType[];
nextPageRequest?: RequestObject;
rawResponse?: ResponseObject;
}


/**
* This service is used showcase the four main types of rpcs - unary, server
* side streaming, client side streaming, and bidirectional streaming. This
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test": "mocha build/test"
},
"dependencies": {
"google-gax": "^1.10.0"
"google-gax": "^1.11.0"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import * as gapicConfig from './text_to_speech_client_config.json';

const version = require('../../../package.json').version;



/**
* Service that implements Google Cloud Text-to-Speech API.
* @class
Expand Down
2 changes: 1 addition & 1 deletion typescript/test/testdata/translate/package.json.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test": "mocha build/test"
},
"dependencies": {
"google-gax": "^1.10.0"
"google-gax": "^1.11.0"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// ** All changes to this file may be overwritten. **

import * as gax from 'google-gax';
import {APICallback, Callback, CallOptions, LROperation, Descriptors, ClientOptions} from 'google-gax';
import {APICallback, Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, PaginationResponse} from 'google-gax';
import * as path from 'path';

import { Transform } from 'stream';
Expand All @@ -26,21 +26,6 @@ import * as gapicConfig from './translation_service_client_config.json';

const version = require('../../../package.json').version;


export interface PaginationCallback<
RequestObject, ResponseObject, ResponseType> {
(err: Error|null, values?: ResponseType[], nextPageRequest?: RequestObject,
rawResponse?: ResponseObject): void;
}

export interface PaginationResponse<
RequestObject, ResponseObject, ResponseType> {
values?: ResponseType[];
nextPageRequest?: RequestObject;
rawResponse?: ResponseObject;
}


/**
* Provides natural language translation operations.
* @class
Expand Down

0 comments on commit d5d5b0b

Please sign in to comment.