bbdc-cli 0.4.2__tar.gz → 0.5.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bbdc-cli
3
- Version: 0.4.2
3
+ Version: 0.5.0
4
4
  Summary: Typer CLI for Bitbucket Data Center
5
5
  Project-URL: Repository, https://github.com/marcosgalleterobbva/bb-cli
6
6
  Keywords: bitbucket,cli,typer,data-center,server
@@ -100,6 +100,7 @@ Show help:
100
100
  ```bash
101
101
  bbdc --help
102
102
  bbdc account --help
103
+ bbdc dashboard --help
103
104
  bbdc pr --help
104
105
  ```
105
106
 
@@ -110,8 +111,11 @@ Get information about your authenticated account:
110
111
  bbdc account me
111
112
 
112
113
  # if some account endpoints are not permitted with your token,
113
- # account me returns partial JSON with "partial" + "errors"
114
- bbdc account me --json
114
+ # account me still returns partial JSON with "partial" + "errors"
115
+ bbdc account me
116
+
117
+ # account me is JSON by default; there is no --json flag
118
+ # (use: bbdc account me)
115
119
 
116
120
  # include user profile and settings when your slug is known
117
121
  bbdc account me --user-slug your.user --include-settings
@@ -124,6 +128,19 @@ bbdc account user --user-slug your.user
124
128
  bbdc account settings --user-slug your.user
125
129
  ```
126
130
 
131
+ Inspect dashboard pull requests:
132
+
133
+ ```bash
134
+ # pull requests where you are involved (author/reviewer/participant)
135
+ bbdc dashboard pull-requests
136
+
137
+ # filter by role/state
138
+ bbdc dashboard pull-requests --role REVIEWER --state OPEN
139
+
140
+ # return JSON
141
+ bbdc dashboard pull-requests --json
142
+ ```
143
+
127
144
  List pull requests:
128
145
 
129
146
  ```bash
@@ -81,6 +81,7 @@ Show help:
81
81
  ```bash
82
82
  bbdc --help
83
83
  bbdc account --help
84
+ bbdc dashboard --help
84
85
  bbdc pr --help
85
86
  ```
86
87
 
@@ -91,8 +92,11 @@ Get information about your authenticated account:
91
92
  bbdc account me
92
93
 
93
94
  # if some account endpoints are not permitted with your token,
94
- # account me returns partial JSON with "partial" + "errors"
95
- bbdc account me --json
95
+ # account me still returns partial JSON with "partial" + "errors"
96
+ bbdc account me
97
+
98
+ # account me is JSON by default; there is no --json flag
99
+ # (use: bbdc account me)
96
100
 
97
101
  # include user profile and settings when your slug is known
98
102
  bbdc account me --user-slug your.user --include-settings
@@ -105,6 +109,19 @@ bbdc account user --user-slug your.user
105
109
  bbdc account settings --user-slug your.user
106
110
  ```
107
111
 
112
+ Inspect dashboard pull requests:
113
+
114
+ ```bash
115
+ # pull requests where you are involved (author/reviewer/participant)
116
+ bbdc dashboard pull-requests
117
+
118
+ # filter by role/state
119
+ bbdc dashboard pull-requests --role REVIEWER --state OPEN
120
+
121
+ # return JSON
122
+ bbdc dashboard pull-requests --json
123
+ ```
124
+
108
125
  List pull requests:
109
126
 
110
127
  ```bash
@@ -37,6 +37,7 @@ import typer
37
37
 
38
38
  app = typer.Typer(no_args_is_help=True, add_completion=False)
39
39
  account_app = typer.Typer(no_args_is_help=True, add_completion=False)
40
+ dashboard_app = typer.Typer(no_args_is_help=True, add_completion=False)
40
41
  pr_app = typer.Typer(no_args_is_help=True, add_completion=False)
41
42
  participants_app = typer.Typer(no_args_is_help=True, add_completion=False)
42
43
  comments_app = typer.Typer(no_args_is_help=True, add_completion=False)
@@ -44,6 +45,7 @@ blockers_app = typer.Typer(no_args_is_help=True, add_completion=False)
44
45
  review_app = typer.Typer(no_args_is_help=True, add_completion=False)
45
46
  auto_merge_app = typer.Typer(no_args_is_help=True, add_completion=False)
46
47
  app.add_typer(account_app, name="account", help="Authenticated account operations")
48
+ app.add_typer(dashboard_app, name="dashboard", help="Dashboard operations")
47
49
  app.add_typer(pr_app, name="pr", help="Pull request operations")
48
50
  pr_app.add_typer(participants_app, name="participants", help="PR participants and reviewers")
49
51
  pr_app.add_typer(comments_app, name="comments", help="PR comments")
