adobe / reactor-sdk-javascript

JavaScript SDK for the Reactor API
Apache License 2.0
12 stars 10 forks source link

Added support for query params on getting rule revisions #79

Closed celesterobinson closed 1 year ago

celesterobinson commented 2 years ago

Description

Added support for query parameters to filter rule revisions. It's fully backwards compatible and should not affect any current usages without query parameters. Closes #64

Related Issue

64

Motivation and Context

The Reactor API supports filtering revisions, but that functionality has not been built into the JavaScript SDK yet. This adds support for rules, but support for filtering other resource revisions needs to be added as well. Ticket for that here:

How Has This Been Tested?

I wrote an integration test to filter on rule revisions. I also manually tested using the below code to test against multiple rules on a property.

let rulesForProperty = await reactor.listRulesForProperty(propertyId);
for (let rule of rulesForProperty.data) {
  await reactor.listRevisionsForRule(
    rule.id,
    {'filter[published]': 'EQ true'}
  ).then(revisionList => {
    revisionList.data.map(ruleRevision => {
      console.log(`${ruleRevision.attributes.name}: `, ruleRevision);
    });
  });
};

I swapped out what was being filtered to test multiple attributes.

Screenshots (if appropriate):

Types of changes

Checklist: