bitbucket-data-center-client 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +38 -518
  2. package/dist/api/base.d.ts +11 -0
  3. package/dist/api/base.d.ts.map +1 -0
  4. package/dist/api/base.js +22 -0
  5. package/dist/api/base.js.map +1 -0
  6. package/dist/api/index.d.ts +6 -0
  7. package/dist/api/index.d.ts.map +1 -0
  8. package/dist/api/index.js +6 -0
  9. package/dist/api/index.js.map +1 -0
  10. package/dist/api/projects.d.ts +14 -0
  11. package/dist/api/projects.d.ts.map +1 -0
  12. package/dist/api/projects.js +17 -0
  13. package/dist/api/projects.js.map +1 -0
  14. package/dist/api/pull-requests.d.ts +81 -0
  15. package/dist/api/pull-requests.d.ts.map +1 -0
  16. package/dist/api/pull-requests.js +206 -0
  17. package/dist/api/pull-requests.js.map +1 -0
  18. package/dist/api/repositories.d.ts +35 -0
  19. package/dist/api/repositories.d.ts.map +1 -0
  20. package/dist/api/repositories.js +85 -0
  21. package/dist/api/repositories.js.map +1 -0
  22. package/dist/api/users.d.ts +18 -0
  23. package/dist/api/users.d.ts.map +1 -0
  24. package/dist/api/users.js +24 -0
  25. package/dist/api/users.js.map +1 -0
  26. package/dist/client.d.ts +41 -23
  27. package/dist/client.d.ts.map +1 -1
  28. package/dist/client.js +44 -195
  29. package/dist/client.js.map +1 -1
  30. package/dist/index.d.ts +3 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +4 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/types/common.d.ts +72 -0
  35. package/dist/types/common.d.ts.map +1 -0
  36. package/dist/types/common.js +5 -0
  37. package/dist/types/common.js.map +1 -0
  38. package/dist/types/index.d.ts +6 -0
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/index.js +2 -0
  41. package/dist/types/index.js.map +1 -0
  42. package/dist/types/project.d.ts +41 -0
  43. package/dist/types/project.d.ts.map +1 -0
  44. package/dist/types/project.js +2 -0
  45. package/dist/types/project.js.map +1 -0
  46. package/dist/types/pull-request.d.ts +730 -0
  47. package/dist/types/pull-request.d.ts.map +1 -0
  48. package/dist/types/pull-request.js +2 -0
  49. package/dist/types/pull-request.js.map +1 -0
  50. package/dist/types/repository.d.ts +172 -0
  51. package/dist/types/repository.d.ts.map +1 -0
  52. package/dist/types/repository.js +2 -0
  53. package/dist/types/repository.js.map +1 -0
  54. package/dist/types/user.d.ts +46 -0
  55. package/dist/types/user.d.ts.map +1 -0
  56. package/dist/types/user.js +2 -0
  57. package/dist/types/user.js.map +1 -0
  58. package/package.json +21 -12
  59. package/.claude/settings.local.json +0 -10
  60. package/AGENTS.md +0 -123
  61. package/BitbucketServerSwagger.json +0 -67522
  62. package/LICENSE +0 -21
  63. package/dist/types.d.ts +0 -490
  64. package/dist/types.d.ts.map +0 -1
  65. package/dist/types.js +0 -2
  66. package/dist/types.js.map +0 -1
package/README.md CHANGED
@@ -1,13 +1,6 @@
1
1
  # Bitbucket Data Center Client
2
2
 
3
- A TypeScript client library for Bitbucket Server/Data Center REST API. This library provides a simple, type-safe interface for interacting with Bitbucket Server's REST API.
4
-
5
- ## Features
6
-
7
- - 🔒 **Type-safe**: Full TypeScript support with comprehensive type definitions
8
- - 🚀 **Simple**: Clean, intuitive API design
9
- - 📦 **Lightweight**: Minimal dependencies (only axios)
10
- - 🎯 **Complete**: Covers users, projects, repositories, and pull requests operations
3
+ TypeScript client for Bitbucket Server/Data Center REST API.
11
4
 
12
5
  ## Installation
13
6
 
@@ -15,552 +8,89 @@ A TypeScript client library for Bitbucket Server/Data Center REST API. This libr
15
8
  npm install bitbucket-data-center-client
16
9
  ```
17
10
 
18
- ## Quick Start
11
+ ## Usage
19
12
 
20
13
  ```typescript
21
14
  import { BitbucketClient } from 'bitbucket-data-center-client';
22
15
 
23
- // Initialize the client
24
16
  const client = new BitbucketClient({
17
+ baseUrl: 'https://bitbucket.example.com',
25
18
  token: 'your-personal-access-token',
26
- baseUrl: 'https://bitbucket.example.com'
27
19
  });
28
20
 
29
21
  // Get user profile
30
- const user = await client.getUserProfile({ username: 'john.doe' });
31
- console.log(user.displayName);
22
+ const user = await client.users.getProfile({ username: 'john.doe' });
32
23
 
33
24
  // List projects
34
- const projects = await client.listProjects({ limit: 10 });
35
- projects.values.forEach(project => {
36
- console.log(`${project.key}: ${project.name}`);
37
- });
38
-
39
- // Get pull requests in your inbox
40
- const prs = await client.getInboxPullRequests({ limit: 25 });
41
- prs.values.forEach(pr => {
42
- console.log(`PR #${pr.id}: ${pr.title}`);
43
- });
44
- ```
45
-
46
- ## Authentication
47
-
48
- The client uses **Bearer token authentication** with Bitbucket Personal Access Tokens:
49
-
50
- 1. Generate a Personal Access Token in Bitbucket Server:
51
- - Navigate to **Profile → Manage account → Personal access tokens**
52
- - Create a token with appropriate permissions (e.g., `REPO_READ`, `REPO_WRITE`)
53
- 2. Pass the token and base URL to the client constructor
54
-
55
- ```typescript
56
- // Simple configuration (most common)
57
- const client = new BitbucketClient({
58
- token: process.env.BITBUCKET_TOKEN!,
59
- baseUrl: process.env.BITBUCKET_URL! // e.g., 'https://bitbucket.example.com'
60
- });
25
+ const projects = await client.projects.list();
61
26
 
