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

🔖 release chopper v7.0.9 #531

Merged
merged 119 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
f25fbe4
Fix Header Option Casting (#260)
yousinix May 25, 2021
3d47735
Fix for #259 (#263)
JEuler May 31, 2021
8be965b
4.0.1 fixes (#264)
JEuler Jun 1, 2021
bcb0304
analyzer dependency upgraded (#296)
luis901101 Sep 18, 2021
4e4607e
fix(generator): fix PartValueFile value not nullable if arg is (#288)…
rIIh Sep 18, 2021
939a83f
Chopper generator release 4.0.2 (#297)
JEuler Sep 23, 2021
ff0ec87
fix: fix this.body cast of null value when response body is null (#29…
rIIh Sep 23, 2021
ffcd945
Interpolation fixes (#275)
JEuler Sep 23, 2021
82b951f
encodeQueryComponent now encodeComponent (#278)
JEuler Sep 23, 2021
f7255b7
Prevent double call on token refreshment (#276)
JEuler Oct 10, 2021
ddefa94
Fixes for #309 #308 (#310)
JEuler Dec 7, 2021
0386c74
Remove new keyword from interceptors.md (#312)
michalsrutek Jan 3, 2022
d4dab0d
Analyzer upgrade (#320)
JEuler Jan 16, 2022
bbe2c7a
Add unnecessary_brace_in_string_interps to lint ignores (#317)
pingbird Jan 16, 2022
6bdbd63
Extend pragma to quiet the linter (#318)
vipw Jan 22, 2022
4185d14
Fix converter getting called twice if using an authenticator with a J…
maxroehrl Jan 30, 2022
dbf4272
migrate example to nullsafety (#331)
ipcjs Feb 22, 2022
976d457
Resolve problem in main_json_serializable example (#328)
ibadin Apr 24, 2022
cc2da20
Add @FiledMap @PartMap @PartFileMap (#335)
meysam1717 May 1, 2022
659b9f8
Upgrade of analyzer (#340)
JEuler Jun 20, 2022
e167ba6
Fix nullable QueryMap fails to compile (#344)
techouse Jul 14, 2022
f9009ce
Change return type of decodeJson to FutureOr in order to be able to s…
techouse Sep 7, 2022
5f2eb82
Migrate from pedantic to lints ^2.0.0 with lints/recommended.yaml (#349)
techouse Sep 7, 2022
02cf2e0
Version bumped for release (#352)
JEuler Sep 13, 2022
34b3bda
Revert analyzer to ^4.1.0 and silence linters for Element.enclosingEl…
techouse Sep 13, 2022
426a16e
[chopper_generator] Update analyzer to ^4.4.0 and code_builde to ^4.3…
techouse Sep 17, 2022
35fdf8f
Add Makefiles to streamline development (#357)
techouse Sep 17, 2022
5a59ebf
Add Bug Report Github issue template (#359)
techouse Sep 18, 2022
fcf3478
[chopper_generator] Add types to the generated variables (#360)
techouse Sep 19, 2022
6b3b840
Provide an example using an Isolate Worker Pool with Squadron (#361)
techouse Sep 19, 2022
d74790c
mapToQuery changes (#364)
techouse Oct 8, 2022
0882a7e
Version bumped / changelog update (#367)
JEuler Oct 8, 2022
e3fd623
Request extends http.BaseRequest (#370)
techouse Oct 13, 2022
bd8d65f
Exclude null query vars by default and add new @Method annotation inc…
techouse Oct 14, 2022
786c153
5.1.0 (dev) (#373)
JEuler Oct 15, 2022
9b2b867
[workflow] Upgrade mono_repo to v6.4.1 (#375)
techouse Oct 15, 2022
233678e
Update analyzer to >=4.4.0 <6.0.0 (#378)
techouse Oct 17, 2022
1b2f1fa
Update mono_repo to 6.4.2 (#380)
techouse Oct 18, 2022
1e3e7f4
add techouse (#382)
JEuler Oct 18, 2022
b0fd18f
[Feature] Replace the String based path with Uri (#383)
Guldem Oct 31, 2022
9d1d86c
:memo: Add Authenticator example (#386)
techouse Nov 20, 2022
2775a73
Update getting-started.md (#391)
erlangparasu Dec 11, 2022
11a9ca5
Fix #388 Triggering Authenticator double encodes body in POST, PUT, P…
techouse Dec 11, 2022
bdbe210
Add image upload test (#392)
techouse Dec 11, 2022
b6ea960
Release 5.2.0 (#394)
JEuler Dec 13, 2022
1719c83
6.0.0 (#397)
JEuler Dec 14, 2022
7453582
Configurable HttpLoggingInterceptor (#399)
Guldem Jan 6, 2023
fa73de3
Made apply headers field name case insensitive. (#400)
Guldem Jan 8, 2023
bd3d7cc
:bulb: Clean up code in comments (#403)
techouse Jan 9, 2023
a910ede
Fix dead link on FAQs page (#404)
markasselin Jan 26, 2023
adfb1c5
Updated chopper version to 6.0.0 for chopper_built_value (#406)
Guldem Feb 2, 2023
253d69a
#290 implement Equatable (#410)
techouse Feb 22, 2023
9976752
Add Feature request Github issue template (#414)
techouse Mar 13, 2023
617f3f3
:construction_worker: add CODEOWNERS (#415)
techouse Mar 29, 2023
d83ad40
:arrow_up: Bump Dart SDK constraint to ">=2.17.0 <4.0.0" (#417)
techouse May 12, 2023
83f8c25
:green_heart: Fix CI publish (#419)
techouse May 13, 2023
64bd220
:green_heart: Fix CI publish credentials (#421)
techouse May 14, 2023
09774f1
:green_heart: Fix CI coverage reporting (#423)
techouse May 14, 2023
0145064
:construction_worker: only run CI publish / --dry-run when a package'…
techouse May 15, 2023
ef2fbf5
:green_heart: fix publish CI to run only on push (#425)
techouse May 15, 2023
08781c9
:green_heart: fix publish workflow (#427)
techouse May 20, 2023
485ef8f
Adding follow redirects to toHttpRequest (#430)
Joran-Dob May 26, 2023
a88aa3a
:arrow_up: update squadron example (#432)
techouse May 27, 2023
0546452
:arrow_up: update http constraint to ">=0.13.0 <2.0.0" (#431)
techouse May 27, 2023
ae8bff5
Add MultipartRequest log to CurlInterceptor (#435)
JosephNK May 27, 2023
d824ded
:green_heart: add cleanup step to publish workflow (#434)
techouse May 28, 2023
829d5b0
:twisted_rightwards_arrows: post release branch sync (#437)
techouse May 28, 2023
455cd34
:bug: fix Multipart for List<int> and List<String> (#439)
techouse Jun 3, 2023
1f8c596
:twisted_rightwards_arrows: post release branch sync (#441)
techouse Jun 4, 2023
917a463
:sparkles: Generating files in different directories (#444)
techouse Jun 19, 2023
ac90783
:twisted_rightwards_arrows: post release branch sync (#447)
techouse Jun 19, 2023
97959f0
:recycle: refactor chopper_generator (#448)
techouse Jul 4, 2023
0856b86
:twisted_rightwards_arrows: post release branch sync (#450)
techouse Jul 5, 2023
96f9dbc
:heavy_minus_sign: remove dart_code_metrics from dev_dependencies (#452)
techouse Jul 9, 2023
6afebb0
:sparkles: implement Dart 3 class modifiers (#453)
techouse Jul 29, 2023
93b4e8a
:twisted_rightwards_arrows: post release branch sync (#455)
techouse Jul 30, 2023
7cd824c
:passport_control: fix CODEOWNERS (#456)
techouse Jul 30, 2023
aa63283
:recycle: refactor chopper (#460)
techouse Aug 2, 2023
a386e86
:recycle: refactor ChopperClient constructor (#461)
techouse Aug 2, 2023
7a6b5b9
:arrow_up: update mono_repo (#462)
techouse Aug 2, 2023
e9fc26d
:sparkles: add final class modifier to generated Chopper API implemen…
techouse Aug 3, 2023
e07afcf
:twisted_rightwards_arrows: post release branch sync (#466)
techouse Aug 3, 2023
2f7f414
:construction_worker: add Dependabot workflow (#467)
techouse Aug 4, 2023
03f7bf7
:pencil2: fix typo in mono_repo.yaml (#468)
techouse Aug 4, 2023
8dbde76
:sparkles: HttpLoggingInterceptor: allow to pass custom logger (#470)
Maxr1998 Aug 5, 2023
2e00b6a
:construction_worker: use yq to manipulate pubspec.yaml in publish CI…
techouse Aug 7, 2023
0af17f8
:twisted_rightwards_arrows: post release branch sync (#473)
techouse Aug 7, 2023
1a01b60
:sparkles: Attach request/response to interceptor log lines (#475)
Maxr1998 Aug 10, 2023
764d57d
:twisted_rightwards_arrows: post release branch sync (#477)
techouse Aug 11, 2023
f8905ad
:adhesive_bandage: export ChopperLogRecord to library surface (#480)
Maxr1998 Aug 14, 2023
c658d39
:label: make ChopperLogRecord final (#481)
Maxr1998 Aug 14, 2023
a0d70ac
:twisted_rightwards_arrows: post release branch sync (#483)
techouse Aug 14, 2023
2ab9d87
:arrow_up: analyzer: ">=5.13.0 <7.0.0" (#484)
techouse Aug 16, 2023
08bab6c
:twisted_rightwards_arrows: post release branch sync (#486)
techouse Aug 17, 2023
4c52b09
Update README.md (#488)
hunterwilhelm Aug 19, 2023
c7b67a6
:twisted_rightwards_arrows: post release branch sync (#491)
techouse Aug 22, 2023
e706150
Adding support for top level variables (#493)
martinale14 Aug 31, 2023
31c3967
:label: add topics (#495)
techouse Sep 1, 2023
a0f106d
:bug: fix chopper base.dart send() authenticate sending wrong request…
techouse Sep 2, 2023
f85eacd
:twisted_rightwards_arrows: post release branch sync (#499)
techouse Sep 2, 2023
be71064
:rotating_light: ignore unnecessary_string_interpolations (#501)
techouse Sep 5, 2023
3ff8359
:twisted_rightwards_arrows: post release branch sync (#503)
techouse Sep 8, 2023
14bc48f
:rotating_light: correct static analysis suppression of *.chopper.dar…
techouse Oct 7, 2023
b48066d
:bug: remove charset from http request headers when the body is in by…
techouse Oct 7, 2023
cbb4a92
:construction_worker: update mono_repo (#509)
techouse Oct 7, 2023
ce0836d
:construction_worker: create Github release when publishing package (…
techouse Oct 7, 2023
fedb899
:twisted_rightwards_arrows: post release branch sync (#514)
techouse Oct 7, 2023
52133f6
:sparkles: encode DateTime as ISO8601 (#516)
techouse Oct 11, 2023
24179ab
:twisted_rightwards_arrows: post release branch sync (#518)
techouse Oct 11, 2023
4860d3a
Fix incorrect url generation when using new baseurl (#520)
martinale14 Oct 12, 2023
8dd5a84
:twisted_rightwards_arrows: post release branch sync (#522)
techouse Oct 13, 2023
08ee151
:arrow_up: Bump lints from 2.1.1 to 3.0.0 in /chopper (#525)
dependabot[bot] Oct 23, 2023
723b5fc
:arrow_up: Bump lints from 2.1.1 to 3.0.0 in /chopper_built_value (#524)
dependabot[bot] Oct 23, 2023
f061355
:arrow_up: Bump lints from 2.1.1 to 3.0.0 in /chopper_generator (#523)
dependabot[bot] Oct 23, 2023
e5417d1
Add mock mixins of Chopper components. (#529)
diegotori Oct 26, 2023
e34feea
Add success/failure callback hooks to Authenticator. (#527)
diegotori Oct 26, 2023
4178d7d
:bug: fix Makefile show_test_coverage (#530)
techouse Oct 29, 2023
cf660d6
Merge branch 'develop' into release/chopper/v7.0.9
techouse Oct 29, 2023
d84b1f6
:bookmark: release chopper v7.0.9
techouse Oct 29, 2023
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
5 changes: 5 additions & 0 deletions chopper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 7.0.9

- Add success/failure callback hooks to Authenticator ([#527](https://github.com/lejard-h/chopper/pull/527))
- Add mock mixins of Chopper components ([#529](https://github.com/lejard-h/chopper/pull/529))

## 7.0.8

- Encode DateTime query parameters in ISO8601 format ([#516](https://github.com/lejard-h/chopper/pull/516))
Expand Down
2 changes: 1 addition & 1 deletion chopper/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sure:
show_test_coverage:
@# Help: Run Dart unit tests for the current project and show the coverage.
dart pub global activate coverage && dart pub global run coverage:test_with_coverage
lcov --remove coverage/lcov.info '**.g.dart' '**.mock.dart' '**.chopper.dart' -o coverage/lcov_without_generated_code.info
lcov --remove coverage/lcov.info '**.g.dart' '**.mock.dart' '**.chopper.dart' -o coverage/lcov_without_generated_code.info --ignore-errors unused
genhtml coverage/lcov_without_generated_code.info -o coverage/html
source ../tool/makefile_helpers.sh && open_link "coverage/html/index.html"

Expand Down
54 changes: 52 additions & 2 deletions chopper/lib/src/authenticator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,62 @@

import 'package:chopper/chopper.dart';

/// This method should return a [Request] that includes credentials to satisfy an authentication challenge received in
/// [response]. It should return `null` if the challenge cannot be satisfied.
///
/// Callback that is called when an authentication challenge is received
/// based on the given [request], [response], and optionally the
/// [originalRequest].
///
typedef AuthenticationCallback = FutureOr<void> Function(
Request request,
Response response, [
Request? originalRequest,
]);

///
/// Handles authentication challenges raised by the [ChopperClient].
///
/// Optionally, you can override either [onAuthenticationSuccessful] or
/// [onAuthenticationFailed] in order to listen to when a particular
/// authentication request succeeds or fails.
///
/// For example, you can use these in order to reset or mutate your
/// instance's internal state for the purposes of keeping track of
/// the number of retries made to authenticate a request.
///
/// Furthermore, you can use these callbacks to determine whether
/// your authentication [Request] from [authenticate] actually succeeded
/// or failed.
///
abstract class Authenticator {
///
/// Returns a [Request] that includes credentials to satisfy
/// an authentication challenge received in [response], based on
/// the incoming [request] or optionally, the [originalRequest]
/// (which was not modified with any previous [RequestInterceptor]s).
///
/// Otherwise, return `null` if the challenge cannot be satisfied.
///
FutureOr<Request?> authenticate(
Request request,
Response response, [
Request? originalRequest,
]);

///
/// Optional callback called by [ChopperClient] when the outgoing
/// request from [authenticate] was successful.
///
/// You can use this to determine whether that request actually succeeded
/// in authenticating the user.
///
AuthenticationCallback? get onAuthenticationSuccessful => null;

Check warning on line 53 in chopper/lib/src/authenticator.dart

View check run for this annotation

Codecov / codecov/patch

chopper/lib/src/authenticator.dart#L53

Added line #L53 was not covered by tests

///
/// Optional callback called by [ChopperClient] when the outgoing
/// request from [authenticate] failed to authenticate.
///
/// You can use this to determine whether that request failed to recover
/// the user's session.
///
AuthenticationCallback? get onAuthenticationFailed => null;

Check warning on line 62 in chopper/lib/src/authenticator.dart

View check run for this annotation

Codecov / codecov/patch

chopper/lib/src/authenticator.dart#L62

Added line #L62 was not covered by tests
}
16 changes: 15 additions & 1 deletion chopper/lib/src/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,13 @@ base class ChopperClient {
);
// To prevent double call with typed response
if (_responseIsSuccessful(res.statusCode)) {
await authenticator!.onAuthenticationSuccessful
?.call(updatedRequest, res, request);
return _processResponse(res);
} else {
res = await _handleErrorResponse<BodyType, InnerType>(res);

await authenticator!.onAuthenticationFailed
?.call(updatedRequest, res, request);
return _processResponse(res);
}
}
Expand Down Expand Up @@ -515,6 +518,17 @@ base class ChopperClient {
Stream<Response> get onResponse => _responseController.stream;
}

///
/// [ChopperClient] mixin for the purposes of creating mocks
/// using a mocking framework such as Mockito or Mocktail.
///
/// ```dart
/// base class MockChopperClient extends Mock with MockChopperClientMixin {}
/// ```
///
@visibleForTesting
base mixin MockChopperClientMixin implements ChopperClient {}

/// A marker and helper class used by `chopper_generator` to generate network
/// call implementations.
///
Expand Down
12 changes: 12 additions & 0 deletions chopper/lib/src/chopper_log_record.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:chopper/src/request.dart';
import 'package:chopper/src/response.dart';
import 'package:meta/meta.dart';

final class ChopperLogRecord {
const ChopperLogRecord(this.message, {this.request, this.response});
Expand All @@ -11,3 +12,14 @@ final class ChopperLogRecord {
@override
String toString() => message;
}

///
/// [ChopperLogRecord] mixin for the purposes of creating mocks
/// using a mocking framework such as Mockito or Mocktail.
///
/// ```dart
/// base class MockChopperLogRecord extends Mock with MockChopperLogRecordMixin {}
/// ```
///
@visibleForTesting
base mixin MockChopperLogRecordMixin implements ChopperLogRecord {}
33 changes: 33 additions & 0 deletions chopper/lib/src/request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ base class Request extends http.BaseRequest with EquatableMixin {
];
}

///
/// [Request] mixin for the purposes of creating mocks
/// using a mocking framework such as Mockito or Mocktail.
///
/// ```dart
/// base class MockRequest extends Mock with MockRequestMixin {}
/// ```
///
@visibleForTesting
base mixin MockRequestMixin implements Request {}

/// Represents a part in a multipart request.
@immutable
final class PartValue<T> with EquatableMixin {
Expand All @@ -263,8 +274,30 @@ final class PartValue<T> with EquatableMixin {
];
}

///
/// [PartValue] mixin for the purposes of creating mocks
/// using a mocking framework such as Mockito or Mocktail.
///
/// ```dart
/// base class MockPartValue<T> extends Mock with MockPartValueMixin<T> {}
/// ```
///
@visibleForTesting
base mixin MockPartValueMixin<T> implements PartValue<T> {}

/// Represents a file [PartValue] in a multipart request.
@immutable
final class PartValueFile<T> extends PartValue<T> {
const PartValueFile(super.name, super.value);
}

///
/// [PartValueFile] mixin for the purposes of creating mocks
/// using a mocking framework such as Mockito or Mocktail.
///
/// ```dart
/// base class MockPartValueFile<T> extends Mock with MockPartValueFileMixin<T> {}
/// ```
///
@visibleForTesting
base mixin MockPartValueFileMixin<T> implements PartValueFile<T> {}
11 changes: 11 additions & 0 deletions chopper/lib/src/response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,14 @@ base class Response<BodyType> with EquatableMixin {
error,
];
}

///
/// [Response] mixin for the purposes of creating mocks
/// using a mocking framework such as Mockito or Mocktail.
///
/// ```dart
/// base class MockResponse<BodyType> extends Mock with MockResponseMixin<BodyType> {}
/// ```
///
@visibleForTesting
base mixin MockResponseMixin<BodyType> implements Response<BodyType> {}
4 changes: 2 additions & 2 deletions chopper/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: chopper
description: Chopper is an http client generator using source_gen, inspired by Retrofit
version: 7.0.8
version: 7.0.9
documentation: https://hadrien-lejard.gitbook.io/chopper
repository: https://github.com/lejard-h/chopper

Expand All @@ -22,7 +22,7 @@ dev_dependencies:
data_fixture_dart: ^2.2.0
faker: ^2.1.0
http_parser: ^4.0.2
lints: ^2.1.1
lints: ">=2.1.1 <4.0.0"
test: ^1.24.4
transparent_image: ^2.0.1
chopper_generator: ^7.0.0
Expand Down
Loading