google-ads-api
Version:
Google Ads API Client Library for Node.js
48 lines (47 loc) • 2.25 kB
TypeScript
import { ClientOptions } from "./client";
import { AllServices, errors, GoogleAdsServiceClient, ServiceName, services } from "./protos";
import { CustomerOptions, CustomerCredentials, RequestOptions, MutateOperation, MutateOptions } from "./types";
import { Hooks } from "./hooks";
import TTLCache from "@isaacs/ttlcache";
export declare const FAILURE_KEY = "google.ads.googleads.v24.errors.googleadsfailure-bin";
export interface CallHeaders {
"developer-token": string;
"login-customer-id"?: string;
"linked-customer-id"?: string;
}
export declare function disposeService(service: {
close: () => Promise<void>;
}): void;
export declare const serviceCache: TTLCache<unknown, {
close: () => Promise<void>;
}>;
export declare class Service {
protected readonly clientOptions: ClientOptions;
protected readonly customerOptions: CustomerOptions;
protected readonly hooks: Hooks;
constructor(clientOptions: ClientOptions, customerOptions: CustomerOptions, hooks?: Hooks);
get credentials(): CustomerCredentials;
protected get callHeaders(): CallHeaders;
private getCredentials;
getAccessToken(): Promise<string>;
protected loadService<T = AllServices>(service: ServiceName, options?: {
skipCache?: boolean;
}): T;
protected getGoogleAdsError(error: Error): errors.GoogleAdsFailure | Error;
private decodeGoogleAdsFailureBuffer;
protected decodePartialFailureError<T>(response: T): T;
protected buildSearchRequestAndService(gaql: string, options?: RequestOptions): {
service: GoogleAdsServiceClient;
request: services.SearchGoogleAdsRequest;
};
protected buildSearchStreamRequestAndService(gaql: string, options?: RequestOptions): {
service: GoogleAdsServiceClient;
request: services.SearchGoogleAdsStreamRequest;
};
protected buildMutationRequestAndService<T>(mutations: MutateOperation<T>[], options?: MutateOptions): {
service: GoogleAdsServiceClient;
request: services.MutateGoogleAdsRequest;
};
protected buildOperations<Op, Ent>(type: "create" | "update" | "remove", entities: Ent[], message?: Ent): Op[];
protected buildRequest<Op, Req, Options>(operations: Op[], options?: Options): Req;
}