@bundleup/sdk 0.0.15 → 0.0.17

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.
package/dist/index.d.mts CHANGED
@@ -146,7 +146,7 @@ declare abstract class Base {
146
146
  declare class Chat extends Base {
147
147
  protected namespace: string;
148
148
  /**
149
- * Fetch chat channels with optional query parameters.
149
+ * Fetch chat channels
150
150
  * @param limit - Maximum number of channels to retrieve.
151
151
  * @param after - Cursor for pagination.
152
152
  * @param includeRaw - Whether to include raw response data.
@@ -164,7 +164,7 @@ interface RepoParams extends Params {
164
164
  declare class Git extends Base {
165
165
  protected namespace: string;
166
166
  /**
167
- * Fetch repositories with optional query parameters.
167
+ * Fetch repositories
168
168
  * @param limit - Maximum number of repositories to retrieve.
169
169
  * @param after - Cursor for pagination.
170
170
  * @param includeRaw - Whether to include raw response data.
@@ -175,8 +175,10 @@ declare class Git extends Base {
175
175
  name: string;
176
176
  full_name: string;
177
177
  description: string | null;
178
+ url: string;
178
179
  created_at: string;
179
180
  updated_at: string;
181
+ pushed_at: string;
180
182
  }[]>>;
181
183
  /**
182
184
  * Fetch pull requests for a specific repository.
@@ -191,7 +193,11 @@ declare class Git extends Base {
191
193
  id: string;
192
194
  number: number;
193
195
  title: string;
196
+ description: string | null;
197
+ draft: boolean;
194
198
  state: string;
199
+ url: string;
200
+ user: string;
195
201
  created_at: string;
196
202
  updated_at: string;
197
203
  merged_at: string | null;
@@ -209,6 +215,45 @@ declare class Git extends Base {
209
215
  name: string;
210
216
  commit_sha: string;
211
217
  }[]>>;
218
+ /**
219
+ * Fetch releases for a specific repository.
220
+ * @param repoName - The name of the repository.
221
+ * @param limit - Maximum number of releases to retrieve.
222
+ * @param after - Cursor for pagination.
223
+ * @param includeRaw - Whether to include raw response data.
224
+ * @returns A promise that resolves to the fetch response.
225
+ * @throws If repoName is not provided.
226
+ */
227
+ releases({ repoName, limit, after, includeRaw }: RepoParams): Promise<Response$1<{
228
+ id: string;
229
+ name: string;
230
+ tag_name: string;
231
+ description: string | null;
232
+ prerelease: boolean;
233
+ url: string;
234
+ created_at: string;
235
+ released_at: string | null;
236
+ }[]>>;
237
+ }
238
+
239
+ declare class PM extends Base {
240
+ protected namespace: string;
241
+ /**
242
+ * Fetch issues
243
+ * @param limit - Maximum number of issues to retrieve.
244
+ * @param after - Cursor for pagination.
245
+ * @param includeRaw - Whether to include raw response data.
246
+ * @returns A promise that resolves to the fetch response.
247
+ */
248
+ issues({ limit, after, includeRaw }?: Params): Promise<Response$1<{
249
+ id: string;
250
+ url: string;
251
+ title: string;
252
+ status: string;
253
+ description: string | null;
254
+ created_at: string;
255
+ updated_at: string;
256
+ }[]>>;
212
257
  }
213
258
 
214
259
  declare class BundleUp {
@@ -244,6 +289,7 @@ declare class BundleUp {
244
289
  unify(connectionId: string): {
245
290
  chat: Chat;
246
291
  git: Git;
292
+ pm: PM;
247
293
  };
248
294
  }
249
295
 
package/dist/index.d.ts CHANGED
@@ -146,7 +146,7 @@ declare abstract class Base {
146
146
  declare class Chat extends Base {
147
147
  protected namespace: string;
148
148
  /**
149
- * Fetch chat channels with optional query parameters.
149
+ * Fetch chat channels
150
150
  * @param limit - Maximum number of channels to retrieve.
151
151
  * @param after - Cursor for pagination.
152
152
  * @param includeRaw - Whether to include raw response data.
@@ -164,7 +164,7 @@ interface RepoParams extends Params {
164
164
  declare class Git extends Base {
165
165
  protected namespace: string;
166
166
  /**
167
- * Fetch repositories with optional query parameters.
167
+ * Fetch repositories
168
168
  * @param limit - Maximum number of repositories to retrieve.
169
169
  * @param after - Cursor for pagination.
170
170
  * @param includeRaw - Whether to include raw response data.
@@ -175,8 +175,10 @@ declare class Git extends Base {
175
175
  name: string;
176
176
  full_name: string;
177
177
  description: string | null;
178
+ url: string;
178
179
  created_at: string;
179
180
  updated_at: string;
181
+ pushed_at: string;
180
182
  }[]>>;
181
183
  /**
182
184
  * Fetch pull requests for a specific repository.
@@ -191,7 +193,11 @@ declare class Git extends Base {
191
193
  id: string;
192
194
  number: number;
193
195
  title: string;
196
+ description: string | null;
197
+ draft: boolean;
194
198
  state: string;
199
+ url: string;
200
+ user: string;
195
201
  created_at: string;
196
202
  updated_at: string;
197
203
  merged_at: string | null;
@@ -209,6 +215,45 @@ declare class Git extends Base {
209
215
  name: string;
210
216
  commit_sha: string;
211
217
  }[]>>;
218
+ /**
219
+ * Fetch releases for a specific repository.
220
+ * @param repoName - The name of the repository.
221
+ * @param limit - Maximum number of releases to retrieve.
222
+ * @param after - Cursor for pagination.
223
+ * @param includeRaw - Whether to include raw response data.
224
+ * @returns A promise that resolves to the fetch response.
225
+ * @throws If repoName is not provided.
226
+ */
227
+ releases({ repoName, limit, after, includeRaw }: RepoParams): Promise<Response$1<{
228
+ id: string;
229
+ name: string;
230
+ tag_name: string;
231
+ description: string | null;
232
+ prerelease: boolean;
233
+ url: string;
234
+ created_at: string;
235
+ released_at: string | null;
236
+ }[]>>;
237
+ }
238
+
239
+ declare class PM extends Base {
240
+ protected namespace: string;
241
+ /**
242
+ * Fetch issues
243
+ * @param limit - Maximum number of issues to retrieve.
244
+ * @param after - Cursor for pagination.
245
+ * @param includeRaw - Whether to include raw response data.
246
+ * @returns A promise that resolves to the fetch response.
247
+ */
248
+ issues({ limit, after, includeRaw }?: Params): Promise<Response$1<{
249
+ id: string;
250
+ url: string;
251
+ title: string;
252
+ status: string;
253
+ description: string | null;
254
+ created_at: string;
255
+ updated_at: string;
256
+ }[]>>;
212
257
  }
213
258
 
214
259
  declare class BundleUp {
@@ -244,6 +289,7 @@ declare class BundleUp {
244
289
  unify(connectionId: string): {
245
290
  chat: Chat;
246
291
  git: Git;
292
+ pm: PM;
247
293
  };
248
294
  }
249
295
 
package/dist/index.js CHANGED
@@ -41,6 +41,15 @@ var Base = class {
41
41
  throw new Error("URL search params must be an object.");
42
42
  }
43
43
  const parts = [this.version, this.namespace, path].filter(Boolean).join("/");
44
+ searchParams = Object.entries(searchParams).reduce(
45
+ (acc, [key, value]) => {
46
+ if (value !== void 0 && value !== null) {
47
+ acc[key] = value;
48
+ }
49
+ return acc;
50
+ },
51
+ {}
52
+ );
44
53
  const url = new URL(parts, this.baseUrl);
45
54
  url.search = new URLSearchParams(searchParams).toString();
46
55
  return url;
@@ -357,6 +366,15 @@ var Base2 = class {
357
366
  throw new Error("URL search params must be an object.");
358
367
  }
359
368
  const parts = [this.version, this.namespace, path].filter(Boolean).join("/");
369
+ searchParams = Object.entries(searchParams).reduce(
370
+ (acc, [key, value]) => {
371
+ if (value !== void 0 && value !== null) {
372
+ acc[key] = value;
373
+ }
374
+ return acc;
375
+ },
376
+ {}
377
+ );
360
378
  const url = new URL(parts, this.baseUrl);
361
379
  url.search = new URLSearchParams(searchParams).toString();
362
380
  return url;
@@ -370,7 +388,7 @@ var Chat = class extends Base2 {
370
388
  this.namespace = "chat";
371
389
  }
372
390
  /**
373
- * Fetch chat channels with optional query parameters.
391
+ * Fetch chat channels
374
392
  * @param limit - Maximum number of channels to retrieve.
375
393
  * @param after - Cursor for pagination.
376
394
  * @param includeRaw - Whether to include raw response data.
@@ -401,7 +419,7 @@ var Git = class extends Base2 {
401
419
  this.namespace = "git";
402
420
  }
403
421
  /**
404
- * Fetch repositories with optional query parameters.
422
+ * Fetch repositories
405
423
  * @param limit - Maximum number of repositories to retrieve.
406
424
  * @param after - Cursor for pagination.
407
425
  * @param includeRaw - Whether to include raw response data.
@@ -485,6 +503,71 @@ var Git = class extends Base2 {
485
503
  const data = await response.json();
486
504
  return data;
487
505
  }
506
+ /**
507
+ * Fetch releases for a specific repository.
508
+ * @param repoName - The name of the repository.
509
+ * @param limit - Maximum number of releases to retrieve.
510
+ * @param after - Cursor for pagination.
511
+ * @param includeRaw - Whether to include raw response data.
512
+ * @returns A promise that resolves to the fetch response.
513
+ * @throws If repoName is not provided.
514
+ */
515
+ async releases({ repoName, limit = 100, after, includeRaw }) {
516
+ if (!repoName) {
517
+ throw new Error("repoName is required to fetch releases.");
518
+ }
519
+ const url = this.buildUrl(
520
+ `repos/${encodeURIComponent(repoName)}/releases`,
521
+ {
522
+ limit,
523
+ after
524
+ }
525
+ );
526
+ const response = await fetch(url, {
527
+ headers: {
528
+ ...this.headers,
529
+ "BU-Include-Raw": includeRaw ? "true" : "false"
530
+ }
531
+ });
532
+ if (!response.ok) {
533
+ throw new Error(
534
+ `Failed to fetch ${url.toString()}: ${response.statusText}`
535
+ );
536
+ }
537
+ const data = await response.json();
538
+ return data;
539
+ }
540
+ };
541
+
542
+ // src/unify/pm.ts
543
+ var PM = class extends Base2 {
544
+ constructor() {
545
+ super(...arguments);
546
+ this.namespace = "pm";
547
+ }
548
+ /**
549
+ * Fetch issues
550
+ * @param limit - Maximum number of issues to retrieve.
551
+ * @param after - Cursor for pagination.
552
+ * @param includeRaw - Whether to include raw response data.
553
+ * @returns A promise that resolves to the fetch response.
554
+ */
555
+ async issues({ limit = 100, after, includeRaw } = {}) {
556
+ const url = this.buildUrl("issues", { limit, after });
557
+ const response = await fetch(url, {
558
+ headers: {
559
+ ...this.headers,
560
+ "BU-Include-Raw": includeRaw ? "true" : "false"
561
+ }
562
+ });
563
+ if (!response.ok) {
564
+ throw new Error(
565
+ `Failed to fetch ${url.toString()}: ${response.statusText}`
566
+ );
567
+ }
568
+ const data = await response.json();
569
+ return data;
570
+ }
488
571
  };
489
572
 
490
573
  // src/index.ts
@@ -541,7 +624,8 @@ var BundleUp = class {
541
624
  }
542
625
  return {
543
626
  chat: new Chat(this.apiKey, connectionId),
544
- git: new Git(this.apiKey, connectionId)
627
+ git: new Git(this.apiKey, connectionId),
628
+ pm: new PM(this.apiKey, connectionId)
545
629
  };
546
630
  }
547
631
  };
package/dist/index.mjs CHANGED
@@ -15,6 +15,15 @@ var Base = class {
15
15
  throw new Error("URL search params must be an object.");
16
16
  }
17
17
  const parts = [this.version, this.namespace, path].filter(Boolean).join("/");
18
+ searchParams = Object.entries(searchParams).reduce(
19
+ (acc, [key, value]) => {
20
+ if (value !== void 0 && value !== null) {
21
+ acc[key] = value;
22
+ }
23
+ return acc;
24
+ },
25
+ {}
26
+ );
18
27
  const url = new URL(parts, this.baseUrl);
19
28
  url.search = new URLSearchParams(searchParams).toString();
20
29
  return url;
@@ -331,6 +340,15 @@ var Base2 = class {
331
340
  throw new Error("URL search params must be an object.");
332
341
  }
333
342
  const parts = [this.version, this.namespace, path].filter(Boolean).join("/");
343
+ searchParams = Object.entries(searchParams).reduce(
344
+ (acc, [key, value]) => {
345
+ if (value !== void 0 && value !== null) {
346
+ acc[key] = value;
347
+ }
348
+ return acc;
349
+ },
350
+ {}
351
+ );
334
352
  const url = new URL(parts, this.baseUrl);
335
353
  url.search = new URLSearchParams(searchParams).toString();
336
354
  return url;
@@ -344,7 +362,7 @@ var Chat = class extends Base2 {
344
362
  this.namespace = "chat";
345
363
  }
346
364
  /**
347
- * Fetch chat channels with optional query parameters.
365
+ * Fetch chat channels
348
366
  * @param limit - Maximum number of channels to retrieve.
349
367
  * @param after - Cursor for pagination.
350
368
  * @param includeRaw - Whether to include raw response data.
@@ -375,7 +393,7 @@ var Git = class extends Base2 {
375
393
  this.namespace = "git";
376
394
  }
377
395
  /**
378
- * Fetch repositories with optional query parameters.
396
+ * Fetch repositories
379
397
  * @param limit - Maximum number of repositories to retrieve.
380
398
  * @param after - Cursor for pagination.
381
399
  * @param includeRaw - Whether to include raw response data.
@@ -459,6 +477,71 @@ var Git = class extends Base2 {
459
477
  const data = await response.json();
460
478
  return data;
461
479
  }
480
+ /**
481
+ * Fetch releases for a specific repository.
482
+ * @param repoName - The name of the repository.
483
+ * @param limit - Maximum number of releases to retrieve.
484
+ * @param after - Cursor for pagination.
485
+ * @param includeRaw - Whether to include raw response data.
486
+ * @returns A promise that resolves to the fetch response.
487
+ * @throws If repoName is not provided.
488
+ */
489
+ async releases({ repoName, limit = 100, after, includeRaw }) {
490
+ if (!repoName) {
491
+ throw new Error("repoName is required to fetch releases.");
492
+ }
493
+ const url = this.buildUrl(
494
+ `repos/${encodeURIComponent(repoName)}/releases`,
495
+ {
496
+ limit,
497
+ after
498
+ }
499
+ );
500
+ const response = await fetch(url, {
501
+ headers: {
502
+ ...this.headers,
503
+ "BU-Include-Raw": includeRaw ? "true" : "false"
504
+ }
505
+ });
506
+ if (!response.ok) {
507
+ throw new Error(
508
+ `Failed to fetch ${url.toString()}: ${response.statusText}`
509
+ );
510
+ }
511
+ const data = await response.json();
512
+ return data;
513
+ }
514
+ };
515
+
516
+ // src/unify/pm.ts
517
+ var PM = class extends Base2 {
518
+ constructor() {
519
+ super(...arguments);
520
+ this.namespace = "pm";
521
+ }
522
+ /**
523
+ * Fetch issues
524
+ * @param limit - Maximum number of issues to retrieve.
525
+ * @param after - Cursor for pagination.
526
+ * @param includeRaw - Whether to include raw response data.
527
+ * @returns A promise that resolves to the fetch response.
528
+ */
529
+ async issues({ limit = 100, after, includeRaw } = {}) {
530
+ const url = this.buildUrl("issues", { limit, after });
531
+ const response = await fetch(url, {
532
+ headers: {
533
+ ...this.headers,
534
+ "BU-Include-Raw": includeRaw ? "true" : "false"
535
+ }
536
+ });
537
+ if (!response.ok) {
538
+ throw new Error(
539
+ `Failed to fetch ${url.toString()}: ${response.statusText}`
540
+ );
541
+ }
542
+ const data = await response.json();
543
+ return data;
544
+ }
462
545
  };
463
546
 
464
547
  // src/index.ts
@@ -515,7 +598,8 @@ var BundleUp = class {
515
598
  }
516
599
  return {
517
600
  chat: new Chat(this.apiKey, connectionId),
518
- git: new Git(this.apiKey, connectionId)
601
+ git: new Git(this.apiKey, connectionId),
602
+ pm: new PM(this.apiKey, connectionId)
519
603
  };
520
604
  }
521
605
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundleup/sdk",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "SDK package for BundleUp",
5
5
  "exports": {
6
6
  ".": {