-
Notifications
You must be signed in to change notification settings - Fork 21
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
add action for audience-manager-cd #39
Conversation
Codecov Report
@@ Coverage Diff @@
## master #39 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 18 +1
Lines 302 311 +9
Branches 39 39
=========================================
+ Hits 302 311 +9
Continue to review full report at Codecov.
|
70ba75f
to
9170f4f
Compare
eb4c498
to
e918869
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.
@chiarabdy Thanks a lot for your PR, it's a nice one!
I've added a few comments regarding a change that has happened where the orgId should not be passed as a default param but is passed through the request header x-gw-ims-org-id.
A part from this and a few nitpicks, not much to say 😄
const audienceManagerClient = await AudienceManagerCD.init(params.orgId, params.apiKey, token) | ||
|
||
// get Customer Profile from Audience Manager Customer Data API | ||
const profiles = await audienceManagerClient.getProfile( |
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.
some formatting here:
await audienceManagerClient.getProfile({
dataSourceId: params.dataSourceId,
id: params.id
})
this.props = { | ||
description: 'This is a sample action showcasing how to access the Adobe Audience Manager Customer Data API', | ||
// eslint-disable-next-line quotes | ||
requiredParams: `['apiKey', 'orgId']`, |
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.
Ok so two things regarding requiredParams:
- you did good adding the requiredParams for default (.env and manifest) variables, but you should also add it for request parameters: so add
dataSourceId
andid
- There is a new change where orgId is passed as a header through
x-gw-ims-org-id
, could you do the same change as in https://github.com/adobe/generator-aio-app/pull/44/files#diff-33c1a44418497d1f2fddbe457c86e7e3R24-R29 ? That also means that orgId is not a default variable in your case anymore (should not be added to manifest and .env)
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.
awesome
according to the last changes of orgId from requiredparams to requiredheaders
i will have to change the stub-action.js as well to pass my tests, but in this case the other action templates tests will failed because of the existing orgId as a paramters too
i will push the changes after your pull request been merged
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.
Hi @chiarabdy good point thanks for pointing this out, the PR just got merged now :)
dotenvStub: { | ||
label: 'please provide your Adobe I/O Audience Manager Customer Data integration org id and api key', | ||
vars: [ | ||
'AUDIENCE_MANAGER_CD_ORG_ID', |
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.
as mentioned above remove org id here
] | ||
}, | ||
actionManifestConfig: { | ||
inputs: { LOG_LEVEL: 'debug', orgId: '$AUDIENCE_MANAGER_CD_ORG_ID', apiKey: '$AUDIENCE_MANAGER_CD_API_KEY' }, |
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.
as mentioned above remove org id here
mockLoggerInstance.error.mockReset() | ||
}) | ||
|
||
const fakeRequestParams = { orgId: 'fakeId', apiKey: 'fakeKey', __ow_headers: { authorization: 'Bearer fakeToken' } } |
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.
you will need to change the tests because the orgId is now passed via __ow_headers: { 'x-gw-ims-org-id'
you can take a look at changes done here https://github.com/adobe/generator-aio-app/pull/44/files#diff-380b645bdf12ec16bd303d123d4cba0a it's probably similar for you
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.
this will also need to change accordingly when adding the id and dataSourceId as requiredParams
…nto audienceManager-cd
…nto audienceManager-cd
…nto audienceManager-cd
d90d630
to
ab0782d
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.
newline missing? or bad indentation?
label: '## please provide your Adobe I/O Audience Manager Customer Data integration api key, id and dataSourceId', | ||
vars: [ | ||
'AUDIENCE_MANAGER_API_KEY', | ||
'AUDIENCE_MANAGER_ID', |
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.
Id and dataSourceId are request parameters, not default parameters you only need AUDIENCE_MANAGER_API_KEY
74792ce
to
d148d33
Compare
@chiarabdy lgtm ! |
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: