google-ads-api
Version:
Google Ads API Client Library for Node.js
72 lines (71 loc) • 3.52 kB
TypeScript
import { CancellableStream } from "google-gax";
import { ClientOptions } from "./client";
import { Hooks } from "./hooks";
import { services } from "./protos";
import ServiceFactory from "./protos/autogen/serviceFactory";
import { CustomerOptions, MutateOperation, MutateOptions, ReportOptions, ReportOptionsWithTotalResults, RequestOptions } from "./types";
export declare class Customer extends ServiceFactory {
constructor(clientOptions: ClientOptions, customerOptions: CustomerOptions, hooks?: Hooks);
/**
@description Single query using a raw GAQL string.
@hooks onQueryStart, onQueryError, onQueryEnd
*/
query<T = services.IGoogleAdsRow[]>(gaqlQuery: string, requestOptions?: Readonly<RequestOptions>): Promise<T>;
/**
@description Stream query using a raw GAQL string. If a generic type is provided, it must be the type of a single row.
If a summary row is requested then this will be the last emitted row of the stream.
@hooks onStreamStart, onStreamError
@example
const stream = queryStream<T>(gaqlQuery)
for await (const row of stream) { ... }
*/
queryStream<T = services.IGoogleAdsRow>(gaqlQuery: string, requestOptions?: Readonly<RequestOptions>): AsyncGenerator<T>;
/**
@description Single query using ReportOptions.
If a summary row is requested then this will be the first row of the results.
@hooks onQueryStart, onQueryError, onQueryEnd
*/
report<T = services.IGoogleAdsRow[]>(options: Readonly<ReportOptions>): Promise<T>;
/**
@description Get the total row count of a report.
@hooks none
*/
reportCount(options: Readonly<ReportOptionsWithTotalResults>): Promise<number | undefined>;
/**
@description Stream query using ReportOptions. If a generic type is provided, it must be the type of a single row.
If a summary row is requested then this will be the last emitted row of the stream.
@hooks onStreamStart, onStreamError
@example
const stream = reportStream<T>(reportOptions)
for await (const row of stream) { ... }
*/
reportStream<T = services.IGoogleAdsRow>(reportOptions: Readonly<ReportOptions>): AsyncGenerator<T>;
/**
@description Retreive the raw stream using ReportOptions.
@hooks onStreamStart
@example
const stream = reportStreamRaw(reportOptions)
stream.on('data', (chunk) => { ... }) // a chunk contains up to 10,000 un-parsed rows
stream.on('error', (error) => { ... })
stream.on('end', () => { ... })
*/
reportStreamRaw(reportOptions: Readonly<ReportOptions>): Promise<CancellableStream | void>;
private search;
private paginatedSearch;
private useStreamToImitateRegularSearch;
private querier;
private streamer;
private handleStreamError;
/**
* @description Creates, updates, or removes resources. This method supports atomic transactions
* with multiple types of resources. For example, you can atomically create a campaign and a
* campaign budget, or perform up to thousands of mutates atomically.
* @hooks onMutationStart, onMutationError, onMutationEnd
*/
mutateResources<T>(mutations: MutateOperation<T>[], mutateOptions?: MutateOptions): Promise<services.MutateGoogleAdsResponse>;
private get googleAdsFields();
private prepareGoogleAdsServicePostRequestArgs;
private decamelizeKeysIfNeeded;
private gaqlQueryStringIncludesLimit;
private generateTooManyRowsError;
}