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

5.2.0.release #393

Merged
merged 47 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 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
3c215c0
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
c566d2b
Release 5.2.0
JEuler Dec 13, 2022
41ee244
Merge branch 'master' into 5.2.0.release
JEuler Dec 13, 2022
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
24 changes: 12 additions & 12 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v6.4.1
# Created with package:mono_repo v6.4.2
name: Dart CI
on:
push:
Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ac8075791e805656e71b4ba23325ace9e3421120
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable"
Expand All @@ -35,17 +35,17 @@ jobs:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: mono_repo self validate
run: dart pub global activate mono_repo 6.4.1
run: dart pub global activate mono_repo 6.4.2
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
name: "analyzer_and_format; PKGS: chopper_built_value, chopper_generator; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ac8075791e805656e71b4ba23325ace9e3421120
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper_built_value-chopper_generator;commands:format-analyze"
Expand All @@ -60,7 +60,7 @@ jobs:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- id: chopper_built_value_pub_upgrade
name: chopper_built_value; dart pub upgrade
run: dart pub upgrade
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ac8075791e805656e71b4ba23325ace9e3421120
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper;commands:format-analyze"
Expand All @@ -107,7 +107,7 @@ jobs:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- id: chopper_pub_upgrade
name: chopper; dart pub upgrade
run: dart pub upgrade
Expand All @@ -129,7 +129,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ac8075791e805656e71b4ba23325ace9e3421120
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper-chopper_built_value;commands:test_1"
Expand All @@ -144,7 +144,7 @@ jobs:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- id: chopper_pub_upgrade
name: chopper; dart pub upgrade
run: dart pub upgrade
Expand Down Expand Up @@ -172,7 +172,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ac8075791e805656e71b4ba23325ace9e3421120
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper-chopper_built_value;commands:test_0"
Expand All @@ -187,7 +187,7 @@ jobs:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- id: chopper_pub_upgrade
name: chopper; dart pub upgrade
run: dart pub upgrade
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ doc/api/
coverage
chopper/doc/
.vscode/
pubspec.temp.yaml
pubspec.temp.yaml
.DS_Store
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center"><a href="https://github.com/lejard-h"><img src="https://avatars.githubusercontent.com/u/7336262?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hadrien Lejard</b></sub></a><br /><a href="https://github.com/lejard-h/chopper/commits?author=lejard-h" title="Code">💻</a> <a href="https://github.com/lejard-h/chopper/pulls?q=is%3Apr+reviewed-by%3Alejard-h" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/lejard-h/chopper/commits?author=lejard-h" title="Tests">⚠️</a> <a href="https://github.com/lejard-h/chopper/commits?author=lejard-h" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/stewemetal"><img src="https://avatars.githubusercontent.com/u/5860632?v=4?s=100" width="100px;" alt=""/><br /><sub><b>István Juhos</b></sub></a><br /><a href="https://github.com/lejard-h/chopper/commits?author=stewemetal" title="Code">💻</a> <a href="https://github.com/lejard-h/chopper/pulls?q=is%3Apr+reviewed-by%3Astewemetal" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/lejard-h/chopper/commits?author=stewemetal" title="Tests">⚠️</a> <a href="https://github.com/lejard-h/chopper/commits?author=stewemetal" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/techouse"><img src="https://avatars.githubusercontent.com/u/1174328?v=4" width="100px;" alt=""/><br /><sub><b>Klemen Tusar</b></sub></a><br /><a href="https://github.com/lejard-h/chopper/commits?author=techouse" title="Code">💻</a> <a href="https://github.com/lejard-h/chopper/pulls?q=is%3Apr+reviewed-by%3Atechouse" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/lejard-h/chopper/commits?author=techouse" title="Tests">⚠️</a> <a href="https://github.com/lejard-h/chopper/commits?author=techouse" title="Documentation">📖</a></td>
<td align="center"><a href="https://www.upwork.com/freelancers/~01192eefd8a1c267f7"><img src="https://avatars.githubusercontent.com/u/231950?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Terekhin</b></sub></a><br /><a href="https://github.com/lejard-h/chopper/commits?author=JEuler" title="Code">💻</a> <a href="https://github.com/lejard-h/chopper/pulls?q=is%3Apr+reviewed-by%3AJEuler" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/lejard-h/chopper/commits?author=JEuler" title="Tests">⚠️</a> <a href="https://github.com/lejard-h/chopper/commits?author=JEuler" title="Documentation">📖</a></td>
<td align="center"><a href="http://ysampir@gmail.com"><img src="https://avatars.githubusercontent.com/u/3999503?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Eugeny Sampir</b></sub></a><br /><a href="https://github.com/lejard-h/chopper/commits?author=fryette" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/Vovanella95"><img src="https://avatars.githubusercontent.com/u/11267533?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Uladzimir_Paliukhovich</b></sub></a><br /><a href="https://github.com/lejard-h/chopper/commits?author=Vovanella95" title="Code">💻</a></td>
Expand All @@ -50,4 +51,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
4 changes: 4 additions & 0 deletions chopper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## 5.2.0

