Skip to content

feat: add function for getting a list of attributes for customers#158

Closed
omBratteng wants to merge 1 commit intocustomerio:mainfrom
dailydotdev:batch-fetch-attributes
Closed

feat: add function for getting a list of attributes for customers#158
omBratteng wants to merge 1 commit intocustomerio:mainfrom
dailydotdev:batch-fetch-attributes

Conversation

@omBratteng
Copy link
Copy Markdown

Adds a function for getting a list of customers attributes
https://customer.io/docs/api/app/#operation/getPeopleById

Copy link
Copy Markdown
Collaborator

@mike-engel mike-engel left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, and sorry for the delay in review.

Another test should be added that tests against an empty array

Comment thread lib/api.ts
}

getAttributesBatch(ids: string[]) {
if (isEmpty(ids)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

isEmpty needs to be updated to handle arrays

Comment thread test/api.ts
);
});

test('#getAttributesBatch: fails without customerId', (t) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
test('#getAttributesBatch: fails without customerId', (t) => {
test('#getAttributesBatch: fails without customer ids', (t) => {

Comment thread test/api.ts
test('#getAttributesBatch: success with default type id', (t) => {
sinon.stub(t.context.client.request, 'post');
t.context.client.getAttributesBatch(['1']);
t.truthy((t.context.client.request.post as SinonStub).calledWith(`${RegionUS.apiUrl}/customers/attributes`));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
t.truthy((t.context.client.request.post as SinonStub).calledWith(`${RegionUS.apiUrl}/customers/attributes`));
t.true((t.context.client.request.post as SinonStub).calledWith(`${RegionUS.apiUrl}/customers/attributes`));

Comment thread test/api.ts
t.falsy((t.context.client.request.post as SinonStub).calledWith(`${RegionUS.apiUrl}/customers/attributes`));
});

test('#getAttributesBatch: success with default type id', (t) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Another assertion is needed to make sure the ids were passed through correctly

@omBratteng
Copy link
Copy Markdown
Author

@mike-engel I no longer work at dailydev, so I do not have access to the fork and am unable to do the changes.

@omBratteng omBratteng closed this May 8, 2026
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.

4 participants