@gohcltech/bitbucket-mcp
Version:
Bitbucket integration for Claude via Model Context Protocol
63 lines • 2.38 kB
JavaScript
/**
* @fileoverview Workspace-specific HTTP client for Bitbucket API operations.
*
* This module provides workspace-related functionality including:
* - Listing all accessible workspaces
* - Getting detailed workspace information
* - Workspace discovery and inspection
*
*/
import { BaseClient } from './base-client.js';
/**
* HTTP client for Bitbucket workspace operations.
*
* Provides methods for workspace discovery and inspection. Workspaces are
* the top-level organizational units in Bitbucket that contain repositories,
* teams, and settings.
*/
export class WorkspaceClient extends BaseClient {
// =============================================================================
// WORKSPACE API METHODS
// =============================================================================
/**
* Retrieves all workspaces accessible to the authenticated user.
*
* @returns Promise resolving to paginated workspace list
* @throws {AuthenticationError} If not authenticated
* @throws {BitbucketApiError} If API request fails
*/
async getWorkspaces() {
return this.get('/workspaces', undefined, {
operationName: 'get_workspaces',
});
}
/**
* Retrieves all workspaces accessible to the authenticated user (all pages).
*
* This method automatically handles pagination to return all workspaces
* across multiple pages. Use this when you need a complete list of workspaces.
*
* @returns Promise resolving to array of all workspaces
* @throws {AuthenticationError} If not authenticated
* @throws {BitbucketApiError} If API request fails
*/
async getAllWorkspaces() {
return this.getAllPages('/workspaces', undefined, {
operationName: 'get_all_workspaces',
});
}
/**
* Retrieves details for a specific workspace.
*
* @param workspaceSlug - Unique identifier for the workspace
* @returns Promise resolving to workspace details
* @throws {AuthenticationError} If not authenticated
* @throws {BitbucketApiError} If workspace not found or request fails
*/
async getWorkspace(workspaceSlug) {
return this.get(`/workspaces/${workspaceSlug}`, undefined, {
operationName: 'get_workspace',
});
}
}
//# sourceMappingURL=workspace-client.js.map