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 5.0.0 #353

Merged
merged 25 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 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
8f578ed
Merge branch 'master' into release-5.0.0
JEuler Sep 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
18 changes: 2 additions & 16 deletions chopper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
# Changelog

## 4.0.6
## 5.0.0

- FieldMap added
- Example migrated to null safety / Angular removed

## 4.0.5

- Add additional param for the authenticator

## 4.0.4

- Fix for authenticator usage

## 4.0.3

- Fix for authenticator usage
- Null-safety fixes
- API breaking changes (FutureOr)

## 4.0.1

Expand Down
35 changes: 34 additions & 1 deletion chopper/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
include: package:pedantic/analysis_options.yaml
include: package:lints/recommended.yaml

analyzer:
exclude:
- "**.g.dart"
- "**.chopper.dart"
- "**.mocks.dart"
- "example/**"
plugins:
- dart_code_metrics

dart_code_metrics:
metrics:
cyclomatic-complexity: 20
number-of-arguments: 4
maximum-nesting-level: 5
number-of-parameters: 7
metrics-exclude:
- test/**
rules:
- newline-before-return
- no-boolean-literal-compare
- no-empty-block
- prefer-trailing-comma
- prefer-conditional-expressions
- no-equal-then-else
anti-patterns:
- long-method
- long-parameter-list

linter:
rules:
avoid_print: true
prefer_single_quotes: true
4 changes: 2 additions & 2 deletions chopper/example/definition.chopper.dart

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

1 change: 1 addition & 0 deletions chopper/example/definition.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';

import 'package:chopper/chopper.dart';

part 'definition.chopper.dart';
Expand Down
3 changes: 2 additions & 1 deletion chopper/example/main.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'package:chopper/chopper.dart';

import 'definition.dart';

Future<void> main() async {
final chopper = ChopperClient(
baseUrl: 'http://localhost:8000',
services: [
// the generated service
MyService.create(ChopperClient())
MyService.create(ChopperClient()),
],
converter: JsonConverter(),
);
Expand Down
2 changes: 1 addition & 1 deletion chopper/lib/chopper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ library chopper;
export 'src/annotations.dart';
export 'src/authenticator.dart';
export 'src/base.dart';
export 'src/constants.dart';
export 'src/interceptor.dart';
export 'src/request.dart';
export 'src/response.dart';
export 'src/utils.dart' hide mapToQuery;
export 'src/constants.dart';
96 changes: 32 additions & 64 deletions chopper/lib/src/annotations.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'dart:async';

import 'package:meta/meta.dart';

import 'constants.dart';
import 'request.dart';
import 'response.dart';
import 'constants.dart';

/// Defines a Chopper API.
///
Expand Down Expand Up @@ -171,15 +173,10 @@ class Method {
@immutable
class Get extends Method {
const Get({
bool optionalBody = true,
String path = '',
Map<String, String> headers = const {},
}) : super(
HttpMethod.Get,
optionalBody: optionalBody,
path: path,
headers: headers,
);
super.optionalBody = true,
super.path,
super.headers,
}) : super(HttpMethod.Get);
}

/// Defines a method as an HTTP POST request.
Expand All @@ -188,30 +185,20 @@ class Get extends Method {
@immutable
class Post extends Method {
const Post({
bool optionalBody = false,
String path = '',
Map<String, String> headers = const {},
}) : super(
HttpMethod.Post,
optionalBody: optionalBody,
path: path,
headers: headers,
);
super.optionalBody,
super.path,
super.headers,
}) : super(HttpMethod.Post);
}

/// Defines a method as an HTTP DELETE request.
@immutable
class Delete extends Method {
const Delete({
bool optionalBody = true,
String path = '',
Map<String, String> headers = const {},
}) : super(
HttpMethod.Delete,
optionalBody: optionalBody,
path: path,
headers: headers,
);
super.optionalBody = true,
super.path,
super.headers,
}) : super(HttpMethod.Delete);
}

/// Defines a method as an HTTP PUT request.
Expand All @@ -220,60 +207,40 @@ class Delete extends Method {
@immutable
class Put extends Method {
const Put({
bool optionalBody = false,
String path = '',
Map<String, String> headers = const {},
}) : super(
HttpMethod.Put,
optionalBody: optionalBody,
path: path,
headers: headers,
);
super.optionalBody,
super.path,
super.headers,
}) : super(HttpMethod.Put);
}

/// Defines a method as an HTTP PATCH request.
/// Use the [Body] annotation to pass data to send.
@immutable
class Patch extends Method {
const Patch({
bool optionalBody = false,
String path = '',
Map<String, String> headers = const {},
}) : super(
HttpMethod.Patch,
optionalBody: optionalBody,
path: path,
headers: headers,
);
super.optionalBody,
super.path,
super.headers,
}) : super(HttpMethod.Patch);
}

/// Defines a method as an HTTP HEAD request.
@immutable
class Head extends Method {
const Head({
bool optionalBody = true,
String path = '',
Map<String, String> headers = const {},
}) : super(
HttpMethod.Head,
optionalBody: optionalBody,
path: path,
headers: headers,
);
super.optionalBody = true,
super.path,
super.headers,
}) : super(HttpMethod.Head);
}

@immutable
class Options extends Method {
const Options({
bool optionalBody = true,
String path = '',
Map<String, String> headers = const {},
}) : super(
HttpMethod.Options,
optionalBody: optionalBody,
path: path,
headers: headers,
);
super.optionalBody = true,
super.path,
super.headers,
}) : super(HttpMethod.Options);
}

/// A function that should convert the body of a [Request] to the HTTP representation.
Expand Down Expand Up @@ -377,6 +344,7 @@ class Multipart {
@immutable
class Part {
final String? name;

const Part([this.name]);
}

Expand Down
7 changes: 5 additions & 2 deletions chopper/lib/src/authenticator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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.
abstract class Authenticator {
FutureOr<Request?> authenticate(Request request, Response response,
[Request? originalRequest]);
FutureOr<Request?> authenticate(
Request request,
Response response, [
Request? originalRequest,
]);
}
Loading