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

feat(shorebird_code_push_protocol): add RecordPatchInstallRequest type #826

Merged
merged 10 commits into from
Aug 9, 2023
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'create_patch_install_request.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:json_annotation/json_annotation.dart';

part 'create_patch_install_request.g.dart';

/// {@template create_patch_install_request}
/// Request to create a patch install.
/// {@endtemplate}
@JsonSerializable()
class CreatePatchInstallRequest {
/// {@macro create_patch_install_request}
CreatePatchInstallRequest({required this.clientId});

/// Converts a Map<String, dynamic> to a [CreatePatchInstallRequest]
factory CreatePatchInstallRequest.fromJson(Map<String, dynamic> json) =>
_$CreatePatchInstallRequestFromJson(json);

/// Converts a [CreatePatchInstallRequest] to a Map<String, dynamic>
Map<String, dynamic> toJson() => _$CreatePatchInstallRequestToJson(this);

/// The client id of the device being updated.
final String clientId;
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export 'create_app_collaborator/create_app_collaborator.dart';
export 'create_channel/create_channel.dart';
export 'create_patch/create_patch.dart';
export 'create_patch_artifact/create_patch_artifact.dart';
export 'create_patch_install/create_patch_install.dart';
export 'create_payment_link/create_payment_link.dart';
export 'create_release/create_release.dart';
export 'create_release_artifact/create_release_artifact.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
import 'package:test/test.dart';

void main() {
group(CreatePatchInstallRequest, () {
test('can be (de)serialized', () {
final response = CreatePatchInstallRequest(
clientId: 'some-client-id',
);
expect(
CreatePatchInstallRequest.fromJson(response.toJson()).toJson(),
equals(response.toJson()),
);
});
});
}