Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Web_Socket_Support #555

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5995eef
stashing
Clasherzz Dec 24, 2024
2cf3a2d
Merge branch 'main' of https://github.com/Clasherzz/apidash
Clasherzz Dec 24, 2024
1b6df9c
Merge branch 'foss42:main' into main
Clasherzz Dec 27, 2024
ede3c40
Merge branch 'foss42:main' into main
Clasherzz Dec 30, 2024
a56e420
Merge branch 'foss42:main' into main
Clasherzz Jan 12, 2025
d9616af
Merge branch 'foss42:main' into main
Clasherzz Jan 15, 2025
55428f4
added model and service files
Clasherzz Jan 16, 2025
261af51
working on models
Clasherzz Jan 16, 2025
c93ccc8
working on models
Clasherzz Jan 16, 2025
fd0e7b6
working on clientWrapper
Clasherzz Jan 16, 2025
77fc705
some ui changes
Clasherzz Jan 17, 2025
248010f
working on sending frames
Clasherzz Jan 23, 2025
7331771
added ping and websocket manager
Clasherzz Jan 26, 2025
5b37792
removed client wrapper
Clasherzz Jan 26, 2025
93668e8
SETTING HEADERS AND PARAMS
Clasherzz Jan 26, 2025
d29c51f
working on HEADERS AND PARAMS
Clasherzz Jan 27, 2025
27dfca3
Merge branch 'foss42:main' into web_socket
Clasherzz Jan 27, 2025
f1521d6
working on HEADERS AND PARAMS
Clasherzz Jan 27, 2025
2c926ee
fixed headers and params
Clasherzz Jan 28, 2025
2850897
added isConnect
Clasherzz Jan 30, 2025
ab20f25
removed print and make time accurate
Clasherzz Jan 30, 2025
8d64ecf
referred dart analyze and some edits
Clasherzz Jan 31, 2025
3ef1fe3
disable headers for web
Clasherzz Feb 1, 2025
5d171bc
request pane corrected
Clasherzz Feb 1, 2025
783821b
final commit
Clasherzz Feb 1, 2025
5cc9ec4
Merge branch 'client_termination' of https://github.com/Clasherzz/api…
Clasherzz Feb 8, 2025
46d3522
resolved scrolling issue
Clasherzz Feb 17, 2025
add28b4
Merge branch 'main' into web_socket
ashitaprasad Feb 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,19 @@ const kResponseCodeReasons = {
508: 'Loop Detected',
510: 'Not Extended',
511: 'Network Authentication Required',
// 1000s - WebSocket Error
1000: 'Normal Closure',
1001: 'Going Away',
1002: 'Protocol Error',
1003: 'Unsupported Data',
1005: 'No Status Received',
1006: 'Abnormal Closure',
1007: 'Invalid Frame Payload Data',
1008: 'Policy Violation',
1009: 'Message Too Big',
1010: 'Missing Mandatory Extension',
1011: 'Internal Server Error (WebSocket)',
1015: 'TLS Handshake Failed',
};

Map<String, String> kHttpHeadersMap = {
Expand Down Expand Up @@ -433,6 +446,8 @@ const kLabelContinue = "Continue";
const kLabelCancel = "Cancel";
const kLabelOk = "Ok";
const kUntitled = "untitled";
const kLabelConnect = "Connect";
const kLabelDisconnect = "Disconnect";
// Request Pane
const kLabelRequest = "Request";
const kLabelHideCode = "Hide Code";
Expand All @@ -441,6 +456,7 @@ const kLabelURLParams = "URL Params";
const kLabelHeaders = "Headers";
const kLabelBody = "Body";
const kLabelQuery = "Query";
const kLabelMessage = "Message";
const kNameCheckbox = "Checkbox";
const kNameURLParam = "URL Parameter";
const kNameHeader = "Header Name";
Expand All @@ -459,6 +475,7 @@ const kHintContent = "Enter content";
const kHintText = "Enter text";
const kHintJson = "Enter JSON";
const kHintQuery = "Enter Query";
const kHintMessage = "Enter message";
// Response Pane
const kLabelNotSent = "Not Sent";
const kLabelResponse = "Response";
Expand Down
1 change: 1 addition & 0 deletions lib/models/history_meta_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/models/history_request_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class HistoryRequestModel with _$HistoryRequestModel {
required HistoryMetaModel metaData,
required HttpRequestModel httpRequestModel,
required HttpResponseModel httpResponseModel,
required WebSocketRequestModel webSocketRequestModel,
required WebSocketResponseModel webSocketResponseModel,

}) = _HistoryRequestModel;

