Developer-friendly & type-safe Typescript SDK specifically catered to leverage *conductorone-sdk-typescript* API.
npm install conductorone-sdk-typescriptDeveloper-friendly & type-safe Typescript SDK specifically catered to leverage conductorone-sdk-typescript API.
ConductorOne API: The ConductorOne API is a HTTP API for managing ConductorOne resources.
The SDK can be installed with either npm, pnpm, bun or yarn package managers.
``bash`
npm add conductorone-sdk-typescript
`bash`
pnpm add conductorone-sdk-typescript
`bash`
bun add conductorone-sdk-typescript
`bash`
yarn add conductorone-sdk-typescript
> [!NOTE]
> This package is published with CommonJS and ES Modules (ESM) support.
For supported JavaScript runtimes, please consult RUNTIMES.md.
`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "
oauth: "
},
});
async function run() {
const result = await conductoroneSDKTypescript.accessConflict.createMonitor();
console.log(result);
}
run();
`
This SDK supports the following security schemes globally:
| Name | Type | Scheme |
| ------------ | ------ | ------------ |
| bearerAuth | http | HTTP Bearer |oauth
| | oauth2 | OAuth2 token |
You can set the security parameters through the security optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "
oauth: "
},
});
async function run() {
const result = await conductoroneSDKTypescript.accessConflict.createMonitor();
console.log(result);
}
run();
`
Available methods
* createMonitor - Create Monitor
* deleteMonitor - Delete Monitor
* getMonitor - Get Monitor
* updateMonitor - Update Monitor
* test - Test
* getAppAccessRequestsDefaults - Get App Access Requests Defaults
* createAppAccessRequestsDefaults - Create App Access Requests Defaults
* cancelAppAccessRequestsDefaults - Cancel App Access Requests Defaults
* deleteAppEntitlementMonitorBinding - Delete App Entitlement Monitor Binding
* createAppEntitlementMonitorBinding - Create App Entitlement Monitor Binding
* getAppEntitlementMonitorBinding - Get App Entitlement Monitor Binding
* listOwnerIDs - List Owner I Ds
* delete - Delete
* list - List
* add - Add
* set - Set
* remove - Remove
* list - List
* create - Create
* addManuallyManagedMembers - Add Manually Managed Members
* deleteAutomation - Delete Automation
* getAutomation - Get Automation
* createAutomation - Create Automation
* removeAutomationExclusion - Remove Automation Exclusion
* listAutomationExclusions - List Automation Exclusions
* addAutomationExclusion - Add Automation Exclusion
* updateAutomation - Update Automation
* removeEntitlementMembership - Remove Entitlement Membership
* ~~listUsers~~ - List Users :warning: Deprecated
* delete - Delete
* get - Get
* update - Update
* listForAppResource - List For App Resource
* listForAppUser - List For App User
* searchAppEntitlementsWithExpired - Search App Entitlements With Expired
* searchAppEntitlementsForAppUser - Search App Entitlements For App User
* search - Search
* searchGrants - Search Grants
* delete - Delete
* get - Get
* create - Create
* removeGrantDuration - Remove Grant Duration
* updateGrantDuration - Update Grant Duration
* listAppUsersForIdentityWithGrant - List App Users For Identity With Grant
* searchGrantFeed - Search Grant Feed
* searchPastGrants - Search Past Grants
* listOwnerIDs - List Owner I Ds
* delete - Delete
* list - List
* set - Set
* remove - Remove
* add - Add
* list - List
* generateReport - Generate Report
* list - List
* createManuallyManagedAppResource - Create Manually Managed App Resource
* deleteManuallyManagedAppResource - Delete Manually Managed App Resource
* get - Get
* update - Update
* delete - Delete
* listOwnerIDs - List Owner I Ds
* remove - Remove
* list - List
* add - Add
* set - Set
* searchAppResourceTypes - Search App Resource Types
* searchAppResources - Search App Resources
* list - List
* createManuallyManagedResourceType - Create Manually Managed Resource Type
* deleteManuallyManagedResourceType - Delete Manually Managed Resource Type
* get - Get
* updateManuallyManagedResourceType - Update Manually Managed Resource Type
* list - List
* create - Create
* delete - Delete
* get - Get
* update - Update
* search - Search
* list - List
* listAppUserCredentials - List App User Credentials
* listAppUsersForUser - List App Users For User
* update - Update
* search - Search
* deleteAttributeValue - Delete Attribute Value
* createAttributeValue - Create Attribute Value
* getAttributeValue - Get Attribute Value
* listComplianceFrameworks - List Compliance Frameworks
* createComplianceFrameworkAttributeValue - Create Compliance Framework Attribute Value
* deleteComplianceFrameworkAttributeValue - Delete Compliance Framework Attribute Value
* getComplianceFrameworkAttributeValue - Get Compliance Framework Attribute Value
* listRiskLevels - List Risk Levels
* createRiskLevelAttributeValue - Create Risk Level Attribute Value
* deleteRiskLevelAttributeValue - Delete Risk Level Attribute Value
* getRiskLevelAttributeValue - Get Risk Level Attribute Value
* listAttributeTypes - List Attribute Types
* listAttributeValues - List Attribute Values
* searchAttributeValues - Search Attribute Values
* introspect - Introspect
* listAutomations - List Automations
* createAutomation - Create Automation
* deleteAutomation - Delete Automation
* getAutomation - Get Automation
* updateAutomation - Update Automation
* executeAutomation - Execute Automation
* listAutomationExecutions - List Automation Executions
* getAutomationExecution - Get Automation Execution
* terminateAutomation - Terminate Automation
* searchAutomationExecutions - Search Automation Executions
* searchAutomationTemplateVersions - Search Automation Template Versions
* searchAutomations - Search Automations
* get - Get
* list - List
* createDelegated - Create Delegated
* confirmSyncValid - Confirm Sync Valid
* getCredentials - Get Credentials
* revokeCredential - Revoke Credential
* forceSync - Force Sync
* pauseSync - Pause Sync
* resumeSync - Resume Sync
* delete - Delete
* get - Get
* update - Update
* create - Create
* updateDelegated - Update Delegated
* rotateCredential - Rotate Credential
* validateHTTPConnectorConfig - Validate Http Connector Config
* configurationSchema - Configuration Schema
* list - List
* create - Create
* delete - Delete
* get - Get
* update - Update
* list - List
* create - Create
* delete - Delete
* get - Get
* update - Update
* listEvents - List Events
* search - Search
* listFunctions - List Functions
* createFunction - Create Function
* listCommits - List Commits
* commit - Commit
* getCommit - Get Commit
* invoke - Invoke
* listTags - List Tags
* createTag - Create Tag
* deleteFunction - Delete Function
* getFunction - Get Function
* updateFunction - Update Function
* search - Search
* list - List
* update - Update
* list - NOTE: Only shows personal clients for the current user.
* create - Create
* delete - Delete
* get - Get
* update - Update
* search - NOTE: Searches personal clients for all users
* list - List
* create - Create
* delete - Delete
* get - Get
* update - Update
* search - Search
* validateCEL - Validate Cel
* list - List
* create - Create
* listAllEntitlementIdsPerApp - List All Entitlement Ids Per App
* listEntitlementsPerCatalog - List Entitlements Per Catalog
* updateAppEntitlements - Update App Entitlements
* removeAppEntitlements - Remove App Entitlements
* addAppEntitlements - Add App Entitlements
* removeAccessEntitlements - Remove Access Entitlements
* addAccessEntitlements - Add Access Entitlements
* listEntitlementsForAccess - List Entitlements For Access
* delete - Delete
* get - Get
* update - Update
* deleteBundleAutomation - Delete Bundle Automation
* getBundleAutomation - Get Bundle Automation
* setBundleAutomation - Set Bundle Automation
* createBundleAutomation - Create Bundle Automation
* resumePausedBundleAutomation - Resume Paused Bundle Automation
* forceRunBundleAutomation - Force Run Bundle Automation
* searchEntitlements - Search Entitlements
* removeEntitlementBinding - Remove Entitlement Binding
* createEntitlementBinding - Create Entitlement Binding
* findBindingForAppEntitlement - Find Binding For App Entitlement
* create - Create
* delete - Delete
* get - Get
* update - Update
* list - List
* get - Get
* update - Update
* get - Get
* update - Update
* testSourceIP - Test Source Ip
* search - Search
* list - List
* create - Create
* delete - Delete
* get - Get
* update - Update
* updateSecret - Update Secret
* test - Test
* listEvents - List Events
* createGrantTask - Create Grant Task
* createOffboardingTask - Create Offboarding Task
* createRevokeTask - Create Revoke Task
* get - Get
* approve - Approve
* approveWithStepUp - Approve With Step Up
* close - Close
* comment - Comment
* deny - Deny
* escalateToEmergencyAccess - Escalate To Emergency Access
* processNow - Process Now
* reassign - Reassign
* hardReset - Hard Reset
* restart - Restart
* skipStep - Skip Step
* updateGrantDuration - Update Grant Duration
* updateRequestData - Update Request Data
* list - List
* search - Search
* list - List
* get - Get
* getUserProfileTypes - Get User Profile Types
* setExpiringUserDelegationBindingByAdmin - Set Expiring User Delegation Binding By Admin
* search - Search
* list - List
* create - Create
* delete - Delete
* get - Get
* update - Update
* test - Test
* search - Search
All the methods listed above are available as standalone functions. These
functions are ideal for use in applications running in the browser, serverless
runtimes or other environments where application bundle size is a primary
concern. When using a bundler to build your application, all unused
functionality will be either excluded from the final bundle or tree-shaken away.
To read more about standalone functions, check FUNCTIONS.md.
- accessConflictCreateMonitor - Create Monitor
- accessConflictDeleteMonitor - Delete Monitor
- accessConflictGetMonitor - Get Monitor
- accessConflictUpdateMonitor - Update Monitor
- accountProvisionPolicyTestTest - Test
- appAccessRequestsDefaultsCancelAppAccessRequestsDefaults - Cancel App Access Requests Defaults
- appAccessRequestsDefaultsCreateAppAccessRequestsDefaults - Create App Access Requests Defaults
- appAccessRequestsDefaultsGetAppAccessRequestsDefaults - Get App Access Requests Defaults
- appEntitlementMonitorBindingCreateAppEntitlementMonitorBinding - Create App Entitlement Monitor Binding
- appEntitlementMonitorBindingDeleteAppEntitlementMonitorBinding - Delete App Entitlement Monitor Binding
- appEntitlementMonitorBindingGetAppEntitlementMonitorBinding - Get App Entitlement Monitor Binding
- appEntitlementOwnersAdd - Add
- appEntitlementOwnersDelete - Delete
- appEntitlementOwnersList - List
- appEntitlementOwnersListOwnerIDs - List Owner I Ds
- appEntitlementOwnersRemove - Remove
- appEntitlementOwnersSet - Set
- appEntitlementsAddAutomationExclusion - Add Automation Exclusion
- appEntitlementsAddManuallyManagedMembers - Add Manually Managed Members
- appEntitlementsCreate - Create
- appEntitlementsCreateAutomation - Create Automation
- appEntitlementsDelete - Delete
- appEntitlementsDeleteAutomation - Delete Automation
- appEntitlementSearchSearch - Search
- appEntitlementSearchSearchAppEntitlementsForAppUser - Search App Entitlements For App User
- appEntitlementSearchSearchAppEntitlementsWithExpired - Search App Entitlements With Expired
- appEntitlementSearchSearchGrants - Search Grants
- appEntitlementsGet - Get
- appEntitlementsGetAutomation - Get Automation
- appEntitlementsList - List
- appEntitlementsListAutomationExclusions - List Automation Exclusions
- appEntitlementsListForAppResource - List For App Resource
- appEntitlementsListForAppUser - List For App User
- appEntitlementsProxyCreate - Create
- appEntitlementsProxyDelete - Delete
- appEntitlementsProxyGet - Get
- appEntitlementsRemoveAutomationExclusion - Remove Automation Exclusion
- appEntitlementsRemoveEntitlementMembership - Remove Entitlement Membership
- appEntitlementsUpdate - Update
- appEntitlementsUpdateAutomation - Update Automation
- appEntitlementUserBindingListAppUsersForIdentityWithGrant - List App Users For Identity With Grant
- appEntitlementUserBindingRemoveGrantDuration - Remove Grant Duration
- appEntitlementUserBindingSearchGrantFeed - Search Grant Feed
- appEntitlementUserBindingSearchPastGrants - Search Past Grants
- appEntitlementUserBindingUpdateGrantDuration - Update Grant Duration
- appOwnersAdd - Add
- appOwnersDelete - Delete
- appOwnersList - List
- appOwnersListOwnerIDs - List Owner I Ds
- appOwnersRemove - Remove
- appOwnersSet - Set
- appReportActionGenerateReport - Generate Report
- appReportList - List
- appResourceCreateManuallyManagedAppResource - Create Manually Managed App Resource
- appResourceDeleteManuallyManagedAppResource - Delete Manually Managed App Resource
- appResourceGet - Get
- appResourceList - List
- appResourceOwnersAdd - Add
- appResourceOwnersDelete - Delete
- appResourceOwnersList - List
- appResourceOwnersListOwnerIDs - List Owner I Ds
- appResourceOwnersRemove - Remove
- appResourceOwnersSet - Set
- appResourceSearchSearchAppResources - Search App Resources
- appResourceSearchSearchAppResourceTypes - Search App Resource Types
- appResourceTypeCreateManuallyManagedResourceType - Create Manually Managed Resource Type
- appResourceTypeDeleteManuallyManagedResourceType - Delete Manually Managed Resource Type
- appResourceTypeGet - Get
- appResourceTypeList - List
- appResourceTypeUpdateManuallyManagedResourceType - Update Manually Managed Resource Type
- appResourceUpdate - Update
- appsCreate - Create
- appsDelete - Delete
- appSearchSearch - Search
- appsGet - Get
- appsList - List
- appsUpdate - Update
- appUsageControlsGet - Get
- appUsageControlsUpdate - Update
- appUserList - List
- appUserListAppUserCredentials - List App User Credentials
- appUserListAppUsersForUser - List App Users For User
- appUserSearch - Search
- appUserUpdate - Update
- attributesCreateAttributeValue - Create Attribute Value
- attributesCreateComplianceFrameworkAttributeValue - Create Compliance Framework Attribute Value
- attributesCreateRiskLevelAttributeValue - Create Risk Level Attribute Value
- attributesDeleteAttributeValue - Delete Attribute Value
- attributesDeleteComplianceFrameworkAttributeValue - Delete Compliance Framework Attribute Value
- attributesDeleteRiskLevelAttributeValue - Delete Risk Level Attribute Value
- attributeSearchSearchAttributeValues - Search Attribute Values
- attributesGetAttributeValue - Get Attribute Value
- attributesGetComplianceFrameworkAttributeValue - Get Compliance Framework Attribute Value
- attributesGetRiskLevelAttributeValue - Get Risk Level Attribute Value
- attributesListAttributeTypes - List Attribute Types
- attributesListAttributeValues - List Attribute Values
- attributesListComplianceFrameworks - List Compliance Frameworks
- attributesListRiskLevels - List Risk Levels
- authIntrospect - Introspect
- automationCreateAutomation - Create Automation
- automationDeleteAutomation - Delete Automation
- automationExecuteAutomation - Execute Automation
- automationExecutionActionsTerminateAutomation - Terminate Automation
- automationExecutionGetAutomationExecution - Get Automation Execution
- automationExecutionListAutomationExecutions - List Automation Executions
- automationExecutionSearchSearchAutomationExecutions - Search Automation Executions
- automationGetAutomation - Get Automation
- automationListAutomations - List Automations
- automationSearchSearchAutomations - Search Automations
- automationSearchSearchAutomationTemplateVersions - Search Automation Template Versions
- automationUpdateAutomation - Update Automation
- awsExternalIDSettingsGet - Get
- connectorCatalogConfigurationSchema - Configuration Schema
- connectorConfirmSyncValid - Confirm Sync Valid
- connectorCreate - Create
- connectorCreateDelegated - Create Delegated
- connectorDelete - Delete
- connectorForceSync - Force Sync
- connectorGet - Get
- connectorGetCredentials - Get Credentials
- connectorList - List
- connectorPauseSync - Pause Sync
- connectorResumeSync - Resume Sync
- connectorRevokeCredential - Revoke Credential
- connectorRotateCredential - Rotate Credential
- connectorUpdate - Update
- connectorUpdateDelegated - Update Delegated
- connectorValidateHTTPConnectorConfig - Validate Http Connector Config
- directoryCreate - Create
- directoryDelete - Delete
- directoryGet - Get
- directoryList - List
- directoryUpdate - Update
- exportCreate - Create
- exportDelete - Delete
- exportGet - Get
- exportList - List
- exportListEvents - List Events
- exportsSearchSearch - Search
- exportUpdate - Update
- functionsCommit - Commit
- functionsCreateFunction - Create Function
- functionsCreateTag - Create Tag
- functionsDeleteFunction - Delete Function
- functionsGetCommit - Get Commit
- functionsGetFunction - Get Function
- functionsInvoke - Invoke
- functionsListCommits - List Commits
- functionsListFunctions - List Functions
- functionsListTags - List Tags
- functionsSearchSearch - Search
- functionsUpdateFunction - Update Function
- orgDomainList - List
- orgDomainUpdate - Update
- personalClientCreate - Create
- personalClientDelete - Delete
- personalClientGet - Get
- personalClientList - NOTE: Only shows personal clients for the current user.
- personalClientSearchSearch - NOTE: Searches personal clients for all users
- personalClientUpdate - Update
- policiesCreate - Create
- policiesDelete - Delete
- policiesGet - Get
- policiesList - List
- policiesUpdate - Update
- policySearchSearch - Search
- policyValidateValidateCEL - Validate Cel
- requestCatalogManagementAddAccessEntitlements - Add Access Entitlements
- requestCatalogManagementAddAppEntitlements - Add App Entitlements
- requestCatalogManagementCreate - Create
- requestCatalogManagementCreateBundleAutomation - Create Bundle Automation
- requestCatalogManagementDelete - Delete
- requestCatalogManagementDeleteBundleAutomation - Delete Bundle Automation
- requestCatalogManagementForceRunBundleAutomation - Force Run Bundle Automation
- requestCatalogManagementGet - Get
- requestCatalogManagementGetBundleAutomation - Get Bundle Automation
- requestCatalogManagementList - List
- requestCatalogManagementListAllEntitlementIdsPerApp - List All Entitlement Ids Per App
- requestCatalogManagementListEntitlementsForAccess - List Entitlements For Access
- requestCatalogManagementListEntitlementsPerCatalog - List Entitlements Per Catalog
- requestCatalogManagementRemoveAccessEntitlements - Remove Access Entitlements
- requestCatalogManagementRemoveAppEntitlements - Remove App Entitlements
- requestCatalogManagementResumePausedBundleAutomation - Resume Paused Bundle Automation
- requestCatalogManagementSetBundleAutomation - Set Bundle Automation
- requestCatalogManagementUpdate - Update
- requestCatalogManagementUpdateAppEntitlements - Update App Entitlements
- requestCatalogSearchSearchEntitlements - Search Entitlements
- requestSchemaCreate - Create
- requestSchemaCreateEntitlementBinding - Create Entitlement Binding
- requestSchemaDelete - Delete
- requestSchemaFindBindingForAppEntitlement - Find Binding For App Entitlement
- requestSchemaGet - Get
- requestSchemaRemoveEntitlementBinding - Remove Entitlement Binding
- requestSchemaUpdate - Update
- rolesGet - Get
- rolesList - List
- rolesUpdate - Update
- sessionSettingsGet - Get
- sessionSettingsTestSourceIP - Test Source Ip
- sessionSettingsUpdate - Update
- stepUpProviderCreate - Create
- stepUpProviderDelete - Delete
- stepUpProviderGet - Get
- stepUpProviderList - List
- stepUpProviderSearch - Search
- stepUpProviderTest - Test
- stepUpProviderUpdate - Update
- stepUpProviderUpdateSecret - Update Secret
- stepUpTransactionGet - Get
- stepUpTransactionSearch - Search
- systemLogListEvents - List Events
- taskActionsApprove - Approve
- taskActionsApproveWithStepUp - Approve With Step Up
- taskActionsClose - Close
- taskActionsComment - Comment
- taskActionsDeny - Deny
- taskActionsEscalateToEmergencyAccess - Escalate To Emergency Access
- taskActionsHardReset - Hard Reset
- taskActionsProcessNow - Process Now
- taskActionsReassign - Reassign
- taskActionsRestart - Restart
- taskActionsSkipStep - Skip Step
- taskActionsUpdateGrantDuration - Update Grant Duration
- taskActionsUpdateRequestData - Update Request Data
- taskAuditList - List
- taskCreateGrantTask - Create Grant Task
- taskCreateOffboardingTask - Create Offboarding Task
- taskCreateRevokeTask - Create Revoke Task
- taskGet - Get
- taskSearchSearch - Search
- userGet - Get
- userGetUserProfileTypes - Get User Profile Types
- userList - List
- userSearchSearch - Search
- userSetExpiringUserDelegationBindingByAdmin - Set Expiring User Delegation Binding By Admin
- webhooksCreate - Create
- webhooksDelete - Delete
- webhooksGet - Get
- webhooksList - List
- webhooksSearchSearch - Search
- webhooksTest - Test
- webhooksUpdate - Update
- ~~appEntitlementsListUsers~~ - List Users :warning: Deprecated
Some of the endpoints in this SDK support pagination. To use pagination, you
make your SDK calls as usual, but the returned response object will also be an
async iterable that can be consumed using the [for await...of][for-await-of]
syntax.
[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
Here's an example of one such pagination call:
`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "
oauth: "
},
});
async function run() {
const result = await conductoroneSDKTypescript.appEntitlementSearch.search();
for await (const page of result) {
console.log(page);
}
}
run();
`
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "
oauth: "
},
});
async function run() {
const result = await conductoroneSDKTypescript.accessConflict.createMonitor({
retries: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
});
console.log(result);
}
run();
`
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
retryConfig: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
security: {
bearerAuth: "
oauth: "
},
});
async function run() {
const result = await conductoroneSDKTypescript.accessConflict.createMonitor();
console.log(result);
}
run();
`
ConductoroneSDKTypescriptError is the base class for all HTTP error responses. It has the following properties:
| Property | Type | Description |
| ------------------- | ---------- | ------------------------------------------------------ |
| error.message | string | Error message |error.statusCode
| | number | HTTP response status code eg 404 |error.headers
| | Headers | HTTP response headers |error.body
| | string | HTTP body. Can be empty string if no body is returned. |error.rawResponse
| | Response | Raw HTTP response |
typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
import * as errors from "conductorone-sdk-typescript/sdk/models/errors";const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "",
oauth: "",
},
});
async function run() {
try {
const result = await conductoroneSDKTypescript.accessConflict
.createMonitor();
console.log(result);
} catch (error) {
if (error instanceof errors.ConductoroneSDKTypescriptError) {
console.log(error.message);
console.log(error.statusCode);
console.log(error.body);
console.log(error.headers);
}
}
}
run();
`$3
Primary error:
* ConductoroneSDKTypescriptError: The base class for HTTP error responses.Less common errors (6)
ConnectionError: HTTP client was unable to make a request to a server.
* RequestTimeoutError: HTTP request timed out due to an AbortSignal signal.
* RequestAbortedError: HTTP request was aborted by the client.
* InvalidRequestError: Any input used to create a request is invalid.
* UnexpectedClientError: Unrecognised or unexpected error.ConductoroneSDKTypescriptError:
* ResponseValidationError: Type mismatch between the data returned from the server and the structure expected by the SDK. See error.rawValue for the raw value and error.pretty() for a nicely formatted multi-line string.
Server Selection
$3
The default server
https://{tenantDomain}.conductor.one contains variables and is set to https://example.conductor.one by default. To override default values, the following parameters are available when initializing the SDK client instance:| Variable | Parameter | Default | Description |
| -------------- | ---------------------- | ----------- | ------------------------------------------------- |
|
tenantDomain | tenantDomain: string | "example" | The domain of the tenant to use for this request. |#### Example
`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
tenantDomain: "",
security: {
bearerAuth: "",
oauth: "",
},
});
async function run() {
const result = await conductoroneSDKTypescript.accessConflict.createMonitor();
console.log(result);
}
run();
`$3
The default server can be overridden globally by passing a URL to the
serverURL: string optional parameter when initializing the SDK client instance. For example:
`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
serverURL: "https://example.conductor.one",
security: {
bearerAuth: "",
oauth: "",
},
});
async function run() {
const result = await conductoroneSDKTypescript.accessConflict.createMonitor();
console.log(result);
}
run();
`
Custom HTTP Client
The TypeScript SDK makes API calls using an
HTTPClient that wraps the native
Fetch API. This
client is a thin wrapper around fetch and provides the ability to attach hooks
around the request lifecycle that can be used to modify the request or handle
errors and response.The
HTTPClient constructor takes an optional fetcher argument that can be
used to integrate a third-party HTTP client or when writing tests to mock out
the HTTP client and feed in fixtures.The following example shows how to use the
"beforeRequest" hook to to add a
custom header and a timeout to requests and how to use the "requestError" hook
to log errors:`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
import { HTTPClient } from "conductorone-sdk-typescript/lib/http";const httpClient = new HTTPClient({
// fetcher takes a function that has the same signature as native
fetch.
fetcher: (request) => {
return fetch(request);
}
});httpClient.addHook("beforeRequest", (request) => {
const nextRequest = new Request(request, {
signal: request.signal || AbortSignal.timeout(5000)
});
nextRequest.headers.set("x-custom-header", "custom value");
return nextRequest;
});
httpClient.addHook("requestError", (error, request) => {
console.group("Request Error");
console.log("Reason:",
${error});
console.log("Endpoint:", ${request.method} ${request.url});
console.groupEnd();
});const sdk = new ConductoroneSDKTypescript({ httpClient: httpClient });
`
Debugging
You can setup your SDK to emit debug logs for SDK requests and responses.
You can pass a logger that matches
console's interface as an SDK option.> [!WARNING]
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
`typescript
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";const sdk = new ConductoroneSDKTypescript({ debugLogger: console });
``This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.