Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

551 google data ingress #628

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

551 google data ingress #628

wants to merge 20 commits into from

Conversation

aaryansinha16
Copy link
Contributor

No description provided.

@aaryansinha16 aaryansinha16 force-pushed the 551-google-data-ingress branch 3 times, most recently from 7fa5830 to f3b1bbc Compare October 20, 2024 09:31
@aaryansinha16 aaryansinha16 force-pushed the 551-google-data-ingress branch 5 times, most recently from f7e5f41 to 927692c Compare October 31, 2024 13:35
@aaryansinha16 aaryansinha16 force-pushed the 551-google-data-ingress branch 2 times, most recently from 376c0d7 to c20d736 Compare November 6, 2024 20:35
packages/channel/src/integration-helper.ts Outdated Show resolved Hide resolved
turbo.json Outdated Show resolved Hide resolved
turbo.json Outdated Show resolved Hide resolved
packages/channel-google/package.json Outdated Show resolved Hide resolved
packages/channel-google/package.json Show resolved Hide resolved
packages/channel-google/src/channel-google.ts Outdated Show resolved Hide resolved
packages/channel-google/src/channel-google.ts Outdated Show resolved Hide resolved
packages/channel-google/src/channel-google.ts Outdated Show resolved Hide resolved

const url = `https://googleads.googleapis.com/${apiVersion}/customers/${customerId ?? managerId}/googleAds:search`;

const defaultQuery = `
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in both cases you are passing a query so let's delete it and make query mandatatory. Same with customerId

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rename it to something more appropriate, like customerQuery

packages/channel-google/src/channel-google.ts Outdated Show resolved Hide resolved
@aaryansinha16 aaryansinha16 force-pushed the 551-google-data-ingress branch 2 times, most recently from 0523677 to bcb024b Compare November 17, 2024 22:16
@aaryansinha16 aaryansinha16 force-pushed the 551-google-data-ingress branch 2 times, most recently from 9865bc7 to cea5684 Compare November 18, 2024 11:44
Copy link
Collaborator

@trixobird trixobird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved the vast majoriy of the past comments - good job.

added some new, and we have pending that:

  • when i tried to ingress data, my insights were not saved
  • add the call back url in the channel prod
  • make sure that both credential work (we may need to add ourselved as test users)

if (validatedResponse.results) {
const managers = validatedResponse.results
.map((result) => result.customerClient)
.filter((custoemer) => custoemer.manager)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customer - typo

}

private static async findManagerAccount(accessToken: string, customerIds: string[]): Promise<string | AError> {
for (const customerId of customerIds) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think when we have one customerId we don't need to go through this process. Even if this customerId is not a manager, they will have access to their own account.

dbAccount: DbAdAccount,
initial: boolean,
): Promise<AError | undefined> {
if (!integration.refreshToken) return new AError('Refresh token is required');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this line here?


for (const range of ranges) {
try {
const refreshedIntegration = await this.refreshedIntegration(integration);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do this inside the handlePagination, applicable else where.

Comment on lines 606 to 610
customer_client.level,
customer_client.manager,
customer_client.descriptive_name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't need level and descriptive_name?

Comment on lines +183 to +186
integrationData.accessTokenExpiresAt = new Date(tokens.accessTokenExpiresAt ?? new Date());
integrationData.refreshTokenExpiresAt = tokens.refreshTokenExpiresAt
? new Date(tokens.refreshTokenExpiresAt)
: undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my understanding if that if access/refresh token has not expiration date, then it does not expire. You have found a contradictory example?

return res;
}

private static parseRequest(signedRequest: string, secret: string): string | AError {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in both places it seems that is doing the same thing and is used from the same function, the signOutCallback. My thought process was to move to channel-utils and call it from there.

});
}

private static async refreshedIntegration(integration: Integration): Promise<Integration | AError> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are places that we can move it a bit more nested still, for example in handlePagination

asset.resource_name IN (${el.adGroupAd.ad.videoResponsiveAd.videos.map((c) => `'${c.asset}'`).join(',')})
`;

const response = await fetch(url, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use Google.handlePangination here? I think the url is the same...


const url = `https://googleads.googleapis.com/${apiVersion}/customers/${customerId ?? managerId}/googleAds:search`;

const defaultQuery = `
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rename it to something more appropriate, like customerQuery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants