@resolution/user-management-api-client
v0.17.1
Published
Atlassian User Management API Client based on OpenAPI Schema from Atlassian.
Readme
Atlassian User Management API Client
TypeScript/JavaScript client for the Atlassian User Management API, generated from the Atlassian OpenAPI schema.
Installation
npm install @resolution/user-management-api-clientor
yarn add @resolution/user-management-api-clientUsage
import { UserManagementApiClient } from '@resolution/user-management-api-client';
// Initialize the client with your API key
const userManagementClient = new UserManagementApiClient({
apiKey: 'your-api-key-here'
});
// Example: Get a user's profile
async function getUserProfile(accountId: string) {
try {
const response = await userManagementClient.profile.getUserProfile({ accountId });
console.log('Profile:', response.data);
} catch (error) {
console.error('Error fetching profile:', error);
}
}Authentication
This client only supports API key authentication. You need to provide an API key when initializing the client:
const client = new UserManagementApiClient({
apiKey: 'your-api-key-here'
});Available Services
The client provides access to the following services:
manage- User management permissionsprofile- User profile managementemail- User email managementapiTokens- User API token managementlifecycle- User lifecycle management (activate, deactivate, delete)
Error Handling
The client uses the ApiError class for error handling:
import { UserManagementApiClient, ApiError } from '@resolution/user-management-api-client';
const userManagementClient = new UserManagementApiClient({
apiKey: 'your-api-key-here'
});
try {
await userManagementClient.profile.getUserProfile({ accountId: 'account-id-here' });
} catch (error) {
if (error instanceof ApiError) {
console.error('API Error:', error.message);
console.error('Status:', error.statusCode);
console.error('Details:', error.details);
} else {
console.error('Unknown error:', error);
}
}Advanced Configuration
You can customize client behavior with additional options:
const client = new UserManagementApiClient({
apiKey: 'your-api-key-here',
// Custom validation error handler
handleValidationError: (error) => {
console.error('Validation error:', error);
},
// Custom deprecation warning logger
logDeprecationWarning: ({ operationName, path, method }) => {
console.warn(`Deprecated operation used: ${operationName} (${method} ${path})`);
},
// Custom retry logic
shouldRetryOnError: (error, attemptNumber) => {
return attemptNumber < 3 && (error.statusCode === 429 || error.statusCode >= 500);
}
});License
MIT
