Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Comprehensive, fully-typed Node.js/TypeScript library for the NinjaOne/NinjaRMM

- Full TypeScript support with comprehensive type definitions
- OAuth 2.0 authentication with automatic token refresh
- Support for all three regional endpoints (US, EU, Oceania)
- Support for all six regional endpoints (US, EU, Oceania, Canada, US2, Federal)
- Built-in rate limiting with configurable thresholds
- Automatic retry logic for rate limits and server errors
- Clean, intuitive API design
Expand All @@ -25,7 +25,7 @@ import { NinjaOneClient } from '@asachs01/node-ninjaone';
const client = new NinjaOneClient({
clientId: process.env.NINJAONE_CLIENT_ID!,
clientSecret: process.env.NINJAONE_CLIENT_SECRET!,
region: 'us', // 'us' | 'eu' | 'oc'
region: 'us', // 'us' | 'eu' | 'oc' | 'ca' | 'us2' | 'fed'
});

// List organizations
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { WebhooksResource } from './resources/webhooks.js';
* const client = new NinjaOneClient({
* clientId: process.env.NINJAONE_CLIENT_ID!,
* clientSecret: process.env.NINJAONE_CLIENT_SECRET!,
* region: 'us', // or 'eu', 'oc'
* region: 'us', // or 'eu', 'oc', 'ca', 'us2', 'fed'
* });
*
* // List organizations
Expand Down
7 changes: 5 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* NinjaOne regional endpoints
*/
export type NinjaOneRegion = 'us' | 'eu' | 'oc';
export type NinjaOneRegion = 'us' | 'eu' | 'oc' | 'ca' | 'us2' | 'fed';

/**
* Regional base URLs
Expand All @@ -14,6 +14,9 @@ export const REGION_URLS: Record<NinjaOneRegion, string> = {
us: 'https://app.ninjarmm.com',
eu: 'https://eu.ninjarmm.com',
oc: 'https://oc.ninjarmm.com',
ca: 'https://ca.ninjarmm.com',
us2: 'https://us2.ninjarmm.com',
fed: 'https://fed.ninjarmm.com',
};

/**
Expand Down Expand Up @@ -94,7 +97,7 @@ export function resolveConfig(config: NinjaOneConfig): ResolvedConfig {
const region = config.region ?? 'us';
const regionUrl = REGION_URLS[region];
if (!regionUrl) {
throw new Error(`Invalid region: ${region}. Valid regions are: us, eu, oc`);
throw new Error(`Invalid region: ${region}. Valid regions are: us, eu, oc, ca, us2, fed`);
}
baseUrl = regionUrl;
}
Expand Down
Loading