-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
7fa5830
to
f3b1bbc
Compare
f7e5f41
to
927692c
Compare
376c0d7
to
c20d736
Compare
|
||
const url = `https://googleads.googleapis.com/${apiVersion}/customers/${customerId ?? managerId}/googleAds:search`; | ||
|
||
const defaultQuery = ` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
0523677
to
bcb024b
Compare
9865bc7
to
cea5684
Compare
cea5684
to
0be2850
Compare
There was a problem hiding this 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) |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
customer_client.level, | ||
customer_client.manager, | ||
customer_client.descriptive_name |
There was a problem hiding this comment.
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?
integrationData.accessTokenExpiresAt = new Date(tokens.accessTokenExpiresAt ?? new Date()); | ||
integrationData.refreshTokenExpiresAt = tokens.refreshTokenExpiresAt | ||
? new Date(tokens.refreshTokenExpiresAt) | ||
: undefined; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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, { |
There was a problem hiding this comment.
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 = ` |
There was a problem hiding this comment.
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
No description provided.