From afb1dea7a5e16fcf4393e952301f87a287e6f3a3 Mon Sep 17 00:00:00 2001 From: Bryan Oltman Date: Mon, 7 Oct 2024 12:21:50 -0400 Subject: [PATCH] feat: add optional organization id field to create app request (#2513) --- .../lib/src/messages/create_app/create_app_request.dart | 9 ++++++++- .../src/messages/create_app/create_app_request.g.dart | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_app/create_app_request.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_app/create_app_request.dart index 2ecd9ce9..0dc47f03 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_app/create_app_request.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_app/create_app_request.dart @@ -8,7 +8,10 @@ part 'create_app_request.g.dart'; @JsonSerializable() class CreateAppRequest { /// {@macro create_app_request} - const CreateAppRequest({required this.displayName}); + const CreateAppRequest({ + required this.displayName, + this.organizationId, + }); /// Converts a Map to a [CreateAppRequest] factory CreateAppRequest.fromJson(Map json) => @@ -19,4 +22,8 @@ class CreateAppRequest { /// The display name of the app. final String displayName; + + /// The id of organization that this app will belong to. If no id is provided, + /// this app will belong to the user's personal organization. + final int? organizationId; } diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_app/create_app_request.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_app/create_app_request.g.dart index 283e0bda..fd91e54c 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_app/create_app_request.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_app/create_app_request.g.dart @@ -15,13 +15,19 @@ CreateAppRequest _$CreateAppRequestFromJson(Map json) => ($checkedConvert) { final val = CreateAppRequest( displayName: $checkedConvert('display_name', (v) => v as String), + organizationId: + $checkedConvert('organization_id', (v) => (v as num?)?.toInt()), ); return val; }, - fieldKeyMap: const {'displayName': 'display_name'}, + fieldKeyMap: const { + 'displayName': 'display_name', + 'organizationId': 'organization_id' + }, ); Map _$CreateAppRequestToJson(CreateAppRequest instance) => { 'display_name': instance.displayName, + 'organization_id': instance.organizationId, };