diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact.dart deleted file mode 100644 index 9513fc98..00000000 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact.dart +++ /dev/null @@ -1 +0,0 @@ -export 'create_artifact_request.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch/create_patch_response.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch/create_patch_response.dart index 22895d34..f8bab873 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch/create_patch_response.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch/create_patch_response.dart @@ -1,5 +1,4 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; part 'create_patch_response.g.dart'; @@ -9,11 +8,7 @@ part 'create_patch_response.g.dart'; @JsonSerializable() class CreatePatchResponse { /// {@macro create_patch_response} - const CreatePatchResponse({ - required this.id, - required this.number, - required this.artifactUploadUrls, - }); + const CreatePatchResponse({required this.id, required this.number}); /// Converts a Map to a [CreatePatchResponse] factory CreatePatchResponse.fromJson(Map json) => @@ -28,7 +23,4 @@ class CreatePatchResponse { /// The patch number. /// A larger number equates to a newer patch. final int number; - - /// The upload urls for artifacts. - final ArtifactUploadUrls artifactUploadUrls; } diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch/create_patch_response.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch/create_patch_response.g.dart index b18a1bad..da073d5a 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch/create_patch_response.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch/create_patch_response.g.dart @@ -16,12 +16,9 @@ CreatePatchResponse _$CreatePatchResponseFromJson(Map json) => final val = CreatePatchResponse( id: $checkedConvert('id', (v) => v as int), number: $checkedConvert('number', (v) => v as int), - artifactUploadUrls: $checkedConvert('artifact_upload_urls', - (v) => ArtifactUploadUrls.fromJson(v as Map)), ); return val; }, - fieldKeyMap: const {'artifactUploadUrls': 'artifact_upload_urls'}, ); Map _$CreatePatchResponseToJson( @@ -29,5 +26,4 @@ Map _$CreatePatchResponseToJson( { 'id': instance.id, 'number': instance.number, - 'artifact_upload_urls': instance.artifactUploadUrls.toJson(), }; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact.dart new file mode 100644 index 00000000..31a75e46 --- /dev/null +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact.dart @@ -0,0 +1,2 @@ +export 'create_patch_artifact_request.dart'; +export 'create_patch_artifact_response.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact_request.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.dart similarity index 58% rename from packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact_request.dart rename to packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.dart index 64145b7c..69cac94b 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact_request.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.dart @@ -1,27 +1,27 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; -part 'create_artifact_request.g.dart'; +part 'create_patch_artifact_request.g.dart'; -/// {@template create_artifact_request} -/// The request body for POST /api/v1/artifacts +/// {@template create_patch_artifact_request} +/// The request body for POST /api/v1/patches//artifacts /// {@endtemplate} @JsonSerializable() -class CreateArtifactRequest { +class CreatePatchArtifactRequest { /// {@macro create_artifact_request} - const CreateArtifactRequest({ + const CreatePatchArtifactRequest({ required this.arch, required this.platform, required this.hash, required this.size, }); - /// Converts a Map to a [CreateArtifactRequest] - factory CreateArtifactRequest.fromJson(Map json) => - _$CreateArtifactRequestFromJson(json); + /// Converts a Map to a [CreatePatchArtifactRequest] + factory CreatePatchArtifactRequest.fromJson(Map json) => + _$CreatePatchArtifactRequestFromJson(json); - /// Converts a [CreateArtifactRequest] to a Map. - Json toJson() => _$CreateArtifactRequestToJson(this); + /// Converts a [CreatePatchArtifactRequest] to a Map. + Json toJson() => _$CreatePatchArtifactRequestToJson(this); /// The arch of the artifact. final String arch; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact_request.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.g.dart similarity index 65% rename from packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact_request.g.dart rename to packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.g.dart index c7dc88e5..4c2c1b4b 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_artifact/create_artifact_request.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.g.dart @@ -2,34 +2,34 @@ // ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars -part of 'create_artifact_request.dart'; +part of 'create_patch_artifact_request.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -CreateArtifactRequest _$CreateArtifactRequestFromJson( +CreatePatchArtifactRequest _$CreatePatchArtifactRequestFromJson( Map json) => $checkedCreate( - 'CreateArtifactRequest', + 'CreatePatchArtifactRequest', json, ($checkedConvert) { - final val = CreateArtifactRequest( + final val = CreatePatchArtifactRequest( arch: $checkedConvert('arch', (v) => v as String), platform: $checkedConvert('platform', (v) => v as String), hash: $checkedConvert('hash', (v) => v as String), size: $checkedConvert( - 'size', (v) => CreateArtifactRequest._parseStringToInt(v)), + 'size', (v) => CreatePatchArtifactRequest._parseStringToInt(v)), ); return val; }, ); -Map _$CreateArtifactRequestToJson( - CreateArtifactRequest instance) => +Map _$CreatePatchArtifactRequestToJson( + CreatePatchArtifactRequest instance) => { 'arch': instance.arch, 'platform': instance.platform, 'hash': instance.hash, - 'size': CreateArtifactRequest._parseIntToString(instance.size), + 'size': CreatePatchArtifactRequest._parseIntToString(instance.size), }; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.dart new file mode 100644 index 00000000..91857320 --- /dev/null +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.dart @@ -0,0 +1,46 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; + +part 'create_patch_artifact_response.g.dart'; + +/// {@template create_patch_artifact_response} +/// The response body for POST /api/v1/patches//artifacts +/// {@endtemplate} +@JsonSerializable() +class CreatePatchArtifactResponse { + /// {@macro create_artifact_response} + const CreatePatchArtifactResponse({ + required this.arch, + required this.platform, + required this.hash, + required this.size, + required this.url, + }); + + /// Converts a Map to a [CreatePatchArtifactResponse] + factory CreatePatchArtifactResponse.fromJson(Map json) => + _$CreatePatchArtifactResponseFromJson(json); + + /// Converts a [CreatePatchArtifactResponse] to a Map. + Json toJson() => _$CreatePatchArtifactResponseToJson(this); + + /// The arch of the artifact. + final String arch; + + /// The platform of the artifact. + final String platform; + + /// The hash of the artifact. + final String hash; + + /// The size of the artifact in bytes. + @JsonKey(fromJson: _parseStringToInt, toJson: _parseIntToString) + final int size; + + /// The upload URL for the artifact. + final String url; + + static int _parseStringToInt(dynamic value) => int.parse(value as String); + + static String _parseIntToString(dynamic value) => value.toString(); +} diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.g.dart new file mode 100644 index 00000000..df5f81a3 --- /dev/null +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars + +part of 'create_patch_artifact_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreatePatchArtifactResponse _$CreatePatchArtifactResponseFromJson( + Map json) => + $checkedCreate( + 'CreatePatchArtifactResponse', + json, + ($checkedConvert) { + final val = CreatePatchArtifactResponse( + arch: $checkedConvert('arch', (v) => v as String), + platform: $checkedConvert('platform', (v) => v as String), + hash: $checkedConvert('hash', (v) => v as String), + size: $checkedConvert( + 'size', (v) => CreatePatchArtifactResponse._parseStringToInt(v)), + url: $checkedConvert('url', (v) => v as String), + ); + return val; + }, + ); + +Map _$CreatePatchArtifactResponseToJson( + CreatePatchArtifactResponse instance) => + { + 'arch': instance.arch, + 'platform': instance.platform, + 'hash': instance.hash, + 'size': CreatePatchArtifactResponse._parseIntToString(instance.size), + 'url': instance.url, + }; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release/create_release_response.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release/create_release_response.dart index 29ae47b3..667c523d 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_release/create_release_response.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release/create_release_response.dart @@ -1,5 +1,4 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; part 'create_release_response.g.dart'; @@ -15,7 +14,6 @@ class CreateReleaseResponse { required this.version, required this.flutterRevision, required this.displayName, - required this.artifactUploadUrls, }); /// Converts a Map to a [CreateReleaseResponse] @@ -39,7 +37,4 @@ class CreateReleaseResponse { /// The display name for the release final String? displayName; - - /// The upload urls for artifacts. - final ArtifactUploadUrls artifactUploadUrls; } diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release/create_release_response.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release/create_release_response.g.dart index b2f7b8e8..ac6e4f9e 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_release/create_release_response.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release/create_release_response.g.dart @@ -21,16 +21,13 @@ CreateReleaseResponse _$CreateReleaseResponseFromJson( flutterRevision: $checkedConvert('flutter_revision', (v) => v as String), displayName: $checkedConvert('display_name', (v) => v as String?), - artifactUploadUrls: $checkedConvert('artifact_upload_urls', - (v) => ArtifactUploadUrls.fromJson(v as Map)), ); return val; }, fieldKeyMap: const { 'appId': 'app_id', 'flutterRevision': 'flutter_revision', - 'displayName': 'display_name', - 'artifactUploadUrls': 'artifact_upload_urls' + 'displayName': 'display_name' }, ); @@ -42,5 +39,4 @@ Map _$CreateReleaseResponseToJson( 'version': instance.version, 'flutter_revision': instance.flutterRevision, 'display_name': instance.displayName, - 'artifact_upload_urls': instance.artifactUploadUrls.toJson(), }; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact.dart index 10acf04c..fb12714b 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact.dart @@ -1 +1,2 @@ export 'create_release_artifact_request.dart'; +export 'create_release_artifact_response.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.dart new file mode 100644 index 00000000..3c923d4d --- /dev/null +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.dart @@ -0,0 +1,46 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; + +part 'create_release_artifact_response.g.dart'; + +/// {@template create_release_artifact_response} +/// The response body for POST /api/v1/artifacts/:id/artifacts +/// {@endtemplate} +@JsonSerializable() +class CreateReleaseArtifactResponse { + /// {@macro create_release_artifact_response} + const CreateReleaseArtifactResponse({ + required this.arch, + required this.platform, + required this.hash, + required this.size, + required this.url, + }); + + /// Converts a Map to a [CreateReleaseArtifactResponse] + factory CreateReleaseArtifactResponse.fromJson(Map json) => + _$CreateReleaseArtifactResponseFromJson(json); + + /// Converts a [CreateReleaseArtifactResponse] to a Map. + Json toJson() => _$CreateReleaseArtifactResponseToJson(this); + + /// The arch of the artifact. + final String arch; + + /// The platform of the artifact. + final String platform; + + /// The hash of the artifact. + final String hash; + + /// The size of the artifact in bytes. + @JsonKey(fromJson: _parseStringToInt, toJson: _parseIntToString) + final int size; + + /// The upload URL for the artifact. + final String url; + + static int _parseStringToInt(dynamic value) => int.parse(value as String); + + static String _parseIntToString(dynamic value) => value.toString(); +} diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.g.dart new file mode 100644 index 00000000..725f9383 --- /dev/null +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars + +part of 'create_release_artifact_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateReleaseArtifactResponse _$CreateReleaseArtifactResponseFromJson( + Map json) => + $checkedCreate( + 'CreateReleaseArtifactResponse', + json, + ($checkedConvert) { + final val = CreateReleaseArtifactResponse( + arch: $checkedConvert('arch', (v) => v as String), + platform: $checkedConvert('platform', (v) => v as String), + hash: $checkedConvert('hash', (v) => v as String), + size: $checkedConvert('size', + (v) => CreateReleaseArtifactResponse._parseStringToInt(v)), + url: $checkedConvert('url', (v) => v as String), + ); + return val; + }, + ); + +Map _$CreateReleaseArtifactResponseToJson( + CreateReleaseArtifactResponse instance) => + { + 'arch': instance.arch, + 'platform': instance.platform, + 'hash': instance.hash, + 'size': CreateReleaseArtifactResponse._parseIntToString(instance.size), + 'url': instance.url, + }; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/messages.dart b/packages/shorebird_code_push_protocol/lib/src/messages/messages.dart index d058ad7b..ab2c2b12 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/messages.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/messages.dart @@ -2,7 +2,7 @@ export 'cancel_subscription/cancel_subscription_response.dart'; export 'check_for_patches/check_for_patches.dart'; export 'create_app/create_app.dart'; export 'create_app_collaborator/create_app_collaborator.dart'; -export 'create_artifact/create_artifact.dart'; +export 'create_patch_artifact/create_patch_artifact.dart'; export 'create_channel/create_channel.dart'; export 'create_patch/create_patch.dart'; export 'create_payment_link/create_payment_link.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/artifact_upload_urls.dart b/packages/shorebird_code_push_protocol/lib/src/models/artifact_upload_urls.dart deleted file mode 100644 index 5964cb15..00000000 --- a/packages/shorebird_code_push_protocol/lib/src/models/artifact_upload_urls.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -part 'artifact_upload_urls.g.dart'; - -/// {@template artifact_upload_urls} -/// An object that contains signed upload URLs for artifacts. -/// {@endtemplate} -@JsonSerializable() -class ArtifactUploadUrls { - /// {@macro artifact_upload_urls} - const ArtifactUploadUrls({required this.android}); - - /// Converts a Map to an [ArtifactUploadUrls] - factory ArtifactUploadUrls.fromJson(Map json) => - _$ArtifactUploadUrlsFromJson(json); - - /// Converts a [ArtifactUploadUrls] to a Map - Map toJson() => _$ArtifactUploadUrlsToJson(this); - - /// The upload urls for Android artifacts. - final AndroidArtifactUploadUrls android; -} - -/// {@template android_artifact_upload_urls} -/// An object that contains signed upload URLs for Android artifacts. -/// {@endtemplate} -@JsonSerializable() -class AndroidArtifactUploadUrls { - /// {@macro android_artifact_upload_urls} - const AndroidArtifactUploadUrls({ - required this.x86, - required this.aarch64, - required this.arm, - }); - - /// Converts a Map to an [AndroidArtifactUploadUrls] - factory AndroidArtifactUploadUrls.fromJson(Map json) => - _$AndroidArtifactUploadUrlsFromJson(json); - - /// Converts a [AndroidArtifactUploadUrls] to a Map - Map toJson() => _$AndroidArtifactUploadUrlsToJson(this); - - final String x86; - final String aarch64; - final String arm; -} diff --git a/packages/shorebird_code_push_protocol/lib/src/models/artifact_upload_urls.g.dart b/packages/shorebird_code_push_protocol/lib/src/models/artifact_upload_urls.g.dart deleted file mode 100644 index f83e0a00..00000000 --- a/packages/shorebird_code_push_protocol/lib/src/models/artifact_upload_urls.g.dart +++ /dev/null @@ -1,52 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars - -part of 'artifact_upload_urls.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -ArtifactUploadUrls _$ArtifactUploadUrlsFromJson(Map json) => - $checkedCreate( - 'ArtifactUploadUrls', - json, - ($checkedConvert) { - final val = ArtifactUploadUrls( - android: $checkedConvert( - 'android', - (v) => AndroidArtifactUploadUrls.fromJson( - v as Map)), - ); - return val; - }, - ); - -Map _$ArtifactUploadUrlsToJson(ArtifactUploadUrls instance) => - { - 'android': instance.android.toJson(), - }; - -AndroidArtifactUploadUrls _$AndroidArtifactUploadUrlsFromJson( - Map json) => - $checkedCreate( - 'AndroidArtifactUploadUrls', - json, - ($checkedConvert) { - final val = AndroidArtifactUploadUrls( - x86: $checkedConvert('x86', (v) => v as String), - aarch64: $checkedConvert('aarch64', (v) => v as String), - arm: $checkedConvert('arm', (v) => v as String), - ); - return val; - }, - ); - -Map _$AndroidArtifactUploadUrlsToJson( - AndroidArtifactUploadUrls instance) => - { - 'x86': instance.x86, - 'aarch64': instance.aarch64, - 'arm': instance.arm, - }; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/models.dart b/packages/shorebird_code_push_protocol/lib/src/models/models.dart index 30afd7b6..ec77bf2c 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/models.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/models.dart @@ -1,6 +1,5 @@ export 'app.dart'; export 'app_metadata.dart'; -export 'artifact_upload_urls.dart'; export 'channel.dart'; export 'collaborator.dart'; export 'error_response.dart'; diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_patch/create_patch_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_patch/create_patch_response_test.dart index 6dc3863b..3ea5cbe4 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/create_patch/create_patch_response_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_patch/create_patch_response_test.dart @@ -4,17 +4,7 @@ import 'package:test/test.dart'; void main() { group(CreatePatchResponse, () { test('can be (de)serialized', () { - const response = CreatePatchResponse( - id: 42, - number: 1, - artifactUploadUrls: ArtifactUploadUrls( - android: AndroidArtifactUploadUrls( - x86: 'x86', - aarch64: 'aarch64', - arm: 'arm', - ), - ), - ); + const response = CreatePatchResponse(id: 42, number: 1); expect( CreatePatchResponse.fromJson(response.toJson()).toJson(), equals(response.toJson()), diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_artifact/create_artifact_request_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_request_test.dart similarity index 67% rename from packages/shorebird_code_push_protocol/test/src/messages/create_artifact/create_artifact_request_test.dart rename to packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_request_test.dart index d6c24034..cf075e84 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/create_artifact/create_artifact_request_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_request_test.dart @@ -2,16 +2,16 @@ import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; import 'package:test/test.dart'; void main() { - group(CreateArtifactRequest, () { + group(CreatePatchArtifactRequest, () { test('can be (de)serialized', () { - const request = CreateArtifactRequest( + const request = CreatePatchArtifactRequest( arch: 'arm64', platform: 'android', hash: '1234', size: 9876, ); expect( - CreateArtifactRequest.fromJson(request.toJson()).toJson(), + CreatePatchArtifactRequest.fromJson(request.toJson()).toJson(), equals(request.toJson()), ); }); diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_response_test.dart new file mode 100644 index 00000000..63ac53ce --- /dev/null +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_response_test.dart @@ -0,0 +1,20 @@ +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; +import 'package:test/test.dart'; + +void main() { + group(CreatePatchArtifactResponse, () { + test('can be (de)serialized', () { + const request = CreatePatchArtifactResponse( + arch: 'arm64', + platform: 'android', + hash: '1234', + size: 9876, + url: 'https://example.com', + ); + expect( + CreatePatchArtifactResponse.fromJson(request.toJson()).toJson(), + equals(request.toJson()), + ); + }); + }); +} diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_release/create_release_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_release/create_release_response_test.dart index 65b4297b..85d16f7f 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/create_release/create_release_response_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_release/create_release_response_test.dart @@ -10,13 +10,6 @@ void main() { version: '1.0.0', displayName: 'v1.0.0', flutterRevision: 'flutter-revision', - artifactUploadUrls: ArtifactUploadUrls( - android: AndroidArtifactUploadUrls( - x86: 'x86', - aarch64: 'aarch64', - arm: 'arm', - ), - ), ); expect( CreateReleaseResponse.fromJson(response.toJson()).toJson(), diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_response_test.dart new file mode 100644 index 00000000..cec01504 --- /dev/null +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_response_test.dart @@ -0,0 +1,20 @@ +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; +import 'package:test/test.dart'; + +void main() { + group(CreateReleaseArtifactResponse, () { + test('can be (de)serialized', () { + const response = CreateReleaseArtifactResponse( + arch: 'arm64', + platform: 'android', + hash: '1234', + size: 9876, + url: 'https://example.com', + ); + expect( + CreateReleaseArtifactResponse.fromJson(response.toJson()).toJson(), + equals(response.toJson()), + ); + }); + }); +} diff --git a/packages/shorebird_code_push_protocol/test/src/models/artifact_upload_urls_test.dart b/packages/shorebird_code_push_protocol/test/src/models/artifact_upload_urls_test.dart deleted file mode 100644 index 9f6a0cb0..00000000 --- a/packages/shorebird_code_push_protocol/test/src/models/artifact_upload_urls_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; -import 'package:test/test.dart'; - -void main() { - group(ArtifactUploadUrls, () { - test('can be (de)serialized', () { - const artifactUploadUrls = ArtifactUploadUrls( - android: AndroidArtifactUploadUrls( - x86: 'x86', - aarch64: 'aarch64', - arm: 'arm', - ), - ); - expect( - ArtifactUploadUrls.fromJson(artifactUploadUrls.toJson()).toJson(), - equals(artifactUploadUrls.toJson()), - ); - }); - }); -}