- Replaced the String based path with Uri
- Fix for Authenticator body rewrite

## 5.1.0

Expand Down
12 changes: 6 additions & 6 deletions chopper/example/definition.chopper.dart

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

2 changes: 1 addition & 1 deletion chopper/example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'definition.dart';

Future<void> main() async {
final chopper = ChopperClient(
baseUrl: 'http://localhost:8000',
baseUrl: Uri.parse('http://localhost:8000'),
services: [
// the generated service
MyService.create(ChopperClient()),
Expand Down
59 changes: 35 additions & 24 deletions chopper/lib/src/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final List<Type> allowedInterceptorsType = [
class ChopperClient {
/// Base URL of each request of the registered services.
/// E.g., the hostname of your service.
final String baseUrl;
final Uri baseUrl;

/// The [http.Client] used to make network calls.
final http.Client httpClient;
Expand Down Expand Up @@ -60,6 +60,7 @@ class ChopperClient {
/// The base URL of each request of the registered services can be defined
/// with the [baseUrl] parameter.
/// E.g., the hostname of your service.
/// If not provided, a empty default [Uri] will be used.
///
/// A custom HTTP client can be passed as the [client] parameter to be used
/// with the created [ChopperClient].
Expand All @@ -70,7 +71,7 @@ class ChopperClient {
///
/// ```dart
/// final chopper = ChopperClient(
/// baseUrl: 'localhost:8000',
/// baseUrl: Uri.parse('localhost:8000'),
/// services: [
/// // Add a generated service
/// TodosListService.create()
Expand Down Expand Up @@ -111,14 +112,19 @@ class ChopperClient {
/// );
/// ```
ChopperClient({
this.baseUrl = '',
Uri? baseUrl,
http.Client? client,
Iterable interceptors = const [],
this.authenticator,
this.converter,
this.errorConverter,
Iterable<ChopperService> services = const [],
}) : httpClient = client ?? http.Client(),
}) : assert(
baseUrl == null || !baseUrl.hasQuery,
'baseUrl should not contain query parameters.'
'Use a request interceptor to add default query parameters'),
baseUrl = baseUrl ?? Uri(),
httpClient = client ?? http.Client(),
_clientIsInternal = client == null {
if (!interceptors.every(_isAnInterceptor)) {
throw ArgumentError(
Expand Down Expand Up @@ -152,7 +158,7 @@ class ChopperClient {
///
/// ```dart
/// final chopper = ChopperClient(
/// baseUrl: 'localhost:8000',
/// baseUrl: Uri.parse('localhost:8000'),
/// services: [
/// // Add a generated service
/// TodosListService.create()
Expand Down Expand Up @@ -287,9 +293,10 @@ class ChopperClient {
ConvertRequest? requestConverter,
ConvertResponse? responseConverter,
}) async {
var req = await _interceptRequest(
final Request req = await _interceptRequest(
await _handleRequestConverter(request, requestConverter),
);

_requestController.add(req);

final streamRes = await httpClient.send(await req.toBaseRequest());
Expand All @@ -301,7 +308,11 @@ class ChopperClient {
dynamic res = Response(response, response.body);

if (authenticator != null) {
var updatedRequest = await authenticator!.authenticate(req, res, request);
final Request? updatedRequest = await authenticator!.authenticate(
request,
res,
request,
);

if (updatedRequest != null) {
res = await send<BodyType, InnerType>(
Expand Down Expand Up @@ -341,10 +352,10 @@ class ChopperClient {

/// Makes a HTTP GET request using the [send] function.
Future<Response<BodyType>> get<BodyType, InnerType>(
String url, {
Uri url, {
Map<String, String> headers = const {},
Uri? baseUrl,
Map<String, dynamic> parameters = const {},
String? baseUrl,
dynamic body,
}) =>
send<BodyType, InnerType>(
Expand All @@ -360,13 +371,13 @@ class ChopperClient {

/// Makes a HTTP POST request using the [send] function
Future<Response<BodyType>> post<BodyType, InnerType>(
String url, {
Uri url, {
dynamic body,
List<PartValue> parts = const [],
Map<String, String> headers = const {},
Map<String, dynamic> parameters = const {},
bool multipart = false,
String? baseUrl,
Uri? baseUrl,
}) =>
send<BodyType, InnerType>(
Request(
Expand All @@ -376,20 +387,20 @@ class ChopperClient {
body: body,
parts: parts,
headers: headers,
multipart: multipart,
parameters: parameters,
multipart: multipart,
),
);

/// Makes a HTTP PUT request using the [send] function.
Future<Response<BodyType>> put<BodyType, InnerType>(
String url, {
Uri url, {
dynamic body,
List<PartValue> parts = const [],
Map<String, String> headers = const {},
Map<String, dynamic> parameters = const {},
bool multipart = false,
String? baseUrl,
Uri? baseUrl,
}) =>
send<BodyType, InnerType>(
Request(
Expand All @@ -399,20 +410,20 @@ class ChopperClient {
body: body,
parts: parts,
headers: headers,
multipart: multipart,
parameters: parameters,
multipart: multipart,
),
);

/// Makes a HTTP PATCH request using the [send] function.
Future<Response<BodyType>> patch<BodyType, InnerType>(
String url, {
Uri url, {
dynamic body,
List<PartValue> parts = const [],
Map<String, String> headers = const {},
Map<String, dynamic> parameters = const {},
bool multipart = false,
String? baseUrl,
Uri? baseUrl,
}) =>
send<BodyType, InnerType>(
Request(
Expand All @@ -422,17 +433,17 @@ class ChopperClient {
body: body,
parts: parts,
headers: headers,
multipart: multipart,
parameters: parameters,
multipart: multipart,
),
);

/// Makes a HTTP DELETE request using the [send] function.
Future<Response<BodyType>> delete<BodyType, InnerType>(
String url, {
Uri url, {
Map<String, String> headers = const {},
Map<String, dynamic> parameters = const {},
String? baseUrl,
Uri? baseUrl,
}) =>
send<BodyType, InnerType>(
Request(
Expand All @@ -446,10 +457,10 @@ class ChopperClient {

/// Makes a HTTP HEAD request using the [send] function.
Future<Response<BodyType>> head<BodyType, InnerType>(
String url, {
Uri url, {
Map<String, String> headers = const {},
Map<String, dynamic> parameters = const {},
String? baseUrl,
Uri? baseUrl,
}) =>
send<BodyType, InnerType>(
Request(
Expand All @@ -463,10 +474,10 @@ class ChopperClient {

/// Makes a HTTP OPTIONS request using the [send] function.
Future<Response<BodyType>> options<BodyType, InnerType>(
String url, {
Uri url, {
Map<String, String> headers = const {},
Map<String, dynamic> parameters = const {},
String? baseUrl,
Uri? baseUrl,
}) =>
send<BodyType, InnerType>(
Request(
Expand Down
Loading