Skip to content

Commit

Permalink
feat: added methods for working with account properties (#2003)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvovik committed Aug 6, 2022
1 parent 2d7d444 commit 5421ece
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/api-clients",
"version": "5.8.0",
"version": "5.9.0",
"description": "JavaScript API clients for ULMS platform",
"keywords": [],
"homepage": "https://github.com/foxford/ulms-api-clients-js#readme",
Expand Down
46 changes: 44 additions & 2 deletions src/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ class Dispatcher extends BasicClient {
}
}

/**
* Class properties enum
* @returns {{IS_ADULT: string}}
*/
static get classKeys() {
return {
IS_ADULT: 'is_adult',
}
}

/**
* Account properties enum
* @returns {{ONBOARDING: string}}
*/
static get accountKeys() {
return {
ONBOARDING: 'onboarding',
}
}

/**
* Commit edition by scope
* @param {string} audience
Expand All @@ -46,10 +66,13 @@ class Dispatcher extends BasicClient {
* @param {string} kind
* @param {string} audience
* @param {string} scope
* @param {object} options
* @returns {Promise}
*/
readScope(kind, audience, scope) {
return this.get(`${this.baseUrl}/audiences/${audience}/${kind}/${scope}`)
readScope(kind, audience, scope, options) {
return this.get(
this.url(`/audiences/${audience}/${kind}/${scope}`, options)
)
}

/**
Expand Down Expand Up @@ -80,6 +103,25 @@ class Dispatcher extends BasicClient {
)
}

/**
* Read account property
* @param {string} propertyId
* @returns {Promise}
*/
readAccountProperty(propertyId) {
return this.get(`${this.baseUrl}/account/properties/${propertyId}`)
}

/**
* Update account property
* @param {string} propertyId
* @param {object} data
* @returns {Promise}
*/
updateAccountProperty(propertyId, data) {
return this.put(`${this.baseUrl}/account/properties/${propertyId}`, data)
}

/**
* Update dispatcher scope
* @param {string} kind
Expand Down

0 comments on commit 5421ece

Please sign in to comment.