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

📦 directly export qs.ListFormat instead of internal wrapper #624

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion chopper/lib/chopper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/// [Getting Started](https://hadrien-lejard.gitbook.io/chopper)
library chopper;

export 'package:qs_dart/qs_dart.dart' show ListFormat;
export 'src/annotations.dart';
export 'src/authenticator.dart';
export 'src/base.dart';
Expand All @@ -14,7 +15,6 @@ export 'src/extensions.dart';
export 'src/chain/chain.dart';
export 'src/interceptors/interceptor.dart';
export 'src/converters.dart';
export 'src/list_format.dart';
export 'src/request.dart';
export 'src/response.dart';
export 'src/utils.dart' hide mapToQuery;
2 changes: 1 addition & 1 deletion chopper/lib/src/annotations.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'dart:async';

import 'package:chopper/src/constants.dart';
import 'package:chopper/src/list_format.dart';
import 'package:chopper/src/request.dart';
import 'package:chopper/src/response.dart';
import 'package:meta/meta.dart';
import 'package:meta/meta_meta.dart';
import 'package:qs_dart/qs_dart.dart' show ListFormat;

/// {@template ChopperApi}
/// Defines a Chopper API.
Expand Down
29 changes: 0 additions & 29 deletions chopper/lib/src/list_format.dart

This file was deleted.

2 changes: 1 addition & 1 deletion chopper/lib/src/request.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'dart:async' show Stream;

import 'package:chopper/src/extensions.dart';
import 'package:chopper/src/list_format.dart';
import 'package:chopper/src/utils.dart';
import 'package:equatable/equatable.dart' show EquatableMixin;
import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'package:qs_dart/qs_dart.dart' show ListFormat;

/// {@template request}
/// This class represents an HTTP request that can be made with Chopper.
Expand Down
10 changes: 5 additions & 5 deletions chopper/lib/src/utils.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:collection';

import 'package:chopper/chopper.dart';
import 'package:chopper/src/request.dart';
import 'package:logging/logging.dart';
import 'package:qs_dart/qs_dart.dart' as qs;
import 'package:qs_dart/qs_dart.dart' show encode, EncodeOptions, ListFormat;

/// Creates a new [Request] by copying [request] and adding a header with the
/// provided key [name] and value [value] to the result.
Expand Down Expand Up @@ -69,10 +69,10 @@ String mapToQuery(
}) {
listFormat ??= useBrackets == true ? ListFormat.brackets : ListFormat.repeat;

return qs.encode(
return encode(
map,
qs.EncodeOptions(
listFormat: listFormat.qsListFormat,
EncodeOptions(
listFormat: listFormat,
allowDots: listFormat == ListFormat.repeat,
encodeDotInKeys: listFormat == ListFormat.repeat,
encodeValuesOnly: listFormat == ListFormat.repeat,
Expand Down
2 changes: 1 addition & 1 deletion chopper/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
http: ^1.1.0
logging: ^1.2.0
meta: ^1.9.1
qs_dart: ^1.1.0
qs_dart: ^1.2.0

dev_dependencies:
build_runner: ^2.4.9
Expand Down
2 changes: 1 addition & 1 deletion chopper/test/utils_test.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// ignore_for_file: deprecated_member_use_from_same_package

import 'package:chopper/src/list_format.dart';
import 'package:chopper/src/request.dart';
import 'package:chopper/src/utils.dart';
import 'package:qs_dart/qs_dart.dart' show ListFormat;
import 'package:test/test.dart';

import 'fixtures/example_enum.dart';
Expand Down
5 changes: 2 additions & 3 deletions chopper_generator/lib/src/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:chopper_generator/src/vars.dart';
import 'package:code_builder/code_builder.dart';
import 'package:dart_style/dart_style.dart';
import 'package:logging/logging.dart';
import 'package:qs_dart/qs_dart.dart' show ListFormat;
import 'package:source_gen/source_gen.dart';

/// Code generator for [chopper.ChopperApi] annotated classes.
Expand Down Expand Up @@ -406,7 +405,7 @@ final class ChopperGenerator

final bool hasTag = tag.isNotEmpty;

final ListFormat? listFormat = Utils.getListFormat(method);
final chopper.ListFormat? listFormat = Utils.getListFormat(method);

final bool? useBrackets = Utils.getUseBrackets(method);

Expand Down Expand Up @@ -716,7 +715,7 @@ final class ChopperGenerator
bool hasParts = false,
bool useQueries = false,
bool useHeaders = false,
ListFormat? listFormat,
chopper.ListFormat? listFormat,
@Deprecated('Use listFormat instead') bool? useBrackets,
bool? includeNullQueryVars,
Reference? tagRefer,
Expand Down
2 changes: 1 addition & 1 deletion chopper_generator/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import 'dart:math' show max;

import 'package:analyzer/dart/element/element.dart';
import 'package:chopper/chopper.dart' show ListFormat;
import 'package:chopper_generator/src/extensions.dart';
import 'package:code_builder/code_builder.dart';
import 'package:collection/collection.dart';
import 'package:qs_dart/qs_dart.dart' show ListFormat;
import 'package:source_gen/source_gen.dart';

final class Utils {
Expand Down
1 change: 0 additions & 1 deletion chopper_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies:
meta: ^1.9.1
source_gen: ^1.5.0
yaml: ^3.1.2
qs_dart: ^1.1.0
collection: ^1.18.0

dev_dependencies:
Expand Down