@or-sdk/permissions
v2.13.1
Published
OneReach SDK client for Permissions
Readme
@or-sdk/permissions
OneReach SDK client for Permissions.
When to use
- Use this package when integrating with the Permissions capability on the OneReach platform.
- Use its typed client and exported models instead of hand-writing requests to that service.
When not to use
- Do not use it for a different platform capability; choose the dedicated
@or-sdk/*package instead. - Do not use it for generic third-party HTTP calls.
Installation
$ npm i @or-sdk/permissionsUsage
import { Permissions } from '@or-sdk/permissions'
const permissions = new Permissions({
token: 'my-account-token-string',
permissionsUrl: 'http://example.permissions/endpoint'
});Configuration
permissionsUrlis required; provide the Permissions service endpoint explicitly.discoveryUrlis optional configuration metadata and does not replacepermissionsUrl.- Provide
tokenas a bearer-token string or getter where supported.
Common pitfalls
- Keep the client token current when it can expire; a token getter is preferable where the constructor accepts one.
- Treat the generated TypeScript types as the authoritative contract for optional parameters and response shapes.
Method map
| Method | Purpose |
|---|---|
| registerProduct(...) | See the exported TypeScript signature for parameters and result. |
| registerService(...) | See the exported TypeScript signature for parameters and result. |
| getAllAvailablePermissions(...) | See the exported TypeScript signature for parameters and result. |
| getCurrent(...) | See the exported TypeScript signature for parameters and result. |
| getCurrentForProduct(...) | See the exported TypeScript signature for parameters and result. |
| getCurrentForService(...) | See the exported TypeScript signature for parameters and result. |
| updateSingleUser(...) | See the exported TypeScript signature for parameters and result. |
| updateMultiUser(...) | See the exported TypeScript signature for parameters and result. |
| updateMultiUserByAccIdAndSingleId(...) | See the exported TypeScript signature for parameters and result. |
| getMultiUserByAccIdAndSingleId(...) | See the exported TypeScript signature for parameters and result. |
| resetSingleUserPermissions(...) | See the exported TypeScript signature for parameters and result. |
More detail
Full signatures and exported types are available in src/ and dist/types/.
Additional API reference
Methods below were missing from the package guide. Signatures and return types are taken directly from the exported source API.
Permissions
| Method | Returns | Purpose |
|---|---|---|
| getByUserIdInCurrentAccount(userId: string, accountId?: string) | Promise<UserPermissionsResponse> | Gets permissions for a specific user within an account |
| getAccountDefaultPermissions(accountId?: string) | Promise<UserPermissionsResponse> | Gets the account-level default permissions (applied to users without their own overrides) |
| updateAccountDefaultPermissions(params: UpdateAccountDefaultPermissionsDto) | Promise<UserPermissionsResponse> | Updates the account-level default permissions |
| resetAccountDefaultPermissions(accountId?: string) | Promise<UserPermissionsResponse> | Resets the account-level default permissions back to the environment defaults |
| getEnvironmentDefaultPermissions() | Promise<UserPermissionsResponse> | Gets the environment-level default permissions (applied to every account without its own defaults) |
| updateEnvironmentDefaultPermissions(params: UpdateEnvironmentDefaultPermissionsDto) | Promise<UserPermissionsResponse> | Updates the environment-level default permissions |
| resetEnvironmentDefaultPermissions() | Promise<UserPermissionsResponse> | Resets the environment-level default permissions back to the product defaults |
| checkScope(scope: string[]) | Promise<boolean> | Checks if user has the specified permission scopes |
| getApiTokenPermissionsForService(tokenId: string, service: string) | Promise<PermissionsByServiceResponse> | Gets permissions for an API token for a specific service |
| getApiTokenPermissions(tokenId: string) | Promise<ApiTokenPermissionsResponse> | Gets all permissions for an API token |
| getBulkApiTokenPermissions(tokenIds: string[]) | Promise<BulkApiTokenPermissionsResponse> | Gets permissions for multiple API tokens |
| setApiTokenPermissions(params: UpdateApiTokenPermissionsDto) | Promise<ApiTokenPermissionsResponse> | Sets permissions for an API token |
| deleteApiTokenPermissions(tokenId: string) | Promise<{ success: boolean }> | Deletes all permissions for an API token |
| getFlowPermissionsForProduct(flowId: string, product: string) | Promise<FlowProductPermissionsResponse> | Gets permissions for a flow for a specific product |
| getFlowPermissions(flowId: string) | Promise<FlowPermissionsResponse> | Gets all permissions for a flow |
| setFlowPermissions(params: UpdateFlowPermissionsDto) | Promise<FlowPermissionsResponse> | Sets permissions for a flow |
