Skip to content

Commit

Permalink
Merge pull request #12 from DougMidgley/feature/0.0.6
Browse files Browse the repository at this point in the history
Dependency & Readme update
  • Loading branch information
DougMidgley authored Dec 23, 2021
2 parents f92ed2a + 2267214 commit 37d5a8e
Show file tree
Hide file tree
Showing 7 changed files with 339 additions and 294 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## SFMC SDK follows [semantic versioning](https://semver.org/).

## 0.0.6 - 2021-12-23

- Bump dependency versions
- Extended SOAP action support to other types
- Added SOAP Retreive Bulk
- Added REST Get Collection & GetBulk features

## 0.0.2 - 2021-04-10

NPM Publishing
Expand Down
5 changes: 1 addition & 4 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

- [ ] Documentation update
- [ ] Bug fix
- [ ] New metadata support
- [ ] Enhanced metadata
- [ ] Add a CLI option
- [ ] Add something to the core
- [ ] Extend features
- [ ] Other, please explain:

## What changes did you make? (Give an overview)
Expand Down
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This library attempts to overcomes some of the complexity/shortcomings of the or
- Only uses Promises/Async-Await, no callbacks
- Maintainers of the semi-official lib from Salesforce are not responsive
- Allows for using a persisting credentials in an external app, then passing
- We expect parsing of SOAP to

## Usage

Expand All @@ -41,10 +42,31 @@ const sfmc = new SDK(

### SOAP

SOAP currently only supports retrieve, will be updating soon for other types.
SOAP currently only supports all the standard SOAP action types. Some examples below

```javascript
const soapResponse = await sfmc.soap.retrieve('DataExtension', ['ObjectID'], {});
const soapRetrieve = await sfmc.soap.retrieve('DataExtension', ['ObjectID'], {});
const soapRetrieveBulk = await sfmc.soap.retrieveBulk('DataExtension', ['ObjectID'], filter: {
leftOperand: 'ExternalKey',
operator: 'equals',
rightOperand: 'SOMEKEYHERE',
}); // when you want to auto paginate
const soapCreate = await sfmc.soap.create('Subscriber', {
"SubscriberKey": "12345123",
"EmailAddress": "[email protected]"
}, {
"options": {
"SaveOptions": { "SaveAction" : "UpdateAdd" }
}
}});
const soapUpdate = await sfmc.soap.update('Role', {
"CustomerKey": "12345123",
"Name": "UpdatedName"
}, {});
const soapExecute = await sfmc.soap.execute('LogUnsubEvent', [{
"SubscriberKey": "12345123",
"EmailAddress": "[email protected]"
}], {});
```

### REST
Expand All @@ -56,6 +78,8 @@ const restResponse = await sfmc.rest.get('/interaction/v1/interactions');
const restResponse = await sfmc.rest.post('/interaction/v1/interactions', jsonPayload);
const restResponse = await sfmc.rest.patch('/interaction/v1/interactions/IDHERE', jsonPayload); // PUT ALSO
const restResponse = await sfmc.rest.delete('/interaction/v1/interactions/IDHERE');
const restResponse = await sfmc.rest.getBulk('/interaction/v1/interactions'); // auto-paginate based on $pageSize
const restResponse = await sfmc.rest.getCollection(['/interaction/v1/interactions/213', '/interaction/v1/interactions/123'], 3); // parallel requests
```

## Contributing
Expand All @@ -67,7 +91,6 @@ Please make sure to update tests as appropriate.
## To Do

- No tests are in place
- Improve handling for other SOAP Actions than Retrieve
- Look at persisting access tokens across sessions as an option
- Validation improvement
- Support Scopes in API Requests
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = class SDK {
/**
* Creates an instance of SDK.
* @param {Object} options Auth Object for making requests
* @param {Object} eventHandlers collection of handler functions (for examplef or logging)
* @param {Object} eventHandlers collection of handler functions (for example for logging)
*/
constructor(options, eventHandlers) {
this.auth = new Auth(options, eventHandlers);
Expand Down
Loading

0 comments on commit 37d5a8e

Please sign in to comment.