Skip to content

Commit 745f052

Browse files
committed
feat: add getOrgSecurityPolicy
1 parent f542552 commit 745f052

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ const { SocketSdk } = require('@socketsecurity/sdk')
6363
* `getOrganizations()`
6464
* `postSettings(selectors)`
6565
* `selectors`: An array of settings selectors, e.g. `[{ organization: 'id' }]`
66+
* `getOrgSecurityPolicy(orgSlug)`
67+
* `orgSlug`: the slug of the organization
6668

6769
## Additional exports
6870

index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,22 @@ class SocketSdk {
587587
}
588588
}
589589

590+
/**
591+
* @param {string} orgSlug
592+
* @returns {Promise<SocketSdkResultType<'getOrgSecurityPolicy'>>}
593+
*/
594+
async getOrgSecurityPolicy (orgSlug) {
595+
const orgSlugParam = encodeURIComponent(orgSlug)
596+
597+
try {
598+
const client = await this.#getClient()
599+
const data = await client.get(`orgs/${orgSlugParam}/settings/security-policy`).json()
600+
return { success: true, status: 200, data }
601+
} catch (err) {
602+
return /** @type {SocketSdkErrorType<'getOrgSecurityPolicy'>} */ (this.#handleApiError(err))
603+
}
604+
}
605+
590606
/**
591607
* @param {unknown} err
592608
* @returns {{ success: false, status: number, error: Record<string,unknown> }}

0 commit comments

Comments
 (0)