@@ -1252,6 +1254,41 @@ def _op_pr_auto_merge_cancel(
1252
1254
  return {"message": f"Cancelled auto-merge for PR #{pr_id}"}
1253
1255
 
1254
1256
 
1257
+ def _op_dashboard_pull_requests(
1258
+ bb: BitbucketClient,
1259
+ *,
1260
+ user: Optional[str],
1261
+ state: Optional[str],
1262
+ role: Optional[str],
1263
+ participant_status: Optional[str],
1264
+ order: Optional[str],
1265
+ closed_since: Optional[int],
1266
+ limit: int,
1267
+ max_items: int,
1268
+ ) -> Dict[str, Any]:
1269
+ params: Dict[str, Any] = {}
1270
+ if user:
1271
+ params["user"] = user
1272
+ if state:
1273
+ params["state"] = state
1274
+ if role:
1275
+ params["role"] = role
1276
+ if participant_status:
1277
+ params["participantStatus"] = participant_status
1278
+ if order:
1279
+ params["order"] = order
1280
+ if closed_since is not None:
1281
+ params["closedSince"] = closed_since
1282
+ prs = bb.paged_get(
1283
+ "dashboard/pull-requests",
1284
+ params=params or None,
1285
+ limit=limit,
1286
+ max_items=max_items,
1287
+ )
1288
+ who = user or "current user"
1289
+ return {"message": f"Fetched {len(prs)} dashboard pull requests for {who}", "data": prs}
1290
+
1291
+
1255
1292
  def _op_account_recent_repos(
1256
1293
  bb: BitbucketClient, limit: int, max_items: int
1257
1294
  ) -> Dict[str, Any]:
@@ -1758,7 +1795,6 @@ def account_me(
1758
1795
  ),
1759
1796
  limit: int = typer.Option(25, help="Page size for account-related paged endpoints"),
1760
1797
  max_items: int = typer.Option(100, help="Max items per account-related endpoint"),
1761
- json_out: bool = typer.Option(False, "--json", help="Print raw JSON response"),
1762
1798
  ):
1763
1799
  """Get a consolidated snapshot of the authenticated account.
1764
1800
 
@@ -1773,10 +1809,58 @@ def account_me(
1773
1809
  limit=limit,
1774
1810
  max_items=max_items,
1775
1811
  )
1812
+ _print_json(resp["data"])
1813
+
1814
+
1815
+ @dashboard_app.command("pull-requests")
1816
+ def dashboard_pull_requests(
1817
+ user: Optional[str] = typer.Option(None, "--user", help="Involved user name; defaults to current user"),
1818
+ state: Optional[str] = typer.Option(
1819
+ None,
1820
+ "--state",
1821
+ help="OPEN, DECLINED, or MERGED. Omit to include all states.",
1822
+ ),
1823
+ role: Optional[str] = typer.Option(
1824
+ None,
1825
+ "--role",
1826
+ help="REVIEWER, AUTHOR, or PARTICIPANT. Omit to include all roles.",
1827
+ ),
1828
+ participant_status: Optional[str] = typer.Option(
1829
+ None,
1830
+ "--participant-status",
1831
+ help="Comma-separated list: UNAPPROVED, NEEDS_WORK, APPROVED.",
1832
+ ),
1833
+ order: Optional[str] = typer.Option(
1834
+ None,
1835
+ "--order",
1836
+ help="OLDEST, NEWEST, DRAFT_STATUS, PARTICIPANT_STATUS, and/or CLOSED_DATE.",
1837
+ ),
1838
+ closed_since: Optional[int] = typer.Option(
1839
+ None,
1840
+ "--closed-since",
1841
+ help="Only include PRs closed in the last N seconds.",
1842
+ ),
1843
+ limit: int = typer.Option(25, help="Page size"),
1844
+ max_items: int = typer.Option(100, help="Max items to fetch across pages"),
1845
+ json_out: bool = typer.Option(False, "--json", help="Print raw JSON instead of a table"),
1846
+ ):
1847
+ """List dashboard pull requests for a user."""
1848
+ bb = client()
1849
+ resp = _op_dashboard_pull_requests(
1850
+ bb,
1851
+ user=user,
1852
+ state=state,
1853
+ role=role,
1854
+ participant_status=participant_status,
1855
+ order=order,
1856
+ closed_since=closed_since,
1857
+ limit=limit,
1858
+ max_items=max_items,
1859
+ )
1776
1860
  if json_out:
1777
1861
  _print_json(resp["data"])
1778
1862
  else:
1779
- _print_json(resp["data"])
1863
+ _print_prs(resp["data"])
1780
1864
 
1781
1865
 
1782
1866
  @pr_app.command("list")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bbdc-cli
3
- Version: 0.4.2
3
+ Version: 0.5.0
4
4
  Summary: Typer CLI for Bitbucket Data Center
5
5
  Project-URL: Repository, https://github.com/marcosgalleterobbva/bb-cli
6
6
  Keywords: bitbucket,cli,typer,data-center,server
@@ -100,6 +100,7 @@ Show help:
100
100
  ```bash
101
101
  bbdc --help
102
102
  bbdc account --help
103
+ bbdc dashboard --help
103
104
  bbdc pr --help
104
105
  ```
105
106
 
@@ -110,8 +111,11 @@ Get information about your authenticated account:
110
111
  bbdc account me
111
112
 
112
113
  # if some account endpoints are not permitted with your token,
113
- # account me returns partial JSON with "partial" + "errors"
114
- bbdc account me --json
114
+ # account me still returns partial JSON with "partial" + "errors"
115
+ bbdc account me
116
+
117
+ # account me is JSON by default; there is no --json flag
118
+ # (use: bbdc account me)
115
119
 
116
120
  # include user profile and settings when your slug is known
117
121
  bbdc account me --user-slug your.user --include-settings
@@ -124,6 +128,19 @@ bbdc account user --user-slug your.user
124
128
  bbdc account settings --user-slug your.user
125
129
  ```
126
130
 
131
+ Inspect dashboard pull requests:
132
+
133
+ ```bash
134
+ # pull requests where you are involved (author/reviewer/participant)
135
+ bbdc dashboard pull-requests
136
+
137
+ # filter by role/state
138
+ bbdc dashboard pull-requests --role REVIEWER --state OPEN
139
+
140
+ # return JSON
141
+ bbdc dashboard pull-requests --json
142
+ ```
143
+
127
144
  List pull requests:
128
145
 
129
146
  ```bash
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "bbdc-cli"
7
- version = "0.4.2"
7
+ version = "0.5.0"
8
8
  description = "Typer CLI for Bitbucket Data Center"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
File without changes
File without changes