Skip to content

Commit

Permalink
🔖 release chopper v7.1.1 (#568)
Browse files Browse the repository at this point in the history
* 🔖 release chopper v7.1.1

# chopper

## 7.1.1

- #567

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Job Guldemeester <job@dutchcodingcompany.com>
  • Loading branch information
techouse and Guldem committed Jan 28, 2024
1 parent 56c1ce0 commit 911b4c7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
4 changes: 4 additions & 0 deletions chopper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.1.1

- Add `Target` annotations ([#567](https://github.com/lejard-h/chopper/pull/567))

## 7.1.0+1

- Bump `chopper_generator` version requirement to 7.1.0
Expand Down
23 changes: 23 additions & 0 deletions chopper/lib/src/annotations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:chopper/src/constants.dart';
import 'package:chopper/src/request.dart';
import 'package:chopper/src/response.dart';
import 'package:meta/meta.dart';
import 'package:meta/meta_meta.dart';

/// {@template ChopperApi}
/// Defines a Chopper API.
Expand All @@ -22,6 +23,7 @@ import 'package:meta/meta.dart';
/// See [Method] to define an HTTP request
/// {@endtemplate}
@immutable
@Target({TargetKind.classType})
final class ChopperApi {
/// A part of a URL that every request defined inside a class annotated with [ChopperApi] will be prefixed with.
///
Expand Down Expand Up @@ -49,6 +51,7 @@ final class ChopperApi {
/// ```
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class Path {
/// Name is used to bind a method parameter to
/// a URL path parameter.
Expand All @@ -75,6 +78,7 @@ final class Path {
/// See [QueryMap] to pass an [Map<String, dynamic>] as value
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class Query {
/// Name is used to bind a method parameter to
/// the query parameter.
Expand Down Expand Up @@ -103,6 +107,7 @@ final class Query {
/// ```
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class QueryMap {
/// {@macro QueryMap}
const QueryMap();
Expand All @@ -120,6 +125,7 @@ final class QueryMap {
/// See [Converter] to apply conversion to the body.
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class Body {
/// {@macro Body}
const Body();
Expand All @@ -136,6 +142,7 @@ final class Body {
/// ```
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class Header {
/// Name is used to bind a method parameter to
/// a header name.
Expand Down Expand Up @@ -169,6 +176,7 @@ final class Header {
/// A [Converter] needs to be specified for conversion.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
sealed class Method {
/// HTTP method for the request
final String method;
Expand Down Expand Up @@ -232,6 +240,7 @@ sealed class Method {
/// Defines a method as an HTTP GET request.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class Get extends Method {
/// {@macro Get}
const Get({
Expand All @@ -249,6 +258,7 @@ final class Get extends Method {
/// Use the [Body] annotation to pass data to send.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class Post extends Method {
/// {@macro Post}
const Post({
Expand All @@ -264,6 +274,7 @@ final class Post extends Method {
/// Defines a method as an HTTP DELETE request.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class Delete extends Method {
/// {@macro Delete}
const Delete({
Expand All @@ -281,6 +292,7 @@ final class Delete extends Method {
/// Use the [Body] annotation to pass data to send.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class Put extends Method {
/// {@macro Put}
const Put({
Expand All @@ -297,6 +309,7 @@ final class Put extends Method {
/// Use the [Body] annotation to pass data to send.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class Patch extends Method {
/// {@macro Patch}
const Patch({
Expand All @@ -312,6 +325,7 @@ final class Patch extends Method {
/// Defines a method as an HTTP HEAD request.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class Head extends Method {
/// {@macro Head}
const Head({
Expand All @@ -327,6 +341,7 @@ final class Head extends Method {
/// Defines a method as an HTTP OPTIONS request.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class Options extends Method {
/// {@macro Options}
const Options({
Expand Down Expand Up @@ -377,6 +392,7 @@ typedef ConvertResponse<T> = FutureOr<Response> Function(Response response);
/// ```
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class FactoryConverter {
final ConvertRequest? request;
final ConvertResponse? response;
Expand All @@ -399,6 +415,7 @@ final class FactoryConverter {
/// Will be converted to `{ 'name': value }`.
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class Field {
/// Name can be use to specify the name of the field
/// ```dart
Expand All @@ -420,6 +437,7 @@ final class Field {
/// ```
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class FieldMap {
/// {@macro FieldMap}
const FieldMap();
Expand All @@ -438,6 +456,7 @@ final class FieldMap {
/// Use [PartFile] annotation to send `File` or `List<int>`.
/// {@endtemplate}
@immutable
@Target({TargetKind.method})
final class Multipart {
/// {@macro Multipart}
const Multipart();
Expand All @@ -451,6 +470,7 @@ final class Multipart {
/// Also accepts `MultipartFile` (from package:http).
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class Part {
final String? name;

Expand All @@ -468,6 +488,7 @@ final class Part {
/// ```
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class PartMap {
/// {@macro PartMap}
const PartMap();
Expand All @@ -488,6 +509,7 @@ final class PartMap {
/// - `MultipartFile` (from package:http)
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class PartFile {
final String? name;

Expand All @@ -505,6 +527,7 @@ final class PartFile {
/// ```
/// {@endtemplate}
@immutable
@Target({TargetKind.parameter})
final class PartFileMap {
/// {@macro PartFileMap}
const PartFileMap();
Expand Down
2 changes: 1 addition & 1 deletion 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.1.0+1
version: 7.1.1
documentation: https://hadrien-lejard.gitbook.io/chopper
repository: https://github.com/lejard-h/chopper

Expand Down
16 changes: 16 additions & 0 deletions faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,22 @@ It goes without saying that running the code generation is a pre-requisite at th
flutter pub run build_runner build
```

##### Changing the default extension of the generated files

If you want to change the default extension of the generated files from `.chopper.dart` to
something else, you can do so by adding the following to your `build.yaml` file:

```yaml
targets:
$default:
builders:
chopper_generator:
options:
# This assumes you want the files to end with `.chopper.g.dart`
# instead of the default `.chopper.dart`.
build_extensions: { ".dart": [ ".chopper.g.dart" ] }
```

#### Configure a WorkerPool and run the example

```dart
Expand Down

0 comments on commit 911b4c7

Please sign in to comment.