factory HistoryRequestModel.fromJson(Map<String, Object?> json) =>
Expand Down
92 changes: 85 additions & 7 deletions lib/models/history_request_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ mixin _$HistoryRequestModel {
HistoryMetaModel get metaData => throw _privateConstructorUsedError;
HttpRequestModel get httpRequestModel => throw _privateConstructorUsedError;
HttpResponseModel get httpResponseModel => throw _privateConstructorUsedError;
WebSocketRequestModel get webSocketRequestModel =>
throw _privateConstructorUsedError;
WebSocketResponseModel get webSocketResponseModel =>
throw _privateConstructorUsedError;

/// Serializes this HistoryRequestModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
Expand All @@ -45,11 +49,15 @@ abstract class $HistoryRequestModelCopyWith<$Res> {
{String historyId,
HistoryMetaModel metaData,
HttpRequestModel httpRequestModel,
HttpResponseModel httpResponseModel});
HttpResponseModel httpResponseModel,
WebSocketRequestModel webSocketRequestModel,
WebSocketResponseModel webSocketResponseModel});

$HistoryMetaModelCopyWith<$Res> get metaData;
$HttpRequestModelCopyWith<$Res> get httpRequestModel;
$HttpResponseModelCopyWith<$Res> get httpResponseModel;
$WebSocketRequestModelCopyWith<$Res> get webSocketRequestModel;
$WebSocketResponseModelCopyWith<$Res> get webSocketResponseModel;
}

/// @nodoc
Expand All @@ -71,6 +79,8 @@ class _$HistoryRequestModelCopyWithImpl<$Res, $Val extends HistoryRequestModel>
Object? metaData = null,
Object? httpRequestModel = null,
Object? httpResponseModel = null,
Object? webSocketRequestModel = null,
Object? webSocketResponseModel = null,
}) {
return _then(_value.copyWith(
historyId: null == historyId
Expand All @@ -89,6 +99,14 @@ class _$HistoryRequestModelCopyWithImpl<$Res, $Val extends HistoryRequestModel>
? _value.httpResponseModel
: httpResponseModel // ignore: cast_nullable_to_non_nullable
as HttpResponseModel,
webSocketRequestModel: null == webSocketRequestModel
? _value.webSocketRequestModel
: webSocketRequestModel // ignore: cast_nullable_to_non_nullable
as WebSocketRequestModel,
webSocketResponseModel: null == webSocketResponseModel
? _value.webSocketResponseModel
: webSocketResponseModel // ignore: cast_nullable_to_non_nullable
as WebSocketResponseModel,
) as $Val);
}

Expand Down Expand Up @@ -121,6 +139,28 @@ class _$HistoryRequestModelCopyWithImpl<$Res, $Val extends HistoryRequestModel>
return _then(_value.copyWith(httpResponseModel: value) as $Val);
});
}

/// Create a copy of HistoryRequestModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$WebSocketRequestModelCopyWith<$Res> get webSocketRequestModel {
return $WebSocketRequestModelCopyWith<$Res>(_value.webSocketRequestModel,
(value) {
return _then(_value.copyWith(webSocketRequestModel: value) as $Val);
});
}

/// Create a copy of HistoryRequestModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$WebSocketResponseModelCopyWith<$Res> get webSocketResponseModel {
return $WebSocketResponseModelCopyWith<$Res>(_value.webSocketResponseModel,
(value) {
return _then(_value.copyWith(webSocketResponseModel: value) as $Val);
});
}
}

/// @nodoc
Expand All @@ -135,14 +175,20 @@ abstract class _$$HistoryRequestModelImplCopyWith<$Res>
{String historyId,
HistoryMetaModel metaData,
HttpRequestModel httpRequestModel,
HttpResponseModel httpResponseModel});
HttpResponseModel httpResponseModel,
WebSocketRequestModel webSocketRequestModel,
WebSocketResponseModel webSocketResponseModel});

@override
$HistoryMetaModelCopyWith<$Res> get metaData;
@override
$HttpRequestModelCopyWith<$Res> get httpRequestModel;
@override
$HttpResponseModelCopyWith<$Res> get httpResponseModel;
@override
$WebSocketRequestModelCopyWith<$Res> get webSocketRequestModel;
@override
$WebSocketResponseModelCopyWith<$Res> get webSocketResponseModel;
}

