Developer-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.
npm add conductorone-sdk-typescriptpnpm add conductorone-sdk-typescriptbun add conductorone-sdk-typescriptyarn add conductorone-sdk-typescriptNote
This package is published with CommonJS and ES Modules (ESM) support.
For supported JavaScript runtimes, please consult RUNTIMES.md.
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
oauth: "<YOUR_OAUTH_HERE>",
},
});
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:
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
oauth: "<YOUR_OAUTH_HERE>",
},
});
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
- 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⚠️ 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
- removeGrantDuration - Remove Grant Duration
- updateGrantDuration - Update Grant Duration
- listAppUsersForIdentityWithGrant - List App Users For Identity With Grant
- searchGrantFeed - Search Grant Feed
- searchPastGrants - Search Past Grants
- list - List
- generateReport - Generate Report
- list - List
- createManuallyManagedAppResource - Create Manually Managed App Resource
- deleteManuallyManagedAppResource - Delete Manually Managed App Resource
- get - Get
- update - Update
- 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
- 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
- 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 - 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
- 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
- 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
- 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.
Available standalone functions
accessConflictCreateMonitor- Create MonitoraccessConflictDeleteMonitor- Delete MonitoraccessConflictGetMonitor- Get MonitoraccessConflictUpdateMonitor- Update MonitoraccountProvisionPolicyTestTest- TestappAccessRequestsDefaultsCancelAppAccessRequestsDefaults- Cancel App Access Requests DefaultsappAccessRequestsDefaultsCreateAppAccessRequestsDefaults- Create App Access Requests DefaultsappAccessRequestsDefaultsGetAppAccessRequestsDefaults- Get App Access Requests DefaultsappEntitlementMonitorBindingCreateAppEntitlementMonitorBinding- Create App Entitlement Monitor BindingappEntitlementMonitorBindingDeleteAppEntitlementMonitorBinding- Delete App Entitlement Monitor BindingappEntitlementMonitorBindingGetAppEntitlementMonitorBinding- Get App Entitlement Monitor BindingappEntitlementOwnersAdd- AddappEntitlementOwnersDelete- DeleteappEntitlementOwnersList- ListappEntitlementOwnersListOwnerIDs- List Owner I DsappEntitlementOwnersRemove- RemoveappEntitlementOwnersSet- SetappEntitlementsAddAutomationExclusion- Add Automation ExclusionappEntitlementsAddManuallyManagedMembers- Add Manually Managed MembersappEntitlementsCreate- CreateappEntitlementsCreateAutomation- Create AutomationappEntitlementsDelete- DeleteappEntitlementsDeleteAutomation- Delete AutomationappEntitlementSearchSearch- SearchappEntitlementSearchSearchAppEntitlementsForAppUser- Search App Entitlements For App UserappEntitlementSearchSearchAppEntitlementsWithExpired- Search App Entitlements With ExpiredappEntitlementSearchSearchGrants- Search GrantsappEntitlementsGet- GetappEntitlementsGetAutomation- Get AutomationappEntitlementsList- ListappEntitlementsListAutomationExclusions- List Automation ExclusionsappEntitlementsListForAppResource- List For App ResourceappEntitlementsListForAppUser- List For App UserappEntitlementsProxyCreate- CreateappEntitlementsProxyDelete- DeleteappEntitlementsProxyGet- GetappEntitlementsRemoveAutomationExclusion- Remove Automation ExclusionappEntitlementsRemoveEntitlementMembership- Remove Entitlement MembershipappEntitlementsUpdate- UpdateappEntitlementsUpdateAutomation- Update AutomationappEntitlementUserBindingListAppUsersForIdentityWithGrant- List App Users For Identity With GrantappEntitlementUserBindingRemoveGrantDuration- Remove Grant DurationappEntitlementUserBindingSearchGrantFeed- Search Grant FeedappEntitlementUserBindingSearchPastGrants- Search Past GrantsappEntitlementUserBindingUpdateGrantDuration- Update Grant DurationappOwnersAdd- AddappOwnersDelete- DeleteappOwnersList- ListappOwnersListOwnerIDs- List Owner I DsappOwnersRemove- RemoveappOwnersSet- SetappReportActionGenerateReport- Generate ReportappReportList- ListappResourceCreateManuallyManagedAppResource- Create Manually Managed App ResourceappResourceDeleteManuallyManagedAppResource- Delete Manually Managed App ResourceappResourceGet- GetappResourceList- ListappResourceOwnersAdd- AddappResourceOwnersDelete- DeleteappResourceOwnersList- ListappResourceOwnersListOwnerIDs- List Owner I DsappResourceOwnersRemove- RemoveappResourceOwnersSet- SetappResourceSearchSearchAppResources- Search App ResourcesappResourceSearchSearchAppResourceTypes- Search App Resource TypesappResourceTypeCreateManuallyManagedResourceType- Create Manually Managed Resource TypeappResourceTypeDeleteManuallyManagedResourceType- Delete Manually Managed Resource TypeappResourceTypeGet- GetappResourceTypeList- ListappResourceTypeUpdateManuallyManagedResourceType- Update Manually Managed Resource TypeappResourceUpdate- UpdateappsCreate- CreateappsDelete- DeleteappSearchSearch- SearchappsGet- GetappsList- ListappsUpdate- UpdateappUsageControlsGet- GetappUsageControlsUpdate- UpdateappUserList- ListappUserListAppUserCredentials- List App User CredentialsappUserListAppUsersForUser- List App Users For UserappUserSearch- SearchappUserUpdate- UpdateattributesCreateAttributeValue- Create Attribute ValueattributesCreateComplianceFrameworkAttributeValue- Create Compliance Framework Attribute ValueattributesCreateRiskLevelAttributeValue- Create Risk Level Attribute ValueattributesDeleteAttributeValue- Delete Attribute ValueattributesDeleteComplianceFrameworkAttributeValue- Delete Compliance Framework Attribute ValueattributesDeleteRiskLevelAttributeValue- Delete Risk Level Attribute ValueattributeSearchSearchAttributeValues- Search Attribute ValuesattributesGetAttributeValue- Get Attribute ValueattributesGetComplianceFrameworkAttributeValue- Get Compliance Framework Attribute ValueattributesGetRiskLevelAttributeValue- Get Risk Level Attribute ValueattributesListAttributeTypes- List Attribute TypesattributesListAttributeValues- List Attribute ValuesattributesListComplianceFrameworks- List Compliance FrameworksattributesListRiskLevels- List Risk LevelsauthIntrospect- IntrospectautomationCreateAutomation- Create AutomationautomationDeleteAutomation- Delete AutomationautomationExecuteAutomation- Execute AutomationautomationExecutionActionsTerminateAutomation- Terminate AutomationautomationExecutionGetAutomationExecution- Get Automation ExecutionautomationExecutionListAutomationExecutions- List Automation ExecutionsautomationExecutionSearchSearchAutomationExecutions- Search Automation ExecutionsautomationGetAutomation- Get AutomationautomationListAutomations- List AutomationsautomationSearchSearchAutomations- Search AutomationsautomationSearchSearchAutomationTemplateVersions- Search Automation Template VersionsautomationUpdateAutomation- Update AutomationawsExternalIDSettingsGet- GetconnectorCatalogConfigurationSchema- Configuration SchemaconnectorConfirmSyncValid- Confirm Sync ValidconnectorCreate- CreateconnectorCreateDelegated- Create DelegatedconnectorDelete- DeleteconnectorForceSync- Force SyncconnectorGet- GetconnectorGetCredentials- Get CredentialsconnectorList- ListconnectorPauseSync- Pause SyncconnectorResumeSync- Resume SyncconnectorRevokeCredential- Revoke CredentialconnectorRotateCredential- Rotate CredentialconnectorUpdate- UpdateconnectorUpdateDelegated- Update DelegatedconnectorValidateHTTPConnectorConfig- Validate Http Connector ConfigdirectoryCreate- CreatedirectoryDelete- DeletedirectoryGet- GetdirectoryList- ListdirectoryUpdate- UpdateexportCreate- CreateexportDelete- DeleteexportGet- GetexportList- ListexportListEvents- List EventsexportsSearchSearch- SearchexportUpdate- UpdatefunctionsCommit- CommitfunctionsCreateFunction- Create FunctionfunctionsCreateTag- Create TagfunctionsDeleteFunction- Delete FunctionfunctionsGetCommit- Get CommitfunctionsGetFunction- Get FunctionfunctionsInvoke- InvokefunctionsListCommits- List CommitsfunctionsListFunctions- List FunctionsfunctionsListTags- List TagsfunctionsSearchSearch- SearchfunctionsUpdateFunction- Update FunctionorgDomainList- ListorgDomainUpdate- UpdatepersonalClientCreate- CreatepersonalClientDelete- DeletepersonalClientGet- GetpersonalClientList- NOTE: Only shows personal clients for the current user.personalClientSearchSearch- NOTE: Searches personal clients for all userspersonalClientUpdate- UpdatepoliciesCreate- CreatepoliciesDelete- DeletepoliciesGet- GetpoliciesList- ListpoliciesUpdate- UpdatepolicySearchSearch- SearchpolicyValidateValidateCEL- Validate CelrequestCatalogManagementAddAccessEntitlements- Add Access EntitlementsrequestCatalogManagementAddAppEntitlements- Add App EntitlementsrequestCatalogManagementCreate- CreaterequestCatalogManagementCreateBundleAutomation- Create Bundle AutomationrequestCatalogManagementDelete- DeleterequestCatalogManagementDeleteBundleAutomation- Delete Bundle AutomationrequestCatalogManagementForceRunBundleAutomation- Force Run Bundle AutomationrequestCatalogManagementGet- GetrequestCatalogManagementGetBundleAutomation- Get Bundle AutomationrequestCatalogManagementList- ListrequestCatalogManagementListAllEntitlementIdsPerApp- List All Entitlement Ids Per ApprequestCatalogManagementListEntitlementsForAccess- List Entitlements For AccessrequestCatalogManagementListEntitlementsPerCatalog- List Entitlements Per CatalogrequestCatalogManagementRemoveAccessEntitlements- Remove Access EntitlementsrequestCatalogManagementRemoveAppEntitlements- Remove App EntitlementsrequestCatalogManagementResumePausedBundleAutomation- Resume Paused Bundle AutomationrequestCatalogManagementSetBundleAutomation- Set Bundle AutomationrequestCatalogManagementUpdate- UpdaterequestCatalogManagementUpdateAppEntitlements- Update App EntitlementsrequestCatalogSearchSearchEntitlements- Search EntitlementsrequestSchemaCreate- CreaterequestSchemaCreateEntitlementBinding- Create Entitlement BindingrequestSchemaDelete- DeleterequestSchemaFindBindingForAppEntitlement- Find Binding For App EntitlementrequestSchemaGet- GetrequestSchemaRemoveEntitlementBinding- Remove Entitlement BindingrequestSchemaUpdate- UpdaterolesGet- GetrolesList- ListrolesUpdate- UpdatesessionSettingsGet- GetsessionSettingsTestSourceIP- Test Source IpsessionSettingsUpdate- UpdatestepUpProviderCreate- CreatestepUpProviderDelete- DeletestepUpProviderGet- GetstepUpProviderList- ListstepUpProviderSearch- SearchstepUpProviderTest- TeststepUpProviderUpdate- UpdatestepUpProviderUpdateSecret- Update SecretstepUpTransactionGet- GetstepUpTransactionSearch- SearchsystemLogListEvents- List EventstaskActionsApprove- ApprovetaskActionsApproveWithStepUp- Approve With Step UptaskActionsClose- ClosetaskActionsComment- CommenttaskActionsDeny- DenytaskActionsEscalateToEmergencyAccess- Escalate To Emergency AccesstaskActionsHardReset- Hard ResettaskActionsProcessNow- Process NowtaskActionsReassign- ReassigntaskActionsRestart- RestarttaskActionsSkipStep- Skip SteptaskActionsUpdateGrantDuration- Update Grant DurationtaskActionsUpdateRequestData- Update Request DatataskAuditList- ListtaskCreateGrantTask- Create Grant TasktaskCreateOffboardingTask- Create Offboarding TasktaskCreateRevokeTask- Create Revoke TasktaskGet- GettaskSearchSearch- SearchuserGet- GetuserGetUserProfileTypes- Get User Profile TypesuserList- ListuserSearchSearch- SearchuserSetExpiringUserDelegationBindingByAdmin- Set Expiring User Delegation Binding By AdminwebhooksCreate- CreatewebhooksDelete- DeletewebhooksGet- GetwebhooksList- ListwebhooksSearchSearch- SearchwebhooksTest- TestwebhooksUpdate- Update- List UsersappEntitlementsListUsers⚠️ 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
syntax.
Here's an example of one such pagination call:
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
oauth: "<YOUR_OAUTH_HERE>",
},
});
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:
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
oauth: "<YOUR_OAUTH_HERE>",
},
});
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:
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: "<YOUR_BEARER_TOKEN_HERE>",
oauth: "<YOUR_OAUTH_HERE>",
},
});
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 |
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
import * as errors from "conductorone-sdk-typescript/sdk/models/errors";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
security: {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
oauth: "<YOUR_OAUTH_HERE>",
},
});
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();Primary error:
ConductoroneSDKTypescriptError: The base class for HTTP error responses.
Less common errors (6)
Network errors:
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.
Inherit from ConductoroneSDKTypescriptError:
ResponseValidationError: Type mismatch between the data returned from the server and the structure expected by the SDK. Seeerror.rawValuefor the raw value anderror.pretty()for a nicely formatted multi-line string.
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. |
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
tenantDomain: "<value>",
security: {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
oauth: "<YOUR_OAUTH_HERE>",
},
});
async function run() {
const result = await conductoroneSDKTypescript.accessConflict.createMonitor();
console.log(result);
}
run();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:
import { ConductoroneSDKTypescript } from "conductorone-sdk-typescript";
const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
serverURL: "https://example.conductor.one",
security: {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
oauth: "<YOUR_OAUTH_HERE>",
},
});
async function run() {
const result = await conductoroneSDKTypescript.accessConflict.createMonitor();
console.log(result);
}
run();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:
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 });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.
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.