Skip to content

Commit

Permalink
feat: Add client access via ParseDioClient.client and `ParseHTTPCli…
Browse files Browse the repository at this point in the history
…ent.client` (#1025)
  • Loading branch information
mbfakourii authored Dec 18, 2024
1 parent a3449f4 commit af14388
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/dart/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [8.1.0](https://github.com/parse-community/Parse-SDK-Flutter/compare/flutter-8.0.0...flutter-8.1.0) (2024-12-18)

### Features

* Add client access via `ParseDioClient.dioClient` and `ParseHTTPClient.httpClient` ([#1025](https://github.com/parse-community/Parse-SDK-Flutter/pull/1025))

## [8.0.0](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-7.0.1...dart-8.0.0) (2024-10-17)

### BREAKING CHANGES
Expand Down
2 changes: 1 addition & 1 deletion packages/dart/lib/src/base/parse_constants.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
part of '../../parse_server_sdk.dart';

// Library
const String keySdkVersion = '8.0.0';
const String keySdkVersion = '8.1.0';
const String keyLibraryName = 'Flutter Parse SDK';

// End Points
Expand Down
2 changes: 2 additions & 0 deletions packages/dart/lib/src/network/parse_dio_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class ParseDioClient extends ParseClient {

late _ParseDioClient _client;

dio.Dio get client => _client;

@override
Future<ParseNetworkResponse> get(
String path, {
Expand Down
2 changes: 2 additions & 0 deletions packages/dart/lib/src/network/parse_http_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ParseHTTPClient extends ParseClient {

late _ParseHTTPClient _client;

http.BaseClient get client => _client;

Map<String, String>? get additionalHeaders => _client.additionalHeaders;

set additionalHeaders(Map<String, String>? additionalHeaders) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: parse_server_sdk
description: The Dart SDK to connect to Parse Server. Build your apps faster with Parse Platform, the complete application stack.
version: 8.0.0
version: 8.1.0
homepage: https://parseplatform.org
repository: https://github.com/parse-community/Parse-SDK-Flutter
issue_tracker: https://github.com/parse-community/Parse-SDK-Flutter/issues
Expand Down
28 changes: 28 additions & 0 deletions packages/dart/test/src/network/parse_dio_client_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:dio/dio.dart';
import 'package:parse_server_sdk/parse_server_sdk.dart';
import 'package:test/test.dart';

import '../../test_utils.dart';

void main() {
setUpAll(() async {
await initializeParse();
});

group('ParseDioClient Tests', () {
late ParseDioClient parseDioClient;

setUp(() async {
parseDioClient = ParseDioClient();
});

test('should return an instance of Dio from dioClient', () {
// arrange
final dioClient = parseDioClient.client;

// assert
expect(dioClient, isNotNull);
expect(dioClient, isA<Dio>());
});
});
}
28 changes: 28 additions & 0 deletions packages/dart/test/src/network/parse_http_client_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:http/http.dart' as http;
import 'package:parse_server_sdk/parse_server_sdk.dart';
import 'package:test/test.dart';

import '../../test_utils.dart';

void main() {
setUpAll(() async {
await initializeParse();
});

group('ParseDioClient Tests', () {
late ParseHTTPClient parseHTTPClient;

setUp(() async {
parseHTTPClient = ParseHTTPClient();
});

test('should return an instance of Dio from dioClient', () {
// arrange
final dioClient = parseHTTPClient.client;

// assert
expect(dioClient, isNotNull);
expect(dioClient, isA<http.BaseClient>());
});
});
}

0 comments on commit af14388

Please sign in to comment.