gitraze 0.3.0__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.
Files changed (34) hide show
  1. gitraze-0.5.0/PKG-INFO +176 -0
  2. gitraze-0.5.0/README.md +159 -0
  3. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/__init__.py +5 -1
  4. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/cli.py +10 -5
  5. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/config.py +2 -4
  6. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/core/api_rest.py +6 -0
  7. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/handlers/analyze.py +2 -0
  8. gitraze-0.5.0/gitraze/handlers/repo.py +31 -0
  9. gitraze-0.5.0/gitraze/handlers/search.py +37 -0
  10. gitraze-0.5.0/gitraze/handlers/user.py +25 -0
  11. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/modules/repo.py +14 -3
  12. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/modules/search.py +17 -5
  13. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/modules/user.py +13 -3
  14. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/utils/helpers.py +39 -4
  15. gitraze-0.5.0/gitraze.egg-info/PKG-INFO +176 -0
  16. {gitraze-0.3.0 → gitraze-0.5.0}/pyproject.toml +2 -2
  17. gitraze-0.3.0/PKG-INFO +0 -287
  18. gitraze-0.3.0/README.md +0 -270
  19. gitraze-0.3.0/gitraze/handlers/repo.py +0 -24
  20. gitraze-0.3.0/gitraze/handlers/search.py +0 -31
  21. gitraze-0.3.0/gitraze/handlers/user.py +0 -19
  22. gitraze-0.3.0/gitraze.egg-info/PKG-INFO +0 -287
  23. {gitraze-0.3.0 → gitraze-0.5.0}/LICENSE +0 -0
  24. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/core/__init__.py +0 -0
  25. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/handlers/__init__.py +0 -0
  26. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/modules/__init__.py +0 -0
  27. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/modules/analytics.py +0 -0
  28. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze/utils/__init__.py +0 -0
  29. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze.egg-info/SOURCES.txt +0 -0
  30. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze.egg-info/dependency_links.txt +0 -0
  31. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze.egg-info/entry_points.txt +0 -0
  32. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze.egg-info/requires.txt +0 -0
  33. {gitraze-0.3.0 → gitraze-0.5.0}/gitraze.egg-info/top_level.txt +0 -0
  34. {gitraze-0.3.0 → gitraze-0.5.0}/setup.cfg +0 -0
