eli02 commited on
Commit
628d3f6
·
1 Parent(s): f0a8151

Add logout endpoint documentation and update navigation

Browse files
Files changed (2) hide show
  1. static/index.html +33 -0
  2. static/script.js +1 -0
static/index.html CHANGED
@@ -283,6 +283,39 @@ Future<void> saveData(List<SaveInput> items, String accessToken) async {
283
  <h4>Response:</h4>
284
  <pre><code class="language-json">{
285
  "message": "Data saved successfully"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  }</code></pre>
287
  </div>
288
  </section>
 
283
  <h4>Response:</h4>
284
  <pre><code class="language-json">{
285
  "message": "Data saved successfully"
286
+ }</code></pre>
287
+ </div>
288
+ <div class="endpoint" id="logout">
289
+ <h3>5. Log-out Endpoint</h3>
290
+ <p><span class="method">POST</span><span class="endpoint-url">/logout</span></p>
291
+ <p>This endpoint is used to revoke the access token after the event of logout click.</p>
292
+
293
+ <h4>cURL Reqeust:</h4>
294
+ <pre><code class="language-bash">curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/logout \
295
+ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"</code></pre>
296
+ <h4>Flutter Implementation:</h4>
297
+ <pre><code class="language-dart">Future<void> logout(String accessToken) async {
298
+ final url = Uri.parse('https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/logout');
299
+
300
+ try {
301
+ final response = await http.post(
302
+ url,
303
+ headers: {
304
+ 'Authorization
305
+ ': 'Bearer $accessToken',
306
+ },
307
+ );
308
+
309
+ if (response.statusCode != 200) {
310
+ throw Exception('Failed to logout: ${response.body}');
311
+ }
312
+ } catch (e) {
313
+ throw Exception('Network error: $e');
314
+ }
315
+ }</code></pre>
316
+ <h4>Response:</h4>
317
+ <pre><code class="language-json">{
318
+ "message": "Logout successful"
319
  }</code></pre>
320
  </div>
321
  </section>
static/script.js CHANGED
@@ -5,6 +5,7 @@ const sections = [
5
  { id: 'refresh', title: 'Refresh Token' },
6
  { id: 'search', title: 'Search' },
7
  { id: 'save', title: 'Save'},
 
8
  { id: 'workflow', title: 'Workflow Example' }
9
  ];
10
 
 
5
  { id: 'refresh', title: 'Refresh Token' },
6
  { id: 'search', title: 'Search' },
7
  { id: 'save', title: 'Save'},
8
+ { id: 'logout', title: 'Logout' },
9
  { id: 'workflow', title: 'Workflow Example' }
10
  ];
11