Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/google-ads-admanager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
1. [Select or create a Cloud Platform project][projects].
1. [Enable billing for your project][billing].
1. [Enable the Google Ad Manager API API][enable_api].
1. [Set up authentication][auth] so you can access the
1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.

### Installing the client library
Expand Down Expand Up @@ -233,4 +233,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=admanager.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
[auth]: https://cloud.google.com/docs/authentication/getting-started
3 changes: 0 additions & 3 deletions packages/google-ads-admanager/protos/protos.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 88 additions & 4 deletions packages/google-ads-admanager/src/v1/ad_unit_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type {
import {Transform} from 'stream';
import * as protos from '../../protos/protos';
import jsonProtos = require('../../protos/protos.json');
import {loggingUtils as logging} from 'google-gax';

/**
* Client JSON configuration object, loaded from
Expand All @@ -53,6 +54,8 @@ export class AdUnitServiceClient {
private _defaults: {[method: string]: gax.CallSettings};
private _universeDomain: string;
private _servicePath: string;
private _log = logging.log('admanager');

auth: gax.GoogleAuth;
descriptors: Descriptors = {
page: {},
Expand Down Expand Up @@ -87,7 +90,7 @@ export class AdUnitServiceClient {
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
* the environment variable GCLOUD_PROJECT for your project ID. If your
* app is running in an environment which supports
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
* your project ID will be detected automatically.
* @param {string} [options.apiEndpoint] - The domain name of the
* API remote host.
Expand Down Expand Up @@ -519,7 +522,31 @@ export class AdUnitServiceClient {
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getAdUnit(request, options, callback);
this._log.info('getAdUnit request %j', request);
const wrappedCallback:
| Callback<
protos.google.ads.admanager.v1.IAdUnit,
protos.google.ads.admanager.v1.IGetAdUnitRequest | null | undefined,
{} | null | undefined
>
| undefined = callback
? (error, response, options, rawResponse) => {
this._log.info('getAdUnit response %j', response);
callback!(error, response, options, rawResponse); // We verified callback above.
}
: undefined;
return this.innerApiCalls
.getAdUnit(request, options, wrappedCallback)
?.then(
([response, options, rawResponse]: [
protos.google.ads.admanager.v1.IAdUnit,
protos.google.ads.admanager.v1.IGetAdUnitRequest | undefined,
{} | undefined,
]) => {
this._log.info('getAdUnit response %j', response);
return [response, options, rawResponse];
}
);
}

/**
Expand Down Expand Up @@ -629,7 +656,33 @@ export class AdUnitServiceClient {
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listAdUnits(request, options, callback);
const wrappedCallback:
| PaginationCallback<
protos.google.ads.admanager.v1.IListAdUnitsRequest,
| protos.google.ads.admanager.v1.IListAdUnitsResponse
| null
| undefined,
protos.google.ads.admanager.v1.IAdUnit
>
| undefined = callback
? (error, values, nextPageRequest, rawResponse) => {
this._log.info('listAdUnits values %j', values);
callback!(error, values, nextPageRequest, rawResponse); // We verified callback above.
}
: undefined;
this._log.info('listAdUnits request %j', request);
return this.innerApiCalls
.listAdUnits(request, options, wrappedCallback)
?.then(
([response, input, output]: [
protos.google.ads.admanager.v1.IAdUnit[],
protos.google.ads.admanager.v1.IListAdUnitsRequest | null,
protos.google.ads.admanager.v1.IListAdUnitsResponse,
]) => {
this._log.info('listAdUnits values %j', response);
return [response, input, output];
}
);
}

/**
Expand Down Expand Up @@ -686,6 +739,7 @@ export class AdUnitServiceClient {
const defaultCallSettings = this._defaults['listAdUnits'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
this._log.info('listAdUnits stream %j', request);
return this.descriptors.page.listAdUnits.createStream(
this.innerApiCalls.listAdUnits as GaxCall,
request,
Expand Down Expand Up @@ -750,6 +804,7 @@ export class AdUnitServiceClient {
const defaultCallSettings = this._defaults['listAdUnits'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
this._log.info('listAdUnits iterate %j', request);
return this.descriptors.page.listAdUnits.asyncIterate(
this.innerApiCalls['listAdUnits'] as GaxCall,
request as {},
Expand Down Expand Up @@ -869,7 +924,33 @@ export class AdUnitServiceClient {
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listAdUnitSizes(request, options, callback);
const wrappedCallback:
| PaginationCallback<
protos.google.ads.admanager.v1.IListAdUnitSizesRequest,
| protos.google.ads.admanager.v1.IListAdUnitSizesResponse
| null
| undefined,
protos.google.ads.admanager.v1.IAdUnitSize
>
| undefined = callback
? (error, values, nextPageRequest, rawResponse) => {
this._log.info('listAdUnitSizes values %j', values);
callback!(error, values, nextPageRequest, rawResponse); // We verified callback above.
}
: undefined;
this._log.info('listAdUnitSizes request %j', request);
return this.innerApiCalls
.listAdUnitSizes(request, options, wrappedCallback)
?.then(
([response, input, output]: [
protos.google.ads.admanager.v1.IAdUnitSize[],
protos.google.ads.admanager.v1.IListAdUnitSizesRequest | null,
protos.google.ads.admanager.v1.IListAdUnitSizesResponse,
]) => {
this._log.info('listAdUnitSizes values %j', response);
return [response, input, output];
}
);
}

/**
Expand Down Expand Up @@ -926,6 +1007,7 @@ export class AdUnitServiceClient {
const defaultCallSettings = this._defaults['listAdUnitSizes'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
this._log.info('listAdUnitSizes stream %j', request);
return this.descriptors.page.listAdUnitSizes.createStream(
this.innerApiCalls.listAdUnitSizes as GaxCall,
request,
Expand Down Expand Up @@ -990,6 +1072,7 @@ export class AdUnitServiceClient {
const defaultCallSettings = this._defaults['listAdUnitSizes'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
this._log.info('listAdUnitSizes iterate %j', request);
return this.descriptors.page.listAdUnitSizes.asyncIterate(
this.innerApiCalls['listAdUnitSizes'] as GaxCall,
request as {},
Expand Down Expand Up @@ -1626,6 +1709,7 @@ export class AdUnitServiceClient {
close(): Promise<void> {
if (this.adUnitServiceStub && !this._terminated) {
return this.adUnitServiceStub.then(stub => {
this._log.info('ending gRPC channel');
this._terminated = true;
stub.close();
});
Expand Down
62 changes: 59 additions & 3 deletions packages/google-ads-admanager/src/v1/company_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type {
import {Transform} from 'stream';
import * as protos from '../../protos/protos';
import jsonProtos = require('../../protos/protos.json');
import {loggingUtils as logging} from 'google-gax';

/**
* Client JSON configuration object, loaded from
Expand All @@ -53,6 +54,8 @@ export class CompanyServiceClient {
private _defaults: {[method: string]: gax.CallSettings};
private _universeDomain: string;
private _servicePath: string;
private _log = logging.log('admanager');

auth: gax.GoogleAuth;
descriptors: Descriptors = {
page: {},
Expand Down Expand Up @@ -87,7 +90,7 @@ export class CompanyServiceClient {
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
* the environment variable GCLOUD_PROJECT for your project ID. If your
* app is running in an environment which supports
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
* your project ID will be detected automatically.
* @param {string} [options.apiEndpoint] - The domain name of the
* API remote host.
Expand Down Expand Up @@ -510,7 +513,31 @@ export class CompanyServiceClient {
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getCompany(request, options, callback);
this._log.info('getCompany request %j', request);
const wrappedCallback:
| Callback<
protos.google.ads.admanager.v1.ICompany,
protos.google.ads.admanager.v1.IGetCompanyRequest | null | undefined,
{} | null | undefined
>
| undefined = callback
? (error, response, options, rawResponse) => {
this._log.info('getCompany response %j', response);
callback!(error, response, options, rawResponse); // We verified callback above.
}
: undefined;
return this.innerApiCalls
.getCompany(request, options, wrappedCallback)
?.then(
([response, options, rawResponse]: [
protos.google.ads.admanager.v1.ICompany,
protos.google.ads.admanager.v1.IGetCompanyRequest | undefined,
{} | undefined,
]) => {
this._log.info('getCompany response %j', response);
return [response, options, rawResponse];
}
);
}

/**
Expand Down Expand Up @@ -620,7 +647,33 @@ export class CompanyServiceClient {
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listCompanies(request, options, callback);
const wrappedCallback:
| PaginationCallback<
protos.google.ads.admanager.v1.IListCompaniesRequest,
| protos.google.ads.admanager.v1.IListCompaniesResponse
| null
| undefined,
protos.google.ads.admanager.v1.ICompany
>
| undefined = callback
? (error, values, nextPageRequest, rawResponse) => {
this._log.info('listCompanies values %j', values);
callback!(error, values, nextPageRequest, rawResponse); // We verified callback above.
}
: undefined;
this._log.info('listCompanies request %j', request);
return this.innerApiCalls
.listCompanies(request, options, wrappedCallback)
?.then(
([response, input, output]: [
protos.google.ads.admanager.v1.ICompany[],
protos.google.ads.admanager.v1.IListCompaniesRequest | null,
protos.google.ads.admanager.v1.IListCompaniesResponse,
]) => {
this._log.info('listCompanies values %j', response);
return [response, input, output];
}
);
}

/**
Expand Down Expand Up @@ -677,6 +730,7 @@ export class CompanyServiceClient {
const defaultCallSettings = this._defaults['listCompanies'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
this._log.info('listCompanies stream %j', request);
return this.descriptors.page.listCompanies.createStream(
this.innerApiCalls.listCompanies as GaxCall,
request,
Expand Down Expand Up @@ -741,6 +795,7 @@ export class CompanyServiceClient {
const defaultCallSettings = this._defaults['listCompanies'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
this._log.info('listCompanies iterate %j', request);
return this.descriptors.page.listCompanies.asyncIterate(
this.innerApiCalls['listCompanies'] as GaxCall,
request as {},
Expand Down Expand Up @@ -1377,6 +1432,7 @@ export class CompanyServiceClient {
close(): Promise<void> {
if (this.companyServiceStub && !this._terminated) {
return this.companyServiceStub.then(stub => {
this._log.info('ending gRPC channel');
this._terminated = true;
stub.close();
});
Expand Down
Loading