Skip to content

Commit 271514a

Browse files
committed
patch
1 parent a73be92 commit 271514a

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ const { SocketSdk } = require('@socketsecurity/sdk')
6060
### Utility methods
6161

6262
* `getQuota()`
63-
* `getSettings()`
63+
* `getOrganizations()`
64+
* `postSettings(selectors)`
65+
* `selectors`: An array of settings selectors, e.g. `[{ organization: 'id' }]`
6466

6567
## Additional exports
6668

index.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,30 @@ class SocketSdk {
214214
}
215215
}
216216

217-
/** @returns {Promise<SocketSdkResultType<'getSettings'>>} */
218-
async getSettings () {
217+
/** @returns {Promise<SocketSdkResultType<'getOrganizations'>>} */
218+
async getOrganizations () {
219219
try {
220220
const client = await this.#getClient()
221-
const data = await client.get('settings').json()
221+
const data = await client.get('organizations').json()
222222
return { success: true, status: 200, data }
223223
} catch (err) {
224-
return /** @type {SocketSdkErrorType<'getSettings'>} */ (this.#handleApiError(err))
224+
return /** @type {SocketSdkErrorType<'getQuota'>} */ (this.#handleApiError(err))
225+
}
226+
}
227+
228+
/**
229+
* @param {Array<{ organization?: string }>} selectors
230+
* @returns {Promise<SocketSdkResultType<'postSettings'>>}
231+
*/
232+
async postSettings (selectors) {
233+
try {
234+
const client = await this.#getClient()
235+
const data = await client.post('settings', {
236+
json: selectors
237+
}).json()
238+
return { success: true, status: 200, data }
239+
} catch (err) {
240+
return /** @type {SocketSdkErrorType<'postSettings'>} */ (this.#handleApiError(err))
225241
}
226242
}
227243

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)