62
- // Advanced: with custom axios configuration
63
- const client = new BitbucketClient({
64
- token: process.env.BITBUCKET_TOKEN!,
65
- baseUrl: process.env.BITBUCKET_URL!,
66
- axiosConfig: {
67
- timeout: 10000,
68
- headers: {
69
- 'X-Custom-Header': 'value'
70
- }
71
- }
72
- });
73
- ```
74
-
75
- ## API Reference
76
-
77
- ### User Operations
78
-
79
- #### Get User Profile
80
-
81
- ```typescript
82
- const user = await client.getUserProfile({
83
- username: 'john.doe'
84
- });
85
- console.log(user.displayName, user.emailAddress);
86
- ```
87
-
88
- #### Get All Users
27
+ // List repositories in a project
28
+ const repos = await client.repositories.list({ projectKey: 'PROJ' });
89
29
 
90
- ```typescript
91
- const users = await client.getAllUsers({
92
- filter: 'john' // Optional: filter by username, name, or email
93
- });
94
- ```
95
-
96
- ### Project Operations
97
-
98
- #### List Projects
99
-
100
- ```typescript
101
- const projects = await client.listProjects({
102
- name: 'MyProject', // Optional: filter by name
103
- permission: 'PROJECT_WRITE', // Optional: filter by permission
104
- start: 0, // Optional: pagination start
105
- limit: 25 // Optional: page size
106
- });
107
- ```
108
-
109
- ### Repository Operations
110
-
111
- #### List Repositories
112
-
113
- ```typescript
114
- const repos = await client.listRepositories({
115
- projectKey: 'PROJ'
116
- });
117
- repos.values.forEach(repo => {
118
- console.log(`${repo.slug}: ${repo.name}`);
119
- });
120
- ```
121
-
122
- #### Get Repository
123
-
124
- ```typescript
125
- const repo = await client.getRepository({
126
- projectKey: 'PROJ',
127
- repositorySlug: 'my-repo'
128
- });
129
- console.log(`ID: ${repo.id}, Name: ${repo.name}`);
130
- ```
131
-
132
- ### Pull Request Operations
133
-
134
- #### Get Inbox Pull Requests
135
-
136
- Get all PRs where you're assigned as a reviewer:
137
-
138
- ```typescript
139
- const prs = await client.getInboxPullRequests({
140
- start: 0,
141
- limit: 25
142
- });
143
- ```
144
-
145
- #### Get Pull Request Details
146
-
147
- ```typescript
148
- const pr = await client.getPullRequest({
149
- projectKey: 'PROJ',
150
- repositorySlug: 'my-repo',
151
- pullRequestId: 123
152
- });
153
- console.log(pr.title, pr.author?.user.displayName);
154
- ```
155
-
156
- #### Create Pull Request
157
-
158
- Create a new pull request. Branch names are automatically converted to full refs:
159
-
160
- ```typescript
161
- // Simple same-repo PR
162
- const pr = await client.createPullRequest({
30
+ // Browse repository contents
31
+ const contents = await client.repositories.browse({
163
32
  projectKey: 'PROJ',
164
33
  repositorySlug: 'my-repo',
165
- title: 'Add new feature',
166
- description: 'This PR adds the new feature as discussed',
167
- fromBranch: 'feature-branch', // Just the branch name
168
- toBranch: 'main'
34
+ path: 'src',
169
35
  });
170
36
 
171
- // PR with reviewers
172
- const prWithReviewers = await client.createPullRequest({
37
+ // Get raw file content
38
+ const file = await client.repositories.getRawContent({
173
39
  projectKey: 'PROJ',
174
40
  repositorySlug: 'my-repo',
175
- title: 'Fix critical bug',
176
- description: 'Fixes issue #123',
177
- fromBranch: 'bugfix/critical-issue',
178
- toBranch: 'develop',
179
- reviewers: ['john.doe', 'jane.smith']
180
- });
181
-
182
- // Draft PR
183
- const draftPr = await client.createPullRequest({
184
- projectKey: 'PROJ',
185
- repositorySlug: 'my-repo',
186
- title: 'WIP: Refactor authentication',
187
- fromBranch: 'wip/auth-refactor',
188
- toBranch: 'main',
189
- draft: true
190
- });
191
-
192
- // Cross-repo PR (from fork to upstream)
193
- const crossRepoPr = await client.createPullRequest({
194
- projectKey: 'UPSTREAM',
195
- repositorySlug: 'upstream-repo',
196
- title: 'Contribution from fork',
197
- fromBranch: 'feature',
198
- toBranch: 'main',
199
- fromRepositorySlug: 'my-fork',
200
- fromProjectKey: 'MYPROJ'
201
- });
202
- ```
203
-
204
- #### Get Required/Default Reviewers
205
-
206
- Get the list of default reviewers for a PR before creating it. **Important:** Default reviewers are NOT automatically added when creating PRs via API - you must fetch them and pass them explicitly.
207
-
208
- Use `getRepository()` to obtain the repository ID:
209
-
210
- ```typescript
211
- // First get the repository to obtain its ID
212
- const repo = await client.getRepository({
213
- projectKey: 'PROJ',
214
- repositorySlug: 'my-repo'
41
+ path: 'package.json',
215
42
  });
216
43
 
217
- // Get default reviewers for a specific source/target branch combination
218
- const reviewers = await client.getRequiredReviewers({
44
+ // Get pull request details
45
+ const pr = await client.pullRequests.get({
219
46
  projectKey: 'PROJ',
220
47
  repositorySlug: 'my-repo',
221
- repositoryId: repo.id,
222
- sourceBranch: 'feature-branch',
223
- targetBranch: 'main'
48
+ pullRequestId: 123,
224
49
  });
225
50
 
226
- console.log('Required reviewers:', reviewers.map(r => r.displayName));
227
-
228
- // Create PR with default reviewers
229
- const pr = await client.createPullRequest({
51
+ // Create a pull request
52
+ const newPr = await client.pullRequests.create({
230
53
  projectKey: 'PROJ',
231
54
  repositorySlug: 'my-repo',
232
- title: 'My feature',
233
55
  fromBranch: 'feature-branch',
234
56
  toBranch: 'main',
235
- reviewers: reviewers.map(r => r.name)
236
- });
237
- ```
238
-
239
- #### Get Pull Request Changes
240
-
241
- Get list of changed files:
242
-
243
- ```typescript
244
- const changes = await client.getPullRequestChanges({
245
- projectKey: 'PROJ',
246
- repositorySlug: 'my-repo',
247
- pullRequestId: 123
248
- });
249
- changes.values.forEach(change => {
250
- console.log(`${change.type}: ${change.path?.toString}`);
251
- });
252
- ```
253
-
254
- #### Get Pull Request Diff
255
-
256
- Get diff for entire PR or specific file:
257
-
258
- ```typescript
259
- // Full PR diff (text format)
260
- const textDiff = await client.getPullRequestDiff({
261
- projectKey: 'PROJ',
262
- repositorySlug: 'my-repo',
263
- pullRequestId: 123,
264
- format: 'text'
265
- });
266
-
267
- // Structured diff for specific file
268
- const structuredDiff = await client.getPullRequestDiff({
269
- projectKey: 'PROJ',
270
- repositorySlug: 'my-repo',
271
- pullRequestId: 123,
272
- path: 'src/index.ts',
273
- format: 'json',
274
- contextLines: 3
275
- });
276
- ```
277
-
278
- #### Get File Diff with Line Numbers
279
-
280
- Get structured line-by-line diff for a specific file:
281
-
282
- ```typescript
283
- const diff = await client.getPullRequestFileDiff({
284
- projectKey: 'PROJ',
285
- repositorySlug: 'my-repo',
286
- pullRequestId: 123,
287
- path: 'src/main.ts',
288
- contextLines: 10
289
- });
290
-
291
- // Access hunks and segments
292
- diff.diffs[0]?.hunks?.forEach(hunk => {
293
- hunk.segments.forEach(segment => {
294
- segment.lines.forEach(line => {
295
- console.log(`Line ${line.destination}: ${line.line}`);
296
- });
297
- });
298
- });
299
- ```
300
-
301
- #### Get Pull Request Activities
302
-
303
- Get PR activity (comments, approvals, etc.):
304
-
305
- ```typescript
306
- const activities = await client.getPullRequestActivities({
307
- projectKey: 'PROJ',
308
- repositorySlug: 'my-repo',
309
- pullRequestId: 123,
310
- activityTypes: ['COMMENTED', 'REVIEW_COMMENTED'], // Optional filter
311
- start: 0,
312
- limit: 25
313
- });
314
-
315
- activities.values.forEach(activity => {
316
- console.log(`${activity.action}: ${activity.comment?.text}`);
317
- });
318
- ```
319
-
320
- #### Add Pull Request Comment
321
-
322
- Add general, file, or line comment:
323
-
324
- ```typescript
325
- // General comment
326
- await client.addPullRequestComment({
327
- projectKey: 'PROJ',
328
- repositorySlug: 'my-repo',
329
- pullRequestId: 123,
330
- text: 'Looks good to me!'
331
- });
332
-
333
- // File-level comment
334
- await client.addPullRequestComment({
335
- projectKey: 'PROJ',
336
- repositorySlug: 'my-repo',
337
- pullRequestId: 123,
338
- text: 'This file needs refactoring',
339
- path: 'src/main.ts'
340
- });
341
-
342
- // Inline comment on specific line
343
- await client.addPullRequestComment({
344
- projectKey: 'PROJ',
345
- repositorySlug: 'my-repo',
346
- pullRequestId: 123,
347
- text: 'Consider using const here',
348
- path: 'src/main.ts',
349
- line: 42,
350
- lineType: 'ADDED',
351
- fileType: 'TO'
352
- });
353
-
354
- // Reply to a comment
355
- await client.addPullRequestComment({
356
- projectKey: 'PROJ',
357
- repositorySlug: 'my-repo',
358
- pullRequestId: 123,
359
- text: 'Good catch!',
360
- parentId: 456
361
- });
362
- ```
363
-
364
- #### Delete Pull Request Comment
365
-
366
- ```typescript
367
- await client.deletePullRequestComment({
368
- projectKey: 'PROJ',
369
- repositorySlug: 'my-repo',
370
- pullRequestId: 123,
371
- commentId: 456,
372
- version: 1 // Get from comment object
373
- });
374
- ```
375
-
376
- #### Update Review Status
377
-
378
- Approve, request changes, or remove approval:
379
-
380
- ```typescript
381
- // Approve PR
382
- await client.updateReviewStatus({
383
- projectKey: 'PROJ',
384
- repositorySlug: 'my-repo',
385
- pullRequestId: 123,
386
- status: 'APPROVED'
387
- });
388
-
389
- // Request changes
390
- await client.updateReviewStatus({
391
- projectKey: 'PROJ',
392
- repositorySlug: 'my-repo',
393
- pullRequestId: 123,
394
- status: 'NEEDS_WORK'
395
- });
396
-
397
- // Remove approval
398
- await client.updateReviewStatus({
399
- projectKey: 'PROJ',
400
- repositorySlug: 'my-repo',
401
- pullRequestId: 123,
402
- status: 'UNAPPROVED'
57
+ title: 'Add new feature',
58
+ reviewers: ['reviewer1', 'reviewer2'],
403
59
  });
404
- ```
405
-
406
- #### Add/Remove Comment Reactions
407
60
 
408
- ```typescript
409
- // Add reaction
410
- await client.addPullRequestCommentReaction({
61
+ // Add a comment to a PR
62
+ await client.pullRequests.addComment({
411
63
  projectKey: 'PROJ',
412
64
  repositorySlug: 'my-repo',
413
65
  pullRequestId: 123,
414
- commentId: 456,
415
- emoticon: 'thumbsup' // thumbsup, thumbsdown, heart, thinking_face, laughing
66
+ text: 'Looks good!',
416
67
  });
417
68
 
418
- // Remove reaction
419
- await client.removePullRequestCommentReaction({
69
+ // Approve a PR
70
+ await client.pullRequests.updateReviewStatus({
420
71
  projectKey: 'PROJ',
421
72
  repositorySlug: 'my-repo',
422
73
  pullRequestId: 123,
423
- commentId: 456,
424
- emoticon: 'thumbsup'
425
- });
426
- ```
427
-
428
- ## Complete Example: PR Review Workflow
429
-
430
- ```typescript
431
- import { BitbucketClient } from 'bitbucket-data-center-client';
432
-
433
- const client = new BitbucketClient({
434
- token: process.env.BITBUCKET_TOKEN!,
435
- baseUrl: process.env.BITBUCKET_URL!
74
+ status: 'APPROVED',
436
75
  });
437
-
438
- async function reviewPullRequest() {
439
- // 1. Get PRs in your inbox
440
- const inbox = await client.getInboxPullRequests({ limit: 10 });
441
- const pr = inbox.values[0];
442
-
443
- if (!pr) {
444
- console.log('No PRs to review');
445
- return;
446
- }
447
-
448
- console.log(`Reviewing: ${pr.title}`);
449
-
450
- // 2. Get PR details
451
- const projectKey = pr.toRef.repository.project.key;
452
- const repositorySlug = pr.toRef.repository.slug;
453
- const pullRequestId = pr.id;
454
-
455
- // 3. Get changed files
456
- const changes = await client.getPullRequestChanges({
457
- projectKey,
458
- repositorySlug,
459
- pullRequestId
460
- });
461
-
462
- console.log(`Changed files: ${changes.values.length}`);
463
-
464
- // 4. Review each file
465
- for (const change of changes.values) {
466
- const path = change.path?.toString;
467
- if (!path) continue;
468
-
469
- // Get file diff
470
- const diff = await client.getPullRequestFileDiff({
471
- projectKey,
472
- repositorySlug,
473
- pullRequestId,
474
- path
475
- });
476
-
477
- // Check for issues and add comments
478
- diff.diffs[0]?.hunks?.forEach(hunk => {
479
- hunk.segments.forEach(segment => {
480
- if (segment.type === 'ADDED') {
481
- segment.lines.forEach(line => {
482
- if (line.line?.includes('console.log')) {
483
- // Add inline comment
484
- client.addPullRequestComment({
485
- projectKey,
486
- repositorySlug,
487
- pullRequestId,
488
- text: 'Please remove console.log before merging',
489
- path,
490
- line: line.destination!,
491
- lineType: 'ADDED',
492
- fileType: 'TO'
493
- });
494
- }
495
- });
496
- }
497
- });
498
- });
499
- }
500
-
501
- // 5. Approve or request changes
502
- await client.updateReviewStatus({
503
- projectKey,
504
- repositorySlug,
505
- pullRequestId,
506
- status: 'NEEDS_WORK'
507
- });
508
-
509
- console.log('Review complete!');
510
- }
511
-
512
- reviewPullRequest().catch(console.error);
513
76
  ```
514
77
 
515
- ## Type Definitions
78
+ ## API Structure
516
79
 
517
- This library exports comprehensive TypeScript types for all API entities:
80
+ | Domain | Methods |
81
+ |--------|---------|
82
+ | `client.users` | `getProfile`, `getAll` |
83
+ | `client.projects` | `list` |
84
+ | `client.repositories` | `list`, `get`, `browse`, `getRawContent`, `checkPermissions` |
85
+ | `client.pullRequests` | `getInbox`, `getDashboard`, `get`, `create`, `getChanges`, `getDiff`, `getFileDiff`, `getActivities`, `addComment`, `deleteComment`, `updateReviewStatus`, `addReaction`, `removeReaction`, `getRequiredReviewers` |
518
86
 
519
- ```typescript
520
- import type {
521
- // Common
522
- PaginatedResponse,
523
- // User & Project
524
- RestUser,
525
- RestProject,
526
- RestRepository,
527
- // Pull Request
528
- RestPullRequest,
529
- InboxPullRequest,
530
- RestComment,
531
- RestChange,
532
- DiffResponse,
533
- RestPullRequestActivity,
534
- // Method parameters
535
- GetPullRequestParams,
536
- AddPullRequestCommentParams,
537
- UpdateReviewStatusParams,
538
- // ... and many more
539
- } from 'bitbucket-data-center-client';
540
- ```
541
-
542
- See [types.ts](./src/types.ts) for the complete list of exported types.
543
-
544
- ## API Documentation
545
-
546
- This library is based on the official Bitbucket Server REST API. See `BitbucketServerSwagger.json` in this package for the complete API specification.
547
-
548
- ## Error Handling
87
+ ## Authentication
549
88
 
550
- The client throws axios errors for failed requests:
89
+ Generate a Personal Access Token in Bitbucket: **Profile > Manage account > Personal access tokens**
551
90
 
552
- ```typescript
553
- try {
554
- const pr = await client.getPullRequest({
555
- projectKey: 'PROJ',
556
- repositorySlug: 'my-repo',
557
- pullRequestId: 999
558
- });
559
- } catch (error) {
560
- if (axios.isAxiosError(error)) {
561
- console.error('API Error:', error.response?.data);
562
- }
563
- }
91
+ ```bash
92
+ export BITBUCKET_URL=https://bitbucket.example.com
93
+ export BITBUCKET_TOKEN=your-personal-access-token
564
94
  ```
565
95
 
566
96
  ## Requirements
@@ -571,13 +101,3 @@ try {
571
101
  ## License
572
102
 
573
103
  MIT
574
-
575
- ## Contributing
576
-
577
- Contributions are welcome! Please open an issue or submit a pull request.
578
-
579
- ## Support
580
-
581
- For issues and questions:
582
- - GitHub Issues: [your-repo-url]
583
- - Documentation: See inline JSDoc comments in the source code
@@ -0,0 +1,11 @@
1
+ import { type AxiosInstance } from 'axios';
2
+ import type { BitbucketClientConfig } from '../types/common.js';
3
+ /**
4
+ * Base API class providing shared axios configuration for all domain APIs.
5
+ */
6
+ export declare class BaseApi {
7
+ protected client: AxiosInstance;
8
+ protected baseUrl: string;
9
+ constructor(config: BitbucketClientConfig);
10
+ }
11
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/api/base.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE;;GAEG;AACH,qBAAa,OAAO;IAClB,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;IAChC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEP,MAAM,EAAE,qBAAqB;CAcjD"}
@@ -0,0 +1,22 @@
1
+ import axios from 'axios';
2
+ /**
3
+ * Base API class providing shared axios configuration for all domain APIs.
4
+ */
5
+ export class BaseApi {
6
+ client;
7
+ baseUrl;
8
+ constructor(config) {
9
+ const { token, baseUrl, axiosConfig = {} } = config;
10
+ this.baseUrl = baseUrl;
11
+ this.client = axios.create({
12
+ ...axiosConfig,
13
+ baseURL: `${baseUrl}/rest/api/latest`,
14
+ headers: {
15
+ ...axiosConfig.headers,
16
+ Authorization: `Bearer ${token}`,
17
+ 'Content-Type': 'application/json',
18
+ },
19
+ });
20
+ }
21
+ }
22
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/api/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD;;GAEG;AACH,MAAM,OAAO,OAAO;IACR,MAAM,CAAgB;IACtB,OAAO,CAAS;IAE1B,YAAmB,MAA6B;QAC9C,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YACzB,GAAG,WAAW;YACd,OAAO,EAAE,GAAG,OAAO,kBAAkB;YACrC,OAAO,EAAE;gBACP,GAAG,WAAW,CAAC,OAAO;gBACtB,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ export { BaseApi } from './base.js';
2
+ export { ProjectsApi } from './projects.js';
3
+ export { PullRequestsApi } from './pull-requests.js';
4
+ export { RepositoriesApi } from './repositories.js';
5
+ export { UsersApi } from './users.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { BaseApi } from './base.js';
2
+ export { ProjectsApi } from './projects.js';
3
+ export { PullRequestsApi } from './pull-requests.js';
4
+ export { RepositoriesApi } from './repositories.js';
5
+ export { UsersApi } from './users.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { BaseApi } from './base.js';
2
+ import type { PaginatedResponse } from '../types/common.js';
3
+ import type { ListProjectsParams, RestProject } from '../types/project.js';
4
+ /**
5
+ * Projects API for Bitbucket Server.
6
+ * Provides methods for project-related operations.
7
+ */
8
+ export declare class ProjectsApi extends BaseApi {
9
+ /**
10
+ * List projects, optionally filtered by name or permission
11
+ */
12
+ list(params?: ListProjectsParams): Promise<PaginatedResponse<RestProject>>;
13
+ }
14
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/api/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE3E;;;GAGG;AACH,qBAAa,WAAY,SAAQ,OAAO;IACtC;;OAEG;IACU,IAAI,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAMxF"}