File size: 6,814 Bytes
8b295c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CodeCleano API</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        .endpoint-method {
            font-family: monospace;
            padding: 0.25rem 0.5rem;
            border-radius: 0.25rem;
            font-weight: bold;
        }
        .endpoint-get { background-color: #6EE7B7; color: #065F46; }
        .endpoint-post { background-color: #93C5FD; color: #1E40AF; }
    </style>
</head>
<body class="bg-gray-900 text-gray-100">
    <nav class="bg-gray-800/80 backdrop-blur-md fixed w-full z-50">
        <div class="container mx-auto px-6 py-4">
            <div class="flex justify-between items-center">
                <div class="flex items-center space-x-2">
                    <i data-feather="cpu" class="text-blue-400"></i>
                    <span class="text-xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-400 to-purple-500">CodeCleano API</span>
                </div>
                <div class="flex space-x-6">
                    <a href="index.html" class="hover:text-blue-400 transition">Back to App</a>
                </div>
            </div>
        </div>
    </nav>

    <main class="container mx-auto px-6 pt-24 pb-12">
        <section class="mb-16">
            <h1 class="text-4xl font-bold mb-6">CodeCleano API Documentation</h1>
            <p class="text-xl text-gray-400 max-w-3xl">
                Programmatic access to our code cleaning and refactoring engine. Process individual files or entire repositories.
            </p>
        </section>

        <section class="mb-16">
            <h2 class="text-2xl font-bold mb-6 border-b border-gray-700 pb-2">Authentication</h2>
            <div class="bg-gray-800/70 p-6 rounded-lg mb-6">
                <p class="mb-4">All API requests require an API key sent in the <code class="bg-gray-700 px-2 py-1 rounded">X-API-Key</code> header.</p>
                <div class="code-block p-4 bg-gray-900 rounded">
                    <pre class="text-green-400 overflow-x-auto text-sm">curl -H "X-API-Key: your_api_key_here" https://api.codecleano.ai/v1/clean</pre>
                </div>
            </div>
        </section>

        <section class="mb-16">
            <h2 class="text-2xl font-bold mb-6 border-b border-gray-700 pb-2">Endpoints</h2>

            <!-- Single File Cleaning -->
            <div class="bg-gray-800/70 p-6 rounded-lg mb-8">
                <div class="flex items-center mb-4">
                    <span class="endpoint-method endpoint-post mr-4">POST</span>
                    <span class="font-mono text-lg">/v1/clean</span>
                </div>
                <p class="mb-4">Clean and refactor a single code file.</p>
                
                <h3 class="font-bold mb-2">Request</h3>
                <div class="code-block p-4 bg-gray-900 rounded mb-4">
                    <pre class="text-green-400 overflow-x-auto text-sm">{
  "code": "def messy(x,y):\n    return x+y if x>y else 0",
  "language": "python",
  "options": {
    "rename_vars": true,
    "extract_methods": true,
    "optimize": true
  }
}</pre>
                </div>

                <h3 class="font-bold mb-2">Response</h3>
                <div class="code-block p-4 bg-gray-900 rounded">
                    <pre class="text-green-400 overflow-x-auto text-sm">{
  "cleaned_code": "def calculate_sum(x, y):\n    return x + y if x > y else 0",
  "changes_made": 2,
  "execution_time": "0.45s"
}</pre>
                </div>
            </div>

            <!-- Repository Cleaning -->
            <div class="bg-gray-800/70 p-6 rounded-lg">
                <div class="flex items-center mb-4">
                    <span class="endpoint-method endpoint-post mr-4">POST</span>
                    <span class="font-mono text-lg">/v1/clean-repo</span>
                </div>
                <p class="mb-4">Process an entire repository from GitHub, GitLab, or Bitbucket.</p>
                
                <h3 class="font-bold mb-2">Request</h3>
                <div class="code-block p-4 bg-gray-900 rounded mb-4">
                    <pre class="text-green-400 overflow-x-auto text-sm">{
  "repo_url": "https://github.com/user/repo",
  "language": "javascript",
  "branch": "main",
  "options": {
    "max_file_size": 10000,
    "ignore_tests": true
  }
}</pre>
                </div>

                <h3 class="font-bold mb-2">Response</h3>
                <div class="code-block p-4 bg-gray-900 rounded">
                    <pre class="text-green-400 overflow-x-auto text-sm">{
  "repo_name": "user/repo",
  "files_processed": 42,
  "issues_found": 127,
  "download_url": "https://storage.codecleano.ai/clean-repos/abc123.zip",
  "summary": "Found 15 variables to rename\nExtracted 8 methods\nFixed 32 style violations...",
  "execution_time": "2m 15s"
}</pre>
                </div>
            </div>
        </section>

        <section>
            <h2 class="text-2xl font-bold mb-6 border-b border-gray-700 pb-2">Rate Limits</h2>
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-gray-800/70 p-6 rounded-lg">
                    <h3 class="font-bold mb-2 text-blue-400">Free Tier</h3>
                    <ul class="text-gray-300 space-y-2">
                        <li>20 requests/hour</li>
                        <li>Max file size: 50KB</li>
                        <li>Basic refactoring</li>
                    </ul>
                </div>
                <div class="bg-gray-800/70 p-6 rounded-lg">
                    <h3 class="font-bold mb-2 text-purple-400">Pro Tier</h3>
                    <ul class="text-gray-300 space-y-2">
                        <li>100 requests/hour</li>
                        <li>Max file size: 500KB</li>
                        <li>Advanced optimizations</li>
                    </ul>
                </div>
                <div class="bg-gray-800/70 p-6 rounded-lg">
                    <h3 class="font-bold mb-2 text-green-400">Enterprise</h3>
                    <ul class="text-gray-300 space-y-2">
                        <li>Unlimited requests</li>
                        <li>No size limits</li>
                        <li>Custom models</li>
                    </ul>
                </div>
            </div>
        </section>
    </main>

    <footer class="bg-gray-900/80 py-8 border-t border-gray-800">
        <div class="container mx-auto px-6 text-center">
            <p class="text-gray-500">© 2023 CodeCleano API. All rights reserved.</p>
        </div>
    </footer>

    <script>
        feather.replace();
    </script>
</body>
</html>