Skip to content

Commit 2dae1ad

Browse files
committed
add settings to sdk
1 parent be140b3 commit 2dae1ad

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const { SocketSdk } = require('@socketsecurity/sdk')
5959
### Utility methods
6060

6161
* `getQuota()`
62+
* `getSettings()`
6263

6364
## Additional exports
6465

index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,17 @@ class SocketSdk {
201201
}
202202
}
203203

204+
/** @returns {Promise<SocketSdkResultType<'getSettings'>>} */
205+
async getSettings () {
206+
try {
207+
const client = await this.#getClient()
208+
const data = await client.get('settings').json()
209+
return { success: true, status: 200, data }
210+
} catch (err) {
211+
return /** @type {SocketSdkErrorType<'getSettings'>} */ (this.#handleApiError(err))
212+
}
213+
}
214+
204215
/**
205216
* @param {unknown} err
206217
* @returns {{ success: false, status: number, error: Record<string,unknown> }}

0 commit comments

Comments
 (0)