Skip to content

Commit 6e3db63

Browse files
authored
Merge branch 'main' into resolve-issue-166
2 parents 65268fe + dc7e648 commit 6e3db63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+5733
-197
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ API Dash can be downloaded from the links below:
105105
| Insomnia ||
106106
| OpenAPI | https://github.com/foss42/apidash/issues/121 |
107107
| hurl | https://github.com/foss42/apidash/issues/123 |
108-
| HAR | https://github.com/foss42/apidash/issues/122 |
108+
| HAR | |
109109

110110

111111
**↗️ Create & Customize API Requests**

SECURITY.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Security Policy
2+
3+
This document describes the management of vulnerabilities for API Dash project & the Dart/Flutter packages in the repository.
4+
5+
## Preferred Languages
6+
7+
We prefer all communications to be in English.
8+
9+
## Reporting a Vulnerability
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
Individuals who find potential vulnerabilities in API Dash and Dart/Flutter packages in the API Dash repository are invited to [open a draft security advisory](https://github.com/foss42/apidash/security/advisories/new) for discussion and collaboration on the fix.
14+
15+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
16+
- Type of issue (e.g. buffer overflow, poisoned dependency, cross-site scripting, etc.)
17+
- Full paths of source file(s) related to the manifestation of the issue
18+
- The location of the affected source code (tag/branch/commit or direct URL)
19+
- Any special configuration required to reproduce the issue
20+
- Step-by-step instructions to reproduce the issue
21+
- Proof-of-concept or exploit code (if possible)
22+
- Impact of the issue, including how an attacker might exploit the issue
23+
24+
This information will help us triage your report more quickly.
25+
26+
Our team will positivey respond to any reported vulnerability and take swift action to resolve it.

doc/gsoc/2025/manas_hejmadi.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

doc/gsoc/2025/udhay_adithya_j.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

lib/consts.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ enum CodegenLanguage {
144144
enum ImportFormat {
145145
curl("cURL"),
146146
postman("Postman Collection v2.1"),
147-
insomnia("Insomnia v4");
147+
insomnia("Insomnia v4"),
148+
har("Har v1.2");
148149

149150
const ImportFormat(this.label);
150151
final String label;

lib/dashbot/consts.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const kModel = 'llama3.2:3b';
2+
const kOllamaEndpoint = 'http://127.0.0.1:11434/api';

lib/dashbot/features/debug.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'dart:convert';
2-
import '../services/dashbot_service.dart';
3-
import 'package:apidash/models/request_model.dart';
2+
import '../services/services.dart';
3+
import '../../models/models.dart';
44

55
class DebugFeature {
66
final DashBotService _service;
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import 'dart:convert';
2+
import '../services/services.dart';
3+
import '../../models/models.dart';
4+
5+
class DocumentationFeature {
6+
final DashBotService _service;
7+
8+
DocumentationFeature(this._service);
9+
10+
Future<String> generateApiDocumentation({
11+
required RequestModel? requestModel,
12+
required dynamic responseModel,
13+
}) async {
14+
if (requestModel == null || responseModel == null) {
15+
return "No recent API requests found.";
16+
}
17+
18+
final method = requestModel.httpRequestModel?.method
19+
.toString()
20+
.split('.')
21+
.last
22+
.toUpperCase() ??
23+
"GET";
24+
final endpoint = requestModel.httpRequestModel?.url ?? "Unknown Endpoint";
25+
final headers = requestModel.httpRequestModel?.enabledHeadersMap ?? {};
26+
final parameters = requestModel.httpRequestModel?.enabledParamsMap ?? {};
27+
final body = requestModel.httpRequestModel?.body;
28+
final rawResponse = responseModel.body;
29+
final responseBody =
30+
rawResponse is String ? rawResponse : jsonEncode(rawResponse);
31+
final statusCode = responseModel.statusCode ?? 0;
32+
33+
final prompt = """
34+
API DOCUMENTATION GENERATION
35+
36+
**API Details:**
37+
- Endpoint: $endpoint
38+
- Method: $method
39+
- Status Code: $statusCode
40+
41+
**Request Components:**
42+
- Headers: ${headers.isNotEmpty ? jsonEncode(headers) : "None"}
43+
- Query Parameters: ${parameters.isNotEmpty ? jsonEncode(parameters) : "None"}
44+
- Request Body: ${body != null && body.isNotEmpty ? body : "None"}
45+
46+
**Response Example:**
47+
```
48+
$responseBody
49+
```
50+
51+
**Documentation Instructions:**
52+
Create comprehensive API documentation that includes:
53+
54+
1. **Overview**: A clear, concise description of what this API endpoint does
55+
2. **Authentication**: Required authentication method based on headers
56+
3. **Request Details**: All required and optional parameters with descriptions
57+
4. **Response Structure**: Breakdown of response fields and their meanings
58+
5. **Error Handling**: Possible error codes and troubleshooting
59+
6. **Example Usage**: A complete code example showing how to call this API
60+
61+
Format in clean markdown with proper sections and code blocks where appropriate.
62+
""";
63+
64+
return _service.generateResponse(prompt);
65+
}
66+
}

lib/dashbot/features/explain.dart

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import 'dart:convert';
2-
import '../services/dashbot_service.dart';
3-
import 'package:apidash/models/request_model.dart';
1+
import '../services/services.dart';
2+
import '../../models/models.dart';
43

54
class ExplainFeature {
65
final DashBotService _service;
@@ -19,20 +18,14 @@ class ExplainFeature {
1918
return "Error: Invalid API request (missing endpoint).";
2019
}
2120

22-
final method = requestModel.httpRequestModel?.method
23-
.toString()
24-
.split('.')
25-
.last
26-
.toUpperCase() ??
27-
"GET";
28-
final endpoint = requestModel.httpRequestModel!.url;
21+
final method =
22+
requestModel.httpRequestModel?.method.name.toUpperCase() ?? "GET";
23+
final url = requestModel.httpRequestModel!.url;
2924
final headers = requestModel.httpRequestModel?.enabledHeadersMap ?? {};
3025
final parameters = requestModel.httpRequestModel?.enabledParamsMap ?? {};
31-
final body = requestModel.httpRequestModel?.body;
32-
final rawResponse = responseModel.body;
33-
final responseBody =
34-
rawResponse is String ? rawResponse : jsonEncode(rawResponse);
35-
final statusCode = responseModel.statusCode ?? 0;
26+
final body = requestModel.httpRequestModel?.body ?? '';
27+
final responseBody = responseModel.body;
28+
final statusCode = responseModel.statusCode;
3629

3730
final prompt = '''
3831
FOCUSED API INTERACTION BREAKDOWN
@@ -41,10 +34,16 @@ FOCUSED API INTERACTION BREAKDOWN
4134
- Endpoint Purpose: What is this API endpoint designed to do?
4235
- Interaction Type: Describe the core purpose of this specific request
4336
44-
**Request Mechanics:**
45-
- Exact Endpoint: $endpoint
37+
**Request Details:**
38+
- Endpoint: $url
4639
- HTTP Method: $method
47-
- Key Parameters: ${parameters.isNotEmpty ? 'Specific inputs driving the request' : 'No custom parameters'}
40+
- Request Headers: ${headers.isEmpty ? "None" : headers}
41+
- URL Parameters: ${parameters.isEmpty ? "None" : parameters}
42+
- Request Body: ${body.isEmpty ? "None" : body}
43+
44+
**Response Details**
45+
- Status Code: $statusCode
46+
- Content: $responseBody
4847
4948
**Response CORE Insights:**
5049
- Status: Success or Failure?

lib/dashbot/features/features.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export 'debug.dart';
2+
export 'documentation.dart';
3+
export 'explain.dart';
4+
export 'general_query.dart';
5+
export 'test_generator.dart';

0 commit comments

Comments
 (0)