-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunify_api.py
More file actions
35 lines (26 loc) · 953 Bytes
/
unify_api.py
File metadata and controls
35 lines (26 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
from bundleup import BundleUp
api_key = os.getenv("BUNDLEUP_API_KEY")
connection_id = os.getenv("BUNDLEUP_CONNECTION_ID")
if not api_key:
raise SystemExit("BUNDLEUP_API_KEY is required")
if not connection_id:
raise SystemExit("BUNDLEUP_CONNECTION_ID is required for unify example")
client = BundleUp(api_key)
unify = client.unify(connection_id)
print("Unify API example")
try:
channels = unify.chat.channels({"limit": 10})
print(f"Chat channels: {len(channels.get('data', []))}")
except Exception as error:
print(f"Failed to fetch chat channels: {error}")
try:
repos = unify.git.repos({"limit": 10})
print(f"Git repos: {len(repos.get('data', []))}")
except Exception as error:
print(f"Failed to fetch git repos: {error}")
try:
issues = unify.pm.issues({"limit": 10})
print(f"PM issues: {len(issues.get('data', []))}")
except Exception as error:
print(f"Failed to fetch PM issues: {error}")