Skip to content

Commit

Permalink
Bunped version, added convert by short code
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Sep 17, 2021
1 parent 8e1c68a commit 81f35b2
Show file tree
Hide file tree
Showing 4 changed files with 1,045 additions and 3,108 deletions.
2 changes: 1 addition & 1 deletion lib/api-client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const axios = require('axios'); // .default (@mrz what does this affect?)

// Current version for requests from the API
export const pkgVersion = 'v0.2.2';
export const pkgVersion = 'v0.2.3';
export const apiVersion = 'v1';

// getOptions is a factory for axios default options
Expand Down
29 changes: 29 additions & 0 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,35 @@ class TonicPow {
return this.apiClient.post('/conversions', data);
}

/**
* createConversionByShortCode will fire a conversion for a given goal and link short_code, if successful it will make a new Conversion
*
* For more information: https://docs.tonicpow.com/#0017b795-6e0a-429b-8100-1d44b37ad5cd
*
* @param goalId
* @param shortCode
* @param customDimensions
* @param optionalPurchaseAmount
* @param delayInMinutes
* @returns {Promise}
*/
async createConversionByShortCode(
goalId,
shortCode,
customDimensions = '',
optionalPurchaseAmount = 0.00,
delayInMinutes = 0,
) {
const data = {
goal_id: goalId,
short_code: shortCode,
custom_dimensions: customDimensions,
delay_in_minutes: delayInMinutes,
amount: optionalPurchaseAmount,
};
return this.apiClient.post('/conversions', data);
}

/**
* getConversion will get an existing conversion
*
Expand Down
Loading

0 comments on commit 81f35b2

Please sign in to comment.