gitraze-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: gitraze
3
+ Version: 0.5.0
4
+ Summary: A CLI and Python library for GitHub exploration, search, and analysis
5
+ Author: AK Pandey
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/akpandey-dev/gitraze
8
+ Keywords: github,cli,api,recon,search,github-user,repository
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests
15
+ Requires-Dist: colorama
16
+ Dynamic: license-file
17
+
18
+ # Gitraze
19
+
20
+ > A CLI and Python library for GitHub exploration, search, and analysis
21
+
22
+ Gitraze is a CLI and Python library for exploring, analyzing, and extracting insights from GitHub through the REST API, with GraphQL planned.
23
+
24
+ **Status:** Early development — expect bugs, missing features, and rapid changes. APIs and CLI may change without notice.
25
+
26
+ > Built for developers who prefer terminals over tabs.
27
+
28
+ [![PyPI](https://img.shields.io/pypi/v/gitraze)](https://pypi.org/project/gitraze/)
29
+ [![Python Versions](https://img.shields.io/pypi/pyversions/gitraze)](https://pypi.org/project/gitraze/)
30
+ [![Downloads](https://img.shields.io/pypi/dm/gitraze)](https://pypi.org/project/gitraze/)
31
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/akpandey-dev/gitraze/ci.yml?branch=main)](https://github.com/akpandey-dev/gitraze/actions)
32
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
33
+ [![Issues](https://img.shields.io/github/issues/akpandey-dev/gitraze)](https://github.com/akpandey-dev/gitraze/issues)
34
+ [![Stars](https://img.shields.io/github/stars/akpandey-dev/gitraze?style=social)](https://github.com/akpandey-dev/gitraze)
35
+ [![Last Commit](https://img.shields.io/github/last-commit/akpandey-dev/gitraze)](https://github.com/akpandey-dev/gitraze/commits/main)
36
+ [![Contributors](https://img.shields.io/github/contributors/akpandey-dev/gitraze)](https://github.com/akpandey-dev/gitraze/graphs/contributors)
37
+
38
+
39
+ ---
40
+
41
+ ## Why Gitraze?
42
+
43
+ Most GitHub tools are either slow, bloated, or UI-heavy.
44
+
45
+ Gitraze is built around a simpler approach:
46
+
47
+ * Fast, minimal, no nonsense
48
+ * Built for developers who think in terminals
49
+ * Deep GitHub data access through the REST API
50
+ * Modular and extensible architecture
51
+
52
+ ---
53
+
54
+ ## Features
55
+
56
+ * Modular system
57
+ * GitHub REST API integration
58
+ * CLI-first workflow
59
+ * SDK support
60
+ * Repository insights
61
+ * User analysis
62
+ * Search users, repositories, issues, pull requests, and topics
63
+ * Automatic filtering of pull requests and issues
64
+ * Human-readable timestamps
65
+ * Cleaned descriptions
66
+ * Three data formats
67
+ * Save or display output
68
+ * Analytics modules in progress
69
+ * GraphQL planned
70
+
71
+ ---
72
+
73
+ ## Installation
74
+
75
+ ### From PyPI
76
+
77
+ ```bash
78
+ pip install gitraze
79
+ ```
80
+
81
+ ### From source
82
+
83
+ ```bash
84
+ git clone https://github.com/akpandey-dev/gitraze.git
85
+ cd gitraze
86
+ pip install -e .
87
+ ```
88
+
89
+ > There may be some gaps between releases on GitHub and PyPI, as multiple commits are sometimes clustered into a single release on PyPI.
90
+
91
+
92
+ ---
93
+
94
+ ## Usage
95
+
96
+ Gitraze can be used from the command line or as a Python library.
97
+
98
+ ### CLI
99
+
100
+ ```bash
101
+ gitraze --help
102
+ ```
103
+
104
+ Example:
105
+
106
+ ```bash
107
+ gitraze --version
108
+ gitraze --help
109
+ gitraze user octocat --data-format=raw --output-action=save
110
+ gitraze repo torvalds/linux --data-format=full # Query format must match
111
+ gitraze search repos "machine learning" -n 5 --data-format=compact
112
+ gitraze analyze <target> # Coming soon!
113
+ ```
114
+
115
+ ### Python
116
+
117
+ ```python
118
+ import gitraze as gz
119
+ ```
120
+
121
+ For example:
122
+ ```python
123
+ import gitraze as gz
124
+ user = gz.user("octocat", data_format="compact")
125
+ print(user["name"])
126
+ print(user["followers"])
127
+ ```
128
+
129
+ For command usage, API reference, output formats, and examples, see the **[documentation](docs/)**.
130
+
131
+ ---
132
+
133
+ ## Philosophy
134
+
135
+ Gitraze is built for speed, clarity, and control.
136
+
137
+ No clutter, no distractions — just raw access to GitHub data, the way it should be.
138
+
139
+ If you live in the terminal, Gitraze lives with you.
140
+
141
+ ---
142
+
143
+ ## Project Status
144
+
145
+ Gitraze is in active development:
146
+
147
+ * Expect breaking changes
148
+ * Some commands may not work
149
+ * Features are being added rapidly
150
+ * GraphQL is not implemented yet; Gitraze is REST-focused for now
151
+
152
+ If you're here early — you're basically a beta tester.
153
+
154
+ ---
155
+
156
+ ## Contributing
157
+
158
+ PRs, ideas, bug reports, and feature suggestions are welcome.
159
+
160
+ If you want to improve or modify Gitraze, go ahead.
161
+
162
+ * Fork the repository
163
+ * Create a feature branch
164
+ * Submit a PR with clean commit messages
165
+
166
+ ```bash
167
+ git checkout -b feature/cool-thing
168
+ ```
169
+
170
+ Just keep the code clean and the terminal fast.
171
+
172
+ ---
173
+
174
+ ## License
175
+
176
+ MIT License — do whatever you want, just don't blame me if you break stuff.
@@ -0,0 +1,159 @@
1
+ # Gitraze
2
+
3
+ > A CLI and Python library for GitHub exploration, search, and analysis
4
+
5
+ Gitraze is a CLI and Python library for exploring, analyzing, and extracting insights from GitHub through the REST API, with GraphQL planned.
6
+
7
+ **Status:** Early development — expect bugs, missing features, and rapid changes. APIs and CLI may change without notice.
8
+
9
+ > Built for developers who prefer terminals over tabs.
10
+
11
+ [![PyPI](https://img.shields.io/pypi/v/gitraze)](https://pypi.org/project/gitraze/)
12
+ [![Python Versions](https://img.shields.io/pypi/pyversions/gitraze)](https://pypi.org/project/gitraze/)
13
+ [![Downloads](https://img.shields.io/pypi/dm/gitraze)](https://pypi.org/project/gitraze/)
14
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/akpandey-dev/gitraze/ci.yml?branch=main)](https://github.com/akpandey-dev/gitraze/actions)
15
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
16
+ [![Issues](https://img.shields.io/github/issues/akpandey-dev/gitraze)](https://github.com/akpandey-dev/gitraze/issues)
17
+ [![Stars](https://img.shields.io/github/stars/akpandey-dev/gitraze?style=social)](https://github.com/akpandey-dev/gitraze)
18
+ [![Last Commit](https://img.shields.io/github/last-commit/akpandey-dev/gitraze)](https://github.com/akpandey-dev/gitraze/commits/main)
19
+ [![Contributors](https://img.shields.io/github/contributors/akpandey-dev/gitraze)](https://github.com/akpandey-dev/gitraze/graphs/contributors)
20
+
21
+
22
+ ---
23
+
24
+ ## Why Gitraze?
25
+
26
+ Most GitHub tools are either slow, bloated, or UI-heavy.
27
+
28
+ Gitraze is built around a simpler approach:
29
+
30
+ * Fast, minimal, no nonsense
31
+ * Built for developers who think in terminals
32
+ * Deep GitHub data access through the REST API
33
+ * Modular and extensible architecture
34
+
35
+ ---
36
+
37
+ ## Features
38
+
39
+ * Modular system
40
+ * GitHub REST API integration
41
+ * CLI-first workflow
42
+ * SDK support
43
+ * Repository insights
44
+ * User analysis
45
+ * Search users, repositories, issues, pull requests, and topics
46
+ * Automatic filtering of pull requests and issues
47
+ * Human-readable timestamps
48
+ * Cleaned descriptions
49
+ * Three data formats
50
+ * Save or display output
51
+ * Analytics modules in progress
52
+ * GraphQL planned
53
+
54
+ ---
55
+
56
+ ## Installation
57
+
58
+ ### From PyPI
59
+
60
+ ```bash
61
+ pip install gitraze
62
+ ```
63
+
64
+ ### From source
65
+
66
+ ```bash
67
+ git clone https://github.com/akpandey-dev/gitraze.git
68
+ cd gitraze
69
+ pip install -e .
70
+ ```
71
+
72
+ > There may be some gaps between releases on GitHub and PyPI, as multiple commits are sometimes clustered into a single release on PyPI.
73
+
74
+
75
+ ---
76
+
77
+ ## Usage
78
+
79
+ Gitraze can be used from the command line or as a Python library.
80
+
81
+ ### CLI
82
+
83
+ ```bash
84
+ gitraze --help
85
+ ```
86
+
87
+ Example:
88
+
89
+ ```bash
90
+ gitraze --version
91
+ gitraze --help
92
+ gitraze user octocat --data-format=raw --output-action=save
93
+ gitraze repo torvalds/linux --data-format=full # Query format must match
94
+ gitraze search repos "machine learning" -n 5 --data-format=compact
95
+ gitraze analyze <target> # Coming soon!
96
+ ```
97
+
98
+ ### Python
99
+
100
+ ```python
101
+ import gitraze as gz
102
+ ```
103
+
104
+ For example:
105
+ ```python
106
+ import gitraze as gz
107
+ user = gz.user("octocat", data_format="compact")
108
+ print(user["name"])
109
+ print(user["followers"])
110
+ ```
111
+
112
+ For command usage, API reference, output formats, and examples, see the **[documentation](docs/)**.
113
+
114
+ ---
115
+
116
+ ## Philosophy
117
+
118
+ Gitraze is built for speed, clarity, and control.
119
+
120
+ No clutter, no distractions — just raw access to GitHub data, the way it should be.
121
+
122
+ If you live in the terminal, Gitraze lives with you.
123
+
124
+ ---
125
+
126
+ ## Project Status
127
+
128
+ Gitraze is in active development:
129
+
130
+ * Expect breaking changes
131
+ * Some commands may not work
132
+ * Features are being added rapidly
133
+ * GraphQL is not implemented yet; Gitraze is REST-focused for now
134
+
135
+ If you're here early — you're basically a beta tester.
136
+
137
+ ---
138
+
139
+ ## Contributing
140
+
141
+ PRs, ideas, bug reports, and feature suggestions are welcome.
142
+
143
+ If you want to improve or modify Gitraze, go ahead.
144
+
145
+ * Fork the repository
146
+ * Create a feature branch
147
+ * Submit a PR with clean commit messages
148
+
149
+ ```bash
150
+ git checkout -b feature/cool-thing
151
+ ```
152
+
153
+ Just keep the code clean and the terminal fast.
154
+
155
+ ---
156
+
157
+ ## License
158
+
159
+ MIT License — do whatever you want, just don't blame me if you break stuff.
@@ -3,8 +3,10 @@ from .modules.repo import get_repo_rest as repo
3
3
  from .modules.search import get_search_rest as search
4
4
 
5
5
  from .utils.helpers import display
6
+ from .utils.helpers import save
7
+ from .utils.helpers import output_action
6
8
 
7
- __version__ = "0.2.5"
9
+ __version__ = "0.5.0"
8
10
 
9
11
  USERS = "users"
10
12
  REPOS = "repos"
@@ -13,7 +15,9 @@ ISSUES = "issues"
13
15
  TOPICS = "topics"
14
16
 
15
17
  __all__ = [
18
+ "output_action",
16
19
  "display",
20
+ "save",
17
21
  "user",
18
22
  "repo",
19
23
  "search",
@@ -6,16 +6,18 @@ from gitraze.handlers.analyze import handle_analysis
6
6
 
7
7
 
8
8
  def main():
9
+ """Parse CLI arguments and dispatch the selected command."""
10
+
9
11
  parser = argparse.ArgumentParser(
10
12
  prog="gitraze",
11
- description="GitRaze CLI Tool"
13
+ description="Gitraze CLI Tool"
12
14
  )
13
15
 
14
16
  # Global flag
15
17
  parser.add_argument(
16
18
  "--version",
17
19
  action="version",
18
- version="gitraze 0.3.0"
20
+ version="gitraze 0.5.0"
19
21
  )
20
22
 
21
23
  subparsers = parser.add_subparsers(dest="command", required=True)
@@ -23,14 +25,16 @@ def main():
23
25
  # USER
24
26
  user_parser = subparsers.add_parser("user", help="Fetch user info (GitHub username)")
25
27
  user_parser.add_argument("username", help="Format: username")
26
- user_parser.add_argument("--format", choices=["compact", "full", "raw"], default="compact", help="Output format (default: compact)")
28
+ user_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
29
+ user_parser.add_argument("--output-action", choices=["display", "save"], default="display", help="Output action (default: display)")
27
30
  user_parser.set_defaults(func=handle_user)
28
31
 
29
32
 
30
33
  # REPO
31
34
  repo_parser = subparsers.add_parser("repo", help="Fetch repo info (Repository in owner/repo format)")
32
35
  repo_parser.add_argument("repo", help="Format: owner/repo")
33
- repo_parser.add_argument("--format", choices=["compact", "full", "raw"], default="compact", help="Output format (default: compact)")
36
+ repo_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
37
+ repo_parser.add_argument("--output-action", choices=["display", "save"], default="display", help="Output action (default: display)")
34
38
  repo_parser.set_defaults(func=handle_repo)
35
39
 
36
40
 
@@ -39,7 +43,8 @@ def main():
39
43
  search_parser.add_argument("category",choices=["repos", "users", "issues", "prs", "topics"],help="repos | users | issues | prs | topics")
40
44
  search_parser.add_argument("query", nargs="+", help="Search category (repos, users, issues, topics)")
41
45
  search_parser.add_argument("-n", "--limit", type=int, default=1, help="Number of results to show")
42
- search_parser.add_argument("--format", choices=["compact", "full", "raw"], default="compact", help="Output format (default: compact)")
46
+ search_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
47
+ search_parser.add_argument("--output-action", choices=["display", "save"], default="display", help="Output action (default: display)")
43
48
  search_parser.set_defaults(func=handle_search)
44
49
 
45
50
 
@@ -1,15 +1,13 @@
1
- # config.py
2
1
 
3
- '''=============REST=============='''
4
2
 
5
- # --- BASE CONFIGS ---
3
+ # BASE CONFIGS
6
4
  REST_BASE_URL = "https://api.github.com"
7
5
  GRAPHQL_URL = "https://api.github.com/graphql"
8
6
  DEFAULT_TIMEOUT = 10
9
7
  DEFAULT_HEADERS = {
10
8
  "Accept": "application/vnd.github+json"}
11
9
 
12
- # --- SEARCH CATEGORIES CONFIG ---
10
+ # SEARCH CATEGORIES CONFIG
13
11
  SEARCH_MAP = {
14
12
  "repos": "repositories",
15
13
  "users": "users",
@@ -4,6 +4,8 @@ from gitraze.config import REST_BASE_URL, DEFAULT_HEADERS, DEFAULT_TIMEOUT
4
4
  from gitraze.config import SEARCH_MAP
5
5
 
6
6
  def get_user(username):
7
+ """Fetch raw user data from the GitHub REST API."""
8
+
7
9
  url = f"{REST_BASE_URL}/users/{username}"
8
10
 
9
11
  try:
@@ -23,6 +25,8 @@ def get_user(username):
23
25
 
24
26
 
25
27
  def get_repo(owner, repo):
28
+ """Fetch raw repository data from the GitHub REST API."""
29
+
26
30
  url = f"{REST_BASE_URL}/repos/{owner}/{repo}"
27
31
  try:
28
32
  response = requests.get(
@@ -40,6 +44,8 @@ def get_repo(owner, repo):
40
44
  return {"error": f"Request failed: {str(e)}"}
41
45
 
42
46
  def get_search(category, query):
47
+ """Fetch raw search results from the GitHub REST API."""
48
+
43
49
  url = f"{REST_BASE_URL}/search/{SEARCH_MAP.get(category)}"
44
50
 
45
51
  filters = []
@@ -2,6 +2,8 @@ from gitraze.utils.helpers import pretty_print
2
2
 
3
3
 
4
4
  def handle_analysis(args):
5
+ """Placeholder function for handling analysis commands."""
6
+
5
7
  target = " ".join(args.target)
6
8
  print(f"[ANALYZE] Analyzing '{target}'")
7
9
  print("Not implemented yet")
@@ -0,0 +1,31 @@
1
+ import json
2
+ from gitraze.utils.helpers import file_save, pretty_print
3
+ from gitraze.modules.repo import get_repo_rest
4
+
5
+ def handle_repo(args):
6
+ """Handle the repo CLI command."""
7
+
8
+ print("[+] Fetching repository data...")
9
+ parts = args.repo.split("/")
10
+
11
+ if len(parts) != 2:
12
+ print("Invalid format. Use: owner/repo")
13
+ return
14
+ owner, repo = parts
15
+ data = get_repo_rest(owner, repo, data_format=args.data_format)
16
+
17
+ if "error" in data:
18
+ print(data["error"])
19
+ return
20
+
21
+ print("[✓] Done")
22
+
23
+ if args.output_action == "save":
24
+ file_save(data, f"{owner}-{repo}-data.json")
25
+ return
26
+ elif args.output_action == "display":
27
+ if args.data_format == "raw":
28
+ print(json.dumps(data, indent=2))
29
+ return
30
+ else:
31
+ pretty_print(data, title=f"User: {owner}, Repository: {repo}")
@@ -0,0 +1,37 @@
1
+ import json
2
+ from gitraze.utils.helpers import file_save, pretty_print
3
+ from gitraze.modules.search import get_search_rest
4
+
5
+ def handle_search(args):
6
+ """Handle the search CLI command."""
7
+
8
+ category = args.category
9
+
10
+ raw_query = " ".join(args.query)
11
+ clean_query = raw_query.replace('"', '')
12
+ query = f'"{clean_query}"'
13
+
14
+ print(f"[+] Searching {category} for {query}...")
15
+
16
+
17
+ data = get_search_rest(category, query, args.limit, data_format=args.data_format)
18
+
19
+ if "error" in data:
20
+ print(data["error"])
21
+ return
22
+
23
+ print("[✓] Done")
24
+
25
+ if args.output_action == "save":
26
+ file_save(data, f"{category}-{clean_query}-data.json")
27
+ return
28
+ elif args.output_action == "display":
29
+ if args.data_format == "raw":
30
+ print(json.dumps(data, indent=2))
31
+ return
32
+ else:
33
+ if isinstance(data, list):
34
+ for i, item in enumerate(data, 1):
35
+ pretty_print(item, title=f"{category} [{i}] -> {query}")
36
+ else:
37
+ pretty_print(data, title=f"Search: {category} -> {query}")
@@ -0,0 +1,25 @@
1
+ import json
2
+ from gitraze.utils.helpers import file_save, pretty_print
3
+ from gitraze.modules.user import get_user_rest
4
+
5
+ def handle_user(args):
6
+ """Handle the user CLI command."""
7
+
8
+ print("[+] Fetching user data...")
9
+ data = get_user_rest(args.username, data_format=args.data_format)
10
+
11
+ if "error" in data:
12
+ print(data["error"])
13
+ return
14
+
15
+ print("[✓] Done")
16
+
17
+ if args.output_action == "save":
18
+ file_save(data, f"{args.username}-data.json")
19
+ return
20
+ elif args.output_action == "display":
21
+ if args.data_format == "raw":
22
+ print(json.dumps(data, indent=2))
23
+ return
24
+ else:
25
+ pretty_print(data, title=f"User: {args.username}")
@@ -3,15 +3,26 @@ from gitraze.utils.helpers import format_date
3
3
  from gitraze.utils.helpers import normalize_api_data
4
4
  from gitraze.core.api_rest import get_repo as rest_get_repo
5
5
 
6
- def get_repo_rest(owner, repo, output_format="compact"):
6
+ def get_repo_rest(owner, repo, data_format="compact"):
7
+ """Fetch GitHub repository data in the requested data format.
8
+
9
+ Args:
10
+ owner: GitHub repository owner's username or organization name.
11
+ repo: GitHub repository name.
12
+ data_format: Data format: "compact", "full", or "raw".
13
+
14
+ Returns:
15
+ Repository data in the requested format, or an error dictionary.
16
+ """
17
+
7
18
  data = rest_get_repo(owner, repo)
8
19
 
9
20
  if "error" in data:
10
21
  return data
11
22
 
12
- if output_format == "raw":
23
+ if data_format == "raw":
13
24
  return data
14
- if output_format == "full":
25
+ if data_format == "full":
15
26
  return normalize_api_data(data)
16
27
 
17
28
  return {
@@ -5,11 +5,23 @@ from gitraze.utils.helpers import normalize_api_data
5
5
  from gitraze.core.api_rest import get_search
6
6
 
7
7
 
8
- def get_search_rest(category, query, limit=1, output_format="compact"):
8
+ def get_search_rest(category, query, limit=1, data_format="compact"):
9
+ """Search GitHub and return results in the requested data format.
10
+
11
+ Args:
12
+ category: Search category: "repos", "users", "issues", "prs", or "topics".
13
+ query: Search query passed to GitHub.
14
+ limit: Maximum number of results to return.
15
+ data_format: Data format: "compact", "full", or "raw".
16
+
17
+ Returns:
18
+ Search results in the requested format, or an error dictionary.
19
+ """
20
+
9
21
  if category not in ["repos", "users", "issues", "prs", "topics"]:
10
22
  return {"error": "Invalid category"}
11
- if output_format not in ["compact", "full", "raw"]:
12
- return {"error": "Invalid output format"}
23
+ if data_format not in ["compact", "full", "raw"]:
24
+ return {"error": "Invalid data format"}
13
25
 
14
26
  data = get_search(category, query)
15
27
  if "error" in data:
@@ -25,9 +37,9 @@ def get_search_rest(category, query, limit=1, output_format="compact"):
25
37
  return {"error": "No results found"}
26
38
  items = items[:limit]
27
39
 
28
- if output_format == "raw":
40
+ if data_format == "raw":
29
41
  return items
30
- if output_format == "full":
42
+ if data_format == "full":
31
43
  return [normalize_api_data(item) for item in items]
32
44
 
33
45
  results = []
@@ -3,16 +3,26 @@ from gitraze.utils.helpers import format_date
3
3
  from gitraze.utils.helpers import normalize_api_data
4
4
  from gitraze.core.api_rest import get_user as rest_get_user
5
5
 
6
- def get_user_rest(username, output_format="compact"):
6
+ def get_user_rest(username, data_format="compact"):
7
+ """Fetch GitHub user data in the requested data format.
8
+
9
+ Args:
10
+ username: GitHub username to fetch.
11
+ data_format: Data format: "compact", "full", or "raw".
12
+
13
+ Returns:
14
+ User data in the requested format, or an error dictionary.
15
+ """
16
+
7
17
  data = rest_get_user(username)
8
18
 
9
19
  if "error" in data:
10
20
  return data
11
21
 
12
22
 
13
- if output_format == "raw":
23
+ if data_format == "raw":
14
24
  return data
15
- if output_format == "full":
25
+ if data_format == "full":
16
26
  return normalize_api_data(data)
17
27
 
18
28
  return {