Skip to content

Commit

Permalink
feat(dynamite): use named imports for dynamite_runtime/http_client
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
  • Loading branch information
Leptopoda committed Jan 1, 2024
1 parent 4fc34fc commit 1a111fb
Show file tree
Hide file tree
Showing 30 changed files with 4,581 additions and 4,354 deletions.
92 changes: 46 additions & 46 deletions packages/dynamite/dynamite/example/lib/petstore.openapi.dart
Expand Up @@ -11,17 +11,17 @@ import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:built_value/standard_json_plugin.dart' as _i2;
import 'package:dynamite_runtime/built_value.dart' as _i1;
import 'package:dynamite_runtime/http_client.dart';
import 'package:built_value/standard_json_plugin.dart' as _i3;
import 'package:dynamite_runtime/built_value.dart' as _i2;
import 'package:dynamite_runtime/http_client.dart' as _i1;
import 'package:meta/meta.dart';
import 'package:universal_io/io.dart';
import 'package:uri/uri.dart';

part 'petstore.openapi.g.dart';

class $Client extends DynamiteClient {
/// Creates a new [DynamiteClient] for untagged requests.
class $Client extends _i1.DynamiteClient {
/// Creates a new `DynamiteClient` for untagged requests.
$Client(
super.baseURL, {
super.baseHeaders,
Expand All @@ -31,7 +31,7 @@ class $Client extends DynamiteClient {
});

/// Creates a new [$Client] from another [client].
$Client.fromClient(DynamiteClient client)
$Client.fromClient(_i1.DynamiteClient client)
: super(
client.baseURL,
baseHeaders: client.baseHeaders,
Expand All @@ -46,8 +46,8 @@ class $Client extends DynamiteClient {
/// Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.
///
///
/// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers.
/// Throws a [DynamiteApiException] if the API call does not return an expected status code.
/// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers.
/// Throws a `DynamiteApiException` if the API call does not return an expected status code.
///
/// Parameters:
/// * [tags] tags to filter by.
Expand All @@ -58,8 +58,8 @@ class $Client extends DynamiteClient {
/// * default: unexpected error
///
/// See:
/// * [findPetsRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized.
Future<DynamiteResponse<BuiltList<Pet>, void>> findPets({
/// * [findPetsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized.
Future<_i1.DynamiteResponse<BuiltList<Pet>, void>> findPets({
BuiltList<String>? tags,
int? limit,
}) async {
Expand All @@ -79,8 +79,8 @@ class $Client extends DynamiteClient {
///
/// This method and the response it returns is experimental. The API might change without a major version bump.
///
/// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers.
/// Throws a [DynamiteApiException] if the API call does not return an expected status code.
/// Returns a [Future] containing a `DynamiteRawResponse` with the raw [HttpClientResponse] and serialization helpers.
/// Throws a `DynamiteApiException` if the API call does not return an expected status code.
///
/// Parameters:
/// * [tags] tags to filter by.
Expand All @@ -91,9 +91,9 @@ class $Client extends DynamiteClient {
/// * default: unexpected error
///
/// See:
/// * [findPets] for an operation that returns a [DynamiteResponse] with a stable API.
/// * [findPets] for an operation that returns a `DynamiteResponse` with a stable API.
@experimental
DynamiteRawResponse<BuiltList<Pet>, void> findPetsRaw({
_i1.DynamiteRawResponse<BuiltList<Pet>, void> findPetsRaw({
BuiltList<String>? tags,
int? limit,
}) {
Expand All @@ -109,7 +109,7 @@ class $Client extends DynamiteClient {
_parameters['limit'] = $limit;

final _path = UriTemplate('/pets{?tags*,limit*}').expand(_parameters);
return DynamiteRawResponse<BuiltList<Pet>, void>(
return _i1.DynamiteRawResponse<BuiltList<Pet>, void>(
response: executeRequest(
'get',
_path,
Expand All @@ -125,16 +125,16 @@ class $Client extends DynamiteClient {

/// Creates a new pet in the store. Duplicates are allowed.
///
/// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers.
/// Throws a [DynamiteApiException] if the API call does not return an expected status code.
/// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers.
/// Throws a `DynamiteApiException` if the API call does not return an expected status code.
///
/// Status codes:
/// * 200: pet response
/// * default: unexpected error
///
/// See:
/// * [addPetRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized.
Future<DynamiteResponse<Pet, void>> addPet({required NewPet newPet}) async {
/// * [addPetRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized.
Future<_i1.DynamiteResponse<Pet, void>> addPet({required NewPet newPet}) async {
final rawResponse = addPetRaw(
newPet: newPet,
);
Expand All @@ -146,17 +146,17 @@ class $Client extends DynamiteClient {
///
/// This method and the response it returns is experimental. The API might change without a major version bump.
///
/// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers.
/// Throws a [DynamiteApiException] if the API call does not return an expected status code.
/// Returns a [Future] containing a `DynamiteRawResponse` with the raw [HttpClientResponse] and serialization helpers.
/// Throws a `DynamiteApiException` if the API call does not return an expected status code.
///
/// Status codes:
/// * 200: pet response
/// * default: unexpected error
///
/// See:
/// * [addPet] for an operation that returns a [DynamiteResponse] with a stable API.
/// * [addPet] for an operation that returns a `DynamiteResponse` with a stable API.
@experimental
DynamiteRawResponse<Pet, void> addPetRaw({required NewPet newPet}) {
_i1.DynamiteRawResponse<Pet, void> addPetRaw({required NewPet newPet}) {
const _headers = <String, String>{
'Accept': 'application/json',
};
Expand All @@ -165,7 +165,7 @@ class $Client extends DynamiteClient {
_headers['Content-Type'] = 'application/json';
_body = utf8.encode(json.encode(_$jsonSerializers.serialize(newPet, specifiedType: const FullType(NewPet))));
const _path = '/pets';
return DynamiteRawResponse<Pet, void>(
return _i1.DynamiteRawResponse<Pet, void>(
response: executeRequest(
'post',
_path,
Expand All @@ -181,8 +181,8 @@ class $Client extends DynamiteClient {

/// Returns a user based on a single ID, if the user does not have access to the pet.
///
/// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers.
/// Throws a [DynamiteApiException] if the API call does not return an expected status code.
/// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers.
/// Throws a `DynamiteApiException` if the API call does not return an expected status code.
///
/// Parameters:
/// * [id] ID of pet to fetch.
Expand All @@ -192,8 +192,8 @@ class $Client extends DynamiteClient {
/// * default: unexpected error
///
/// See:
/// * [findPetByIdRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized.
Future<DynamiteResponse<Pet, void>> findPetById({required int id}) async {
/// * [findPetByIdRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized.
Future<_i1.DynamiteResponse<Pet, void>> findPetById({required int id}) async {
final rawResponse = findPetByIdRaw(
id: id,
);
Expand All @@ -205,8 +205,8 @@ class $Client extends DynamiteClient {
///
/// This method and the response it returns is experimental. The API might change without a major version bump.
///
/// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers.
/// Throws a [DynamiteApiException] if the API call does not return an expected status code.
/// Returns a [Future] containing a `DynamiteRawResponse` with the raw [HttpClientResponse] and serialization helpers.
/// Throws a `DynamiteApiException` if the API call does not return an expected status code.
///
/// Parameters:
/// * [id] ID of pet to fetch.
Expand All @@ -216,9 +216,9 @@ class $Client extends DynamiteClient {
/// * default: unexpected error
///
/// See:
/// * [findPetById] for an operation that returns a [DynamiteResponse] with a stable API.
/// * [findPetById] for an operation that returns a `DynamiteResponse` with a stable API.
@experimental
DynamiteRawResponse<Pet, void> findPetByIdRaw({required int id}) {
_i1.DynamiteRawResponse<Pet, void> findPetByIdRaw({required int id}) {
final _parameters = <String, dynamic>{};
const _headers = <String, String>{
'Accept': 'application/json',
Expand All @@ -228,7 +228,7 @@ class $Client extends DynamiteClient {
_parameters['id'] = $id;

final _path = UriTemplate('/pets/{id}').expand(_parameters);
return DynamiteRawResponse<Pet, void>(
return _i1.DynamiteRawResponse<Pet, void>(
response: executeRequest(
'get',
_path,
Expand All @@ -244,8 +244,8 @@ class $Client extends DynamiteClient {

/// deletes a single pet based on the ID supplied.
///
/// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers.
/// Throws a [DynamiteApiException] if the API call does not return an expected status code.
/// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers.
/// Throws a `DynamiteApiException` if the API call does not return an expected status code.
///
/// Parameters:
/// * [id] ID of pet to delete.
Expand All @@ -255,8 +255,8 @@ class $Client extends DynamiteClient {
/// * default: unexpected error
///
/// See:
/// * [deletePetRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized.
Future<DynamiteResponse<void, void>> deletePet({required int id}) async {
/// * [deletePetRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized.
Future<_i1.DynamiteResponse<void, void>> deletePet({required int id}) async {
final rawResponse = deletePetRaw(
id: id,
);
Expand All @@ -268,8 +268,8 @@ class $Client extends DynamiteClient {
///
/// This method and the response it returns is experimental. The API might change without a major version bump.
///
/// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers.
/// Throws a [DynamiteApiException] if the API call does not return an expected status code.
/// Returns a [Future] containing a `DynamiteRawResponse` with the raw [HttpClientResponse] and serialization helpers.
/// Throws a `DynamiteApiException` if the API call does not return an expected status code.
///
/// Parameters:
/// * [id] ID of pet to delete.
Expand All @@ -279,17 +279,17 @@ class $Client extends DynamiteClient {
/// * default: unexpected error
///
/// See:
/// * [deletePet] for an operation that returns a [DynamiteResponse] with a stable API.
/// * [deletePet] for an operation that returns a `DynamiteResponse` with a stable API.
@experimental
DynamiteRawResponse<void, void> deletePetRaw({required int id}) {
_i1.DynamiteRawResponse<void, void> deletePetRaw({required int id}) {
final _parameters = <String, dynamic>{};
final _headers = <String, String>{};

final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int));
_parameters['id'] = $id;

final _path = UriTemplate('/pets/{id}').expand(_parameters);
return DynamiteRawResponse<void, void>(
return _i1.DynamiteRawResponse<void, void>(
response: executeRequest(
'delete',
_path,
Expand Down Expand Up @@ -415,9 +415,9 @@ final Serializers _$serializers = (Serializers().toBuilder()
@visibleForTesting
final Serializers $jsonSerializers = _$jsonSerializers;
final Serializers _$jsonSerializers = (_$serializers.toBuilder()
..add(_i1.DynamiteDoubleSerializer())
..addPlugin(_i2.StandardJsonPlugin())
..addPlugin(const _i1.HeaderPlugin())
..addPlugin(const _i1.ContentStringPlugin()))
..add(_i2.DynamiteDoubleSerializer())
..addPlugin(_i3.StandardJsonPlugin())
..addPlugin(const _i2.HeaderPlugin())
..addPlugin(const _i2.ContentStringPlugin()))
.build();
// coverage:ignore-end

0 comments on commit 1a111fb

Please sign in to comment.