/// @nodoc
Expand All @@ -162,6 +208,8 @@ class __$$HistoryRequestModelImplCopyWithImpl<$Res>
Object? metaData = null,
Object? httpRequestModel = null,
Object? httpResponseModel = null,
Object? webSocketRequestModel = null,
Object? webSocketResponseModel = null,
}) {
return _then(_$HistoryRequestModelImpl(
historyId: null == historyId
Expand All @@ -180,6 +228,14 @@ class __$$HistoryRequestModelImplCopyWithImpl<$Res>
? _value.httpResponseModel
: httpResponseModel // ignore: cast_nullable_to_non_nullable
as HttpResponseModel,
webSocketRequestModel: null == webSocketRequestModel
? _value.webSocketRequestModel
: webSocketRequestModel // ignore: cast_nullable_to_non_nullable
as WebSocketRequestModel,
webSocketResponseModel: null == webSocketResponseModel
? _value.webSocketResponseModel
: webSocketResponseModel // ignore: cast_nullable_to_non_nullable
as WebSocketResponseModel,
));
}
}
Expand All @@ -192,7 +248,9 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
{required this.historyId,
required this.metaData,
required this.httpRequestModel,
required this.httpResponseModel});
required this.httpResponseModel,
required this.webSocketRequestModel,
required this.webSocketResponseModel});

factory _$HistoryRequestModelImpl.fromJson(Map<String, dynamic> json) =>
_$$HistoryRequestModelImplFromJson(json);
Expand All @@ -205,10 +263,14 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
final HttpRequestModel httpRequestModel;
@override
final HttpResponseModel httpResponseModel;
@override
final WebSocketRequestModel webSocketRequestModel;
@override
final WebSocketResponseModel webSocketResponseModel;

@override
String toString() {
return 'HistoryRequestModel(historyId: $historyId, metaData: $metaData, httpRequestModel: $httpRequestModel, httpResponseModel: $httpResponseModel)';
return 'HistoryRequestModel(historyId: $historyId, metaData: $metaData, httpRequestModel: $httpRequestModel, httpResponseModel: $httpResponseModel, webSocketRequestModel: $webSocketRequestModel, webSocketResponseModel: $webSocketResponseModel)';
}

@override
Expand All @@ -223,13 +285,23 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
(identical(other.httpRequestModel, httpRequestModel) ||
other.httpRequestModel == httpRequestModel) &&
(identical(other.httpResponseModel, httpResponseModel) ||
other.httpResponseModel == httpResponseModel));
other.httpResponseModel == httpResponseModel) &&
(identical(other.webSocketRequestModel, webSocketRequestModel) ||
other.webSocketRequestModel == webSocketRequestModel) &&
(identical(other.webSocketResponseModel, webSocketResponseModel) ||
other.webSocketResponseModel == webSocketResponseModel));
}

@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, historyId, metaData, httpRequestModel, httpResponseModel);
runtimeType,
historyId,
metaData,
httpRequestModel,
httpResponseModel,
webSocketRequestModel,
webSocketResponseModel);

/// Create a copy of HistoryRequestModel
/// with the given fields replaced by the non-null parameter values.
Expand All @@ -253,7 +325,9 @@ abstract class _HistoryRequestModel implements HistoryRequestModel {
{required final String historyId,
required final HistoryMetaModel metaData,
required final HttpRequestModel httpRequestModel,
required final HttpResponseModel httpResponseModel}) =
required final HttpResponseModel httpResponseModel,
required final WebSocketRequestModel webSocketRequestModel,
required final WebSocketResponseModel webSocketResponseModel}) =
_$HistoryRequestModelImpl;

factory _HistoryRequestModel.fromJson(Map<String, dynamic> json) =
Expand All @@ -267,6 +341,10 @@ abstract class _HistoryRequestModel implements HistoryRequestModel {
HttpRequestModel get httpRequestModel;
@override
HttpResponseModel get httpResponseModel;
@override
WebSocketRequestModel get webSocketRequestModel;
@override
WebSocketResponseModel get webSocketResponseModel;

/// Create a copy of HistoryRequestModel
/// with the given fields replaced by the non-null parameter values.
Expand Down
6 changes: 6 additions & 0 deletions lib/models/history_request_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/models/request_model.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:apidash_core/apidash_core.dart';

part 'request_model.freezed.dart';

part 'request_model.g.dart';

@freezed
Expand All @@ -17,9 +15,11 @@ class RequestModel with _$RequestModel {
@Default("") String description,
@JsonKey(includeToJson: false) @Default(0) requestTabIndex,
HttpRequestModel? httpRequestModel,
WebSocketRequestModel? webSocketRequestModel,
int? responseStatus,
String? message,
HttpResponseModel? httpResponseModel,
WebSocketResponseModel? webSocketResponseModel,
@JsonKey(includeToJson: false) @Default(false) bool isWorking,
@JsonKey(includeToJson: false) DateTime? sendingTime,
}) = _RequestModel;
Expand Down
Loading