Skip to content

Commit

Permalink
feat: support google ads v14
Browse files Browse the repository at this point in the history
  • Loading branch information
htdangkhoa committed Nov 11, 2023
1 parent 73a5d8b commit db08223
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/lib/Customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CustomerServiceClient } from '../generated/google';
import {
ListAccessibleCustomersRequest,
ListAccessibleCustomersResponse,
} from '../generated/google/ads/googleads/v13/services/customer_service';
} from '../generated/google/ads/googleads/v14/services/customer_service';

export class Customer extends Service {
protected get callMetadata(): Metadata {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/GoogleAds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
SearchGoogleAdsStreamResponse,
MutateGoogleAdsRequest,
MutateGoogleAdsResponse,
} from '../generated/google/ads/googleads/v13/services/google_ads_service';
} from '../generated/google/ads/googleads/v14/services/google_ads_service';

export class GoogleAds extends Service {
private customerOptions: CustomerOptions;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const HOST = 'googleads.googleapis.com' as const;

export const VERSION = 'v13' as const;
export const VERSION = 'v14' as const;

export const FAILURE_KEY = `google.ads.googleads.${VERSION}.errors.googleadsfailure-bin`;
2 changes: 1 addition & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { credentials, OAuth2Client } from '@grpc/grpc-js';
import { GoogleAdsFailure } from '../generated/google/ads/googleads/v13/errors/errors';
import { GoogleAdsFailure } from '../generated/google/ads/googleads/v14/errors/errors';
import { FAILURE_KEY } from './constants';

export const getCredentials = (authClient: OAuth2Client) => {
Expand Down
10 changes: 5 additions & 5 deletions src/tests/google-ads.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { status, Metadata, ServiceError } from '@grpc/grpc-js';
import { AuthenticationErrorEnum_AuthenticationError } from '../generated/google/ads/googleads/v13/errors/authentication_error';
import { AuthenticationErrorEnum_AuthenticationError } from '../generated/google/ads/googleads/v14/errors/authentication_error';
import {
ErrorCode,
GoogleAdsFailure,
} from '../generated/google/ads/googleads/v13/errors/errors';
import { RequestErrorEnum_RequestError } from '../generated/google/ads/googleads/v13/errors/request_error';
import { GoogleAdsRow } from '../generated/google/ads/googleads/v13/services/google_ads_service';
} from '../generated/google/ads/googleads/v14/errors/errors';
import { RequestErrorEnum_RequestError } from '../generated/google/ads/googleads/v14/errors/request_error';
import { GoogleAdsRow } from '../generated/google/ads/googleads/v14/services/google_ads_service';
import { Status } from '../generated/google/rpc/status';
import { FAILURE_KEY, QueryBuilder, VERSION } from '../lib';
import { GoogleAds } from '../lib/GoogleAds';
Expand Down Expand Up @@ -148,7 +148,7 @@ describe('searchStream', () => {
const { value, done } = await stream.next();
if (done) break;
const results =
value.results?.map?.((result) => result).filter(Boolean) ?? [];
value.results?.map?.((result: any) => result).filter(Boolean) ?? [];
campaigns.push(...results);
}

Expand Down
8 changes: 4 additions & 4 deletions src/tests/protos.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CustomerServiceClient } from '../generated/google/ads/googleads/v13/services/customer_service';
import { GoogleAdsServiceClient } from '../generated/google/ads/googleads/v13/services/google_ads_service';
import { Campaign } from '../generated/google/ads/googleads/v13/resources/campaign';
import { AdvertisingChannelTypeEnum_AdvertisingChannelType } from '../generated/google/ads/googleads/v13/enums/advertising_channel_type';
import { CustomerServiceClient } from '../generated/google/ads/googleads/v14/services/customer_service';
import { GoogleAdsServiceClient } from '../generated/google/ads/googleads/v14/services/google_ads_service';
import { Campaign } from '../generated/google/ads/googleads/v14/resources/campaign';
import { AdvertisingChannelTypeEnum_AdvertisingChannelType } from '../generated/google/ads/googleads/v14/enums/advertising_channel_type';
import { MOCK_ADDRESS, MOCK_CREDENTIALS } from './test-utils';

describe('CustomerServiceClient', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/tests/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { credentials, Metadata, ServiceError } from '@grpc/grpc-js';
import { google } from 'googleapis';
import { AdGroupStatusEnum_AdGroupStatus } from '../generated/google/ads/googleads/v13/enums/ad_group_status';
import { AdGroupTypeEnum_AdGroupType } from '../generated/google/ads/googleads/v13/enums/ad_group_type';
import { ListAccessibleCustomersResponse } from '../generated/google/ads/googleads/v13/services/customer_service';
import { AdGroupStatusEnum_AdGroupStatus } from '../generated/google/ads/googleads/v14/enums/ad_group_status';
import { AdGroupTypeEnum_AdGroupType } from '../generated/google/ads/googleads/v14/enums/ad_group_type';
import { ListAccessibleCustomersResponse } from '../generated/google/ads/googleads/v14/services/customer_service';
import {
GoogleAdsRow,
MutateGoogleAdsRequest,
Expand All @@ -13,7 +13,7 @@ import {
SearchGoogleAdsResponse,
SearchGoogleAdsStreamRequest,
SearchGoogleAdsStreamResponse,
} from '../generated/google/ads/googleads/v13/services/google_ads_service';
} from '../generated/google/ads/googleads/v14/services/google_ads_service';
import { AllServices, Customer, GoogleAds, Service, ServiceName } from '../lib';

export const MOCK_ADDRESS = 'googleads.googleapis.com';
Expand Down

0 comments on commit db08223

Please sign in to comment.